Added missed file.
Added missed MDF_Tool.cxx.
Adding test cases for issue CR23766
static Standard_GUID BinLStorageDriver ("13a56835-8269-11d5-aab2-0050044b1af1");
static Standard_GUID BinLRetrievalDriver("13a56836-8269-11d5-aab2-0050044b1af1");
-#define CURRENT_DOCUMENT_VERSION 6
+#define CURRENT_DOCUMENT_VERSION 7
//=======================================================================
//function : Factory
#include <TColStd_Array1OfInteger.hxx>
#include <CDM_MessageDriver.hxx>
#include <TDF_Attribute.hxx>
+#include <TNaming_Iterator.hxx>
#include <TNaming_NameType.hxx>
#include <TNaming_Naming.hxx>
#include <TNaming_NamedShape.hxx>
"Cannot retrieve reference on "
"Arguments of Name");
WriteMessage (aMsg);
- }
+ }
#ifdef DEB
//cout << "CurDocVersion = " << BinMNaming::DocumentVersion() <<endl;
#endif
- if(BinMNaming::DocumentVersion() > 3) {
+ if(BinMNaming::DocumentVersion() > 3) {
TCollection_AsciiString entry;
ok = theSource >> entry;
if(ok) {
aName.ContextLabel(tLab);
}
}
- }
+ if(BinMNaming::DocumentVersion() > 4 && BinMNaming::DocumentVersion() < 7) {
+ // Orientation processing - converting from old format
+ Handle(TNaming_NamedShape) aNS;
+ if(anAtt->Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+ //const TDF_Label& aLab = aNS->Label();
+ TNaming_Iterator itL (aNS);
+ for (; itL.More(); itL.Next()) {
+ const TopoDS_Shape& S = itL.NewShape();
+ if (S.IsNull()) continue;
+ if(aNS->Evolution() == TNaming_SELECTED) {
+ if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX &&
+ !itL.OldShape().IsNull() && itL.OldShape().ShapeType() == TopAbs_VERTEX ) {//OR-N
+ TopAbs_Orientation OrientationToApply = itL.OldShape().Orientation();
+ aName.Orientation(OrientationToApply);
+ }
+ }
+ }
+ }
+ }
+ if(BinMNaming::DocumentVersion() > 6) {
+ ok = theSource >> anIndx;
+ TopAbs_Orientation OrientationToApply(TopAbs_FORWARD);
+ if(ok) {
+ OrientationToApply = (TopAbs_Orientation)anIndx;
+ aName.Orientation(OrientationToApply);
+#ifdef DEB
+ cout << "NamingDriver:: Retrieved Orientation = " << OrientationToApply << " Ok = " << theSource.IsOK() <<endl;
+#endif
+ } else {
+ aMsg = TCollection_ExtendedString("BinMNaming_NamingDriver: "
+ "Cannot retrieve Name Orientation ");
+ WriteMessage (aMsg);
+ }
+ }
+ }
#ifdef DEB
else if(BinMNaming::DocumentVersion() == -1)
cout << "Current DocVersion field is not initialized. " <<endl;
else
cout << "Current DocVersion = " << BinMNaming::DocumentVersion() <<endl;
#endif
- }
+ }
}
return ok;
}
if(!aName.ContextLabel().IsNull())
TDF_Tool::Entry(aName.ContextLabel(), entry);
theTarget << entry;
+
+//7. keep Orientation
+ theTarget << (Standard_Integer)aName.Orientation();
+
}
#define DeclareConstAndSpeedCast(V,T,Vdown) const Handle(T)& Vdown = (Handle(T)&) V
#define SpeedCast(V,T,Vdown) Vdown = *((Handle(T)*)& V)
+#include <NCollection_List.hxx>
+typedef struct {
+ Handle(PDF_Attribute) pAtt;
+ Handle(TDF_Attribute) tAtt;
+} ATTR;
+typedef NCollection_List<ATTR> MDF_AttributeList;
+typedef MDF_AttributeList::Iterator MDF_ListIteratorOfAttributeList;
+
#undef DEB_MDF_TOOL
// Persistent structure:
//purpose : PERSISTENT -> TRANSIENT
// Reads the persistent attributes content.
//=======================================================================
-
+//#define DEB_ORIENT
void MDF_Tool::ReadAttributes
(const MDF_TypeARDriverMap& aDriverMap,
const Handle(MDF_RRelocationTable)& aReloc)
const PTColStd_PersistentTransientMap& attMap = aReloc->AttributeTable();
PTColStd_DataMapIteratorOfPersistentTransientMap itr(attMap);
Handle(TDF_Attribute) tAtt;
+ MDF_AttributeList attNList;
+ Standard_Boolean isName1(Standard_False);
+ ATTR pairAtt;
for ( ; itr.More(); itr.Next()) {
DeclareConstAndSpeedCast(itr.Key(),PDF_Attribute,pAtt);
if (!pAtt.IsNull()) { // See above...
const Handle(Standard_Type)& type = pAtt->DynamicType();
+
+ if(!strcmp (type->Name(), "PNaming_Naming_1") ) {
+#ifdef DEB_ORIENT
+ cout << "TYPE = " << type->Name() << endl;
+#endif
+ isName1 = Standard_True;
+ } else isName1 = Standard_False;
+
if (aDriverMap.IsBound(type)) {
- SpeedCast(itr.Value(),TDF_Attribute,tAtt);
- const Handle(MDF_ARDriver)& driver = aDriverMap.Find(type);
- driver->Paste(pAtt, tAtt, aReloc);
+ SpeedCast(itr.Value(),TDF_Attribute,tAtt);
+ const Handle(MDF_ARDriver)& driver = aDriverMap.Find(type);
+ if(isName1) {
+ pairAtt.pAtt = pAtt;
+ pairAtt.tAtt = tAtt;
+ attNList.Append(pairAtt);
+ }
+ else
+ driver->Paste(pAtt, tAtt, aReloc);
}
}
}
+// post processing for compartibiliy with previous versions (24.07.2013)
+ if(attNList.Extent()) {
+ MDF_ListIteratorOfAttributeList listIt(attNList);
+ for(;listIt.More();listIt.Next()) {
+ const Handle(PDF_Attribute)& pAtt = listIt.Value().pAtt;
+ if (!pAtt.IsNull()) {
+ const Handle(Standard_Type)& type = pAtt->DynamicType();
+ if (aDriverMap.IsBound(type)) {
+ const Handle(MDF_ARDriver)& driver = aDriverMap.Find(type);
+ driver->Paste(pAtt, listIt.Value().tAtt, aReloc);
+ }
+ }
+ }
+ }
+//
TDF_AttributeList attList;
for (itr.Initialize(attMap); itr.More(); itr.Next()) {
SpeedCast(itr.Value(),TDF_Attribute,tAtt);
class NamingRetrievalDriver_1;
-- New fields added
-
+
+ class NamingRetrievalDriver_2;
+ -- New fields added
+
class NamedShapeStorageDriver;
class NamingStorageDriver;
#include <MNaming_NamingStorageDriver.hxx>
#include <MNaming_NamingRetrievalDriver.hxx>
#include <MNaming_NamingRetrievalDriver_1.hxx>
+#include <MNaming_NamingRetrievalDriver_2.hxx>
#include <CDM_MessageDriver.hxx>
//=======================================================================
aDriverSeq->Append(new MNaming_NamedShapeRetrievalDriver(theMsgDriver));
aDriverSeq->Append(new MNaming_NamingRetrievalDriver(theMsgDriver));
aDriverSeq->Append(new MNaming_NamingRetrievalDriver_1(theMsgDriver));
+ aDriverSeq->Append(new MNaming_NamingRetrievalDriver_2(theMsgDriver));
}
#include <Standard_NoSuchObject.hxx>
#include <TNaming_Naming.hxx>
#include <TNaming_NameType.hxx>
+#include <TNaming_Iterator.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <CDM_MessageDriver.hxx>
case 5 : return TopAbs_WIRE;
case 6 : return TopAbs_EDGE;
case 7 : return TopAbs_VERTEX;
- default :
- return TopAbs_SHAPE;
+ default :
+ return TopAbs_SHAPE;
}
+ return TopAbs_SHAPE;
}
//=======================================================================
case 9 : return TNaming_ORIENTATION;
case 10 : return TNaming_WIREIN;
default :
- Standard_DomainError::Raise("TNaming_NameType; enum term unknown ");
+ Standard_DomainError::Raise("TNaming_NameType; enum term unknown ");
}
return TNaming_INTERSECTION;
}
//function : Paste
//purpose :
//=======================================================================
-
+//#define DEB_ORIENT
void MNaming_NamingRetrievalDriver_1::Paste (
const Handle(PDF_Attribute)& Source,
const Handle(TDF_Attribute)& Target,
const Handle(MDF_RRelocationTable)& RelocTable) const
{
Handle(PNaming_Naming_1) PF = Handle(PNaming_Naming_1)::DownCast(Source);
- Handle(TNaming_Naming) F = Handle(TNaming_Naming)::DownCast(Target);
+ Handle(TNaming_Naming) F = Handle(TNaming_Naming)::DownCast(Target);
PNamingToTNaming (PF->GetName(),F->ChangeName(),RelocTable);
+ // Orientation processing
+ Handle(TNaming_NamedShape) aNS;
+ if(F->Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+#ifdef DEB_ORIENT
+ const TDF_Label& aLab = aNS->Label();
+ TCollection_AsciiString entry;
+ TDF_Tool::Entry(aLab, entry);
+ cout << "Label = " << entry << " Evolution = " <<aNS->Evolution() << " IsEmpty = " << aNS->IsEmpty() <<endl;
+#endif
+ if(!aNS->IsEmpty()) {
+ TNaming_Iterator itL (aNS);
+ for (; itL.More(); itL.Next()) {
+ const TopoDS_Shape& S = itL.NewShape();
+ if (S.IsNull()) continue;
+ if(aNS->Evolution() == TNaming_SELECTED) {
+ if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX &&
+ !itL.OldShape().IsNull() && itL.OldShape().ShapeType() == TopAbs_VERTEX ) {//OR-N
+ TopAbs_Orientation OrientationToApply = itL.OldShape().Orientation();
+#ifdef DEB_ORIENT
+ cout <<"Retrieved Orientation = " << OrientationToApply <<endl;
+#endif
+ F->ChangeName().Orientation(OrientationToApply);
+ }
+ }
+ }
+ }
+ }
+ //
}
--- /dev/null
+-- Created on: 2008-08-15
+-- Created by: Sergey ZARITCHNY <szy@opencascade.com>
+-- Copyright (c) 2008-2012 OPEN CASCADE SAS
+--
+-- The content of this file is subject to the Open CASCADE Technology Public
+-- License Version 6.5 (the "License"). You may not use the content of this file
+-- except in compliance with the License. Please obtain a copy of the License
+-- at http://www.opencascade.org and read it completely before using this file.
+--
+-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+--
+-- The Original Code and all software distributed under the License is
+-- distributed on an "AS IS" basis, without warranty of any kind, and the
+-- Initial Developer hereby disclaims all such warranties, including without
+-- limitation, any warranties of merchantability, fitness for a particular
+-- purpose or non-infringement. Please see the License for the specific terms
+-- and conditions governing the rights and limitations under the License.
+
+
+class NamingRetrievalDriver_2 from MNaming inherits ARDriver from MDF
+
+ ---Purpose:
+
+uses RRelocationTable from MDF,
+ Attribute from PDF,
+ Attribute from TDF,
+ MessageDriver from CDM
+
+is
+
+
+ Create(theMessageDriver : MessageDriver from CDM)
+ returns mutable NamingRetrievalDriver_2 from MNaming;
+
+
+ VersionNumber(me) returns Integer from Standard;
+ ---Purpose: Returns the version number from which the driver
+ -- is available: 0.
+
+ SourceType(me) returns Type from Standard;
+ ---Purpose: Returns the type: Naming from PNaming.
+
+ NewEmpty (me) returns mutable Attribute from TDF;
+
+
+ Paste(me;
+ Source : Attribute from PDF;
+ Target : mutable Attribute from TDF;
+ RelocTable : RRelocationTable from MDF);
+
+
+end NamingRetrievalDriver_2;
--- /dev/null
+// Created on: 2008-08-15
+// Created by: Sergey ZARITCHNY
+// Copyright (c) 2008-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <MNaming_NamingRetrievalDriver_2.ixx>
+#include <PNaming_Naming_2.hxx>
+#include <PNaming_NamedShape.hxx>
+#include <PNaming_HArray1OfNamedShape.hxx>
+#include <PNaming_Name_2.hxx>
+#include <PCollection_HAsciiString.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TDF_Tool.hxx>
+#include <TNaming_NamedShape.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <TNaming_Naming.hxx>
+#include <TNaming_NameType.hxx>
+#include <TopAbs_ShapeEnum.hxx>
+#include <CDM_MessageDriver.hxx>
+
+//=======================================================================
+//function : IntegerToShapeEnum
+//purpose :
+//=======================================================================
+
+static TopAbs_ShapeEnum IntegerToShapeEnum (const Standard_Integer I)
+{
+ switch(I)
+ {
+ case 0 : return TopAbs_COMPOUND;
+ case 1 : return TopAbs_COMPSOLID;
+ case 2 : return TopAbs_SOLID;
+ case 3 : return TopAbs_SHELL;
+ case 4 : return TopAbs_FACE;
+ case 5 : return TopAbs_WIRE;
+ case 6 : return TopAbs_EDGE;
+ case 7 : return TopAbs_VERTEX;
+ default :
+ return TopAbs_SHAPE;
+ }
+ return TopAbs_SHAPE;
+}
+
+//=======================================================================
+//function : IntegerToNameType
+//purpose :
+//=======================================================================
+
+static TNaming_NameType IntegerToNameType (const Standard_Integer I)
+{
+ switch(I)
+ {
+ case 0 : return TNaming_UNKNOWN;
+ case 1 : return TNaming_IDENTITY;
+ case 2 : return TNaming_MODIFUNTIL;
+ case 3 : return TNaming_GENERATION;
+ case 4 : return TNaming_INTERSECTION;
+ case 5 : return TNaming_UNION;
+ case 6 : return TNaming_SUBSTRACTION;
+ case 7 : return TNaming_CONSTSHAPE;
+ case 8 : return TNaming_FILTERBYNEIGHBOURGS;
+ case 9 : return TNaming_ORIENTATION;
+ case 10 : return TNaming_WIREIN;
+ default :
+ Standard_DomainError::Raise("TNaming_NameType; enum term unknown ");
+ }
+ return TNaming_UNKNOWN;
+}
+//=======================================================================
+//function : IntegerToOrientation
+//purpose :
+//=======================================================================
+static TopAbs_Orientation IntegerToOrientation (const Standard_Integer Or)
+{
+ switch(Or)
+ {
+ case 0 : return TopAbs_FORWARD;
+ case 1 : return TopAbs_REVERSED;
+ case 2 : return TopAbs_INTERNAL;
+ case 3 : return TopAbs_EXTERNAL;
+ default :
+ Standard_DomainError::Raise("PNaming_Name::myOrientation; enum term unknown ");
+ }
+ return TopAbs_FORWARD;
+}
+//=======================================================================
+//function : MNaming_Naming_2
+//purpose :
+//=======================================================================
+
+MNaming_NamingRetrievalDriver_2::MNaming_NamingRetrievalDriver_2(
+ const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver)
+{
+}
+
+//=======================================================================
+//function : VersionNumber
+//purpose :
+//=======================================================================
+
+Standard_Integer MNaming_NamingRetrievalDriver_2::VersionNumber() const
+{ return 0; }
+
+//=======================================================================
+//function : SourceType
+//purpose :
+//=======================================================================
+
+Handle(Standard_Type) MNaming_NamingRetrievalDriver_2::SourceType() const
+{ return STANDARD_TYPE(PNaming_Naming_2); }
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+
+Handle(TDF_Attribute) MNaming_NamingRetrievalDriver_2::NewEmpty() const
+{ return new TNaming_Naming (); }
+
+//=======================================================================
+//function : PNamingToTNaming
+//purpose :
+//=======================================================================
+
+static void PNamingToTNaming (const Handle(PNaming_Name_2)& PN,
+ TNaming_Name& TN,
+ const Handle(MDF_RRelocationTable)& RelocTable)
+
+{
+ TN.Type (IntegerToNameType (PN->Type ()));
+ TN.ShapeType(IntegerToShapeEnum(PN->ShapeType()));
+ Handle(TNaming_NamedShape) NS;
+ Handle(TDF_Data) aData;
+ if (!PN->Arguments().IsNull()) {
+ Standard_Integer NbArgs = PN->Arguments()->Length();
+ for (Standard_Integer i = 1; i <= NbArgs; i++) {
+ RelocTable->HasRelocation(PN->Arguments()->Value(i),NS);
+ TN.Append(NS);
+ if(aData.IsNull() && !NS.IsNull())
+ aData = NS->Label().Data();
+ }
+ }
+
+ Handle(TNaming_NamedShape) StopNS;
+ if (!PN->StopNamedShape().IsNull())
+ RelocTable->HasRelocation(PN->StopNamedShape(),StopNS);
+ TN.StopNamedShape(StopNS);
+ TN.Index(PN->Index());
+
+ TDF_Label tLab; // Null label.
+ Handle(PCollection_HAsciiString) pEntry = PN->ContextLabel();
+ if (!pEntry.IsNull()) {
+ TCollection_AsciiString entry = pEntry->Convert();
+ if(!aData.IsNull())
+ TDF_Tool::Label(aData,entry,tLab);
+ }
+ TN.ContextLabel(tLab);
+ TN.Orientation(IntegerToOrientation (PN->Orientation ()));
+}
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void MNaming_NamingRetrievalDriver_2::Paste (
+ const Handle(PDF_Attribute)& Source,
+ const Handle(TDF_Attribute)& Target,
+ const Handle(MDF_RRelocationTable)& RelocTable) const
+{
+ Handle(PNaming_Naming_2) PF = Handle(PNaming_Naming_2)::DownCast(Source);
+ Handle(TNaming_Naming) F = Handle(TNaming_Naming)::DownCast(Target);
+ PNamingToTNaming (PF->GetName(),F->ChangeName(),RelocTable);
+}
+
#include <MNaming_NamingStorageDriver.ixx>
-#include <PNaming_Naming_1.hxx>
+#include <PNaming_Naming_2.hxx>
#include <PCollection_HAsciiString.hxx>
#include <Standard_NoSuchObject.hxx>
#include <TDF_Tool.hxx>
#include <TNaming_Naming.hxx>
#include <TCollection_AsciiString.hxx>
#include <TNaming_Name.hxx>
-#include <PNaming_Name_1.hxx>
+#include <PNaming_Name_2.hxx>
#include <PNaming_NamedShape.hxx>
#include <TNaming_NamedShape.hxx>
#include <TNaming_ListOfNamedShape.hxx>
#include <TNaming_ListIteratorOfListOfNamedShape.hxx>
#include <CDM_MessageDriver.hxx>
#include <PNaming_HArray1OfNamedShape.hxx>
+#include <TopAbs_Orientation.hxx>
//=======================================================================
-//function : IntegerToShapeEnum
+//function : ShapeEnumToInteger
//purpose :
//=======================================================================
}
//=======================================================================
-//function : IntegerToNameType
+//function : NameTypeToInteger
//purpose :
//=======================================================================
return 0;
}
+//=======================================================================
+//function : OrientationToInteger
+//purpose :
+//=======================================================================
+
+static Standard_Integer OrientationToInteger (const TopAbs_Orientation Or)
+{
+ switch(Or)
+ {
+ case TopAbs_FORWARD : return 0;
+ case TopAbs_REVERSED : return 1;
+ case TopAbs_INTERNAL : return 2;
+ case TopAbs_EXTERNAL : return 3;
+ default :
+ Standard_DomainError::Raise("TNaming_Name::myOrientation; enum term unknown ");
+ }
+ return 0;
+}
//=======================================================================
//function : MNaming_NamingStorageDriver
//purpose :
//=======================================================================
Handle(PDF_Attribute) MNaming_NamingStorageDriver::NewEmpty() const
-{ return new PNaming_Naming_1 (); }
+{ return new PNaming_Naming_2 (); }
//=======================================================================
//=======================================================================
static void TNamingToPNaming (const TNaming_Name& TN,
- Handle(PNaming_Name_1)& PN,
+ Handle(PNaming_Name_2)& PN,
const Handle(MDF_SRelocationTable)& RelocTable)
{
- PN = new PNaming_Name_1();
+ PN = new PNaming_Name_2();
PN->Type (NameTypeToInteger (TN.Type ()));
PN->ShapeType(ShapeEnumToInteger(TN.ShapeType()));
}
PN->ContextLabel(pEntry);
+ PN->Orientation(OrientationToInteger(TN.Orientation()));
}
//=======================================================================
const Handle(PDF_Attribute)& Target,
const Handle(MDF_SRelocationTable)& RelocTable) const
{
- Handle(PNaming_Naming_1) PF = Handle(PNaming_Naming_1)::DownCast(Target);
+ Handle(PNaming_Naming_2) PF = Handle(PNaming_Naming_2)::DownCast(Target);
Handle(TNaming_Naming) F = Handle(TNaming_Naming)::DownCast(Source);
- Handle(PNaming_Name_1) PN ;
+ Handle(PNaming_Name_2) PN ;
TNamingToPNaming (F->GetName(), PN ,RelocTable);
PF->SetName(PN);
}
class Name;
class Name_1;
+
+ class Name_2;
class NamedShape;
class Naming_1;
+ class Naming_2;
+
class HArray1OfNamedShape instantiates HArray1 from PCollection (NamedShape);
end PNaming;
--- /dev/null
+-- Created on: 2008-08-15
+-- Created by: Sergey ZARITCHNY <szy@opencascade.com>
+-- Copyright (c) 2008-2012 OPEN CASCADE SAS
+--
+-- The content of this file is subject to the Open CASCADE Technology Public
+-- License Version 6.5 (the "License"). You may not use the content of this file
+-- except in compliance with the License. Please obtain a copy of the License
+-- at http://www.opencascade.org and read it completely before using this file.
+--
+-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+--
+-- The Original Code and all software distributed under the License is
+-- distributed on an "AS IS" basis, without warranty of any kind, and the
+-- Initial Developer hereby disclaims all such warranties, including without
+-- limitation, any warranties of merchantability, fitness for a particular
+-- purpose or non-infringement. Please see the License for the specific terms
+-- and conditions governing the rights and limitations under the License.
+
+
+class Name_2 from PNaming inherits Persistent from Standard
+
+ ---Purpose:
+uses
+ NamedShape from PNaming,
+ HArray1OfNamedShape from PNaming,
+ HAsciiString from PCollection
+
+is
+ Create returns mutable Name_2 from PNaming;
+
+ Type (me : mutable; T : Integer from Standard);
+ ---C++: inline
+
+ ShapeType (me : mutable; T : Integer from Standard);
+ ---C++: inline
+
+ Arguments (me :mutable ; Args : HArray1OfNamedShape from PNaming);
+ ---C++: inline
+
+ StopNamedShape (me : mutable; arg : NamedShape from PNaming);
+ ---C++: inline
+
+ Orientation (me : mutable; Or : Integer from Standard);
+ ---C++: inline
+
+ Type (me) returns Integer from Standard;
+ ---C++: inline
+
+ ShapeType (me) returns Integer from Standard;
+ ---C++: inline
+
+ Arguments (me) returns HArray1OfNamedShape from PNaming;
+ ---C++: inline
+
+ StopNamedShape (me) returns NamedShape from PNaming;
+ ---C++: inline
+
+ Index(me : mutable; I : Integer from Standard);
+ ---C++: inline
+
+ Index(me) returns Integer from Standard;
+ ---C++: inline
+
+ ContextLabel (me) returns HAsciiString from PCollection;
+ ---C++: return const&
+ ---C++: inline
+
+ ContextLabel (me : mutable; theLab : HAsciiString from PCollection);
+ ---C++: inline
+
+ Orientation(me) returns Integer from Standard;
+ ---C++: inline
+
+fields
+
+ myType : Integer from Standard;
+ myShapeType : Integer from Standard;
+ myArgs : HArray1OfNamedShape from PNaming;
+ myStop : NamedShape from PNaming;
+ myIndex : Integer from Standard;
+ myContextLabel : HAsciiString from PCollection;
+ myOrientation : Integer from Standard;
+end Name_2;
--- /dev/null
+// Created on: 2008-08-15
+// Created by: Sergey ZARITCHNY <szy@op
+// Copyright (c) 2008-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <PNaming_Name_2.ixx>
+
+//=======================================================================
+//function : PNaming_Name_2
+//purpose :
+//=======================================================================
+
+PNaming_Name_2::PNaming_Name_2()
+:myType(0),myShapeType(0),myIndex(0), myOrientation(0)
+{
+}
--- /dev/null
+// Created on: 2008-08-15
+// Created by: Sergey ZARITCHNY <szy@op
+// Copyright (c) 2008-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+inline void PNaming_Name_2::Type(const Standard_Integer T)
+{myType = T;}
+
+inline void PNaming_Name_2::ShapeType(const Standard_Integer T)
+{myShapeType = T;}
+
+inline void PNaming_Name_2::Arguments(const Handle(PNaming_HArray1OfNamedShape)& Args)
+{myArgs = Args;}
+
+inline void PNaming_Name_2::StopNamedShape(const Handle(PNaming_NamedShape)& NS)
+{myStop = NS;}
+
+inline void PNaming_Name_2::Index(const Standard_Integer I)
+{myIndex = I;}
+
+inline Standard_Integer PNaming_Name_2::Type() const
+{return myType;}
+
+inline Standard_Integer PNaming_Name_2::ShapeType() const
+{return myShapeType;}
+
+inline Handle_PNaming_HArray1OfNamedShape PNaming_Name_2::Arguments() const
+{return myArgs;}
+
+inline Handle_PNaming_NamedShape PNaming_Name_2::StopNamedShape() const
+{return myStop;}
+
+inline Standard_Integer PNaming_Name_2::Index() const
+{return myIndex;}
+
+inline void PNaming_Name_2::ContextLabel(const Handle(PCollection_HAsciiString)& theLabel)
+{myContextLabel = theLabel;}
+
+inline const Handle(PCollection_HAsciiString)& PNaming_Name_2::ContextLabel() const
+{return myContextLabel;}
+
+inline void PNaming_Name_2::Orientation(const Standard_Integer Or)
+{myOrientation = Or;}
+
+inline Standard_Integer PNaming_Name_2::Orientation() const
+{return myOrientation;}
\ No newline at end of file
--- /dev/null
+-- Created on: 2008-08-15
+-- Created by: Sergey ZARITCHNY <szy@opencascade.com>
+-- Copyright (c) 2008-2012 OPEN CASCADE SAS
+--
+-- The content of this file is subject to the Open CASCADE Technology Public
+-- License Version 6.5 (the "License"). You may not use the content of this file
+-- except in compliance with the License. Please obtain a copy of the License
+-- at http://www.opencascade.org and read it completely before using this file.
+--
+-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+--
+-- The Original Code and all software distributed under the License is
+-- distributed on an "AS IS" basis, without warranty of any kind, and the
+-- Initial Developer hereby disclaims all such warranties, including without
+-- limitation, any warranties of merchantability, fitness for a particular
+-- purpose or non-infringement. Please see the License for the specific terms
+-- and conditions governing the rights and limitations under the License.
+
+
+
+class Naming_2 from PNaming inherits Attribute from PDF
+
+ ---Purpose:
+uses
+ Name_2 from PNaming
+
+is
+ Create
+ returns mutable Naming_2 from PNaming;
+
+ SetName(me : mutable ; aName : Name_2 from PNaming);
+
+ GetName(me) returns Name_2 from PNaming;
+
+fields
+
+ myName : Name_2 from PNaming;
+
+end Naming_2;
--- /dev/null
+// Created on: 2008-08-15
+// Created by: Sergey ZARITCHNY
+// Copyright (c) 2008-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+#include <PNaming_Naming_2.ixx>
+
+//=======================================================================
+//function : PNaming_Naming_2
+//purpose :
+//=======================================================================
+
+PNaming_Naming_2::PNaming_Naming_2() {}
+
+
+//=======================================================================
+//function : SetName
+//purpose :
+//=======================================================================
+
+void PNaming_Naming_2::SetName(const Handle(PNaming_Name_2)& Name)
+{myName = Name ;}
+
+//=======================================================================
+//function : GetName
+//purpose :
+//=======================================================================
+
+Handle(PNaming_Name_2) PNaming_Naming_2::GetName() const
+{
+ return myName;
+}
NameType from TNaming,
NamedShape from TNaming,
ListOfNamedShape from TNaming,
- ShapeEnum from TopAbs,
+ ShapeEnum from TopAbs,
+ Orientation from TopAbs,
Shape from TopoDS,
Label from TDF,
LabelMap from TDF,
Index (me : in out; I : Integer from Standard);
ContextLabel (me : in out; theLab : Label from TDF);
-
+
+ Orientation (me : in out; theOrientation : Orientation from TopAbs);
+
---Category: Queriyng
-- ========
ContextLabel (me) returns Label from TDF;
---C++: return const&
+
+ Orientation (me) returns Orientation from TopAbs;
+ ---C++: inline
+ ---C++: return const
---Category: Resolution
myIndex : Integer from Standard;
myShape : Shape from TopoDS;
myContextLabel : Label from TDF;
+ myOrientation : Orientation from TopAbs;
end Name;
Standard_Boolean isCand(Standard_True); // aS is a Candidate
TNaming_DataMapIteratorOfDataMapOfShapeMapOfShape it2(DM);
for (;it2.More();it2.Next()) {
- const TopoDS_Shape& aKey2 = it2.Key();
- if(aKey2 == aKey1) continue;
- const TNaming_MapOfShape& aMap2 = it2.Value();
- if(!aMap2.Contains(aS)) isCand = Standard_False;
+ const TopoDS_Shape& aKey2 = it2.Key();
+ if(aKey2 == aKey1) continue;
+ const TNaming_MapOfShape& aMap2 = it2.Value();
+ if(!aMap2.Contains(aS)) isCand = Standard_False;
}
- if(isCand)
- List.Append(aS);
+ if(isCand)
+ List.Append(aS);
}
break;
}
{
return myContextLabel;
}
-/*
+
//=======================================================================
//function : Orientation
//purpose : Set
//=======================================================================
-
-void TNaming_Name::Orientation(const Standard_Boolean theOrientation)
+void TNaming_Name::Orientation(const TopAbs_Orientation theOrientation)
{
myOrientation = theOrientation;
}
-//=======================================================================
-//function : ContextLabel
-//purpose : Get
-//=======================================================================
-
-const Standard_Boolean TNaming_Name::Orientation() const
-{
- return myOrientation;
-}
-*/
--- /dev/null
+// File: TNaming_Name.lxx
+// Copyright: Open CASCADE 2013
+// Created on: 2013-07-03
+// Created by: Sergey Zaritchny
+// Copyright (c) 1999-2013 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+//=======================================================================
+//function : Orientation
+//purpose : Get
+//=======================================================================
+
+inline const TopAbs_Orientation TNaming_Name::Orientation() const
+{
+ return myOrientation;
+}
}
-//=======================================================================
-//function : DummyShapeToStoreOrientation
-//=======================================================================
-static const TopoDS_Shape& DummyShapeToStoreOrientation (const TopAbs_Orientation Or)
-{
- gp_Pnt aPnt(0,0,0);
- static TopoDS_Vertex aVForward, aVRev;
- switch(Or) {
- case TopAbs_FORWARD:
- if(aVForward.IsNull()) {
- aVForward = BRepBuilderAPI_MakeVertex (aPnt).Vertex();
- aVForward.Orientation(TopAbs_FORWARD);
- }
- return aVForward;
- case TopAbs_REVERSED:
- if(aVRev.IsNull()) {
- aVRev = BRepBuilderAPI_MakeVertex (aPnt).Vertex();
- aVRev.Orientation(TopAbs_REVERSED);
- }
- return aVRev;
- }
- return aVForward;
-}
-
//=======================================================================
//function : Select
//purpose :
Standard_ConstructionError::Raise("TNaming_Builder : not same evolution");
}
- TNaming_RefShape* pos;
-
- if(S.ShapeType() != TopAbs_VERTEX &&
- (S.Orientation() == TopAbs_FORWARD || S.Orientation() == TopAbs_REVERSED)) {
- const TopoDS_Shape& aV = DummyShapeToStoreOrientation (S.Orientation());
- if (!myShapes->myMap.IsBound(aV)) {
- pos = new TNaming_RefShape(aV);
- myShapes->myMap.Bind(aV,pos);
- } else
- pos = myShapes->myMap.ChangeFind(aV);
- } else {
- if (!myShapes->myMap.IsBound(InS)) {
- pos = new TNaming_RefShape(InS);
- myShapes->myMap.Bind(InS,pos);
- }
- else
- pos = myShapes->myMap.ChangeFind(InS);
+ TNaming_RefShape* pos;
+ if (!myShapes->myMap.IsBound(InS)) {
+ pos = new TNaming_RefShape(InS);
+ myShapes->myMap.Bind(InS,pos);
}
+ else
+ pos = myShapes->myMap.ChangeFind(InS);
TNaming_RefShape* pns;
if (!myShapes->myMap.IsBound(S)) {
TNaming_Name& theName = Naming->ChangeName();
theName.ShapeType(S.ShapeType());
theName.Shape(S);
+ theName.Orientation(S.Orientation());
theName.Type(Name);
TNaming_Builder B(Naming->Label());
B.Select(S,S);
TNaming_Name& theName = NF->ChangeName();
theName.ShapeType(S.ShapeType());
theName.Shape(S);
+ theName.Orientation(S.Orientation());
theName.Type(TNaming_FILTERBYNEIGHBOURGS);
theName.Append(NS);
theName.StopNamedShape (Until);
TNaming_Name& theName = Naming->ChangeName();
theName.ShapeType(Selection.ShapeType());
theName.Shape(Selection);
+ theName.Orientation(Selection.Orientation());
theName.Type(Ident.Type());
#ifdef MDTV_DEB_MOD
cout <<"BuildName: Inserted Naming Att at ";
Naming = TNaming_Naming::Insert(F);
TNaming_Name& theName = Naming->ChangeName();
theName.ShapeType(Selection.ShapeType());
- theName.Shape(Selection); //szy 21.10.03
+ theName.Shape(Selection);
+ theName.Orientation(Selection.Orientation());
theName.Type(TNaming_GENERATION);
theName.Append(TNaming_Tool::NamedShape(Selection,F));
theName.Append(NewNS);
F.AddAttribute (Naming);
TNaming_Name& theName = Naming->ChangeName();
theName.ShapeType(Selection.ShapeType());
- theName.Shape(Selection);
+ theName.Shape(Selection);
+ theName.Orientation(Selection.Orientation());
}
TNaming_Name& theName = Naming->ChangeName();
F.AddAttribute (Naming);
TNaming_Name& theName = Naming->ChangeName();
theName.ShapeType(Selection.ShapeType());
- theName.Shape(Selection);
+ theName.Shape(Selection);
+ theName.Orientation(Selection.Orientation());
}
TNaming_Name& theName = Naming->ChangeName();
TNaming_Name& theName = Naming->ChangeName();
theName.ShapeType(S.ShapeType());
theName.Shape(S);
+ theName.Orientation(S.Orientation());
}
#ifdef MDTV_DEB_CC
cout <<"BuildAggregationName ==> ";
Handle (TNaming_Naming) aNaming = TNaming_Naming::Insert(F);
TNaming_Name& aName = aNaming->ChangeName();
aName.ShapeType(aS.ShapeType());
- aName.Shape(aS);
+ aName.Shape(aS);
+ theName.Orientation(aS.Orientation());
aName.Type(TNaming_UNION);
if (atomTyp != TopAbs_SHAPE) {
theName.ShapeType(S.ShapeType());
theName.Shape(S);
theName.Type(TNaming_ORIENTATION);
+ theName.Orientation(S.Orientation());
if (!TNaming_Selector::IsIdentified (F, S, NS, Geom))
NS = TNaming_Naming::Name(Naming->Label(),S,Context,Geom,0);
theName.ShapeType(S.ShapeType());// modified by vro 05.09.00
theName.Shape(S);
+ theName.Orientation(S.Orientation());
if(S.ShapeType() != TopAbs_WIRE)
theName.Type(TNaming_UNION);
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TNaming_OldShapeIterator.hxx>
#include <TNaming_Tool.hxx>
+#include <TNaming_Naming.hxx>
+#include <TDF_ChildIterator.hxx>
#ifdef DEB
//#define MDTV_DEB_DESC
//#define MDTV_DEB_APPLY
Standard_Boolean YaOrientationToApply(Standard_False);
TopAbs_Orientation OrientationToApply(TopAbs_FORWARD);
if(Att->Evolution() == TNaming_SELECTED) {
- if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX &&
- !itL.OldShape().IsNull() && itL.OldShape().ShapeType() == TopAbs_VERTEX) {
- YaOrientationToApply = Standard_True;
- OrientationToApply = itL.OldShape().Orientation();
- }
+ if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX) {//OR-N
+ Handle (TNaming_Naming) aNaming;
+ Lab.FindAttribute(TNaming_Naming::GetID(), aNaming);
+ if(!aNaming.IsNull()) {
+ if(aNaming->GetName().Type() == TNaming_ORIENTATION) {
+ OrientationToApply = aNaming->GetName().Orientation();
+ } else {
+ Handle (TNaming_Naming) aNaming2;
+ TDF_ChildIterator it(aNaming->Label());
+ for(;it.More();it.Next()) {
+ const TDF_Label& aLabel = it.Value();
+ aLabel.FindAttribute(TNaming_Naming::GetID(), aNaming2);
+ if(!aNaming2.IsNull()) {
+ if(aNaming2->GetName().Type() == TNaming_ORIENTATION) {
+ OrientationToApply = aNaming2->GetName().Orientation();
+ break;
+ }
+ }
+ }
+ }
+ if(OrientationToApply == TopAbs_FORWARD || OrientationToApply == TopAbs_REVERSED)
+ YaOrientationToApply = Standard_True;
+ }
+ } //
}
TNaming_NewShapeIterator it(itL);
if (!it.More()) {
Handle(TNaming_Naming) N = new TNaming_Naming ();
N->ChangeName().Type(TNaming_IDENTITY);
N->ChangeName().Append(NS);
-
+ N->ChangeName().Orientation(Selection.Orientation());
#ifdef BUC60862
// inserted by vro 06.09.00:
N->ChangeName().ShapeType(Selection.ShapeType());
#include <TDF_AttributeMap.hxx>
#include <TDF_Tool.hxx>
#include <TDF_MapIteratorOfAttributeMap.hxx>
+#include <TDF_ChildIterator.hxx>
#include <TopExp_Explorer.hxx>
#include <TNaming_ListIteratorOfListOfNamedShape.hxx>
#endif
//function : GetShape
//purpose :
//=======================================================================
-
TopoDS_Shape TNaming_Tool::GetShape(const Handle(TNaming_NamedShape)& NS)
{
TNaming_Iterator itL (NS);
if(NS->Evolution() == TNaming_SELECTED) {
for (; itL.More(); itL.Next()) {
if(!itL.NewShape().IsNull()) {
- if(itL.NewShape().ShapeType() != TopAbs_VERTEX &&
- !itL.OldShape().IsNull() && itL.OldShape().ShapeType() == TopAbs_VERTEX) {
- const TopoDS_Shape& aS = itL.NewShape().Oriented(itL.OldShape().Orientation());
- MS.Add(aS);
- } else
- MS.Add(itL.NewShape());
- }
- }
+ if(itL.NewShape().ShapeType() != TopAbs_VERTEX ) { //OR-N
+ Handle (TNaming_Naming) aNaming;
+ NS->Label().FindAttribute(TNaming_Naming::GetID(), aNaming);
+ if(!aNaming.IsNull()) {
+ if(aNaming->GetName().Orientation() == TopAbs_FORWARD ||
+ aNaming->GetName().Orientation() == TopAbs_REVERSED) {
+ TopoDS_Shape aS = itL.NewShape();
+ if(aNaming->GetName().Type() == TNaming_ORIENTATION) {
+ aS.Orientation(aNaming->GetName().Orientation());
+ } else {
+ Handle (TNaming_Naming) aNaming2;
+ TDF_ChildIterator it(aNaming->Label());
+ for(;it.More();it.Next()) {
+ const TDF_Label& aLabel = it.Value();
+ aLabel.FindAttribute(TNaming_Naming::GetID(), aNaming2);
+ if(!aNaming2.IsNull()) {
+ if(aNaming2->GetName().Type() == TNaming_ORIENTATION) {
+ aS.Orientation(aNaming2->GetName().Orientation());
+ break;
+ }
+ }
+ }
+ }
+ MS.Add(aS);
+ } else
+ MS.Add(itL.NewShape());
+ } else
+ MS.Add(itL.NewShape());
+ } //
+ else
+ MS.Add(itL.NewShape());
+ }
+ }
} else
for (; itL.More(); itL.Next()) {
if (!itL.NewShape().IsNull()) MS.Add(itL.NewShape());
for (; itL.More(); itL.Next()) {
const TopoDS_Shape& S = itL.NewShape();
if (S.IsNull()) continue;
+//OR-N
Standard_Boolean YaOrientationToApply(Standard_False);
TopAbs_Orientation OrientationToApply(TopAbs_FORWARD);
if(Att->Evolution() == TNaming_SELECTED) {
- if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX &&
- !itL.OldShape().IsNull() && itL.OldShape().ShapeType() == TopAbs_VERTEX) {
- YaOrientationToApply = Standard_True;
- OrientationToApply = itL.OldShape().Orientation();
- }
- }
+ if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX) {
+ Handle (TNaming_Naming) aNaming;
+ Att->Label().FindAttribute(TNaming_Naming::GetID(), aNaming);
+ if(!aNaming.IsNull()) {
+ if(aNaming->GetName().Type() == TNaming_ORIENTATION) {
+ OrientationToApply = aNaming->GetName().Orientation();
+ } else {
+ Handle (TNaming_Naming) aNaming2;
+ TDF_ChildIterator it(aNaming->Label());
+ for(;it.More();it.Next()) {
+ const TDF_Label& aLabel = it.Value();
+ aLabel.FindAttribute(TNaming_Naming::GetID(), aNaming2);
+ if(!aNaming2.IsNull()) {
+ if(aNaming2->GetName().Type() == TNaming_ORIENTATION) {
+ OrientationToApply = aNaming2->GetName().Orientation();
+ break;
+ }
+ }
+ }
+ }
+ if(OrientationToApply == TopAbs_FORWARD || OrientationToApply == TopAbs_REVERSED)
+ YaOrientationToApply = Standard_True;
+ }
+ }
+ } //
TNaming_NewShapeIterator it(itL);
if (!it.More()) {
MS.Add(S);
for (; itL.More(); itL.Next()) {
const TopoDS_Shape& S = itL.NewShape();
if (S.IsNull()) continue;
+//OR-N
Standard_Boolean YaOrientationToApply(Standard_False);
TopAbs_Orientation OrientationToApply(TopAbs_FORWARD);
if(Att->Evolution() == TNaming_SELECTED) {
- if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX &&
- !itL.OldShape().IsNull() && itL.OldShape().ShapeType() == TopAbs_VERTEX) {
- YaOrientationToApply = Standard_True;
- OrientationToApply = itL.OldShape().Orientation();
+ if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX) {
+ Handle (TNaming_Naming) aNaming;
+ Att->Label().FindAttribute(TNaming_Naming::GetID(), aNaming);
+ if(!aNaming.IsNull()) {
+ if(aNaming->GetName().Type() == TNaming_ORIENTATION) {
+ OrientationToApply = aNaming->GetName().Orientation();
+ } else {
+ Handle (TNaming_Naming) aNaming2;
+ TDF_ChildIterator it(aNaming->Label());
+ for(;it.More();it.Next()) {
+ const TDF_Label& aLabel = it.Value();
+ aLabel.FindAttribute(TNaming_Naming::GetID(), aNaming2);
+ if(!aNaming2.IsNull()) {
+ if(aNaming2->GetName().Type() == TNaming_ORIENTATION) {
+ OrientationToApply = aNaming2->GetName().Orientation();
+ break;
+ }
+ }
+ }
+ }
+ if(OrientationToApply == TopAbs_FORWARD || OrientationToApply == TopAbs_REVERSED)
+ YaOrientationToApply = Standard_True;
+ }
}
- }
+ } //
TNaming_NewShapeIterator it(itL);
if (!it.More()) {
MS.Add(S);
static Standard_GUID XmlLStorageDriver ("13a56820-8269-11d5-aab2-0050044b1af1");
static Standard_GUID XmlLRetrievalDriver("13a56822-8269-11d5-aab2-0050044b1af1");
-#define CURRENT_DOCUMENT_VERSION 6
+#define CURRENT_DOCUMENT_VERSION 7
//=======================================================================
//function : Factory
#include <TNaming_Naming.hxx>
#include <TNaming_NamedShape.hxx>
#include <TNaming_ListIteratorOfListOfNamedShape.hxx>
+#include <TNaming_Iterator.hxx>
#include <TDF_Tool.hxx>
//=======================================================================
IMPLEMENT_DOMSTRING (ShapeTypeString, "shapetype")
IMPLEMENT_DOMSTRING (ArgumentsString, "arguments")
IMPLEMENT_DOMSTRING (ContextLabelString, "contextlabel")
+IMPLEMENT_DOMSTRING (OrientString, "orientation")
IMPLEMENT_DOMSTRING (NTUnknownString, "unknown")
IMPLEMENT_DOMSTRING (NTIdentityString, "identity")
else
cout << "Retrieving Context Label is NULL" <<endl;
#endif
+
+ if(XmlMNaming::DocumentVersion() > 4 && XmlMNaming::DocumentVersion() < 7) {
+ // Orientation processing - converting from old format
+ Handle(TNaming_NamedShape) aNS;
+ if (aNg->Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+ //const TDF_Label& aLab = aNS->Label();
+ TNaming_Iterator itL (aNS);
+ for (; itL.More(); itL.Next()) {
+ const TopoDS_Shape& S = itL.NewShape();
+ if (S.IsNull()) continue;
+ if(aNS->Evolution() == TNaming_SELECTED) {
+ if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX &&
+ !itL.OldShape().IsNull() && itL.OldShape().ShapeType() == TopAbs_VERTEX ) {//OR-N
+ TopAbs_Orientation OrientationToApply = itL.OldShape().Orientation();
+ aNgName.Orientation(OrientationToApply);
+ }
+ }
+ }
+ }
+ }
+ if(XmlMNaming::DocumentVersion() > 6) {
+ aDOMStr = anElem.getAttribute(::OrientString());
+ if (!aDOMStr.GetInteger(aNb))
+ {
+ aMsgString = TCollection_ExtendedString
+ ("XmlMNaming_NamingDriver: Cannot retrieve "
+ "integer value of orientation from \"") + aDOMStr + "\"";
+ WriteMessage (aMsgString);
+ return Standard_False;
+ }
+ aNgName.Orientation((TopAbs_Orientation)aNb);
+ }
+ // or. end
}
#ifdef DEB
else if(XmlMNaming::DocumentVersion() == -1)
cout << "XmlMNaming_NamingDriver::Store: aDOMString is NULL" <<endl;
#endif
+ // orientation
+ anElem.setAttribute(::OrientString(), (Standard_Integer)aNgName.Orientation());
+
}
//=======================================================================
--- /dev/null
+puts "==========="
+puts "OCC23766"
+puts "==========="
+puts ""
+############################################################
+# Shape orientation processing mechanism redesign
+############################################################
+
+# test to check compatibility of old cbf format
+
+Open [locate_data_file bug23766_ttt1_old.cbf] D
+
+GetShape D 0:1:2:1:2 E1
+set info1 [whatis E1]
+
+## to be FORWARD:
+if { [regexp "FORWARD" $info1] != 1 } {
+ puts "Error: orientation of E1 is incorrect"
+} else {
+ puts "OK: orientation of E1 is correct"
+}
+
+GetShape D 0:1:3:1:2 E2
+set info2 [whatis E2]
+
+## to be REVERSED:
+if { [regexp "REVERSED" $info2] != 1 } {
+ puts "Error: orientation of E2 is incorrect"
+} else {
+ puts "OK: orientation of E2 is correct"
+}
+
--- /dev/null
+puts "==========="
+puts "OCC23766"
+puts "==========="
+puts ""
+############################################################
+# Shape orientation processing mechanism redesign
+############################################################
+
+# test to check compatibility of old std format
+
+Open [locate_data_file bug23766_ttt1_old.std] D
+
+GetShape D 0:1:2:1:2 E1
+set info1 [whatis E1]
+
+## to be FORWARD:
+if { [regexp "FORWARD" $info1] != 1 } {
+ puts "Error: orientation of E1 is incorrect"
+} else {
+ puts "OK: orientation of E1 is correct"
+}
+
+GetShape D 0:1:3:1:2 E2
+set info2 [whatis E2]
+
+## to be REVERSED:
+if { [regexp "REVERSED" $info2] != 1 } {
+ puts "Error: orientation of E2 is incorrect"
+} else {
+ puts "OK: orientation of E2 is correct"
+}
--- /dev/null
+puts "==========="
+puts "OCC23766"
+puts "==========="
+puts ""
+############################################################
+# Shape orientation processing mechanism redesign
+############################################################
+
+# test to check compatibility of old xml format
+
+Open [locate_data_file bug23766_ttt1_old.xml] D
+
+GetShape D 0:1:2:1:2 E1
+set info1 [whatis E1]
+
+## to be FORWARD:
+if { [regexp "FORWARD" $info1] != 1 } {
+ puts "Error: orientation of E1 is incorrect"
+} else {
+ puts "OK: orientation of E1 is correct"
+}
+
+GetShape D 0:1:3:1:2 E2
+set info2 [whatis E2]
+
+## to be REVERSED:
+if { [regexp "REVERSED" $info2] != 1 } {
+ puts "Error: orientation of E2 is incorrect"
+} else {
+ puts "OK: orientation of E2 is correct"
+}
--- /dev/null
+puts "=========="
+puts "OCC23766"
+puts "=========="
+puts ""
+########################################################
+# Shape orientation processing mechanis, redesign
+########################################################
+
+## test for keeping Orientation (cbf)
+
+erase
+NewDocument D BinOcaf
+
+#1 - create box
+NewCommand D
+set B2 [AddObject D]; ## add object
+set F2 [AddFunction D $B2 Box]; ## add function
+BoxDX D $B2 190; ## set argumets of this function
+BoxDY D $B2 290
+BoxDZ D $B2 390
+InitLogBook D; ## initialize (clean) internal maps of labels
+AddDriver D Box Attach
+ComputeFun D $F2; ## compute the function
+GetShape D $F2:2 Box2; ## check result
+
+#2 - make selections keeping orientation
+explode Box2 F
+explode Box2_1 E
+explode Box2_3 E
+don Box2_1_1 Box2_3_4
+set Sel1 [AttachShape D Box2_1_1 ${B2} ${B2} 1]; ## set attachment
+set Sel2 [AttachShape D Box2_3_4 ${B2} ${B2} 1]; ## set attachment
+
+#3 - check orientation of the selected shapes
+GetShape D 0:1:2:1:2 E1
+set info1 [whatis E1]
+## to be: E1 is a shape EDGE FORWARD Modified Orientable
+if { [regexp "FORWARD" $info1] != 1 } {
+ puts "Error: orientation of E1 is incorrect"
+} else {
+ puts "OK: orientation of E1 is correct"
+}
+
+GetShape D 0:1:3:1:2 E2
+set info2 [whatis E2]
+## to be: E2 is a shape EDGE REVERSED Modified Orientable
+if { [regexp "REVERSED" $info2] != 1 } {
+ puts "Error: orientation of E2 is incorrect"
+} else {
+ puts "OK: orientation of E2 is correct"
+}
+
+#4 - test persistence: check orientation after retrieving (to be the same as before)
+file delete -force ${imagedir}/bug23766_ttt1.cbf
+NewCommand D
+SaveAs D ${imagedir}/bug23766_ttt1.cbf
+Close D
+##unset D
+Open ${imagedir}/bug23766_ttt1.cbf D
+GetShape D 0:1:2:1:2 E1
+set info3 [whatis E1]
+## to be: E1 is a shape EDGE FORWARD Modified Orientable
+if { [regexp "FORWARD" $info3] != 1 } {
+ puts "Error: orientation of E1 is incorrect"
+} else {
+ puts "OK: orientation of E1 is correct"
+}
+
+GetShape D 0:1:3:1:2 E2
+set info4 [whatis E2]
+## to be: E2 is a shape EDGE REVERSED Modified Orientable
+if { [regexp "REVERSED" $info4] != 1 } {
+ puts "Error: orientation of E2 is incorrect"
+} else {
+ puts "OK: orientation of E2 is correct"
+}
+
--- /dev/null
+puts "=========="
+puts "OCC23766"
+puts "=========="
+puts ""
+########################################################
+# Shape orientation processing mechanis, redesign
+########################################################
+
+## test for keeping Orientation (std)
+
+erase
+NewDocument D MDTV-Standard
+#1 - create box
+NewCommand D
+set B2 [AddObject D]; ## add object
+set F2 [AddFunction D $B2 Box]; ## add function
+BoxDX D $B2 190; ## set argumets of this function
+BoxDY D $B2 290
+BoxDZ D $B2 390
+InitLogBook D; ## initialize (clean) internal maps of labels
+AddDriver D Box Attach
+ComputeFun D $F2; ## compute the function
+GetShape D $F2:2 Box2; ## check result
+
+#2 - make selections keeping orientation
+explode Box2 F
+explode Box2_1 E
+explode Box2_3 E
+don Box2_1_1 Box2_3_4
+set Sel1 [AttachShape D Box2_1_1 ${B2} ${B2} 1]; ## set attachment keeping orientation of the edge
+set Sel2 [AttachShape D Box2_3_4 ${B2} ${B2} 1]; ## set attachment keeping orientation of the edge
+
+#3 - check orientation of the selected shapes
+GetShape D 0:1:2:1:2 E1
+set info1 [whatis E1]
+## to be: E1 is a shape EDGE FORWARD Modified Orientable
+if { [regexp "FORWARD" $info1] != 1 } {
+ puts "Error: orientation of E1 is incorrect"
+} else {
+ puts "OK: orientation of E1 is correct"
+}
+
+GetShape D 0:1:3:1:2 E2
+set info2 [whatis E2]
+## to be: E2 is a shape EDGE REVERSED Modified Orientable
+if { [regexp "REVERSED" $info2] != 1 } {
+ puts "Error: orientation of E2 is incorrect"
+} else {
+ puts "OK: orientation of E2 is correct"
+}
+
+#4 - test persistence: check orientation after retrieving (to be the same as before)
+file delete -force ${imagedir}/bug23766_ttt1.std
+NewCommand D
+SaveAs D ${imagedir}/bug23766_ttt1.std
+Close D
+##unset D
+Open ${imagedir}/bug23766_ttt1.std D
+GetShape D 0:1:2:1:2 E1
+set info3 [whatis E1]
+## to be: E1 is a shape EDGE FORWARD Modified Orientable
+if { [regexp "FORWARD" $info3] != 1 } {
+ puts "Error: orientation of E1 is incorrect"
+} else {
+ puts "OK: orientation of E1 is correct"
+}
+
+GetShape D 0:1:3:1:2 E2
+set info4 [whatis E2]
+## to be: E2 is a shape EDGE REVERSED Modified Orientable
+if { [regexp "REVERSED" $info4] != 1 } {
+ puts "Error: orientation of E2 is incorrect"
+} else {
+ puts "OK: orientation of E2 is correct"
+}
--- /dev/null
+puts "=========="
+puts "OCC23766"
+puts "=========="
+puts ""
+########################################################
+# Shape orientation processing mechanis, redesign
+########################################################
+
+## test for keeping Orientation (xml)
+
+erase
+NewDocument D XmlOcaf
+
+#1 - create box
+NewCommand D
+set B2 [AddObject D]; ## add object
+set F2 [AddFunction D $B2 Box]; ## add function
+BoxDX D $B2 190; ## set argumets of this function
+BoxDY D $B2 290
+BoxDZ D $B2 390
+InitLogBook D; ## initialize (clean) internal maps of labels
+AddDriver D Box Attach
+ComputeFun D $F2; ## compute the function
+GetShape D $F2:2 Box2; ## check result
+
+#2 - make selections keeping orientation
+explode Box2 F
+explode Box2_1 E
+explode Box2_3 E
+don Box2_1_1 Box2_3_4
+set Sel1 [AttachShape D Box2_1_1 ${B2} ${B2} 1]; ## set attachment
+set Sel2 [AttachShape D Box2_3_4 ${B2} ${B2} 1]; ## set attachment
+
+#3 - check orientation of the selected shapes
+GetShape D 0:1:2:1:2 E1
+set info1 [whatis E1]
+## to be: E1 is a shape EDGE FORWARD Modified Orientable
+if { [regexp "FORWARD" $info1] != 1 } {
+ puts "Error: orientation of E1 is incorrect"
+} else {
+ puts "OK: orientation of E1 is correct"
+}
+
+GetShape D 0:1:3:1:2 E2
+set info2 [whatis E2]
+## to be: E2 is a shape EDGE REVERSED Modified Orientable
+if { [regexp "REVERSED" $info2] != 1 } {
+ puts "Error: orientation of E2 is incorrect"
+} else {
+ puts "OK: orientation of E2 is correct"
+}
+
+#4 - test persistence: check orientation after retrieving (to be the same as before)
+file delete -force ${imagedir}/bug23766_ttt1.xml
+NewCommand D
+SaveAs D ${imagedir}/bug23766_ttt1.xml
+Close D
+##unset D
+Open ${imagedir}/bug23766_ttt1.xml D
+GetShape D 0:1:2:1:2 E1
+set info3 [whatis E1]
+## to be: E1 is a shape EDGE FORWARD Modified Orientable
+if { [regexp "FORWARD" $info3] != 1 } {
+ puts "Error: orientation of E1 is incorrect"
+} else {
+ puts "OK: orientation of E1 is correct"
+}
+
+GetShape D 0:1:3:1:2 E2
+set info4 [whatis E2]
+## to be: E2 is a shape EDGE REVERSED Modified Orientable
+if { [regexp "REVERSED" $info4] != 1 } {
+ puts "Error: orientation of E2 is incorrect"
+} else {
+ puts "OK: orientation of E2 is correct"
+}