diff --git a/src/TNaming/TNaming_Identifier.cdl b/src/TNaming/TNaming_Identifier.cdl index f4b55f58a1..a5c0e9ebcf 100755 --- a/src/TNaming/TNaming_Identifier.cdl +++ b/src/TNaming/TNaming_Identifier.cdl @@ -22,14 +22,14 @@ is Create (Lab : Label from TDF; S : Shape from TopoDS; - Context : Shape from TopoDS; - Geom : Boolean from Standard) + Context : Shape from TopoDS; + Geom : Boolean from Standard) returns Identifier from TNaming; Create (Lab : Label from TDF; S : Shape from TopoDS; - Context : NamedShape from TNaming; - Geom : Boolean from Standard) + ContextNS : NamedShape from TNaming; + Geom : Boolean from Standard) returns Identifier from TNaming; @@ -80,6 +80,9 @@ is Localizer : in out Localizer from TNaming; NS : NamedShape from TNaming); + + Init(me : in out; Context : Shape from TopoDS) is private; + fields myTDFAcces : Label from TDF; diff --git a/src/TNaming/TNaming_Identifier.cxx b/src/TNaming/TNaming_Identifier.cxx index ccb90eb6bd..d2dc5930e4 100755 --- a/src/TNaming/TNaming_Identifier.cxx +++ b/src/TNaming/TNaming_Identifier.cxx @@ -64,17 +64,43 @@ TNaming_Identifier::TNaming_Identifier(const TDF_Label& LabAcces, :myTDFAcces(LabAcces), myShape(S), myOneOnly(OneOnly), myDone(Standard_False),myIsFeature(Standard_False) +{ + Init(Context); +} + +//======================================================================= +//function : TNaming_Identifier +//purpose : +//======================================================================= + +TNaming_Identifier::TNaming_Identifier(const TDF_Label& LabAcces, + const TopoDS_Shape& S, + const Handle(TNaming_NamedShape)& ContextNS, + const Standard_Boolean OneOnly) +:myTDFAcces(LabAcces), myShape(S), myOneOnly(OneOnly), +myDone(Standard_False),myIsFeature(Standard_False) + +{ + const TopoDS_Shape& aContext = TNaming_Tool::GetShape (ContextNS); + Init(aContext); +} + +//======================================================================= +//function : Init +//purpose : +//======================================================================= +void TNaming_Identifier::Init(const TopoDS_Shape& Context) { Handle(TNaming_UsedShapes) US; - LabAcces.Root().FindAttribute(TNaming_UsedShapes::GetID(),US); + myTDFAcces.Root().FindAttribute(TNaming_UsedShapes::GetID(),US); TNaming_Localizer Localizer; - Localizer.Init (US,LabAcces.Transaction()); + Localizer.Init (US,myTDFAcces.Transaction()); Handle(TNaming_NamedShape) NS; - NS = TNaming_Tool::NamedShape(S,LabAcces); + NS = TNaming_Tool::NamedShape(myShape, myTDFAcces); if (NS.IsNull()) { - AncestorIdentification(Localizer,Context); + AncestorIdentification(Localizer, Context); return; } #ifdef MDTV_DEB_IDF @@ -95,9 +121,7 @@ myDone(Standard_False),myIsFeature(Standard_False) else { Identification(Localizer,NS); } -} - - +} //======================================================================= //function : Type