Warnings on vc14 were eliminated
[occt.git] / src / STEPControl / STEPControl_ActorRead.cxx
index 3441152..42b2ca0 100644 (file)
 //:n4 abv 11.02.99 S4132: recognition of GeometricSet (instead of GeometricCurveSet)
 //    gka 05.04.99 S4136: eliminate parameter lastpreci
 //gka,abv 14.04.99 S4136: maintain unit context, precision and maxtolerance values
-#include <STEPControl_ActorRead.ixx>
-#include <OSD_Timer.hxx>
-
-// #include <Interface_InterfaceModel.hxx>  // pour mise au point
-
-#include <StepShape_ShapeDefinitionRepresentation.hxx>
-#include <StepShape_ShapeRepresentation.hxx>
-#include <StepShape_FacetedBrepAndBrepWithVoids.hxx>
-#include <StepShape_FacetedBrep.hxx>
-#include <StepShape_ShellBasedSurfaceModel.hxx>
-#include <StepShape_ManifoldSolidBrep.hxx>
-#include <StepShape_BrepWithVoids.hxx>
-#include <StepShape_GeometricSet.hxx>
 
-// MappedItem :
-#include <StepRepr_MappedItem.hxx>
-#include <StepGeom_Axis2Placement3d.hxx>
-#include <StepRepr_RepresentationMap.hxx>
-#include <StepToTopoDS_MakeTransformed.hxx>
-
-// FaceSurface :
-#include <StepShape_FaceSurface.hxx>
-#include <StepToTopoDS_Tool.hxx>
-#include <StepToTopoDS_DataMapOfTRI.hxx>
-#include <StepToTopoDS_TranslateFace.hxx>
-
-//  Unites :
-#include <StepRepr_RepresentationContext.hxx>
-#include <StepRepr_GlobalUnitAssignedContext.hxx>
-#include <StepRepr_GlobalUncertaintyAssignedContext.hxx>
-//#include <StepBasic_UncertaintyMeasureWithUnit.hxx>
+#include <BRep_Builder.hxx>
+#include <BRepCheck_Shell.hxx>
+#include <BRepCheck_Status.hxx>
+#include <Geom_Axis2Placement.hxx>
+#include <gp_Ax3.hxx>
+#include <gp_Trsf.hxx>
+#include <HeaderSection_FileName.hxx>
+#include <Interface_EntityIterator.hxx>
+#include <Interface_Graph.hxx>
+#include <Interface_InterfaceModel.hxx>
+#include <Interface_Macros.hxx>
+#include <Interface_Static.hxx>
+#include <Message_Messenger.hxx>
+#include <Message_ProgressSentry.hxx>
+#include <OSD_Timer.hxx>
+#include <Precision.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_Transient.hxx>
+#include <Standard_Type.hxx>
+#include <StepBasic_ProductDefinition.hxx>
 #include <StepBasic_ProductRelatedProductCategory.hxx>
+#include <STEPConstruct_Assembly.hxx>
+#include <STEPConstruct_UnitContext.hxx>
+#include <STEPControl_ActorRead.hxx>
+#include <StepData_StepModel.hxx>
+#include <StepDimTol_DatumFeature.hxx>
+#include <StepDimTol_GeometricTolerance.hxx>
+#include <StepDimTol_GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol.hxx>
+#include <StepGeom_Axis2Placement3d.hxx>
+#include <StepGeom_CartesianTransformationOperator3d.hxx>
 #include <StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext.hxx>
+#include <StepGeom_GeometricRepresentationItem.hxx>
 #include <StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx.hxx>
