mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-16 10:54:53 +03:00
0023766: Shape orientation processing mechanism redesign
Added missed file. Added missed MDF_Tool.cxx. Adding test cases for issue CR23766
This commit is contained in:
parent
602952413f
commit
7dcac1dfa0
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
static Standard_GUID BinLStorageDriver ("13a56835-8269-11d5-aab2-0050044b1af1");
|
static Standard_GUID BinLStorageDriver ("13a56835-8269-11d5-aab2-0050044b1af1");
|
||||||
static Standard_GUID BinLRetrievalDriver("13a56836-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
|
//function : Factory
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <TColStd_Array1OfInteger.hxx>
|
#include <TColStd_Array1OfInteger.hxx>
|
||||||
#include <CDM_MessageDriver.hxx>
|
#include <CDM_MessageDriver.hxx>
|
||||||
#include <TDF_Attribute.hxx>
|
#include <TDF_Attribute.hxx>
|
||||||
|
#include <TNaming_Iterator.hxx>
|
||||||
#include <TNaming_NameType.hxx>
|
#include <TNaming_NameType.hxx>
|
||||||
#include <TNaming_Naming.hxx>
|
#include <TNaming_Naming.hxx>
|
||||||
#include <TNaming_NamedShape.hxx>
|
#include <TNaming_NamedShape.hxx>
|
||||||
@ -259,6 +260,40 @@ Standard_Boolean BinMNaming_NamingDriver::Paste
|
|||||||
aName.ContextLabel(tLab);
|
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
|
#ifdef DEB
|
||||||
else if(BinMNaming::DocumentVersion() == -1)
|
else if(BinMNaming::DocumentVersion() == -1)
|
||||||
@ -332,4 +367,8 @@ void BinMNaming_NamingDriver::Paste (const Handle(TDF_Attribute)& theSource,
|
|||||||
if(!aName.ContextLabel().IsNull())
|
if(!aName.ContextLabel().IsNull())
|
||||||
TDF_Tool::Entry(aName.ContextLabel(), entry);
|
TDF_Tool::Entry(aName.ContextLabel(), entry);
|
||||||
theTarget << entry;
|
theTarget << entry;
|
||||||
|
|
||||||
|
//7. keep Orientation
|
||||||
|
theTarget << (Standard_Integer)aName.Orientation();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,14 @@
|
|||||||
#define DeclareConstAndSpeedCast(V,T,Vdown) const Handle(T)& Vdown = (Handle(T)&) V
|
#define DeclareConstAndSpeedCast(V,T,Vdown) const Handle(T)& Vdown = (Handle(T)&) V
|
||||||
#define SpeedCast(V,T,Vdown) 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
|
#undef DEB_MDF_TOOL
|
||||||
|
|
||||||
// Persistent structure:
|
// Persistent structure:
|
||||||
@ -364,7 +372,7 @@ void MDF_Tool::ReadLabels
|
|||||||
//purpose : PERSISTENT -> TRANSIENT
|
//purpose : PERSISTENT -> TRANSIENT
|
||||||
// Reads the persistent attributes content.
|
// Reads the persistent attributes content.
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
//#define DEB_ORIENT
|
||||||
void MDF_Tool::ReadAttributes
|
void MDF_Tool::ReadAttributes
|
||||||
(const MDF_TypeARDriverMap& aDriverMap,
|
(const MDF_TypeARDriverMap& aDriverMap,
|
||||||
const Handle(MDF_RRelocationTable)& aReloc)
|
const Handle(MDF_RRelocationTable)& aReloc)
|
||||||
@ -374,18 +382,50 @@ void MDF_Tool::ReadAttributes
|
|||||||
const PTColStd_PersistentTransientMap& attMap = aReloc->AttributeTable();
|
const PTColStd_PersistentTransientMap& attMap = aReloc->AttributeTable();
|
||||||
PTColStd_DataMapIteratorOfPersistentTransientMap itr(attMap);
|
PTColStd_DataMapIteratorOfPersistentTransientMap itr(attMap);
|
||||||
Handle(TDF_Attribute) tAtt;
|
Handle(TDF_Attribute) tAtt;
|
||||||
|
MDF_AttributeList attNList;
|
||||||
|
Standard_Boolean isName1(Standard_False);
|
||||||
|
ATTR pairAtt;
|
||||||
for ( ; itr.More(); itr.Next()) {
|
for ( ; itr.More(); itr.Next()) {
|
||||||
DeclareConstAndSpeedCast(itr.Key(),PDF_Attribute,pAtt);
|
DeclareConstAndSpeedCast(itr.Key(),PDF_Attribute,pAtt);
|
||||||
if (!pAtt.IsNull()) { // See above...
|
if (!pAtt.IsNull()) { // See above...
|
||||||
const Handle(Standard_Type)& type = pAtt->DynamicType();
|
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)) {
|
if (aDriverMap.IsBound(type)) {
|
||||||
SpeedCast(itr.Value(),TDF_Attribute,tAtt);
|
SpeedCast(itr.Value(),TDF_Attribute,tAtt);
|
||||||
const Handle(MDF_ARDriver)& driver = aDriverMap.Find(type);
|
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);
|
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;
|
TDF_AttributeList attList;
|
||||||
for (itr.Initialize(attMap); itr.More(); itr.Next()) {
|
for (itr.Initialize(attMap); itr.More(); itr.Next()) {
|
||||||
SpeedCast(itr.Value(),TDF_Attribute,tAtt);
|
SpeedCast(itr.Value(),TDF_Attribute,tAtt);
|
||||||
|
@ -39,6 +39,9 @@ is
|
|||||||
class NamingRetrievalDriver_1;
|
class NamingRetrievalDriver_1;
|
||||||
-- New fields added
|
-- New fields added
|
||||||
|
|
||||||
|
class NamingRetrievalDriver_2;
|
||||||
|
-- New fields added
|
||||||
|
|
||||||
class NamedShapeStorageDriver;
|
class NamedShapeStorageDriver;
|
||||||
|
|
||||||
class NamingStorageDriver;
|
class NamingStorageDriver;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <MNaming_NamingStorageDriver.hxx>
|
#include <MNaming_NamingStorageDriver.hxx>
|
||||||
#include <MNaming_NamingRetrievalDriver.hxx>
|
#include <MNaming_NamingRetrievalDriver.hxx>
|
||||||
#include <MNaming_NamingRetrievalDriver_1.hxx>
|
#include <MNaming_NamingRetrievalDriver_1.hxx>
|
||||||
|
#include <MNaming_NamingRetrievalDriver_2.hxx>
|
||||||
#include <CDM_MessageDriver.hxx>
|
#include <CDM_MessageDriver.hxx>
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -58,4 +59,5 @@ void MNaming::AddRetrievalDrivers
|
|||||||
aDriverSeq->Append(new MNaming_NamedShapeRetrievalDriver(theMsgDriver));
|
aDriverSeq->Append(new MNaming_NamedShapeRetrievalDriver(theMsgDriver));
|
||||||
aDriverSeq->Append(new MNaming_NamingRetrievalDriver(theMsgDriver));
|
aDriverSeq->Append(new MNaming_NamingRetrievalDriver(theMsgDriver));
|
||||||
aDriverSeq->Append(new MNaming_NamingRetrievalDriver_1(theMsgDriver));
|
aDriverSeq->Append(new MNaming_NamingRetrievalDriver_1(theMsgDriver));
|
||||||
|
aDriverSeq->Append(new MNaming_NamingRetrievalDriver_2(theMsgDriver));
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include <Standard_NoSuchObject.hxx>
|
#include <Standard_NoSuchObject.hxx>
|
||||||
#include <TNaming_Naming.hxx>
|
#include <TNaming_Naming.hxx>
|
||||||
#include <TNaming_NameType.hxx>
|
#include <TNaming_NameType.hxx>
|
||||||
|
#include <TNaming_Iterator.hxx>
|
||||||
#include <TopAbs_ShapeEnum.hxx>
|
#include <TopAbs_ShapeEnum.hxx>
|
||||||
#include <CDM_MessageDriver.hxx>
|
#include <CDM_MessageDriver.hxx>
|
||||||
|
|
||||||
@ -54,6 +55,7 @@ static TopAbs_ShapeEnum IntegerToShapeEnum (const Standard_Integer I)
|
|||||||
default :
|
default :
|
||||||
return TopAbs_SHAPE;
|
return TopAbs_SHAPE;
|
||||||
}
|
}
|
||||||
|
return TopAbs_SHAPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -161,7 +163,7 @@ static void PNamingToTNaming (const Handle(PNaming_Name_1)& PN,
|
|||||||
//function : Paste
|
//function : Paste
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
//#define DEB_ORIENT
|
||||||
void MNaming_NamingRetrievalDriver_1::Paste (
|
void MNaming_NamingRetrievalDriver_1::Paste (
|
||||||
const Handle(PDF_Attribute)& Source,
|
const Handle(PDF_Attribute)& Source,
|
||||||
const Handle(TDF_Attribute)& Target,
|
const Handle(TDF_Attribute)& Target,
|
||||||
@ -170,5 +172,33 @@ void MNaming_NamingRetrievalDriver_1::Paste (
|
|||||||
Handle(PNaming_Naming_1) PF = Handle(PNaming_Naming_1)::DownCast(Source);
|
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);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
53
src/MNaming/MNaming_NamingRetrievalDriver_2.cdl
Normal file
53
src/MNaming/MNaming_NamingRetrievalDriver_2.cdl
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
-- 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;
|
192
src/MNaming/MNaming_NamingRetrievalDriver_2.cxx
Normal file
192
src/MNaming/MNaming_NamingRetrievalDriver_2.cxx
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
// 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);
|
||||||
|
}
|
||||||
|
|
@ -21,23 +21,24 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <MNaming_NamingStorageDriver.ixx>
|
#include <MNaming_NamingStorageDriver.ixx>
|
||||||
#include <PNaming_Naming_1.hxx>
|
#include <PNaming_Naming_2.hxx>
|
||||||
#include <PCollection_HAsciiString.hxx>
|
#include <PCollection_HAsciiString.hxx>
|
||||||
#include <Standard_NoSuchObject.hxx>
|
#include <Standard_NoSuchObject.hxx>
|
||||||
#include <TDF_Tool.hxx>
|
#include <TDF_Tool.hxx>
|
||||||
#include <TNaming_Naming.hxx>
|
#include <TNaming_Naming.hxx>
|
||||||
#include <TCollection_AsciiString.hxx>
|
#include <TCollection_AsciiString.hxx>
|
||||||
#include <TNaming_Name.hxx>
|
#include <TNaming_Name.hxx>
|
||||||
#include <PNaming_Name_1.hxx>
|
#include <PNaming_Name_2.hxx>
|
||||||
#include <PNaming_NamedShape.hxx>
|
#include <PNaming_NamedShape.hxx>
|
||||||
#include <TNaming_NamedShape.hxx>
|
#include <TNaming_NamedShape.hxx>
|
||||||
#include <TNaming_ListOfNamedShape.hxx>
|
#include <TNaming_ListOfNamedShape.hxx>
|
||||||
#include <TNaming_ListIteratorOfListOfNamedShape.hxx>
|
#include <TNaming_ListIteratorOfListOfNamedShape.hxx>
|
||||||
#include <CDM_MessageDriver.hxx>
|
#include <CDM_MessageDriver.hxx>
|
||||||
#include <PNaming_HArray1OfNamedShape.hxx>
|
#include <PNaming_HArray1OfNamedShape.hxx>
|
||||||
|
#include <TopAbs_Orientation.hxx>
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : IntegerToShapeEnum
|
//function : ShapeEnumToInteger
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
@ -59,7 +60,7 @@ static Standard_Integer ShapeEnumToInteger (const TopAbs_ShapeEnum I)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : IntegerToNameType
|
//function : NameTypeToInteger
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
@ -85,6 +86,24 @@ static Standard_Integer NameTypeToInteger (const TNaming_NameType I)
|
|||||||
return 0;
|
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
|
//function : MNaming_NamingStorageDriver
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -117,7 +136,7 @@ Handle(Standard_Type) MNaming_NamingStorageDriver::SourceType() const
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
Handle(PDF_Attribute) MNaming_NamingStorageDriver::NewEmpty() const
|
Handle(PDF_Attribute) MNaming_NamingStorageDriver::NewEmpty() const
|
||||||
{ return new PNaming_Naming_1 (); }
|
{ return new PNaming_Naming_2 (); }
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -126,10 +145,10 @@ Handle(PDF_Attribute) MNaming_NamingStorageDriver::NewEmpty() const
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
static void TNamingToPNaming (const TNaming_Name& TN,
|
static void TNamingToPNaming (const TNaming_Name& TN,
|
||||||
Handle(PNaming_Name_1)& PN,
|
Handle(PNaming_Name_2)& PN,
|
||||||
const Handle(MDF_SRelocationTable)& RelocTable)
|
const Handle(MDF_SRelocationTable)& RelocTable)
|
||||||
{
|
{
|
||||||
PN = new PNaming_Name_1();
|
PN = new PNaming_Name_2();
|
||||||
PN->Type (NameTypeToInteger (TN.Type ()));
|
PN->Type (NameTypeToInteger (TN.Type ()));
|
||||||
PN->ShapeType(ShapeEnumToInteger(TN.ShapeType()));
|
PN->ShapeType(ShapeEnumToInteger(TN.ShapeType()));
|
||||||
|
|
||||||
@ -161,6 +180,7 @@ static void TNamingToPNaming (const TNaming_Name& TN,
|
|||||||
|
|
||||||
}
|
}
|
||||||
PN->ContextLabel(pEntry);
|
PN->ContextLabel(pEntry);
|
||||||
|
PN->Orientation(OrientationToInteger(TN.Orientation()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -173,9 +193,9 @@ void MNaming_NamingStorageDriver::Paste (
|
|||||||
const Handle(PDF_Attribute)& Target,
|
const Handle(PDF_Attribute)& Target,
|
||||||
const Handle(MDF_SRelocationTable)& RelocTable) const
|
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(TNaming_Naming) F = Handle(TNaming_Naming)::DownCast(Source);
|
||||||
Handle(PNaming_Name_1) PN ;
|
Handle(PNaming_Name_2) PN ;
|
||||||
TNamingToPNaming (F->GetName(), PN ,RelocTable);
|
TNamingToPNaming (F->GetName(), PN ,RelocTable);
|
||||||
PF->SetName(PN);
|
PF->SetName(PN);
|
||||||
}
|
}
|
||||||
|
@ -37,12 +37,16 @@ is
|
|||||||
|
|
||||||
class Name_1;
|
class Name_1;
|
||||||
|
|
||||||
|
class Name_2;
|
||||||
|
|
||||||
class NamedShape;
|
class NamedShape;
|
||||||
|
|
||||||
class Naming;
|
class Naming;
|
||||||
|
|
||||||
class Naming_1;
|
class Naming_1;
|
||||||
|
|
||||||
|
class Naming_2;
|
||||||
|
|
||||||
class HArray1OfNamedShape instantiates HArray1 from PCollection (NamedShape);
|
class HArray1OfNamedShape instantiates HArray1 from PCollection (NamedShape);
|
||||||
|
|
||||||
end PNaming;
|
end PNaming;
|
||||||
|
84
src/PNaming/PNaming_Name_2.cdl
Normal file
84
src/PNaming/PNaming_Name_2.cdl
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
-- 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;
|
32
src/PNaming/PNaming_Name_2.cxx
Normal file
32
src/PNaming/PNaming_Name_2.cxx
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// 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)
|
||||||
|
{
|
||||||
|
}
|
62
src/PNaming/PNaming_Name_2.lxx
Normal file
62
src/PNaming/PNaming_Name_2.lxx
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
// 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;}
|
40
src/PNaming/PNaming_Naming_2.cdl
Normal file
40
src/PNaming/PNaming_Naming_2.cdl
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
-- 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;
|
47
src/PNaming/PNaming_Naming_2.cxx
Normal file
47
src/PNaming/PNaming_Naming_2.cxx
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// 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;
|
||||||
|
}
|
@ -29,6 +29,7 @@ uses
|
|||||||
NamedShape from TNaming,
|
NamedShape from TNaming,
|
||||||
ListOfNamedShape from TNaming,
|
ListOfNamedShape from TNaming,
|
||||||
ShapeEnum from TopAbs,
|
ShapeEnum from TopAbs,
|
||||||
|
Orientation from TopAbs,
|
||||||
Shape from TopoDS,
|
Shape from TopoDS,
|
||||||
Label from TDF,
|
Label from TDF,
|
||||||
LabelMap from TDF,
|
LabelMap from TDF,
|
||||||
@ -55,6 +56,8 @@ is
|
|||||||
|
|
||||||
ContextLabel (me : in out; theLab : Label from TDF);
|
ContextLabel (me : in out; theLab : Label from TDF);
|
||||||
|
|
||||||
|
Orientation (me : in out; theOrientation : Orientation from TopAbs);
|
||||||
|
|
||||||
|
|
||||||
---Category: Queriyng
|
---Category: Queriyng
|
||||||
-- ========
|
-- ========
|
||||||
@ -76,6 +79,10 @@ is
|
|||||||
ContextLabel (me) returns Label from TDF;
|
ContextLabel (me) returns Label from TDF;
|
||||||
---C++: return const&
|
---C++: return const&
|
||||||
|
|
||||||
|
Orientation (me) returns Orientation from TopAbs;
|
||||||
|
---C++: inline
|
||||||
|
---C++: return const
|
||||||
|
|
||||||
|
|
||||||
---Category: Resolution
|
---Category: Resolution
|
||||||
-- ==========
|
-- ==========
|
||||||
@ -98,5 +105,6 @@ fields
|
|||||||
myIndex : Integer from Standard;
|
myIndex : Integer from Standard;
|
||||||
myShape : Shape from TopoDS;
|
myShape : Shape from TopoDS;
|
||||||
myContextLabel : Label from TDF;
|
myContextLabel : Label from TDF;
|
||||||
|
myOrientation : Orientation from TopAbs;
|
||||||
|
|
||||||
end Name;
|
end Name;
|
||||||
|
@ -2176,24 +2176,13 @@ const TDF_Label& TNaming_Name::ContextLabel() const
|
|||||||
{
|
{
|
||||||
return myContextLabel;
|
return myContextLabel;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Orientation
|
//function : Orientation
|
||||||
//purpose : Set
|
//purpose : Set
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
void TNaming_Name::Orientation(const TopAbs_Orientation theOrientation)
|
||||||
void TNaming_Name::Orientation(const Standard_Boolean theOrientation)
|
|
||||||
{
|
{
|
||||||
myOrientation = theOrientation;
|
myOrientation = theOrientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ContextLabel
|
|
||||||
//purpose : Get
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Standard_Boolean TNaming_Name::Orientation() const
|
|
||||||
{
|
|
||||||
return myOrientation;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
31
src/TNaming/TNaming_Name.lxx
Normal file
31
src/TNaming/TNaming_Name.lxx
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// 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;
|
||||||
|
}
|
@ -832,30 +832,6 @@ void TNaming_Builder::Modify(const TopoDS_Shape& oldShape,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//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
|
//function : Select
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -870,23 +846,12 @@ void TNaming_Builder::Select (const TopoDS_Shape& S,
|
|||||||
}
|
}
|
||||||
|
|
||||||
TNaming_RefShape* pos;
|
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)) {
|
if (!myShapes->myMap.IsBound(InS)) {
|
||||||
pos = new TNaming_RefShape(InS);
|
pos = new TNaming_RefShape(InS);
|
||||||
myShapes->myMap.Bind(InS,pos);
|
myShapes->myMap.Bind(InS,pos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pos = myShapes->myMap.ChangeFind(InS);
|
pos = myShapes->myMap.ChangeFind(InS);
|
||||||
}
|
|
||||||
|
|
||||||
TNaming_RefShape* pns;
|
TNaming_RefShape* pns;
|
||||||
if (!myShapes->myMap.IsBound(S)) {
|
if (!myShapes->myMap.IsBound(S)) {
|
||||||
|
@ -231,6 +231,7 @@ static Handle(TNaming_NamedShape) BuildNS (const TDF_Label& F,
|
|||||||
TNaming_Name& theName = Naming->ChangeName();
|
TNaming_Name& theName = Naming->ChangeName();
|
||||||
theName.ShapeType(S.ShapeType());
|
theName.ShapeType(S.ShapeType());
|
||||||
theName.Shape(S);
|
theName.Shape(S);
|
||||||
|
theName.Orientation(S.Orientation());
|
||||||
theName.Type(Name);
|
theName.Type(Name);
|
||||||
TNaming_Builder B(Naming->Label());
|
TNaming_Builder B(Naming->Label());
|
||||||
B.Select(S,S);
|
B.Select(S,S);
|
||||||
@ -823,6 +824,7 @@ static Standard_Boolean Filter (const TDF_Label& F,
|
|||||||
TNaming_Name& theName = NF->ChangeName();
|
TNaming_Name& theName = NF->ChangeName();
|
||||||
theName.ShapeType(S.ShapeType());
|
theName.ShapeType(S.ShapeType());
|
||||||
theName.Shape(S);
|
theName.Shape(S);
|
||||||
|
theName.Orientation(S.Orientation());
|
||||||
theName.Type(TNaming_FILTERBYNEIGHBOURGS);
|
theName.Type(TNaming_FILTERBYNEIGHBOURGS);
|
||||||
theName.Append(NS);
|
theName.Append(NS);
|
||||||
theName.StopNamedShape (Until);
|
theName.StopNamedShape (Until);
|
||||||
@ -1004,6 +1006,7 @@ static Handle(TNaming_NamedShape) BuildName (const TDF_Label& F
|
|||||||
TNaming_Name& theName = Naming->ChangeName();
|
TNaming_Name& theName = Naming->ChangeName();
|
||||||
theName.ShapeType(Selection.ShapeType());
|
theName.ShapeType(Selection.ShapeType());
|
||||||
theName.Shape(Selection);
|
theName.Shape(Selection);
|
||||||
|
theName.Orientation(Selection.Orientation());
|
||||||
theName.Type(Ident.Type());
|
theName.Type(Ident.Type());
|
||||||
#ifdef MDTV_DEB_MOD
|
#ifdef MDTV_DEB_MOD
|
||||||
cout <<"BuildName: Inserted Naming Att at ";
|
cout <<"BuildName: Inserted Naming Att at ";
|
||||||
@ -1124,7 +1127,8 @@ static Handle(TNaming_NamedShape) BuildName (const TDF_Label& F
|
|||||||
Naming = TNaming_Naming::Insert(F);
|
Naming = TNaming_Naming::Insert(F);
|
||||||
TNaming_Name& theName = Naming->ChangeName();
|
TNaming_Name& theName = Naming->ChangeName();
|
||||||
theName.ShapeType(Selection.ShapeType());
|
theName.ShapeType(Selection.ShapeType());
|
||||||
theName.Shape(Selection); //szy 21.10.03
|
theName.Shape(Selection);
|
||||||
|
theName.Orientation(Selection.Orientation());
|
||||||
theName.Type(TNaming_GENERATION);
|
theName.Type(TNaming_GENERATION);
|
||||||
theName.Append(TNaming_Tool::NamedShape(Selection,F));
|
theName.Append(TNaming_Tool::NamedShape(Selection,F));
|
||||||
theName.Append(NewNS);
|
theName.Append(NewNS);
|
||||||
@ -1305,6 +1309,7 @@ static Handle(TNaming_NamedShape) BuildNameWire (const TDF_Label&
|
|||||||
TNaming_Name& theName = Naming->ChangeName();
|
TNaming_Name& theName = Naming->ChangeName();
|
||||||
theName.ShapeType(Selection.ShapeType());
|
theName.ShapeType(Selection.ShapeType());
|
||||||
theName.Shape(Selection);
|
theName.Shape(Selection);
|
||||||
|
theName.Orientation(Selection.Orientation());
|
||||||
}
|
}
|
||||||
|
|
||||||
TNaming_Name& theName = Naming->ChangeName();
|
TNaming_Name& theName = Naming->ChangeName();
|
||||||
@ -1511,6 +1516,7 @@ static Handle(TNaming_NamedShape) BuildNameShell (const TDF_Label& F,
|
|||||||
TNaming_Name& theName = Naming->ChangeName();
|
TNaming_Name& theName = Naming->ChangeName();
|
||||||
theName.ShapeType(Selection.ShapeType());
|
theName.ShapeType(Selection.ShapeType());
|
||||||
theName.Shape(Selection);
|
theName.Shape(Selection);
|
||||||
|
theName.Orientation(Selection.Orientation());
|
||||||
}
|
}
|
||||||
|
|
||||||
TNaming_Name& theName = Naming->ChangeName();
|
TNaming_Name& theName = Naming->ChangeName();
|
||||||
@ -1628,6 +1634,7 @@ static void BuildAggregationName (const TDF_Label& F,
|
|||||||
TNaming_Name& theName = Naming->ChangeName();
|
TNaming_Name& theName = Naming->ChangeName();
|
||||||
theName.ShapeType(S.ShapeType());
|
theName.ShapeType(S.ShapeType());
|
||||||
theName.Shape(S);
|
theName.Shape(S);
|
||||||
|
theName.Orientation(S.Orientation());
|
||||||
}
|
}
|
||||||
#ifdef MDTV_DEB_CC
|
#ifdef MDTV_DEB_CC
|
||||||
cout <<"BuildAggregationName ==> ";
|
cout <<"BuildAggregationName ==> ";
|
||||||
@ -1661,6 +1668,7 @@ static void BuildAggregationName (const TDF_Label& F,
|
|||||||
TNaming_Name& aName = aNaming->ChangeName();
|
TNaming_Name& aName = aNaming->ChangeName();
|
||||||
aName.ShapeType(aS.ShapeType());
|
aName.ShapeType(aS.ShapeType());
|
||||||
aName.Shape(aS);
|
aName.Shape(aS);
|
||||||
|
theName.Orientation(aS.Orientation());
|
||||||
aName.Type(TNaming_UNION);
|
aName.Type(TNaming_UNION);
|
||||||
|
|
||||||
if (atomTyp != TopAbs_SHAPE) {
|
if (atomTyp != TopAbs_SHAPE) {
|
||||||
@ -1742,6 +1750,7 @@ Handle(TNaming_NamedShape) TNaming_Naming::Name (const TDF_Label& F,
|
|||||||
theName.ShapeType(S.ShapeType());
|
theName.ShapeType(S.ShapeType());
|
||||||
theName.Shape(S);
|
theName.Shape(S);
|
||||||
theName.Type(TNaming_ORIENTATION);
|
theName.Type(TNaming_ORIENTATION);
|
||||||
|
theName.Orientation(S.Orientation());
|
||||||
|
|
||||||
if (!TNaming_Selector::IsIdentified (F, S, NS, Geom))
|
if (!TNaming_Selector::IsIdentified (F, S, NS, Geom))
|
||||||
NS = TNaming_Naming::Name(Naming->Label(),S,Context,Geom,0);
|
NS = TNaming_Naming::Name(Naming->Label(),S,Context,Geom,0);
|
||||||
@ -1847,6 +1856,7 @@ Handle(TNaming_NamedShape) TNaming_Naming::Name (const TDF_Label& F,
|
|||||||
|
|
||||||
theName.ShapeType(S.ShapeType());// modified by vro 05.09.00
|
theName.ShapeType(S.ShapeType());// modified by vro 05.09.00
|
||||||
theName.Shape(S);
|
theName.Shape(S);
|
||||||
|
theName.Orientation(S.Orientation());
|
||||||
if(S.ShapeType() != TopAbs_WIRE)
|
if(S.ShapeType() != TopAbs_WIRE)
|
||||||
theName.Type(TNaming_UNION);
|
theName.Type(TNaming_UNION);
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
||||||
#include <TNaming_OldShapeIterator.hxx>
|
#include <TNaming_OldShapeIterator.hxx>
|
||||||
#include <TNaming_Tool.hxx>
|
#include <TNaming_Tool.hxx>
|
||||||
|
#include <TNaming_Naming.hxx>
|
||||||
|
#include <TDF_ChildIterator.hxx>
|
||||||
#ifdef DEB
|
#ifdef DEB
|
||||||
//#define MDTV_DEB_DESC
|
//#define MDTV_DEB_DESC
|
||||||
//#define MDTV_DEB_APPLY
|
//#define MDTV_DEB_APPLY
|
||||||
@ -173,12 +175,31 @@ void TNaming_NamingTool::CurrentShape(const TDF_LabelMap& Valid,
|
|||||||
Standard_Boolean YaOrientationToApply(Standard_False);
|
Standard_Boolean YaOrientationToApply(Standard_False);
|
||||||
TopAbs_Orientation OrientationToApply(TopAbs_FORWARD);
|
TopAbs_Orientation OrientationToApply(TopAbs_FORWARD);
|
||||||
if(Att->Evolution() == TNaming_SELECTED) {
|
if(Att->Evolution() == TNaming_SELECTED) {
|
||||||
if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX &&
|
if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX) {//OR-N
|
||||||
!itL.OldShape().IsNull() && itL.OldShape().ShapeType() == TopAbs_VERTEX) {
|
Handle (TNaming_Naming) aNaming;
|
||||||
YaOrientationToApply = Standard_True;
|
Lab.FindAttribute(TNaming_Naming::GetID(), aNaming);
|
||||||
OrientationToApply = itL.OldShape().Orientation();
|
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);
|
TNaming_NewShapeIterator it(itL);
|
||||||
if (!it.More()) {
|
if (!it.More()) {
|
||||||
if (YaOrientationToApply)
|
if (YaOrientationToApply)
|
||||||
|
@ -403,7 +403,7 @@ Standard_Boolean TNaming_Selector::Select (const TopoDS_Shape& Selection,
|
|||||||
Handle(TNaming_Naming) N = new TNaming_Naming ();
|
Handle(TNaming_Naming) N = new TNaming_Naming ();
|
||||||
N->ChangeName().Type(TNaming_IDENTITY);
|
N->ChangeName().Type(TNaming_IDENTITY);
|
||||||
N->ChangeName().Append(NS);
|
N->ChangeName().Append(NS);
|
||||||
|
N->ChangeName().Orientation(Selection.Orientation());
|
||||||
#ifdef BUC60862
|
#ifdef BUC60862
|
||||||
// inserted by vro 06.09.00:
|
// inserted by vro 06.09.00:
|
||||||
N->ChangeName().ShapeType(Selection.ShapeType());
|
N->ChangeName().ShapeType(Selection.ShapeType());
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <TDF_AttributeMap.hxx>
|
#include <TDF_AttributeMap.hxx>
|
||||||
#include <TDF_Tool.hxx>
|
#include <TDF_Tool.hxx>
|
||||||
#include <TDF_MapIteratorOfAttributeMap.hxx>
|
#include <TDF_MapIteratorOfAttributeMap.hxx>
|
||||||
|
#include <TDF_ChildIterator.hxx>
|
||||||
#include <TopExp_Explorer.hxx>
|
#include <TopExp_Explorer.hxx>
|
||||||
#include <TNaming_ListIteratorOfListOfNamedShape.hxx>
|
#include <TNaming_ListIteratorOfListOfNamedShape.hxx>
|
||||||
#endif
|
#endif
|
||||||
@ -143,7 +144,6 @@ static TopoDS_Shape MakeShape (const TopTools_MapOfShape& MS)
|
|||||||
//function : GetShape
|
//function : GetShape
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
TopoDS_Shape TNaming_Tool::GetShape(const Handle(TNaming_NamedShape)& NS)
|
TopoDS_Shape TNaming_Tool::GetShape(const Handle(TNaming_NamedShape)& NS)
|
||||||
{
|
{
|
||||||
TNaming_Iterator itL (NS);
|
TNaming_Iterator itL (NS);
|
||||||
@ -151,12 +151,37 @@ TopoDS_Shape TNaming_Tool::GetShape(const Handle(TNaming_NamedShape)& NS)
|
|||||||
if(NS->Evolution() == TNaming_SELECTED) {
|
if(NS->Evolution() == TNaming_SELECTED) {
|
||||||
for (; itL.More(); itL.Next()) {
|
for (; itL.More(); itL.Next()) {
|
||||||
if(!itL.NewShape().IsNull()) {
|
if(!itL.NewShape().IsNull()) {
|
||||||
if(itL.NewShape().ShapeType() != TopAbs_VERTEX &&
|
if(itL.NewShape().ShapeType() != TopAbs_VERTEX ) { //OR-N
|
||||||
!itL.OldShape().IsNull() && itL.OldShape().ShapeType() == TopAbs_VERTEX) {
|
Handle (TNaming_Naming) aNaming;
|
||||||
const TopoDS_Shape& aS = itL.NewShape().Oriented(itL.OldShape().Orientation());
|
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);
|
MS.Add(aS);
|
||||||
} else
|
} else
|
||||||
MS.Add(itL.NewShape());
|
MS.Add(itL.NewShape());
|
||||||
|
} else
|
||||||
|
MS.Add(itL.NewShape());
|
||||||
|
} //
|
||||||
|
else
|
||||||
|
MS.Add(itL.NewShape());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@ -214,15 +239,35 @@ TopoDS_Shape TNaming_Tool::CurrentShape(const Handle(TNaming_NamedShape)& Att)
|
|||||||
for (; itL.More(); itL.Next()) {
|
for (; itL.More(); itL.Next()) {
|
||||||
const TopoDS_Shape& S = itL.NewShape();
|
const TopoDS_Shape& S = itL.NewShape();
|
||||||
if (S.IsNull()) continue;
|
if (S.IsNull()) continue;
|
||||||
|
//OR-N
|
||||||
Standard_Boolean YaOrientationToApply(Standard_False);
|
Standard_Boolean YaOrientationToApply(Standard_False);
|
||||||
TopAbs_Orientation OrientationToApply(TopAbs_FORWARD);
|
TopAbs_Orientation OrientationToApply(TopAbs_FORWARD);
|
||||||
if(Att->Evolution() == TNaming_SELECTED) {
|
if(Att->Evolution() == TNaming_SELECTED) {
|
||||||
if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX &&
|
if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX) {
|
||||||
!itL.OldShape().IsNull() && itL.OldShape().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;
|
YaOrientationToApply = Standard_True;
|
||||||
OrientationToApply = itL.OldShape().Orientation();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} //
|
||||||
TNaming_NewShapeIterator it(itL);
|
TNaming_NewShapeIterator it(itL);
|
||||||
if (!it.More()) {
|
if (!it.More()) {
|
||||||
MS.Add(S);
|
MS.Add(S);
|
||||||
@ -259,15 +304,35 @@ TopoDS_Shape TNaming_Tool::CurrentShape(const Handle(TNaming_NamedShape)& Att,
|
|||||||
for (; itL.More(); itL.Next()) {
|
for (; itL.More(); itL.Next()) {
|
||||||
const TopoDS_Shape& S = itL.NewShape();
|
const TopoDS_Shape& S = itL.NewShape();
|
||||||
if (S.IsNull()) continue;
|
if (S.IsNull()) continue;
|
||||||
|
//OR-N
|
||||||
Standard_Boolean YaOrientationToApply(Standard_False);
|
Standard_Boolean YaOrientationToApply(Standard_False);
|
||||||
TopAbs_Orientation OrientationToApply(TopAbs_FORWARD);
|
TopAbs_Orientation OrientationToApply(TopAbs_FORWARD);
|
||||||
if(Att->Evolution() == TNaming_SELECTED) {
|
if(Att->Evolution() == TNaming_SELECTED) {
|
||||||
if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX &&
|
if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX) {
|
||||||
!itL.OldShape().IsNull() && itL.OldShape().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;
|
YaOrientationToApply = Standard_True;
|
||||||
OrientationToApply = itL.OldShape().Orientation();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} //
|
||||||
TNaming_NewShapeIterator it(itL);
|
TNaming_NewShapeIterator it(itL);
|
||||||
if (!it.More()) {
|
if (!it.More()) {
|
||||||
MS.Add(S);
|
MS.Add(S);
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
static Standard_GUID XmlLStorageDriver ("13a56820-8269-11d5-aab2-0050044b1af1");
|
static Standard_GUID XmlLStorageDriver ("13a56820-8269-11d5-aab2-0050044b1af1");
|
||||||
static Standard_GUID XmlLRetrievalDriver("13a56822-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
|
//function : Factory
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <TNaming_Naming.hxx>
|
#include <TNaming_Naming.hxx>
|
||||||
#include <TNaming_NamedShape.hxx>
|
#include <TNaming_NamedShape.hxx>
|
||||||
#include <TNaming_ListIteratorOfListOfNamedShape.hxx>
|
#include <TNaming_ListIteratorOfListOfNamedShape.hxx>
|
||||||
|
#include <TNaming_Iterator.hxx>
|
||||||
#include <TDF_Tool.hxx>
|
#include <TDF_Tool.hxx>
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -41,6 +42,7 @@ IMPLEMENT_DOMSTRING (TypeString, "nametype")
|
|||||||
IMPLEMENT_DOMSTRING (ShapeTypeString, "shapetype")
|
IMPLEMENT_DOMSTRING (ShapeTypeString, "shapetype")
|
||||||
IMPLEMENT_DOMSTRING (ArgumentsString, "arguments")
|
IMPLEMENT_DOMSTRING (ArgumentsString, "arguments")
|
||||||
IMPLEMENT_DOMSTRING (ContextLabelString, "contextlabel")
|
IMPLEMENT_DOMSTRING (ContextLabelString, "contextlabel")
|
||||||
|
IMPLEMENT_DOMSTRING (OrientString, "orientation")
|
||||||
|
|
||||||
IMPLEMENT_DOMSTRING (NTUnknownString, "unknown")
|
IMPLEMENT_DOMSTRING (NTUnknownString, "unknown")
|
||||||
IMPLEMENT_DOMSTRING (NTIdentityString, "identity")
|
IMPLEMENT_DOMSTRING (NTIdentityString, "identity")
|
||||||
@ -203,6 +205,39 @@ Standard_Boolean XmlMNaming_NamingDriver::Paste
|
|||||||
else
|
else
|
||||||
cout << "Retrieving Context Label is NULL" <<endl;
|
cout << "Retrieving Context Label is NULL" <<endl;
|
||||||
#endif
|
#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
|
#ifdef DEB
|
||||||
else if(XmlMNaming::DocumentVersion() == -1)
|
else if(XmlMNaming::DocumentVersion() == -1)
|
||||||
@ -287,6 +322,9 @@ void XmlMNaming_NamingDriver::Paste
|
|||||||
cout << "XmlMNaming_NamingDriver::Store: aDOMString is NULL" <<endl;
|
cout << "XmlMNaming_NamingDriver::Store: aDOMString is NULL" <<endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// orientation
|
||||||
|
anElem.setAttribute(::OrientString(), (Standard_Integer)aNgName.Orientation());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
32
tests/bugs/caf/bug23766_1
Executable file
32
tests/bugs/caf/bug23766_1
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
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"
|
||||||
|
}
|
||||||
|
|
31
tests/bugs/caf/bug23766_2
Executable file
31
tests/bugs/caf/bug23766_2
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
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"
|
||||||
|
}
|
31
tests/bugs/caf/bug23766_3
Executable file
31
tests/bugs/caf/bug23766_3
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
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"
|
||||||
|
}
|
77
tests/bugs/caf/bug23766_4
Executable file
77
tests/bugs/caf/bug23766_4
Executable file
@ -0,0 +1,77 @@
|
|||||||
|
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"
|
||||||
|
}
|
||||||
|
|
75
tests/bugs/caf/bug23766_5
Executable file
75
tests/bugs/caf/bug23766_5
Executable file
@ -0,0 +1,75 @@
|
|||||||
|
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"
|
||||||
|
}
|
76
tests/bugs/caf/bug23766_6
Executable file
76
tests/bugs/caf/bug23766_6
Executable file
@ -0,0 +1,76 @@
|
|||||||
|
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"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user