X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FSTEPPlugin%2FSTEPPlugin_ImportDriver.cxx;h=25637a7439f6f76610397e53f067795334af5165;hb=d6f16273ade8fc4eba4d41c1ffa0d5d79baaf47b;hp=b15b56a626aaa5167f769a2bfd3cccfc7c3a9d5c;hpb=8370b4a1c488f6ef18d8944869d6a8cd3a2d18d2;p=modules%2Fgeom.git diff --git a/src/STEPPlugin/STEPPlugin_ImportDriver.cxx b/src/STEPPlugin/STEPPlugin_ImportDriver.cxx index b15b56a62..25637a743 100644 --- a/src/STEPPlugin/STEPPlugin_ImportDriver.cxx +++ b/src/STEPPlugin/STEPPlugin_ImportDriver.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2014-2021 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -78,69 +78,69 @@ namespace * GetShape() */ //============================================================================= - + TopoDS_Shape GetShape(const Handle(Standard_Transient) &theEnti, const Handle(Transfer_TransientProcess) &theTP) { TopoDS_Shape aResult; Handle(Transfer_Binder) aBinder = theTP->Find(theEnti); - + if (aBinder.IsNull()) { return aResult; } - + aResult = TransferBRep::ShapeResult(aBinder); - + return aResult; } - + //============================================================================= /*! * GetLabel() */ //============================================================================= - + TDF_Label GetLabel(const Handle(Standard_Transient) &theEnti, const TDF_Label &theShapeLabel, const TopoDS_Shape &aShape) { TDF_Label aResult; - + if (theEnti->IsKind (STANDARD_TYPE(StepGeom_GeometricRepresentationItem))) { // check all named shapes using iterator TDF_ChildIDIterator anIt (theShapeLabel, TDataStd_Name::GetID(), Standard_True); - + for (; anIt.More(); anIt.Next()) { Handle(TDataStd_Name) nameAttr = Handle(TDataStd_Name)::DownCast(anIt.Value()); - + if (nameAttr.IsNull()) { continue; } - + TDF_Label aLab = nameAttr->Label(); Handle(TNaming_NamedShape) shAttr; - + if (aLab.FindAttribute(TNaming_NamedShape::GetID(), shAttr) && shAttr->Get().IsEqual(aShape)) { aResult = aLab; } } } - + // create label and set shape if (aResult.IsNull()) { TDF_TagSource aTag; - + aResult = aTag.NewChild(theShapeLabel); - + TNaming_Builder tnBuild (aResult); - + tnBuild.Generated(aShape); } - + return aResult; } @@ -235,7 +235,7 @@ namespace } } - // Set the result shape orienation. + // Set the result shape orientation. aResult.Orientation(theShape.Orientation()); theMapModified.Bind(theShape, aResult); } else { @@ -323,7 +323,7 @@ namespace * StoreName() */ //============================================================================= - + void StoreName(const Handle(Standard_Transient) &theEnti, const TopTools_IndexedMapOfShape &theIndices, const Handle(XSControl_WorkSession) &theWS, @@ -332,18 +332,18 @@ namespace TopTools_DataMapOfShapeShape &theMapShapeAssembly) { Handle(TCollection_HAsciiString) aName; - + if (theEnti->IsKind(STANDARD_TYPE(StepShape_TopologicalRepresentationItem)) || theEnti->IsKind(STANDARD_TYPE(StepGeom_GeometricRepresentationItem))) { aName = Handle(StepRepr_RepresentationItem)::DownCast(theEnti)->Name(); } else if (theEnti->IsKind(STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence))) { - Handle(StepRepr_NextAssemblyUsageOccurrence) aNAUO = + Handle(StepRepr_NextAssemblyUsageOccurrence) aNAUO = Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(theEnti); Interface_EntityIterator aSubs = theWS->Graph().Sharings(aNAUO); for (aSubs.Start(); aSubs.More(); aSubs.Next()) { - Handle(StepRepr_ProductDefinitionShape) aPDS = + Handle(StepRepr_ProductDefinitionShape) aPDS = Handle(StepRepr_ProductDefinitionShape)::DownCast(aSubs.Value()); if(aPDS.IsNull()) { @@ -368,13 +368,13 @@ namespace } else { Handle(StepBasic_ProductDefinition) PD = Handle(StepBasic_ProductDefinition)::DownCast(theEnti); - + if (PD.IsNull() == Standard_False) { Handle(StepBasic_Product) Prod = PD->Formation()->OfProduct(); aName = Prod->Name(); } } - + bool isValidName = false; if (aName.IsNull() == Standard_False) { @@ -565,7 +565,7 @@ namespace result = "M"; else error = "The file contains not supported units"; - + // TODO (for other units) // else // result = "??" @@ -597,7 +597,7 @@ STEPPlugin_ImportDriver::STEPPlugin_ImportDriver() //function : Execute //purpose : //======================================================================= -Standard_Integer STEPPlugin_ImportDriver::Execute( TFunction_Logbook& log ) const +Standard_Integer STEPPlugin_ImportDriver::Execute(Handle(TFunction_Logbook)& log) const { if( Label().IsNull() ) return 0; Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction( Label() ); @@ -787,9 +787,8 @@ Standard_Integer STEPPlugin_ImportDriver::Execute( TFunction_Logbook& log ) cons aResShape.Nullify(); } } - catch( Standard_Failure ) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - anError = aFail->GetMessageString(); + catch( Standard_Failure& aFail ) { + anError = aFail.GetMessageString(); aResShape.Nullify(); } @@ -800,20 +799,11 @@ Standard_Integer STEPPlugin_ImportDriver::Execute( TFunction_Logbook& log ) cons aFunction->SetValue( aResShape ); - log.SetTouched( Label() ); + log->SetTouched(Label()); return 1; } -//======================================================================= -//function : MustExecute -//purpose : -//======================================================================= -Standard_Boolean STEPPlugin_ImportDriver::MustExecute( const TFunction_Logbook& ) const -{ - return Standard_True; -} - //================================================================================ /*! * \brief Returns a name of creation operation and names and values of creation parameters @@ -881,13 +871,10 @@ STEPPlugin_ImportDriver::GetValue( const TCollection_AsciiString& theFileName, theError = theFileName + " reading failed"; } } - catch( Standard_Failure ) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - theError = aFail->GetMessageString(); + catch( Standard_Failure& aFail ) { + theError = aFail.GetMessageString(); } return aValue; } - -IMPLEMENT_STANDARD_HANDLE( STEPPlugin_ImportDriver, GEOM_BaseDriver ); -IMPLEMENT_STANDARD_RTTIEXT( STEPPlugin_ImportDriver, GEOM_BaseDriver ); +IMPLEMENT_STANDARD_RTTIEXT( STEPPlugin_ImportDriver, GEOM_BaseDriver )