-
-#include <STEPConstruct_UnitContext.hxx>
-#include <UnitsMethods.hxx>
-
-//  Representation Relationship & cie
-#include <Interface_Graph.hxx>
-#include <Interface_EntityIterator.hxx>
-#include <TransferBRep.hxx>
-#include <StepShape_ContextDependentShapeRepresentation.hxx>
-#include <StepRepr_ShapeRepresentationRelationship.hxx>
-#include <StepRepr_ShapeRepresentationRelationshipWithTransformation.hxx>
-#include <StepRepr_Transformation.hxx>
+#include <StepRepr_GlobalUncertaintyAssignedContext.hxx>
+#include <StepRepr_GlobalUnitAssignedContext.hxx>
+#include <StepRepr_HArray1OfRepresentationItem.hxx>
+#include <StepRepr_HSequenceOfRepresentationItem.hxx>
 #include <StepRepr_ItemDefinedTransformation.hxx>
-
-#include <BRep_Builder.hxx>
-#include <StepToTopoDS_Builder.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <TransferBRep_ShapeBinder.hxx>
-
-#include <Interface_Static.hxx>
-#include <Interface_Macros.hxx>
-#include <Interface_InterfaceModel.hxx>
-
-#include <StepBasic_ProductDefinition.hxx>
-#include <StepRepr_ProductDefinitionShape.hxx>
+#include <StepRepr_MappedItem.hxx>
 #include <StepRepr_NextAssemblyUsageOccurrence.hxx>
-#include <STEPConstruct_Assembly.hxx>
-#include <Precision.hxx>
-#include <StepToGeom_MakeTransformation3d.hxx>
-#include <StepToGeom_MakeAxis2Placement.hxx>
-#include <Geom_Axis2Placement.hxx>
-#include <gp_Ax3.hxx>
+#include <StepRepr_ProductDefinitionShape.hxx>
+#include <StepRepr_PropertyDefinition.hxx>
+#include <StepRepr_Representation.hxx>
+#include <StepRepr_RepresentationContext.hxx>
+#include <StepRepr_RepresentationMap.hxx>
+#include <StepRepr_RepresentationRelationship.hxx>
 #include <StepRepr_ShapeAspect.hxx>
-#include <XSAlgo.hxx>
-#include <XSAlgo_AlgoContainer.hxx>
+#include <StepRepr_ShapeRepresentationRelationship.hxx>
+#include <StepRepr_ShapeRepresentationRelationshipWithTransformation.hxx>
+#include <StepRepr_Transformation.hxx>
+#include <StepShape_AdvancedBrepShapeRepresentation.hxx>
+#include <StepShape_BrepWithVoids.hxx>
+#include <StepShape_ContextDependentShapeRepresentation.hxx>
 #include <StepShape_EdgeBasedWireframeModel.hxx>
+#include <StepShape_EdgeBasedWireframeShapeRepresentation.hxx>
 #include <StepShape_FaceBasedSurfaceModel.hxx>
-
-#include <StepShape_AdvancedBrepShapeRepresentation.hxx>
+#include <StepShape_FaceSurface.hxx>
+#include <StepShape_FacetedBrep.hxx>
+#include <StepShape_FacetedBrepAndBrepWithVoids.hxx>
 #include <StepShape_FacetedBrepShapeRepresentation.hxx>
-#include <StepShape_ManifoldSurfaceShapeRepresentation.hxx>
-#include <StepShape_EdgeBasedWireframeShapeRepresentation.hxx>
 #include <StepShape_GeometricallyBoundedSurfaceShapeRepresentation.hxx>
 #include <StepShape_GeometricallyBoundedWireframeShapeRepresentation.hxx>
-
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <Message_ProgressSentry.hxx>
-#include <Message_Messenger.hxx>
-#include <StepRepr_HSequenceOfRepresentationItem.hxx>
-#include <StepBasic_ProductDefinition.hxx>
-#include <Standard_Failure.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <StepDimTol_DatumFeature.hxx>
-#include <StepDimTol_GeometricTolerance.hxx>
-#include <StepDimTol_GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol.hxx>
-
-// For non-manifold topology processing (ssv; 12.11.2010)
+#include <StepShape_GeometricSet.hxx>
+#include <StepShape_ManifoldSolidBrep.hxx>
+#include <StepShape_ManifoldSurfaceShapeRepresentation.hxx>
 #include <StepShape_NonManifoldSurfaceShapeRepresentation.hxx>
