-// File: TNaming_NamedShape.cxx
-// Created: Wed Dec 18 10:41:48 1996
-// Author: Yves FRICAUD
-// <yfr@claquox.paris1.matra-dtv.fr>
+// Created on: 1996-12-18
+// Created by: Yves FRICAUD
+// Copyright (c) 1996-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
-
-#include <TNaming_NamedShape.ixx>
-#include <TNaming_Builder.ixx>
-
-#include <TDF_Label.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <gp_Pnt.hxx>
+#include <Standard.hxx>
+#include <Standard_ConstructionError.hxx>
+#include <Standard_GUID.hxx>
+#include <Standard_NoMoreObject.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <Standard_NullObject.hxx>
+#include <Standard_Type.hxx>
+#include <TDF_Attribute.hxx>
+#include <TDF_AttributeDelta.hxx>
+#include <TDF_AttributeIterator.hxx>
#include <TDF_Data.hxx>
+#include <TDF_DataSet.hxx>
#include <TDF_DeltaOnAddition.hxx>
-#include <TDF_AttributeIterator.hxx>
-#include <TNaming_PtrNode.hxx>
-#include <TNaming_PtrRefShape.hxx>
-#include <TNaming_RefShape.hxx>
-#include <TNaming_PtrDataMapOfShapePtrRefShape.hxx>
-#include <TNaming_UsedShapes.hxx>
-#include <TNaming_Tool.hxx>
+#include <TDF_DeltaOnModification.hxx>
+#include <TDF_DeltaOnRemoval.hxx>
+#include <TDF_Label.hxx>
+#include <TDF_RelocationTable.hxx>
+#include <TNaming_Builder.hxx>
+#include <TNaming_CopyShape.hxx>
+#include <TNaming_DeltaOnModification.hxx>
+#include <TNaming_DeltaOnRemoval.hxx>
#include <TNaming_Iterator.hxx>
+#include <TNaming_NamedShape.hxx>
#include <TNaming_NewShapeIterator.hxx>
#include <TNaming_OldShapeIterator.hxx>
+#include <TNaming_PtrNode.hxx>
+#include <TNaming_PtrRefShape.hxx>
+#include <TNaming_RefShape.hxx>
#include <TNaming_SameShapeIterator.hxx>
-
-#include <TNaming_DeltaOnModification.hxx>
-#include <TNaming_DeltaOnRemoval.hxx>
-#include <Standard_NoMoreObject.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <Standard_ConstructionError.hxx>
-#include <Standard_NullObject.hxx>
-
-#include <gp_Pnt.hxx>
-#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <TNaming_Tool.hxx>
+#include <TNaming_UsedShapes.hxx>
+#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
-// Defines the nodes classes
-
-#include <Standard.hxx>
-#include <TNaming_CopyShape.hxx>
+IMPLEMENT_STANDARD_RTTIEXT(TNaming_NamedShape,TDF_Attribute)
-#define BUC60921 //SRN 15/05/01 : Fixes the memory leak due to pointer to RefShape is not deleted
+// Defines the nodes classes
//#define MDTV_DEB_HASL
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-
const Standard_GUID& TNaming_NamedShape::GetID()
{
static Standard_GUID TNaming_NamedShapeID("c4ef4200-568f-11d1-8940-080009dc3333");
Standard_Boolean IsValidInTrans(Standard_Integer Trans);
// Memory management
- void* operator new(size_t aSize) {
- return Standard::Allocate(aSize);
- }
-
-/* attempt to eliminate compiler warning
- void* operator new(size_t, void* aNode) {
- return aNode;
- }
-
- void operator delete(void* aNode) {
- Standard::Free(aNode);
- }
-*/
-
- void operator delete(void* aNode, size_t aSize) {
- Standard::Free(aNode);
- }
+ DEFINE_STANDARD_ALLOC
TNaming_PtrRefShape myOld;
TNaming_PtrRefShape myNew;
if (pos->FirstUse() == N) {
TNaming_Node* nextOld = N->nextSameOld;
if (nextOld != 0L)
- pos->FirstUse(nextOld);
- else
- // le shape disparait
- if (MapExist){
- M.UnBind(pos->Shape());
-#ifdef BUC60921
- N->myOld = 0L;
- if(pos != N->myNew)
- delete pos;
-#endif
- }
+ pos->FirstUse(nextOld);
+ else {
+ // le shape disparait
+ if (MapExist)
+ M.UnBind(pos->Shape());
+ N->myOld = 0L;
+ if(pos != N->myNew)
+ {
+ delete pos;
+ pos = 0L;
+ }
+ }
}
else {
TNaming_Node* pdn = pos->FirstUse();
while (pdn != 0L) {
- if (pdn->NextSameShape(pos) == N) {
- if (pdn->myOld == pos) pdn->nextSameOld = N->nextSameOld;
- else pdn->nextSameNew = N->nextSameOld;
- break;
- }
- pdn = pdn->NextSameShape(pos);
+
+ if (pdn->NextSameShape(pos) == N) {
+ if (pdn->myOld == pos) pdn->nextSameOld = N->nextSameOld;
+ else pdn->nextSameNew = N->nextSameOld;
+ break;
+ }
+ pdn = pdn->NextSameShape(pos);
}
}
}
if (pns->FirstUse() == N) {
TNaming_Node* nextNew = N->nextSameNew;
if (nextNew != 0L)
- pns->FirstUse(nextNew);
+ pns->FirstUse(nextNew);
else
- // le shape disparait
- if (MapExist) {
- M.UnBind(pns->Shape());
-#ifdef BUC60921
- N->myNew = 0L;
- delete pns;
-#endif
- }
+ {
+ // le shape disparait
+ if (MapExist)
+ M.UnBind(pns->Shape());
+
+ pns->FirstUse(0L);
+ delete pns;
+ pns = 0L;
+
+ N->myNew = 0L;
+
+ }
}
else {
TNaming_Node* pdn = pns->FirstUse();
while (pdn != 0L) {
- if (pdn->NextSameShape(pns) == N) {
- if (pdn->myOld == pns) pdn->nextSameOld = N->nextSameNew;
- else pdn->nextSameNew = N->nextSameNew;
- break;
- }
- pdn = pdn->NextSameShape(pns);
+ if (pdn->NextSameShape(pns) == N) {
+ if (pdn->myOld == pns) pdn->nextSameOld = N->nextSameNew;
+ else pdn->nextSameNew = N->nextSameNew;
+ break;
+ }
+ pdn = pdn->NextSameShape(pns);
}
}
}
void TNaming_NamedShape::Clear()
{
if (Label().IsNull()) {
-#ifdef DEB
+#ifdef OCCT_DEBUG_BUILDER
cout << "attention etat fantomatique" << endl;
#endif
return;
while (p != 0L) {
q = p;
p = p->nextSameAttribute;
- delete q;
- q = 0L;
+ if( q !=0L)
+ {
+ delete q;
+ q = 0L;
+ }
}
myNode = 0L;
while (p != 0L) {
q = p;
p = p->nextSameAttribute;
- delete q;
- q = 0L;
+ if(q != 0L)
+ {
+ delete q;
+ q = 0L;
+ }
}
myNode = 0L;
(const Handle(TDF_Attribute)& anOldAttribute) const
{
- return new TNaming_DeltaOnModification(*((Handle(TNaming_NamedShape)*)&anOldAttribute));
+ return new TNaming_DeltaOnModification(Handle(TNaming_NamedShape)::DownCast (anOldAttribute));
}
//=======================================================================
return new TNaming_NamedShape();
}
-//=======================================================================
-//function : static GetLocation 23.06.99 (szy)
-//purpose : service: returns copy of Location if exist Relocation
-//=======================================================================
-
-static TopLoc_Location GetLocation(const TopLoc_Location& L,
- const Handle(TDF_RelocationTable)& RT)
-{
- TopLoc_Location result;
-
- if (!L.IsIdentity()) {
- Handle(TopLoc_Datum3D) TD;
- if(!RT->HasTransientRelocation(L.FirstDatum(), TD))
-#ifdef DEB
- cout <<"TNaming_Named_Shape::Paste : Relocation for TopLocation don't exist" << endl;
-#endif
- result = GetLocation(L.NextLocation(), RT) *
- TopLoc_Location(TD).Powered(L.FirstPower());
- }
- return result;
-}
-
//=======================================================================
//function : Paste
//purpose :
void TNaming_NamedShape::Add(TNaming_Node*& pdn )
{
pdn->myAtt = this;
- if (!myNode == 0L){
+ if (myNode != 0L){
pdn->nextSameAttribute = myNode;
}
myNode = pdn;
TNaming_Builder::TNaming_Builder (const TDF_Label& L)
{
- Handle(TNaming_UsedShapes) Shapes;
-
// Find or Build Map;
const TDF_Label& root = L.Root();
- if (!root.FindAttribute(TNaming_UsedShapes::GetID(),Shapes)) {
- Shapes = new TNaming_UsedShapes();
- root.AddAttribute (Shapes);
+ if (!root.FindAttribute(TNaming_UsedShapes::GetID(),myShapes)) {
+ myShapes = new TNaming_UsedShapes();
+ root.AddAttribute (myShapes);
}
- myMap = &(Shapes->myMap);
//Find Or Build Attribute in LIns.
- Handle(TNaming_NamedShape) Att;
- if (!L.FindAttribute(TNaming_NamedShape::GetID(),Att)) {
- Att = new TNaming_NamedShape();
- L.AddAttribute(Att);
+ if (!L.FindAttribute(TNaming_NamedShape::GetID(),myAtt)) {
+ myAtt = new TNaming_NamedShape();
+ L.AddAttribute(myAtt);
}
else {
- Att->Backup();
- Att->Clear();
- Att->myVersion++;
+ myAtt->Backup();
+ myAtt->Clear();
+ myAtt->myVersion++;
}
- myAtt = Att.operator->();
}
//=======================================================================
TNaming_RefShape* pos = 0L;
TNaming_RefShape* pns;
- if (myMap->IsBound(newShape)) {
-#ifdef DEB
+ if (myShapes->myMap.IsBound(newShape)) {
+#ifdef OCCT_DEBUG_BUILDER
cout <<"TNaming_Builder::Generate : the shape is already in the attribute"<<endl;
#endif
- pns = myMap->ChangeFind(newShape);
- if (pns->FirstUse()->myAtt == myAtt) {
+ pns = myShapes->myMap.ChangeFind(newShape);
+ if (pns->FirstUse()->myAtt == myAtt.operator->()) {
Standard_ConstructionError::Raise("TNaming_Builder::Generate");
}
TNaming_Node* pdn = new TNaming_Node(pos,pns);
pns = new TNaming_RefShape(newShape);
TNaming_Node* pdn = new TNaming_Node(pos,pns);
pns ->FirstUse(pdn);
- myMap->Bind (newShape , pns);
+ myShapes->myMap.Bind (newShape , pns);
myAtt->Add(pdn);
}
}
TNaming_RefShape* pns = 0L;
TNaming_RefShape* pos;
- if (myMap->IsBound(oldShape))
- pos = myMap->ChangeFind(oldShape);
+ if (myShapes->myMap.IsBound(oldShape))
+ pos = myShapes->myMap.ChangeFind(oldShape);
else {
-#ifdef DEB
+#ifdef OCCT_DEBUG_BUILDER
cout <<"TNaming_Builder::Delete : the shape is not in the data"<<endl;
#endif
pos = new TNaming_RefShape(oldShape);
- myMap->Bind(oldShape, pos);
+ myShapes->myMap.Bind(oldShape, pos);
}
TNaming_Node* pdn = new TNaming_Node(pos,pns);
myAtt->Add(pdn);
}
if (oldShape.IsSame(newShape)) {
-#ifdef DEB
+#ifdef OCCT_DEBUG_BUILDER
cout <<"TNaming_Builder::Generate : oldShape IsSame newShape"<<endl;
#endif
return;
}
TNaming_RefShape* pos;
- if (!myMap->IsBound(oldShape)) {
+ if (!myShapes->myMap.IsBound(oldShape)) {
pos = new TNaming_RefShape(oldShape);
- myMap->Bind(oldShape,pos);
+ myShapes->myMap.Bind(oldShape,pos);
}
else
- pos = myMap->ChangeFind(oldShape);
+ pos = myShapes->myMap.ChangeFind(oldShape);
TNaming_RefShape* pns;
- if (!myMap->IsBound(newShape)) {
+ if (!myShapes->myMap.IsBound(newShape)) {
pns = new TNaming_RefShape(newShape);
- myMap->Bind(newShape,pns);
+ myShapes->myMap.Bind(newShape,pns);
}
else
- pns = myMap->ChangeFind(newShape);
+ pns = myShapes->myMap.ChangeFind(newShape);
TNaming_Node* pdn = new TNaming_Node(pos,pns);
myAtt->Add(pdn);
}
if (oldShape.IsSame(newShape)) {
-#ifdef DEB
- cout <<"TNaming_Builder::Modify : oldShape IsSame newShape"<<endl;
-#endif
- return;
- }
- TNaming_RefShape* pos;
- if (!myMap->IsBound(oldShape)) {
- pos = new TNaming_RefShape(oldShape);
- myMap->Bind(oldShape,pos);
- }
- else
- pos = myMap->ChangeFind(oldShape);
-
- TNaming_RefShape* pns;
- if (!myMap->IsBound(newShape)) {
- pns = new TNaming_RefShape(newShape);
- myMap->Bind(newShape,pns);
- }
- else
- pns = myMap->ChangeFind(newShape);
-
- TNaming_Node* pdn = new TNaming_Node(pos,pns);
- myAtt->Add(pdn);
- UpdateFirstUseOrNextSameShape (pos,pdn);
- UpdateFirstUseOrNextSameShape (pns,pdn);
-
-}
-
-//=======================================================================
-//function : Modify
-//purpose :
-//=======================================================================
-
-void TNaming_Builder::Replace(const TopoDS_Shape& oldShape,
- const TopoDS_Shape& newShape)
-{
- if (myAtt->myNode == 0L) myAtt->myEvolution = TNaming_REPLACE;
- else {
- if (myAtt->myEvolution != TNaming_REPLACE)
- Standard_ConstructionError::Raise("TNaming_Builder : not same evolution");
- }
-
- if (oldShape.IsSame(newShape)) {
-#ifdef DEB
+#ifdef OCCT_DEBUG_BUILDER
cout <<"TNaming_Builder::Modify : oldShape IsSame newShape"<<endl;
#endif
return;
}
TNaming_RefShape* pos;
- if (!myMap->IsBound(oldShape)) {
+ if (!myShapes->myMap.IsBound(oldShape)) {
pos = new TNaming_RefShape(oldShape);
- myMap->Bind(oldShape,pos);
+ myShapes->myMap.Bind(oldShape,pos);
}
else
- pos = myMap->ChangeFind(oldShape);
+ pos = myShapes->myMap.ChangeFind(oldShape);
TNaming_RefShape* pns;
- if (!myMap->IsBound(newShape)) {
+ if (!myShapes->myMap.IsBound(newShape)) {
pns = new TNaming_RefShape(newShape);
- myMap->Bind(newShape,pns);
+ myShapes->myMap.Bind(newShape,pns);
}
else
- pns = myMap->ChangeFind(newShape);
+ pns = myShapes->myMap.ChangeFind(newShape);
TNaming_Node* pdn = new TNaming_Node(pos,pns);
myAtt->Add(pdn);
}
-//=======================================================================
-static const TopoDS_Shape& DummyShapeToStoreOrientation (const TopAbs_Orientation Or)
-{
- static TopoDS_Vertex aVForward, aVRev, aVInt, aVExt;
- switch(Or) {
- case TopAbs_FORWARD:
- if(aVForward.IsNull()) {
- gp_Pnt aPnt(0,0,0);
- BRepBuilderAPI_MakeVertex aMake(aPnt);
- aVForward = aMake.Vertex();
- aVForward.Orientation(TopAbs_FORWARD);
- }
- return aVForward;
- case TopAbs_REVERSED:
- if(aVRev.IsNull()) {
- gp_Pnt aPnt(0,0,0);
- BRepBuilderAPI_MakeVertex aMake(aPnt);
- aVRev = aMake.Vertex();
- aVRev.Orientation(TopAbs_REVERSED);
- }
- return aVRev;
- case TopAbs_INTERNAL:
- if(aVInt.IsNull()) {
- gp_Pnt aPnt(0,0,0);
- BRepBuilderAPI_MakeVertex aMake(aPnt);
- aVInt = aMake.Vertex();
- aVInt.Orientation(TopAbs_INTERNAL);
- }
- return aVInt;
- case TopAbs_EXTERNAL:
- if(aVExt.IsNull()) {
- gp_Pnt aPnt(0,0,0);
- BRepBuilderAPI_MakeVertex aMake(aPnt);
- aVExt = aMake.Vertex();
- aVExt.Orientation(TopAbs_EXTERNAL);
- }
- return aVExt;
- }
- return aVForward;
-}
-
//=======================================================================
//function : Select
//purpose :
Standard_ConstructionError::Raise("TNaming_Builder : not same evolution");
}
- TNaming_RefShape* pos;
- if(S.ShapeType() != TopAbs_VERTEX) {
- const TopoDS_Shape& aV = DummyShapeToStoreOrientation (S.Orientation());
- if (!myMap->IsBound(aV)) {
- pos = new TNaming_RefShape(aV);
- myMap->Bind(aV,pos);
- }
- else
- pos = myMap->ChangeFind(aV);
- } else {
- if (!myMap->IsBound(InS)) {
- pos = new TNaming_RefShape(InS);
- myMap->Bind(InS,pos);
- }
- else
- pos = 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 (!myMap->IsBound(S)) {
+ if (!myShapes->myMap.IsBound(S)) {
pns = new TNaming_RefShape(S);
- myMap->Bind(S,pns);
+ myShapes->myMap.Bind(S,pns);
}
else
- pns = myMap->ChangeFind(S);
+ pns = myShapes->myMap.ChangeFind(S);
TNaming_Node* pdn = new TNaming_Node(pos,pns);
myAtt->Add(pdn);
const Standard_Integer Trans)
:myTrans(Trans)
{
- Handle(TNaming_NamedShape) Att;
+ Handle(TDF_Attribute) Att;
if (Lab.FindAttribute(TNaming_NamedShape::GetID(),Trans,Att)) {
- myNode = Att->myNode;
+ myNode = Handle(TNaming_NamedShape)::DownCast (Att)->myNode;
}
else {
myNode = 0L;
-#ifdef DEB
+#ifdef OCCT_DEBUG
cout <<"TNaming_Iterator : No Shape for this label"<<endl;
#endif
}
else Valid = pdn->IsValidInTrans(Trans);
if (Valid)
+ {
if (Old) {
- if( pdn->myOld == RS && pdn->myNew != 0L && pdn->myNew != RS) {
- break;
- }
+ if( pdn->myOld == RS && pdn->myNew != 0L && pdn->myNew != RS) {
+ break;
+ }
}
else {
- if( pdn->myNew == RS && pdn->myOld != 0L && pdn->myOld != RS) {
- break;
- }
+ if( pdn->myNew == RS && pdn->myOld != 0L && pdn->myOld != RS) {
+ break;
+ }
}
+ }
pdn = pdn->NextSameShape(RS);
}
myNode = pdn;
const Standard_Integer Trans,
const Handle(TNaming_UsedShapes)& Shapes)
:myTrans(Trans)
-{
- Standard_Boolean Old = Standard_True;
- TNaming_RefShape* RS = Shapes->Map().ChangeFind(aShape);
+{
+ Standard_NoSuchObject_Raise_if(!Shapes->Map().IsBound(aShape),
+ "TNaming_NewShapeIterator::TNaming_NewShapeIterator aShape");
+ TNaming_RefShape* RS = Shapes->Map().ChangeFind(aShape);
myNode = RS->FirstUse();
+ Standard_Boolean Old(Standard_True);
SelectSameShape(myNode,Old,RS,myTrans);
}
:myTrans(Trans)
{
Handle(TNaming_UsedShapes) Shapes;
- if (access.Root().FindAttribute(TNaming_UsedShapes::GetID(),Shapes)) {
- Standard_Boolean Old = Standard_True;
- TNaming_RefShape* RS = Shapes->Map().ChangeFind(aShape);
+ if (access.Root().FindAttribute(TNaming_UsedShapes::GetID(),Shapes)) {
+ Standard_NoSuchObject_Raise_if(!Shapes->Map().IsBound(aShape),
+ "TNaming_NewShapeIterator::TNaming_NewShapeIterator aShape");
+ TNaming_RefShape* RS = Shapes->Map().ChangeFind(aShape);
myNode = RS->FirstUse();
+ Standard_Boolean Old(Standard_True);
SelectSameShape(myNode,Old,RS,myTrans);
}
}
TNaming_NewShapeIterator::TNaming_NewShapeIterator (const TNaming_Iterator& anIterator)
:myTrans(anIterator.myTrans)
{
- Standard_Boolean Old = Standard_True;
- myNode = anIterator.myNode;
+ Standard_NoSuchObject_Raise_if(anIterator.myNode == 0L,
+ "TNaming_NewShapeIterator::TNaming_NewShapeIterator");
+ myNode = anIterator.myNode;
TNaming_RefShape* RS = myNode->myNew;
if (RS == 0L)
myNode = 0L; // No descendant
else {
// il faut repartir de la premiere utilisation.
myNode = RS->FirstUse();
+ Standard_Boolean Old(Standard_True);
SelectSameShape(myNode,Old,RS,myTrans);
}
}
const Handle(TNaming_UsedShapes)& Shapes)
:myTrans(-1)
{
- Standard_Boolean Old = Standard_True;
+ Standard_NoSuchObject_Raise_if(!Shapes->Map().IsBound(aShape),
+ "TNaming_NewShapeIterator::TNaming_NewShapeIterator aShape");
TNaming_RefShape* RS = Shapes->Map().ChangeFind(aShape);
myNode = RS->FirstUse();
+ Standard_Boolean Old(Standard_True);
SelectSameShape(myNode,Old,RS,myTrans);
}
{
Handle(TNaming_UsedShapes) Shapes;
if (access.Root().FindAttribute(TNaming_UsedShapes::GetID(),Shapes)) {
- Standard_Boolean Old = Standard_True;
- TNaming_RefShape* RS = Shapes->Map().ChangeFind(aShape);
+ Standard_NoSuchObject_Raise_if(!Shapes->Map().IsBound(aShape),
+ "TNaming_NewShapeIterator::TNaming_NewShapeIterator aShape");
+ Standard_Boolean Old(Standard_True);
+ TNaming_RefShape* RS = Shapes->Map().ChangeFind(aShape);
myNode = RS->FirstUse();
SelectSameShape(myNode,Old,RS,myTrans);
}
TNaming_NewShapeIterator::TNaming_NewShapeIterator(const TNaming_NewShapeIterator& anIterator)
:myTrans(anIterator.myTrans)
{
- Standard_Boolean Old = Standard_True;
+ Standard_NoSuchObject_Raise_if(anIterator.myNode == 0L,
+ "TNaming_NewShapeIterator::TNaming_NewShapeIterator");
myNode = anIterator.myNode;
TNaming_RefShape* RS = myNode->myNew;
if (RS == 0L)
else {
// il faut repartir de la premiere utilisation.
myNode = RS->FirstUse();
+ Standard_Boolean Old(Standard_True);
SelectSameShape(myNode,Old,RS,myTrans);
}
}
void TNaming_NewShapeIterator::Next()
{
- Standard_Boolean Old = Standard_True;
TNaming_RefShape* RS = myNode->myOld;
myNode = myNode->NextSameShape(RS);
+ Standard_Boolean Old(Standard_True);
SelectSameShape(myNode,Old,RS,myTrans);
}
const Handle(TNaming_UsedShapes)& Shapes)
:myTrans(Trans)
{
- Standard_Boolean Old = Standard_False;
+ Standard_NoSuchObject_Raise_if(!Shapes->Map().IsBound(aShape),
+ "TNaming_OldShapeIterator::TNaming_OldShapeIterator aShape");
TNaming_RefShape* RS = Shapes->Map().ChangeFind(aShape);
myNode = RS->FirstUse();
+ Standard_Boolean Old(Standard_False);
SelectSameShape(myNode,Old,RS,myTrans);
}
{
Handle(TNaming_UsedShapes) Shapes;
if (access.Root().FindAttribute(TNaming_UsedShapes::GetID(),Shapes)) {
- Standard_Boolean Old = Standard_False;
+ Standard_NoSuchObject_Raise_if(!Shapes->Map().IsBound(aShape),
+ "TNaming_OldShapeIterator::TNaming_OldShapeIterator aShape");
TNaming_RefShape* RS = Shapes->Map().ChangeFind(aShape);
myNode = RS->FirstUse();
+ Standard_Boolean Old(Standard_False);
SelectSameShape(myNode,Old,RS,myTrans);
}
}
const Handle(TNaming_UsedShapes)& Shapes)
:myTrans(-1)
{
- Standard_Boolean Old = Standard_False;
+ Standard_NoSuchObject_Raise_if(!Shapes->Map().IsBound(aShape),
+ "TNaming_OldShapeIterator::TNaming_OldShapeIterator aShape");
TNaming_RefShape* RS = Shapes->Map().ChangeFind(aShape);
myNode = RS->FirstUse();
+ Standard_Boolean Old(Standard_False);
SelectSameShape(myNode,Old,RS,myTrans);
}
:myTrans(-1)
{
Handle(TNaming_UsedShapes) Shapes;
- if (access.Root().FindAttribute(TNaming_UsedShapes::GetID(),Shapes)) {
- Standard_Boolean Old = Standard_False;
+ if (access.Root().FindAttribute(TNaming_UsedShapes::GetID(),Shapes)) {
+ Standard_NoSuchObject_Raise_if(!Shapes->Map().IsBound(aShape),
+ "TNaming_OldShapeIterator::TNaming_OldShapeIterator aShape");
TNaming_RefShape* RS = Shapes->Map().ChangeFind(aShape);
myNode = RS->FirstUse();
+ Standard_Boolean Old(Standard_False);
SelectSameShape(myNode,Old,RS,myTrans);
}
}
TNaming_OldShapeIterator::TNaming_OldShapeIterator (const TNaming_Iterator& anIterator)
:myTrans(anIterator.myTrans)
{
- Standard_Boolean Old = Standard_False;
- myNode = anIterator.myNode;
+ Standard_NoSuchObject_Raise_if(anIterator.myNode == 0L,
+ "TNaming_OldShapeIterator::TNaming_OldShapeIterator");
+ myNode = anIterator.myNode;
TNaming_RefShape* RS = myNode->myNew;
if (RS == 0L)
myNode = 0L; // No descendant
else {
// il faut repartir de la premiere utilisation.
myNode = RS->FirstUse();
+ Standard_Boolean Old(Standard_False);
SelectSameShape(myNode,Old,RS,myTrans);
}
}
TNaming_OldShapeIterator::TNaming_OldShapeIterator(const TNaming_OldShapeIterator& anIterator)
:myTrans(anIterator.myTrans)
{
- Standard_Boolean Old = Standard_False;
- myNode = anIterator.myNode;
+ Standard_NoSuchObject_Raise_if(anIterator.myNode == 0L,
+ "TNaming_OldShapeIterator::TNaming_OldShapeIterator");
+ myNode = anIterator.myNode;
TNaming_RefShape* RS = myNode->myOld;
if (RS == 0L)
myNode = 0L; // No descendant
else {
// il faut repartir de la premiere utilisation.
myNode = RS->FirstUse();
+ Standard_Boolean Old(Standard_False);
SelectSameShape(myNode,Old,RS,myTrans);
}
}
if (access.Root().FindAttribute(TNaming_UsedShapes::GetID(),US)) {
return (US->Map().IsBound(S));
}
-#ifdef MDTV_DEB_HASL
+#ifdef OCCT_DEBUG_HASL
cout << "##==> Sub-Shape has no Label!" <<endl;
#endif
return Standard_False;
}
return Until;
}
-
-
-//=======================================================================
-//function : OldPaste
-//purpose :
-//=======================================================================
-
-void TNaming_NamedShape::OldPaste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& /*Tab*/)
-const
-{
- TDF_Label Lab = into->Label();
- if (Lab.IsNull()) {
- Standard_NullObject::Raise("TNaming_NamedShape::Paste");
- }
- //TDF_Insertor Ins(Lab);
- //TNaming_Builder B(Ins);
- TNaming_Builder B(Lab);
-
- TNaming_Iterator It (this);
- for ( ;It.More() ; It.Next()) {
- const TopoDS_Shape& OS = It.OldShape();
- const TopoDS_Shape& NS = It.NewShape();
- TNaming_Evolution Status = It.Evolution();
- switch (Status) {
- case TNaming_PRIMITIVE :
- {
- B.Generated(NS);
- break;
- }
- case TNaming_GENERATED :
- {
- B.Generated(OS,NS);
- break;
- }
- case TNaming_MODIFY :
- {
- B.Modify(OS,NS);
- break;
- }
- case TNaming_DELETE :
- {
- B.Delete (OS);
- break;
- }
- case TNaming_SELECTED :
- {
- B.Select(NS,OS);
- break;
- }
- case TNaming_REPLACE :
- B.Replace(OS,NS);
- }
- }
-}
-