-#include <StepRepr_HArray1OfRepresentationItem.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopoDS_Iterator.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopoDS_Solid.hxx>
-#include <BRepCheck_Shell.hxx>
-#include <BRepCheck_Status.hxx>
+#include <StepShape_ShapeDefinitionRepresentation.hxx>
+#include <StepShape_ShapeRepresentation.hxx>
+#include <StepShape_ShellBasedSurfaceModel.hxx>
+#include <StepToGeom.hxx>
+#include <StepToTopoDS_Builder.hxx>
+#include <StepToTopoDS_DataMapOfTRI.hxx>
+#include <StepToTopoDS_MakeTransformed.hxx>
+#include <StepToTopoDS_Tool.hxx>
+#include <StepToTopoDS_TranslateFace.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <TopExp_Explorer.hxx>
 #include <TopoDS.hxx>
-#include <TopoDS_Shell.hxx>
+#include <TopoDS_Compound.hxx>
 #include <TopoDS_Face.hxx>
-#include <TopExp_Explorer.hxx>
-#include <StepData_StepModel.hxx>
-#include <HeaderSection_FileName.hxx>
-#include <StepGeom_GeometricRepresentationItem.hxx>
-#include <StepRepr_Representation.hxx>
-#include <StepRepr_PropertyDefinition.hxx>
-#include <StepGeom_CartesianTransformationOperator3d.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Shell.hxx>
+#include <TopoDS_Solid.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <Transfer_Binder.hxx>
+#include <Transfer_TransientProcess.hxx>
+#include <TransferBRep.hxx>
+#include <TransferBRep_ShapeBinder.hxx>
+#include <UnitsMethods.hxx>
+#include <XSAlgo.hxx>
+#include <XSAlgo_AlgoContainer.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(STEPControl_ActorRead,Transfer_ActorOfTransientProcess)
+
+// #include <Interface_InterfaceModel.hxx>  // pour mise au point
+// MappedItem :
+// FaceSurface :
+//  Unites :
+//#include <StepBasic_UncertaintyMeasureWithUnit.hxx>
+//  Representation Relationship & cie
+// For non-manifold topology processing (ssv; 12.11.2010)
 #define TRANSLOG
 
 // ============================================================================
@@ -199,7 +192,7 @@ namespace {
   // The better way is to pass this information via binder or via TopoDS_Shape itself, however,
   // this is very specific info to do so...
   Standard_Boolean NM_DETECTED = Standard_False;
-};
+}
 
 // ============================================================================
 // Method  : STEPControl_ActorRead::STEPControl_ActorRead  ()    
@@ -686,7 +679,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
       IsDepend=Standard_True;
       Handle(StepRepr_RepresentationRelationship) RR = CDSR->RepresentationRelation();
       if (RR.IsNull()) continue;
-      SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( TP->Model(), CDSR );
+      SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( graph, CDSR );
       Handle(StepRepr_Representation) rep = ( SRRReversed ? RR->Rep2() : RR->Rep1() );
       iatrsf = ComputeSRRWT ( RR, TP, Trsf );
       // find real ProductDefinition used rep
@@ -761,7 +754,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
   if(!Recognize(sr))
     return shbinder;
   isBound = Standard_False;
-  Standard_Integer i,nb = sr->NbItems();
+  Standard_Integer nb = sr->NbItems();
   // Used in XSAlgo::AlgoContainer()->ProcessShape (ssv; 13.11.2010)
   Standard_Integer nbTPitems = TP->NbMapped();
   Handle(Message_Messenger) sout = TP->Messenger();
@@ -782,7 +775,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
   Message_ProgressSentry PS ( TP->GetProgress(), "Sub-assembly", 0, nb, 1 );
 
   // [BEGIN] Proceed with non-manifold topology (ssv; 12.11.2010)
-  Standard_Boolean isNMMode = Interface_Static::IVal("read.step.nonmanifold");
+  Standard_Boolean isNMMode = Interface_Static::IVal("read.step.nonmanifold") != 0;
   Standard_Boolean isManifold = Standard_True;
   if ( isNMMode && sr->IsKind(STANDARD_TYPE(StepShape_NonManifoldSurfaceShapeRepresentation)) ) {
     isManifold = Standard_False;
@@ -812,7 +805,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
   myNMTool.SetActive(!isManifold && isNMMode);
   // [END] Proceed with non-manifold topology (ssv; 12.11.2010)
 
-  for (i = 1; i <= nb && PS.More(); i ++,PS.Next()) {
+  for (Standard_Integer i = 1; i <= nb && PS.More(); i ++,PS.Next()) {
   //for (i = 1; i <= nb ; i ++) {
     #ifdef TRANSLOG
     if (TP->TraceLevel() > 2) 
@@ -864,7 +857,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
       // Make compound to store closed Shells
       TopoDS_Compound compWithClosings;
       brepBuilder.MakeCompound(compWithClosings);
-
+      
       // Attempt to close Shells one-by-one
       for (Standard_Integer i = 1; i <= shellClosingsMap.Extent(); i++) {
         TopoDS_Shell adjustedShell = this->closeIDEASShell( TopoDS::Shell( shellClosingsMap.FindKey(i) ),
@@ -935,7 +928,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
   //DeclareAndCast(StepRepr_RepresentationRelationship,SRR,CDSR->RepresentationRelation());
   if ( SRR.IsNull() ) return shbinder;
   
-  Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( TP->Model(), CDSR );
+  Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( TP->Graph(), CDSR );
   Handle(StepRepr_Representation) rep1 = ( SRRReversed ? SRR->Rep2() : SRR->Rep1() );
   Handle(StepShape_ShapeRepresentation) rep = Handle(StepShape_ShapeRepresentation)::DownCast(rep1);
 
@@ -1335,7 +1328,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
       Handle(StepGeom_CartesianTransformationOperator3d) CartOp =
         Handle(StepGeom_CartesianTransformationOperator3d)::DownCast(mapit->MappingTarget());
       if ( ! CartOp.IsNull() ) {
-        ok = StepToGeom_MakeTransformation3d::Convert( CartOp, Trsf );
+        ok = StepToGeom::MakeTransformation3d (CartOp, Trsf);
       }
       else {
         Handle(StepGeom_Axis2Placement3d) Origin = 
@@ -1666,11 +1659,9 @@ Standard_Boolean STEPControl_ActorRead::ComputeTransformation (const Handle(Step
   // translate axis_placements taking units into account 
   Handle(StepRepr_Representation) oldSRContext = mySRContext;
   if ( OrigContext  != oldSRContext ) PrepareUnits(OrigContext,TP);
-  Handle(Geom_Axis2Placement) theOrig;
-  StepToGeom_MakeAxis2Placement::Convert(org,theOrig);
+  Handle(Geom_Axis2Placement) theOrig = StepToGeom::MakeAxis2Placement (org);
   if ( TargContext  != OrigContext  ) PrepareUnits(TargContext,TP);
-  Handle(Geom_Axis2Placement) theTarg;
-  StepToGeom_MakeAxis2Placement::Convert(trg,theTarg);
+  Handle(Geom_Axis2Placement) theTarg = StepToGeom::MakeAxis2Placement (trg);
   if ( oldSRContext != TargContext  ) PrepareUnits(oldSRContext,TP);
 
   gp_Ax3 ax3Orig(theOrig->Ax2());
@@ -1705,7 +1696,7 @@ Standard_Boolean STEPControl_ActorRead::ComputeSRRWT (const Handle(StepRepr_Repr
     // reset units (by Rep2 - ?)
     Handle(StepRepr_Representation) oldSRContext = mySRContext;
     if ( SRR->Rep2() != oldSRContext ) PrepareUnits(SRR->Rep2(),TP);
-    StepToGeom_MakeTransformation3d::Convert( CartOp, Trsf );
+    StepToGeom::MakeTransformation3d (CartOp, Trsf);
     if ( SRR->Rep2() != oldSRContext ) PrepareUnits(oldSRContext,TP);
     return Trsf.Form() != gp_Identity;
   }