0027235: Export GDT: Annotation plane and Presentation.
authorika <ika@opencascade.com>
Wed, 9 Mar 2016 11:25:17 +0000 (14:25 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 8 Apr 2016 08:42:32 +0000 (11:42 +0300)
Implement Null_Style STEP type.
Implement export of annotation planes and presentation as tessellated geometry.
Add tests.

29 files changed:
src/QABugs/QABugs_20.cxx
src/RWStepAP214/RWStepAP214_GeneralModule.cxx
src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx
src/RWStepVisual/RWStepVisual_RWPresentationStyleAssignment.cxx
src/RWStepVisual/RWStepVisual_RWPresentationStyleByContext.cxx
src/RWStepVisual/RWStepVisual_RWTessellatedCurveSet.cxx
src/RWStepVisual/RWStepVisual_RWTessellatedCurveSet.hxx
src/RWStepVisual/RWStepVisual_RWTessellatedGeometricSet.cxx
src/STEPCAFControl/STEPCAFControl_GDTProperty.cxx
src/STEPCAFControl/STEPCAFControl_GDTProperty.hxx
src/STEPCAFControl/STEPCAFControl_Reader.cxx
src/STEPCAFControl/STEPCAFControl_Writer.cxx
src/StepDimTol/StepDimTol_SimpleDatumReferenceModifierMember.hxx
src/StepVisual/FILES
src/StepVisual/StepVisual_NullStyle.hxx [new file with mode: 0644]
src/StepVisual/StepVisual_NullStyleMember.cxx [new file with mode: 0644]
src/StepVisual/StepVisual_NullStyleMember.hxx [new file with mode: 0644]
src/StepVisual/StepVisual_PresentationStyleSelect.cxx
src/StepVisual/StepVisual_PresentationStyleSelect.hxx
src/StepVisual/StepVisual_TessellatedGeometricSet.cxx
src/StepVisual/StepVisual_TessellatedGeometricSet.hxx
tests/gdt/export/end
tests/gdt/grids.list
tests/gdt/presentation/A1 [new file with mode: 0644]
tests/gdt/presentation/A2 [new file with mode: 0644]
tests/gdt/presentation/A3 [new file with mode: 0644]
tests/gdt/presentation/A4 [new file with mode: 0644]
tests/gdt/presentation/begin [new file with mode: 0644]
tests/gdt/presentation/end [new file with mode: 0644]

index f9b2e2b..9e619f1 100644 (file)
 #include <TopoDS.hxx>
 #include <DBRep.hxx>
 
+#include <BRepGProp.hxx>
+#include <DDocStd.hxx>
+#include <GProp_GProps.hxx>
+#include <TDocStd_Document.hxx>
+#include <XCAFDimTolObjects_DatumObject.hxx>
+#include <XCAFDimTolObjects_DimensionObject.hxx>
+#include <XCAFDimTolObjects_GeomToleranceObject.hxx>
+#include <XCAFDoc_Datum.hxx>
+#include <XCAFDoc_Dimension.hxx>
+#include <XCAFDoc_DimTolTool.hxx>
+#include <XCAFDoc_DocumentTool.hxx>
+#include <XCAFDoc_GeomTolerance.hxx>
+#include <XCAFDoc_ShapeTool.hxx>
 //=======================================================================
 //function : SurfaceGenOCC26675_1 
 //purpose  : Generates a surface for intersect (in corresponding
@@ -1418,6 +1431,90 @@ static Standard_Integer OCC27021(Draw_Interpretor& theDI,
   return 0;
 }
 
+//=======================================================================
+//function : OCC27235
+//purpose : check presentation in GDT document
+//=======================================================================
+static Standard_Integer OCC27235 (Draw_Interpretor& theDI, Standard_Integer n, const char** a)
+{
+  if (n < 2) {
+    theDI<<"Use: OCC27235 Doc";
+    return 1;
+  }
+
+  Handle(TDocStd_Document) Doc;
+  DDocStd::GetDocument(a[1], Doc);
+  if ( Doc.IsNull() ) { theDI << a[1] << " is not a document\n"; return 1; }
+  Handle(XCAFDoc_DimTolTool) aDimTolTool= XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+  Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+  TopoDS_Compound aPresentations;
+  BRep_Builder B;
+  B.MakeCompound(aPresentations);
+
+  TDF_LabelSequence aLabels;
+  aShapeTool->GetShapes(aLabels);
+  for ( Standard_Integer i=1; i <= aLabels.Length(); i++ )
+  {
+    aShapeTool->GetSubShapes(aLabels.Value(i), aLabels);
+  }
+
+  TDF_LabelSequence aGDTs;
+  aDimTolTool->GetDimensionLabels(aGDTs);
+  for (Standard_Integer i = 1; i <= aGDTs.Length(); i++) {
+    Handle(XCAFDoc_Dimension) aDimAttr;
+    if (!aGDTs.Value(i).FindAttribute(XCAFDoc_Dimension::GetID(),aDimAttr)) 
+      continue;
+    Handle(XCAFDimTolObjects_DimensionObject) anObject = aDimAttr->GetObject();
+    if (anObject.IsNull())
+      continue;
+    TopoDS_Shape aShape = anObject->GetPresentation();
+    if (!aShape.IsNull())
+      B.Add(aPresentations, aShape);
+  }
+
+  aGDTs.Clear();
+  aDimTolTool->GetGeomToleranceLabels(aGDTs);
+  for (Standard_Integer i = 1; i <= aGDTs.Length(); i++) {
+    Handle(XCAFDoc_GeomTolerance) aGTAttr;
+    if (!aGDTs.Value(i).FindAttribute(XCAFDoc_GeomTolerance::GetID(),aGTAttr)) 
+      continue;
+    Handle(XCAFDimTolObjects_GeomToleranceObject) anObject = aGTAttr->GetObject();
+    if (anObject.IsNull())
+      continue;
+    TopoDS_Shape aShape = anObject->GetPresentation();
+    if (!aShape.IsNull())
+      B.Add(aPresentations, aShape);
+  }
+
+  for ( Standard_Integer i=1; i <= aLabels.Length(); i++ )
+  {
+    TDF_LabelSequence aDatL;
+    if(aDimTolTool->GetRefDatumLabel(aLabels.Value(i), aDatL))
+    {
+      for(Standard_Integer j = aDatL.Lower(); j <= aDatL.Upper(); j++)
+      {
+        Handle(XCAFDoc_Datum) aDat;
+        if(!aDatL.Value(j).FindAttribute(XCAFDoc_Datum::GetID(), aDat))
+          continue;
+        Handle(XCAFDimTolObjects_DatumObject) anObject = aDat->GetObject();
+        if (anObject.IsNull())
+          continue;
+        TopoDS_Shape aShape = anObject->GetPresentation();
+        if (!aShape.IsNull())
+          B.Add(aPresentations, aShape);
+      }
+    }
+  }
+
+  GProp_GProps aG;
+  BRepGProp::LinearProperties(aPresentations, aG);
+  gp_Pnt aPnt = aG.CentreOfMass();
+  theDI << "Centre of mass: " << aPnt.X() << " " << aPnt.Y() << " " << aPnt.Z() << "\n";
+  theDI << "Mass: " << aG.Mass() << "\n";
+
+  return 0;
+}
+
 
 void QABugs::Commands_20(Draw_Interpretor& theCommands) {
   const char *group = "QABugs";
@@ -1425,6 +1522,7 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
   theCommands.Add ("OCC26675_1", "OCC26675_1 result", __FILE__, SurfaceGenOCC26675_1, group);
   theCommands.Add ("OCC24836", "OCC24836", __FILE__, OCC24836, group);
   theCommands.Add("OCC27021", "OCC27021", __FILE__, OCC27021, group);
+  theCommands.Add("OCC27235", "OCC27235", __FILE__, OCC27235, group);
 
   return;
 }
index 07ef03f..b7baa69 100644 (file)
@@ -5076,6 +5076,13 @@ void RWStepAP214_GeneralModule::FillSharedCase(const Standard_Integer CN,
       tool.Share(anent,iter);
     }
     break;
+  case 710:
+    {
+      DeclareAndCast(StepVisual_TessellatedCurveSet,anent,ent);
+      RWStepVisual_RWTessellatedCurveSet tool;
+      tool.Share(anent,iter);
+    }
+    break;
     default : break;
     }
 }
index 718eb4a..06a6208 100644 (file)
@@ -14090,7 +14090,7 @@ void RWStepAP214_ReadWriteModule::WriteStep(const Standard_Integer CN,
     break;
       case 711:
     {
-       DeclareAndCast(StepVisual_CoordinatesList,anent,ent);
+      DeclareAndCast(StepVisual_CoordinatesList,anent,ent);
       RWStepVisual_RWCoordinatesList tool;
       tool.WriteStep(SW,anent);
      
index a18767d..76a200f 100644 (file)
 #include <Interface_Check.hxx>
 #include <Interface_EntityIterator.hxx>
 #include <RWStepVisual_RWPresentationStyleAssignment.hxx>
+#include <StepData_SelectMember.hxx>
 #include <StepData_StepReaderData.hxx>
 #include <StepData_StepWriter.hxx>
+#include <StepVisual_NullStyleMember.hxx>
 #include <StepVisual_HArray1OfPresentationStyleSelect.hxx>
 #include <StepVisual_PresentationStyleAssignment.hxx>
 #include <StepVisual_PresentationStyleSelect.hxx>
@@ -37,18 +39,28 @@ void RWStepVisual_RWPresentationStyleAssignment::ReadStep
 
        // --- own field : styles ---
 
-       Handle(StepVisual_HArray1OfPresentationStyleSelect) aStyles;
-       StepVisual_PresentationStyleSelect aStylesItem;
-       Standard_Integer nsub1;
-       if (data->ReadSubList (num,1,"styles",ach,nsub1)) {
-         Standard_Integer nb1 = data->NbParams(nsub1);
-         aStyles = new StepVisual_HArray1OfPresentationStyleSelect (1, nb1);
-         for (Standard_Integer i1 = 1; i1 <= nb1; i1 ++) {
-           //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
-           if (data->ReadEntity (nsub1,i1,"styles",ach,aStylesItem))
-             aStyles->SetValue(i1,aStylesItem);
-         }
-       }
+  Handle(StepVisual_HArray1OfPresentationStyleSelect) aStyles;
+  StepVisual_PresentationStyleSelect aStylesItem;
+  Standard_Integer nsub1;
+  if (data->ReadSubList (num,1,"styles",ach,nsub1)) {
+    Standard_Integer nb1 = data->NbParams(nsub1);
+    aStyles = new StepVisual_HArray1OfPresentationStyleSelect (1, nb1);
+    for (Standard_Integer i1 = 1; i1 <= nb1; i1 ++) {
+      Interface_ParamType aType = data->ParamType(nsub1, i1);
+      if (aType == Interface_ParamIdent) {
+        data->ReadEntity (nsub1,i1,"styles",ach,aStylesItem);
+      }
+      else {
+        Handle(StepData_SelectMember) aMember;
+        data->ReadMember(nsub1, i1, "null_style", ach, aMember);
+        Standard_CString anEnumText = aMember->EnumText();
+        Handle(StepVisual_NullStyleMember) aNullStyle = new StepVisual_NullStyleMember();
+        aNullStyle->SetEnumText(0, anEnumText);
+        aStylesItem.SetValue(aNullStyle);
+      }
+      aStyles->SetValue(i1,aStylesItem);
+    }
+  }
 
        //--- Initialisation of the read entity ---
 
@@ -65,9 +77,16 @@ void RWStepVisual_RWPresentationStyleAssignment::WriteStep
        // --- own field : styles ---
 
        SW.OpenSub();
-       for (Standard_Integer i1 = 1;  i1 <= ent->NbStyles();  i1 ++) {
-         SW.Send(ent->StylesValue(i1).Value());
-       }
+  for (Standard_Integer i1 = 1;  i1 <= ent->NbStyles();  i1 ++) {
+    StepVisual_PresentationStyleSelect aStyle = ent->StylesValue(i1);
+    if (aStyle.Value()->IsKind(STANDARD_TYPE(StepVisual_NullStyleMember))) {
+      SW.OpenTypedSub("NULL_STYLE");
+      SW.SendEnum(".NULL.");
+      SW.CloseSub();
+    }
+    else
+      SW.Send(aStyle.Value());
+  }
        SW.CloseSub();
 }
 
index 576367c..69eb7ca 100644 (file)
 #include <Interface_Check.hxx>
 #include <Interface_EntityIterator.hxx>
 #include <RWStepVisual_RWPresentationStyleByContext.hxx>
+#include <StepData_SelectMember.hxx>
 #include <StepData_StepReaderData.hxx>
 #include <StepData_StepWriter.hxx>
 #include <StepVisual_HArray1OfPresentationStyleSelect.hxx>
+#include <StepVisual_NullStyleMember.hxx>
 #include <StepVisual_PresentationStyleByContext.hxx>
 #include <StepVisual_PresentationStyleSelect.hxx>
 #include <StepVisual_StyleContextSelect.hxx>
@@ -38,18 +40,28 @@ void RWStepVisual_RWPresentationStyleByContext::ReadStep
 
        // --- inherited field : styles ---
 
-       Handle(StepVisual_HArray1OfPresentationStyleSelect) aStyles;
-       StepVisual_PresentationStyleSelect aStylesItem;
-       Standard_Integer nsub1;
-       if (data->ReadSubList (num,1,"styles",ach,nsub1)) {
-         Standard_Integer nb1 = data->NbParams(nsub1);
-         aStyles = new StepVisual_HArray1OfPresentationStyleSelect (1, nb1);
-         for (Standard_Integer i1 = 1; i1 <= nb1; i1 ++) {
-           //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
-           if (data->ReadEntity (nsub1,i1,"styles",ach,aStylesItem))
-             aStyles->SetValue(i1,aStylesItem);
-         }
-       }
+  Handle(StepVisual_HArray1OfPresentationStyleSelect) aStyles;
+  StepVisual_PresentationStyleSelect aStylesItem;
+  Standard_Integer nsub1;
+  if (data->ReadSubList (num,1,"styles",ach,nsub1)) {
+    Standard_Integer nb1 = data->NbParams(nsub1);
+    aStyles = new StepVisual_HArray1OfPresentationStyleSelect (1, nb1);
+    for (Standard_Integer i1 = 1; i1 <= nb1; i1 ++) {
+      Interface_ParamType aType = data->ParamType(nsub1, i1);
+      if (aType == Interface_ParamIdent) {
+        data->ReadEntity (nsub1,i1,"styles",ach,aStylesItem);
+      }
+      else {
+        Handle(StepData_SelectMember) aMember;
+        data->ReadMember(nsub1, i1, "null_style", ach, aMember);
+        Standard_CString anEnumText = aMember->EnumText();
+        Handle(StepVisual_NullStyleMember) aNullStyle = new StepVisual_NullStyleMember();
+        aNullStyle->SetEnumText(0, anEnumText);
+        aStylesItem.SetValue(aNullStyle);
+      }
+      aStyles->SetValue(i1,aStylesItem);
+    }
+  }
 
        // --- own field : styleContext ---
 
@@ -72,9 +84,16 @@ void RWStepVisual_RWPresentationStyleByContext::WriteStep
        // --- inherited field styles ---
 
        SW.OpenSub();
-       for (Standard_Integer i1 = 1;  i1 <= ent->NbStyles();  i1 ++) {
-         SW.Send(ent->StylesValue(i1).Value());
-       }
+for (Standard_Integer i1 = 1;  i1 <= ent->NbStyles();  i1 ++) {
+    StepVisual_PresentationStyleSelect aStyle = ent->StylesValue(i1);
+    if (aStyle.Value()->IsKind(STANDARD_TYPE(StepVisual_NullStyleMember))) {
+      SW.OpenTypedSub("NULL_STYLE");
+      SW.SendEnum(".NULL.");
+      SW.CloseSub();
+    }
+    else
+      SW.Send(aStyle.Value());
+  }
        SW.CloseSub();
 
        // --- own field : styleContext ---
index ec8326b..520dfcc 100644 (file)
@@ -103,3 +103,15 @@ void RWStepVisual_RWTessellatedCurveSet::WriteStep
   }
   SW.CloseSub();
 }
+
+//=======================================================================
+//function : Share
+//purpose  : 
+//=======================================================================
+void RWStepVisual_RWTessellatedCurveSet::Share (const Handle(StepVisual_TessellatedCurveSet) &ent,
+                                                Interface_EntityIterator& iter) const
+{
+  // Own filed : coordinates
+  iter.AddItem (ent->CoordList());
+}
+
index 5f1a01f..0e3a982 100644 (file)
@@ -43,5 +43,7 @@ public:
         const Handle(StepVisual_TessellatedCurveSet)& ent) const;
   
   Standard_EXPORT void WriteStep (StepData_StepWriter& SW, const  Handle(StepVisual_TessellatedCurveSet)& ent) const;
+
+  Standard_EXPORT void Share (const Handle(StepVisual_TessellatedCurveSet) &ent, Interface_EntityIterator& iter) const;
 };
 #endif // _RWStepVisual_RWTessellatedItem_HeaderFile
index e1bfc63..04fa091 100644 (file)
@@ -48,11 +48,11 @@ void RWStepVisual_RWTessellatedGeometricSet::ReadStep
   Handle(TCollection_HAsciiString) aName;
   data->ReadString (num, 1, "name", ach, aName);
   
-  NCollection_Handle<StepVisual_Array1OfTessellaltedItem> anItems;
+  NCollection_Handle<StepVisual_Array1OfTessellatedItem> anItems;
        Standard_Integer nsub2;
        if (data->ReadSubList (num,2,"items",ach,nsub2)) {
          Standard_Integer nb2 = data->NbParams(nsub2);
-         anItems = new StepVisual_Array1OfTessellaltedItem(1, nb2);
+         anItems = new StepVisual_Array1OfTessellatedItem(1, nb2);
          for (Standard_Integer i2 = 1; i2 <= nb2; i2 ++) {
            Handle(StepVisual_TessellatedItem) anItem;// = new StepVisual_TesselatedItem;
            if (data->ReadEntity (nsub2,i2,"item",ach,STANDARD_TYPE(StepVisual_TessellatedItem), anItem))
index e0087de..1d4d0c4 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#include <BRep_Tool.hxx>
+#include <Geom_BSplineCurve.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_Line.hxx>
+#include <ShapeConstruct_Curve.hxx>
 #include <STEPCAFControl_GDTProperty.hxx>
 #include <StepBasic_MeasureValueMember.hxx>
 #include <StepGeom_CartesianPoint.hxx>
 #include <StepDimTol_StraightnessTolerance.hxx>
 #include <StepDimTol_SurfaceProfileTolerance.hxx>
 #include <StepRepr_DescriptiveRepresentationItem.hxx>
+#include <StepVisual_CoordinatesList.hxx>
+#include <StepVisual_TessellatedCurveSet.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Shape.hxx>
 #include <XCAFDimTolObjects_DatumModifiersSequence.hxx>
 #include <XCAFDimTolObjects_DatumModifWithValue.hxx>
 
@@ -973,7 +983,7 @@ Handle(StepGeom_Axis2Placement3d) STEPCAFControl_GDTProperty::GetAxis2Placement3
     aDirCoords->SetValue(i, theAxis.XDirection().Coord(i));
   aRefDirection = new StepGeom_Direction();
   aRefDirection->Init(new TCollection_HAsciiString(), aDirCoords);
-  anA2P3D->Init(new TCollection_HAsciiString("orientation"), aPoint, Standard_True, anAxis, Standard_True, aRefDirection);
+  anA2P3D->Init(new TCollection_HAsciiString(), aPoint, Standard_True, anAxis, Standard_True, aRefDirection);
   return anA2P3D;
 }
 
@@ -1321,3 +1331,58 @@ Handle(TCollection_HAsciiString) STEPCAFControl_GDTProperty::GetTolValueType(con
       return new TCollection_HAsciiString("unknown");
   }
 }
+
+//=======================================================================
+//function : GetTessellation
+//purpose  : 
+//=======================================================================
+Handle(StepVisual_TessellatedGeometricSet) STEPCAFControl_GDTProperty::GetTessellation(const TopoDS_Shape theShape)
+{
+  // Build coordinate list and curves
+  NCollection_Handle<StepVisual_VectorOfHSequenceOfInteger> aCurves = new StepVisual_VectorOfHSequenceOfInteger;
+  NCollection_Vector<gp_XYZ> aCoords;
+  Standard_Integer aPntNb = 1;
+  for (TopExp_Explorer aCurveIt(theShape, TopAbs_EDGE); aCurveIt.More(); aCurveIt.Next()) {
+    Handle(TColStd_HSequenceOfInteger) aCurve = new TColStd_HSequenceOfInteger;
+    // Find out type of edge curve
+    Standard_Real aFirst = 0, aLast = 0;
+    Handle(Geom_Curve) anEdgeCurve = BRep_Tool::Curve(TopoDS::Edge(aCurveIt.Current()), aFirst, aLast);
+    if (anEdgeCurve.IsNull())
+      continue;
+    // Line
+    if (anEdgeCurve->IsKind(STANDARD_TYPE(Geom_Line))) {
+      for (TopExp_Explorer aVertIt(aCurveIt.Current(), TopAbs_VERTEX); aVertIt.More(); aVertIt.Next()) {
+        aCoords.Append(BRep_Tool::Pnt(TopoDS::Vertex(aVertIt.Current())).XYZ());
+        aCurve->Append(aPntNb);
+        aPntNb++;
+      }
+    }
+    // BSpline
+    else {
+      ShapeConstruct_Curve aSCC;
+      Handle(Geom_BSplineCurve) aBSCurve = aSCC.ConvertToBSpline(anEdgeCurve,
+          aFirst, aLast, Precision::Confusion());
+      for (Standard_Integer i = 1; i <= aBSCurve->NbPoles(); i++) {
+        aCoords.Append(aBSCurve->Pole(i).XYZ());
+        aCurve->Append(aPntNb);
+        aPntNb++;
+      }
+    }
+    aCurves->Append(aCurve);
+  }
+
+  Handle(TColgp_HArray1OfXYZ) aPoints = new TColgp_HArray1OfXYZ(1, aCoords.Length());
+  for (Standard_Integer i = 1; i <= aPoints->Length(); i++) {
+    aPoints->SetValue(i, aCoords.Value(i - 1));
+  }
+  // STEP entities
+  Handle(StepVisual_CoordinatesList) aCoordList = new StepVisual_CoordinatesList();
+  aCoordList->Init(new TCollection_HAsciiString(), aPoints);
+  Handle(StepVisual_TessellatedCurveSet) aCurveSet = new StepVisual_TessellatedCurveSet();
+  aCurveSet->Init(new TCollection_HAsciiString(), aCoordList, aCurves);
+  NCollection_Handle<StepVisual_Array1OfTessellatedItem> aTessItems = new StepVisual_Array1OfTessellatedItem(1, 1);
+  aTessItems->SetValue(1, aCurveSet);
+  Handle(StepVisual_TessellatedGeometricSet) aGeomSet = new StepVisual_TessellatedGeometricSet();
+  aGeomSet->Init(new TCollection_HAsciiString(), aTessItems);
+  return aGeomSet;
+}
index 552b90f..09f433c 100644 (file)
@@ -31,6 +31,7 @@
 #include <StepDimTol_HArray1OfDatumReferenceModifier.hxx>
 #include <StepGeom_Axis2Placement3d.hxx>
 #include <StepRepr_CompoundRepresentationItem.hxx>
+#include <StepVisual_TessellatedGeometricSet.hxx>
 #include <XCAFDimTolObjects_DimensionModifiersSequence.hxx>
 #include <StepShape_LimitsAndFits.hxx>
 #include <XCAFDimTolObjects_DatumModifiersSequence.hxx>
@@ -106,6 +107,8 @@ public:
                                                                                                  const Standard_Real theValue,
                                                                                                  const StepBasic_Unit theUnit);
 
+  Standard_EXPORT static Handle(StepVisual_TessellatedGeometricSet) GetTessellation(const TopoDS_Shape theShape);
+
 };
 
 #endif // _STEPCAFControl_GDTProperty_HeaderFile
index 9065cb9..abab089 100644 (file)
@@ -1886,7 +1886,7 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
       Handle(StepVisual_TessellatedGeometricSet) aTessSet = Handle(StepVisual_TessellatedGeometricSet)::DownCast(aTessItem);
       if( aTessSet.IsNull())
         continue;
-      NCollection_Handle<StepVisual_Array1OfTessellaltedItem> aListItems = aTessSet->Items();
+      NCollection_Handle<StepVisual_Array1OfTessellatedItem> aListItems = aTessSet->Items();
       Standard_Integer nb = aListItems.IsNull() ? 0 : aListItems->Length();
       Handle(StepVisual_TessellatedCurveSet) aTessCurve;
       for (Standard_Integer n = 1; n <= nb && aTessCurve.IsNull(); n++)
index d502b2d..7a053b1 100644 (file)
 #include <Interface_Static.hxx>
 #include <Message_Messenger.hxx>
 #include <MoniTool_DataMapIteratorOfDataMapOfShapeTransient.hxx>
+#include <NCollection_Vector.hxx>
 #include <OSD_Path.hxx>
 #include <Quantity_TypeOfColor.hxx>
 #include <StepAP214_Protocol.hxx>
+#include <StepAP242_DraughtingModelItemAssociation.hxx>
 #include <StepAP242_GeometricItemSpecificUsage.hxx>
 #include <StepBasic_DerivedUnit.hxx>
 #include <StepBasic_DerivedUnitElement.hxx>
 #include <StepGeom_Direction.hxx>
 #include <StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext.hxx>
 #include <StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx.hxx>
+#include <StepGeom_Plane.hxx>
 #include <StepGeom_Surface.hxx>
 #include <StepRepr_CompGroupShAspAndCompShAspAndDatumFeatAndShAsp.hxx>
 #include <StepRepr_CompositeShapeAspect.hxx>
 #include <StepShape_ToleranceValue.hxx>
 #include <StepShape_TypeQualifier.hxx>
 #include <StepShape_ValueFormatTypeQualifier.hxx>
+#include <StepVisual_AnnotationPlane.hxx>
 #include <StepVisual_CurveStyle.hxx>
+#include <StepVisual_DraughtingCallout.hxx>
+#include <StepVisual_DraughtingModel.hxx>
 #include <StepVisual_HArray1OfInvisibleItem.hxx>
 #include <StepVisual_HArray1OfLayeredItem.hxx>
 #include <StepVisual_HArray1OfPresentationStyleAssignment.hxx>
 #include <StepVisual_Invisibility.hxx>
 #include <StepVisual_InvisibleItem.hxx>
 #include <StepVisual_MechanicalDesignGeometricPresentationRepresentation.hxx>
+#include <StepVisual_NullStyleMember.hxx>
 #include <StepVisual_PointStyle.hxx>
 #include <StepVisual_PresentationLayerAssignment.hxx>
 #include <StepVisual_PresentationRepresentation.hxx>
 #include <StepVisual_PresentationStyleByContext.hxx>
 #include <StepVisual_StyledItem.hxx>
 #include <StepVisual_SurfaceStyleUsage.hxx>
+#include <StepVisual_TessellatedAnnotationOccurrence.hxx>
+#include <StepVisual_TessellatedGeometricSet.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_HAsciiString.hxx>
 #include <TColStd_HArray1OfReal.hxx>
@@ -232,6 +241,9 @@ enum DimensionalValueNumber {
   DimensionalValueNumber_Lower,
   DimensionalValueNumber_Upper
 };
+static NCollection_Vector<Handle(StepVisual_AnnotationPlane)> gdtAnnotationPlanes;
+static Handle(StepVisual_DraughtingModel) gdtPresentationDM;
+static Handle(StepVisual_HArray1OfPresentationStyleAssignment) gdtPrsCurveStyle;
 
 // added by skl 15.01.2004 for D&GT writing
 //#include <StepRepr_CompoundItemDefinition.hxx>
@@ -2303,6 +2315,69 @@ static Handle(StepRepr_ShapeAspect) WriteShapeAspect (const Handle(XSControl_Wor
 }
 
 //=======================================================================
+//function : WritePresentation
+//purpose  : auxiliary (write annotation plane and presentation)
+//======================================================================
+static void WritePresentation(const Handle(XSControl_WorkSession) &WS,
+                              const TopoDS_Shape thePresentation,
+                              const gp_Ax2 theAnnotationPlane,
+                              const Handle(Standard_Transient) theDimension)
+{
+  if (thePresentation.IsNull())
+    return;
+  // Get working data
+  Handle(Interface_InterfaceModel) aModel = WS->Model();
+
+  // Presentation
+  Handle(StepVisual_TessellatedGeometricSet) aGeomSet = STEPCAFControl_GDTProperty::GetTessellation(thePresentation);
+  Handle(StepVisual_TessellatedAnnotationOccurrence) aTAO = new StepVisual_TessellatedAnnotationOccurrence();
+  aTAO->Init(new TCollection_HAsciiString(), gdtPrsCurveStyle, aGeomSet);
+  StepVisual_DraughtingCalloutElement aDCElement;
+  aDCElement.SetValue(aTAO);
+  Handle(StepVisual_HArray1OfDraughtingCalloutElement) aTAOs = new StepVisual_HArray1OfDraughtingCalloutElement(1, 1);
+  aTAOs->SetValue(1, aDCElement);
+  Handle(StepVisual_DraughtingCallout) aDCallout = new StepVisual_DraughtingCallout();
+  aDCallout->Init(new TCollection_HAsciiString(), aTAOs);
+  Handle(StepRepr_HArray1OfRepresentationItem) aDCsForDMIA = new StepRepr_HArray1OfRepresentationItem(1, 1);
+  aDCsForDMIA->SetValue(1, aDCallout);
+  StepAP242_ItemIdentifiedRepresentationUsageDefinition aDimension;
+  aDimension.SetValue(theDimension);
+  Handle(StepAP242_DraughtingModelItemAssociation) aDMIA =
+    new StepAP242_DraughtingModelItemAssociation();
+  aDMIA->Init(new TCollection_HAsciiString("PMI representation to presentation link"),
+      new TCollection_HAsciiString(), aDimension, gdtPresentationDM, aDCsForDMIA);
+  aModel->AddWithRefs(aDMIA);
+
+  // Annotation plane
+  // Presentation Style
+  Handle(StepVisual_NullStyleMember) aNullStyle = new StepVisual_NullStyleMember();
+  aNullStyle->SetEnumText(0, ".NULL.");
+  StepVisual_PresentationStyleSelect aStyleItem;
+  aStyleItem.SetValue(aNullStyle);
+  Handle(StepVisual_HArray1OfPresentationStyleSelect) aStyles = new StepVisual_HArray1OfPresentationStyleSelect(1, 1);
+  aStyles->SetValue(1, aStyleItem);
+  Handle(StepVisual_PresentationStyleAssignment) aPrsStyle = new StepVisual_PresentationStyleAssignment();
+  aPrsStyle->Init(aStyles);
+  Handle(StepVisual_HArray1OfPresentationStyleAssignment) aPrsStyles = 
+    new StepVisual_HArray1OfPresentationStyleAssignment(1, 1);
+  aPrsStyles->SetValue(1, aPrsStyle);
+  // Plane
+  Handle(StepGeom_Plane) aPlane = new StepGeom_Plane();
+  Handle(StepGeom_Axis2Placement3d) anAxis = STEPCAFControl_GDTProperty::GetAxis2Placement3D(theAnnotationPlane);
+  aPlane->Init(new TCollection_HAsciiString(), anAxis);
+  // Annotation plane element
+  StepVisual_AnnotationPlaneElement aPlaneElement;
+  aPlaneElement.SetValue(aDCallout);
+  Handle(StepVisual_HArray1OfAnnotationPlaneElement) aDCsForAnnPln = new StepVisual_HArray1OfAnnotationPlaneElement(1, 1);
+  aDCsForAnnPln->SetValue(1, aPlaneElement);
+  // Init AnnotationPlane entity
+  Handle(StepVisual_AnnotationPlane) anAnnPlane = new StepVisual_AnnotationPlane();
+  anAnnPlane->Init(new TCollection_HAsciiString(), aPrsStyles, aPlane, aDCsForAnnPln);
+  gdtAnnotationPlanes.Append(anAnnPlane);
+  aModel->AddWithRefs(anAnnPlane);
+}
+
+//=======================================================================
 //function : WriteDatumAP242
 //purpose  : auxiliary (write Datum entity for given shape or write all 
 //           necessary entities and link them to already written datum 
@@ -2416,6 +2491,7 @@ static Handle(StepDimTol_Datum) WriteDatumAP242(const Handle(XSControl_WorkSessi
       gp_Ax2 aDTAxis = anObject->GetDatumTargetAxis();
       Handle(StepGeom_Axis2Placement3d) anA2P3D = 
         STEPCAFControl_GDTProperty::GetAxis2Placement3D(aDTAxis);
+      anA2P3D->SetName(new TCollection_HAsciiString("orientation"));
       Handle(StepRepr_HArray1OfRepresentationItem) anItems;
       // Process each datum target type
       if (aDatumType == XCAFDimTolObjects_DatumTargetType_Point) {
@@ -2498,6 +2574,9 @@ static Handle(StepDimTol_Datum) WriteDatumAP242(const Handle(XSControl_WorkSessi
   aSDR->Init(aRDefinition, aShapeRepr);
   Model->AddWithRefs(aSDR);
 
+  //Annotation plane and Presentation
+  WritePresentation(WS, anObject->GetPresentation(), anObject->GetPlane(), aSA);
+
   return aDatum;
 }
 
@@ -2838,6 +2917,7 @@ static Handle(StepDimTol_HArray1OfDatumSystemOrReference) WriteDatumSystem(const
   if (anObject->HasAxis()) {
     Handle(StepGeom_Axis2Placement3d) anAxis =
       STEPCAFControl_GDTProperty::GetAxis2Placement3D(anObject->GetAxis());
+    anAxis->SetName(new TCollection_HAsciiString("orientation"));
     Handle(StepAP242_GeometricItemSpecificUsage) aGISU = new StepAP242_GeometricItemSpecificUsage();
     StepAP242_ItemIdentifiedRepresentationUsageDefinition aDefinition;
     aDefinition.SetValue(aDS);
@@ -3087,6 +3167,8 @@ static void WriteGeomTolerance (const Handle(XSControl_WorkSession) &WS,
   }
   Model->AddWithRefs(aGeomTol);
   WriteToleranceZone(WS, anObject, aGeomTol, theRC);
+  //Annotation plane and Presentation
+  WritePresentation(WS, anObject->GetPresentation(), anObject->GetPlane(), aGeomTol);
 }
 
 //=======================================================================
@@ -3474,6 +3556,14 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
   if(DGTTool.IsNull())
     return Standard_False;
 
+  // Common entities for presentation
+  gdtPresentationDM = new StepVisual_DraughtingModel();
+  STEPConstruct_Styles aStyles (WS);
+  Handle(StepVisual_Colour) aCurvColor = aStyles.EncodeColor(Quantity_NOC_WHITE);
+  Handle(StepRepr_RepresentationItem) anItem = NULL;
+  gdtPrsCurveStyle = new StepVisual_HArray1OfPresentationStyleAssignment(1, 1);
+  gdtPrsCurveStyle->SetValue(1, aStyles.MakeColorPSA(anItem, aCurvColor, aCurvColor));
+
   TDF_LabelSequence aDGTLabels;
   STEPConstruct_DataMapOfAsciiStringTransient aDatumMap;
   Handle(StepRepr_RepresentationContext) aRC;
@@ -3642,6 +3732,8 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
 
     // Write values
     WriteDimValues(WS, anObject, aRC, aDimension);
+    //Annotation plane and Presentation
+    WritePresentation(WS, anObject->GetPresentation(), anObject->GetPlane(), aDimension.Value());
   }
 
   //----------------------------//
@@ -3662,6 +3754,18 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
     WriteGeomTolerance(WS, aFirstShapeL, aGeomTolL, aDatumSystem, aRC);
   }
 
+  // Write Draughting model for Annotation Planes
+  if (gdtAnnotationPlanes.Length() == 0)
+    return Standard_True;
+
+  Handle(StepRepr_HArray1OfRepresentationItem) aItems =
+    new StepRepr_HArray1OfRepresentationItem(1, gdtAnnotationPlanes.Length());
+  for (Standard_Integer i = 1; i <= aItems->Length(); i++) {
+    aItems->SetValue(i, gdtAnnotationPlanes.Value(i - 1));
+  }
+  gdtPresentationDM->Init(new TCollection_HAsciiString(), aItems, aRC);
+  aModel->AddWithRefs(gdtPresentationDM);
+
   return Standard_True;
 }
 
index 243045a..cba5948 100644 (file)
@@ -13,8 +13,8 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#ifndef _StepVisual_MarkerMember_HeaderFile
-#define _StepVisual_MarkerMember_HeaderFile
+#ifndef _StepDimTol_SimpleDatumReferenceModifierMember_HeaderFile
+#define _StepDimTol_SimpleDatumReferenceModifierMember_HeaderFile
 
 #include <Standard.hxx>
 #include <Standard_Type.hxx>
index 7368423..3875557 100644 (file)
@@ -124,6 +124,9 @@ StepVisual_MechanicalDesignGeometricPresentationArea.cxx
 StepVisual_MechanicalDesignGeometricPresentationArea.hxx
 StepVisual_MechanicalDesignGeometricPresentationRepresentation.cxx
 StepVisual_MechanicalDesignGeometricPresentationRepresentation.hxx
+StepVisual_NullStyle.hxx
+StepVisual_NullStyleMember.cxx
+StepVisual_NullStyleMember.hxx
 StepVisual_OverRidingStyledItem.cxx
 StepVisual_OverRidingStyledItem.hxx
 StepVisual_PlanarBox.cxx
diff --git a/src/StepVisual/StepVisual_NullStyle.hxx b/src/StepVisual/StepVisual_NullStyle.hxx
new file mode 100644 (file)
index 0000000..6eff163
--- /dev/null
@@ -0,0 +1,25 @@
+// Created on: 2016-03-09
+// Created by: Irina KRYLOVA
+// Copyright (c) 2016 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.
+
+#ifndef _StepVisual_NullStyle_HeaderFile
+#define _StepVisual_NullStyle_HeaderFile
+
+#include <Standard_PrimitiveTypes.hxx>
+
+enum StepVisual_NullStyle {
+  StepVisual_Null
+};
+
+#endif
diff --git a/src/StepVisual/StepVisual_NullStyleMember.cxx b/src/StepVisual/StepVisual_NullStyleMember.cxx
new file mode 100644 (file)
index 0000000..3629970
--- /dev/null
@@ -0,0 +1,72 @@
+// Created on: 2015-07-16
+// Created by: Irina KRYLOVA
+// Copyright (c) 2015 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 <StepVisual_NullStyleMember.hxx>
+#include <StepData_EnumTool.hxx>
+#include <TCollection_AsciiString.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(StepVisual_NullStyleMember,StepData_SelectInt)
+
+static StepData_EnumTool tool
+  (".NULL.");
+
+//=======================================================================
+//function : StepVisual_NullStyleMember
+//purpose  : 
+//=======================================================================
+
+StepVisual_NullStyleMember::StepVisual_NullStyleMember ()   {  }
+
+//=======================================================================
+//function : EnumText
+//purpose  : 
+//=======================================================================
+
+Standard_CString  StepVisual_NullStyleMember::EnumText () const
+{
+  return tool.Text(Int()).ToCString();
+}
+
+//=======================================================================
+//function : SetEnumText
+//purpose  : 
+//=======================================================================
+
+void  StepVisual_NullStyleMember::SetEnumText (const Standard_Integer /*theValue*/, 
+                                                                  const Standard_CString theText)
+{
+  Standard_Integer aVal = tool.Value (theText);
+  if (aVal >= 0) SetInt (aVal);
+}
+
+//=======================================================================
+//function : SetValue
+//purpose  : 
+//=======================================================================
+
+void  StepVisual_NullStyleMember::SetValue (const StepVisual_NullStyle theValue)
+{
+  SetInt ( Standard_Integer (theValue) );  
+}
+
+//=======================================================================
+//function : Value
+//purpose  : 
+//=======================================================================
+
+StepVisual_NullStyle StepVisual_NullStyleMember::Value () const
+{
+  return StepVisual_NullStyle (Int());  
+}
diff --git a/src/StepVisual/StepVisual_NullStyleMember.hxx b/src/StepVisual/StepVisual_NullStyleMember.hxx
new file mode 100644 (file)
index 0000000..d94b607
--- /dev/null
@@ -0,0 +1,61 @@
+// Created on: 2016-03-09
+// Created by: Irina KRYLOVA
+// Copyright (c) 2016 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.
+
+#ifndef _StepVisual_NullStyleMember_HeaderFile
+#define _StepVisual_NullStyleMember_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <StepData_SelectInt.hxx>
+#include <Standard_Boolean.hxx>
+#include <Standard_CString.hxx>
+#include <Standard_Integer.hxx>
+#include <StepVisual_NullStyle.hxx>
+
+class StepVisual_NullStyleMember;
+DEFINE_STANDARD_HANDLE(StepVisual_NullStyleMember, StepData_SelectInt)
+//! Defines NullStyle as unique member of PresentationStyleSelect
+//! Works with an EnumTool
+class StepVisual_NullStyleMember : public StepData_SelectInt
+{
+
+public:
+  
+  Standard_EXPORT StepVisual_NullStyleMember();
+  
+  virtual Standard_Boolean HasName() const Standard_OVERRIDE
+    {  return Standard_True;  }
+
+  virtual Standard_CString Name() const Standard_OVERRIDE
+    {  return "NULL_STYLE";  }
+
+  virtual Standard_Boolean SetName(const Standard_CString /*theName*/) Standard_OVERRIDE
+    {  return Standard_True;  }
+
+  Standard_Integer Kind() const Standard_OVERRIDE
+    {return 4;}
+  
+  Standard_EXPORT virtual   Standard_CString EnumText()  const Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual   void SetEnumText (const Standard_Integer theValue, const Standard_CString theText)  Standard_OVERRIDE;
+  
+  Standard_EXPORT   void SetValue (const StepVisual_NullStyle theValue) ;
+  
+  Standard_EXPORT   StepVisual_NullStyle Value()  const;
+
+  DEFINE_STANDARD_RTTIEXT(StepVisual_NullStyleMember,StepData_SelectInt)
+};
+#endif // _StepVisual_NullStyleMember_HeaderFile
index 0845168..3e67e19 100644 (file)
@@ -16,6 +16,7 @@
 #include <Standard_Transient.hxx>
 #include <StepVisual_CurveStyle.hxx>
 #include <StepVisual_FillAreaStyle.hxx>
+#include <StepVisual_NullStyleMember.hxx>
 #include <StepVisual_PointStyle.hxx>
 #include <StepVisual_PresentationStyleSelect.hxx>
 #include <StepVisual_SurfaceStyleUsage.hxx>
@@ -32,6 +33,7 @@ Standard_Integer StepVisual_PresentationStyleSelect::CaseNum(const Handle(Standa
 //     if (ent->IsKind(STANDARD_TYPE(StepVisual_SymbolStyle))) return 4;
 //     if (ent->IsKind(STANDARD_TYPE(StepVisual_FillAreaStyle))) return 5;
 //     if (ent->IsKind(STANDARD_TYPE(StepVisual_TextStyle))) return 6;
+  if (ent->IsKind(STANDARD_TYPE(StepVisual_NullStyleMember))) return 7;
        return 0;
 }
 
@@ -45,6 +47,11 @@ Handle(StepVisual_CurveStyle) StepVisual_PresentationStyleSelect::CurveStyle ()
        return GetCasted(StepVisual_CurveStyle,Value());
 }
 
+Handle(StepVisual_NullStyleMember) StepVisual_PresentationStyleSelect::NullStyle () const
+{
+       return GetCasted(StepVisual_NullStyleMember,Value());
+}
+
 Handle(StepVisual_SurfaceStyleUsage) StepVisual_PresentationStyleSelect::SurfaceStyleUsage () const
 {
        return GetCasted(StepVisual_SurfaceStyleUsage,Value());
index cc42b58..d8f5a3f 100644 (file)
@@ -26,6 +26,7 @@
 class Standard_Transient;
 class StepVisual_PointStyle;
 class StepVisual_CurveStyle;
+class StepVisual_NullStyleMember;
 class StepVisual_SurfaceStyleUsage;
 
 
@@ -47,6 +48,7 @@ public:
   //! 4 -> SymbolStyle
   //! 5 -> FillAreaStyle
   //! 6 -> TextStyle
+  //! 7 -> NullStyle
   //! 0 else
   Standard_EXPORT Standard_Integer CaseNum (const Handle(Standard_Transient)& ent) const;
   
@@ -55,6 +57,9 @@ public:
   
   //! returns Value as a CurveStyle (Null if another type)
   Standard_EXPORT Handle(StepVisual_CurveStyle) CurveStyle() const;
+
+  //! returns Value as a NullStyleMember (Null if another type)
+  Standard_EXPORT Handle(StepVisual_NullStyleMember) NullStyle() const;
   
   //! returns Value as a SurfaceStyleUsage (Null if another type)
   Standard_EXPORT Handle(StepVisual_SurfaceStyleUsage) SurfaceStyleUsage() const;
index 48fc26f..8cad96a 100644 (file)
@@ -21,13 +21,13 @@ IMPLEMENT_STANDARD_RTTIEXT(StepVisual_TessellatedGeometricSet,StepGeom_Tessellat
 
 StepVisual_TessellatedGeometricSet::StepVisual_TessellatedGeometricSet ()  {}
 
-void StepVisual_TessellatedGeometricSet::Init(const Handle(TCollection_HAsciiString)& theName, const NCollection_Handle<StepVisual_Array1OfTessellaltedItem>& theItems)
+void StepVisual_TessellatedGeometricSet::Init(const Handle(TCollection_HAsciiString)& theName, const NCollection_Handle<StepVisual_Array1OfTessellatedItem>& theItems)
 {
   StepRepr_RepresentationItem::Init(theName);
   myItems = theItems;
 }
 
-NCollection_Handle<StepVisual_Array1OfTessellaltedItem> StepVisual_TessellatedGeometricSet::Items() const
+NCollection_Handle<StepVisual_Array1OfTessellatedItem> StepVisual_TessellatedGeometricSet::Items() const
 {
   return myItems;
 }
index e7b98f6..bc3e373 100644 (file)
 
 class Standard_Transient;
 
-typedef NCollection_Array1<Handle(StepVisual_TessellatedItem)> StepVisual_Array1OfTessellaltedItem;
-//typedef NCollection_Handle<StepVisual_Array1OfTessellaltedItem> Handle(StepVisual_Array1OfTessellaltedItem);
+typedef NCollection_Array1<Handle(StepVisual_TessellatedItem)> StepVisual_Array1OfTessellatedItem;
 
-//DEFINE_HARRAY1(StepVisual_HArray1OfTessellaltedItem, StepVisual_Array1OfTessellaltedItem)
 DEFINE_STANDARD_HANDLE(StepVisual_TessellatedGeometricSet, StepVisual_TessellatedItem)
 class StepVisual_TessellatedGeometricSet  : public StepVisual_TessellatedItem
 {
@@ -40,12 +38,12 @@ public:
   //! Returns a DraughtingCalloutElement select type
   Standard_EXPORT StepVisual_TessellatedGeometricSet();
 
-   Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& theName, const NCollection_Handle<StepVisual_Array1OfTessellaltedItem>& theItems);
+   Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& theName, const NCollection_Handle<StepVisual_Array1OfTessellatedItem>& theItems);
   
-   Standard_EXPORT NCollection_Handle<StepVisual_Array1OfTessellaltedItem> Items() const;
+   Standard_EXPORT NCollection_Handle<StepVisual_Array1OfTessellatedItem> Items() const;
 
 private:
-  NCollection_Handle<StepVisual_Array1OfTessellaltedItem> myItems;
+  NCollection_Handle<StepVisual_Array1OfTessellatedItem> myItems;
 
 public:
 
index 3e27bb3..3792789 100644 (file)
@@ -166,7 +166,7 @@ if { $dump_file == 1 } {
       incr ref_Compare
       append err_compare_ref " Reference data             - $refstr\n"
       append err_compare_ref " Current data               - $curstr\n"
-      append err_compare_ref " Current data after writing - $curstr\n"
+      append err_compare_ref " Current data after writing - $cur2str\n"
       append err_compare_ref "--------------------------------------------------------------------\n"
     }
   }
index b8a7c11..2d4b1d8 100644 (file)
@@ -2,3 +2,4 @@
 002 tolerances
 003 import
 004 export
+005 presentation
diff --git a/tests/gdt/presentation/A1 b/tests/gdt/presentation/A1
new file mode 100644 (file)
index 0000000..97e3f96
--- /dev/null
@@ -0,0 +1,8 @@
+# !!!! This file is generated automatically, do not edit manually! See end script
+set filename bug26689_nist_ctc_01_asme1_ap242.stp
+
+set ref_data {
+Centre of mass: 33.295841310232461 -56.047419205695817 -22.610629589474502
+Mass: 12142.750755797097
+
+}
diff --git a/tests/gdt/presentation/A2 b/tests/gdt/presentation/A2
new file mode 100644 (file)
index 0000000..baebe91
--- /dev/null
@@ -0,0 +1,8 @@
+# !!!! This file is generated automatically, do not edit manually! See end script
+set filename bug26689_nist_ctc_02_asme1_ap242-2.stp
+
+set ref_data {
+Centre of mass: -7.829938249111005 278.41260705890426 -84.730202273479279
+Mass: 54935.33694421465
+
+}
diff --git a/tests/gdt/presentation/A3 b/tests/gdt/presentation/A3
new file mode 100644 (file)
index 0000000..e2b7162
--- /dev/null
@@ -0,0 +1,8 @@
+# !!!! This file is generated automatically, do not edit manually! See end script
+set filename bug26689_nist_ctc_04_asme1_ap242.stp
+
+set ref_data {
+Centre of mass: 35.242126579745523 445.83237754232533 -68.402802262745169
+Mass: 9074.4079919607357
+
+}
diff --git a/tests/gdt/presentation/A4 b/tests/gdt/presentation/A4
new file mode 100644 (file)
index 0000000..2f98748
--- /dev/null
@@ -0,0 +1,8 @@
+# !!!! This file is generated automatically, do not edit manually! See end script
+set filename bug26689_nist_ctc_05_asme1_ap242-1.stp
+
+set ref_data {
+Centre of mass: 64.344333389783159 73.02072510397285 59.833361341556298
+Mass: 12896.277087016462
+
+}
diff --git a/tests/gdt/presentation/begin b/tests/gdt/presentation/begin
new file mode 100644 (file)
index 0000000..f012867
--- /dev/null
@@ -0,0 +1 @@
+pload QAcommands
diff --git a/tests/gdt/presentation/end b/tests/gdt/presentation/end
new file mode 100644 (file)
index 0000000..26a1011
--- /dev/null
@@ -0,0 +1,167 @@
+# Set flag dump_file to 1 in order to regenerate script files with actual data
+# used as reference. In this mode all tests intentionaly report failure. 
+set dump_file 0
+########################################################################
+set mist 0;
+# First
+set x_First 0; set y_First 0; set z_First 0;
+set mass_First 0;
+# Second
+set x_Second 0; set y_Second 0; set z_Second 0;
+set mass_Second 0;
+###################################################################
+set ref_Compare 0
+set todo_msg ""
+set todo_mask "puts \"TODO CR27235 ALL: "
+set end_line "\" \n"
+##################################################################
+
+# Read original file
+if { [string length $filename] > 1} {
+  set path_file [locate_data_file $filename]
+  if { [catch { ReadStep D_First $path_file } catch_result] } {
+    set err_msg "Error: First - file was not read - exception "
+    puts $err_msg
+    append todo_msg $todo_mask $err_msg $end_line
+    set mist 1
+  }
+} else {
+  set mist 1
+}
+
+# Get information presentations
+if { $mist < 1} {           
+  puts ""
+  set xst [ OCC27235 D_First] 
+
+  if { [llength $xst] > 0 } {
+    regexp {Centre of mass+: +([-0-9.+eE]+) +([-0-9.+eE]+) +([-0-9.+eE]+)} $xst full x_First y_First z_First
+    regexp {Mass+: +([-0-9.+eE]+)} $xst full mass_First
+  } else {
+      puts " GDT information was NOT provided"
+  }
+}
+
+if { $mist != 1 } {  
+  puts "" 
+  set result ""
+  append result [format $xst]
+}
+
+# Writing file
+if { $mist < 1} {
+  puts " "
+  puts "-----------------------------WRITING FILE ------------------------------"
+  if { [catch { WriteStep D_First $imagedir/${casename}_D_First.stp } catch_result] } {
+    set err_msg "Error: First - file was not written - exception"
+    puts $err_msg
+    append todo_msg $todo_mask $err_msg $end_line
+    set mist 1
+  }
+  if { $mist < 1 } {
+    if { [catch { ReadStep D_Second $imagedir/${casename}_D_First.stp } catch_result] } {
+      set err_msg "Error: Second - file was not read - exception"
+      puts $err_msg
+      append todo_msg $todo_mask $err_msg $end_line
+      set mist 1
+    }
+  }
+}
+
+catch {[file delete $imagedir/${casename}_D_First.stp]}
+if { [catch { Close D_First } catch_result] } {
+  set err_msg "Error : cannot close a document D_First - exception"
+  puts $err_msg
+}
+
+# Get information about translation
+if { $mist < 1} {           
+  puts ""
+  set xst2 [ OCC27235 D_Second] 
+
+  if { [llength $xst] > 0 } {
+    regexp {Centre of mass+: +([-0-9.+eE]+) +([-0-9.+eE]+) +([-0-9.+eE]+)} $xst2 full x_Second y_Second z_Second
+    regexp {Mass+: +([-0-9.+eE]+)} $xst2 full mass_Second
+  } else {
+      puts " GDT information was NOT provided"
+  }
+  if { [catch { Close D_Second } catch_result] } {
+    set err_msg "Error : cannot close a document D_Second - exception"
+    puts $err_msg
+  }
+}
+
+if { $mist != 1 } {  
+  puts "" 
+  set result2 ""
+  append result2 [format $xst2]
+}
+
+set err_compare_ref ""
+# Put reference data to the test script file if option "dump" is set
+if { $dump_file == 1 } { 
+  set fd_stream  [open $dirname/$groupname/$gridname/$casename w] 
+  puts $fd_stream "# !!!! This file is generated automatically, do not edit manually! See end script"
+  puts $fd_stream "set filename $filename"
+  if { $mist != 1 } {
+    puts $fd_stream "" 
+    puts $fd_stream "set ref_data \{"
+    puts $fd_stream $result
+    puts $fd_stream "\}"
+  }
+  close $fd_stream 
+} elseif { $mist != 1 } {
+  puts "========================== Comparision with reference data ========"
+  puts ""
+  # Comparision of reference data with obtained result
+  set x_Ref 0; set y_Ref 0; set z_Ref 0;
+  set mass_Ref 0;
+  regexp {Centre of mass+: +([-0-9.+eE]+) +([-0-9.+eE]+) +([-0-9.+eE]+)} $ref_data full x_Ref y_Ref z_Ref
+  regexp {Mass+: +([-0-9.+eE]+)} $ref_data full mass_Ref
+
+  if {[expr abs($x_Ref - $x_First)] > 1e-4 || [expr abs($x_Ref - $x_Second)] > 1e-4} {
+    incr ref_Compare
+    append err_compare_ref " Reference data - $x_Ref\n"
+    append err_compare_ref " Current data - $x_Second ($x_First)\n"
+    append err_compare_ref "--------------------------------------------------------------------\n"
+  }
+    
+  if {[expr abs($y_Ref - $y_First)] > 1e-4 || [expr abs($y_Ref - $y_Second)] > 1e-4} {
+    incr ref_Compare
+    append err_compare_ref " Reference data - $y_Ref\n"
+    append err_compare_ref " Current data - $y_Second ($y_First)\n"
+    append err_compare_ref "--------------------------------------------------------------------\n"
+    }
+  if {[expr abs($z_Ref - $z_First)] > 1e-4 || [expr abs($z_Ref - $z_Second)] > 1e-4} {
+    incr ref_Compare
+    append err_compare_ref " Reference data - $z_Ref\n"
+    append err_compare_ref " Current data - $z_Second ($z_First)\n"
+    append err_compare_ref "--------------------------------------------------------------------\n"
+    }
+  if {[expr abs($mass_Ref - $mass_First)] > 1e-4 || [expr abs($mass_Ref - $mass_Second)] > 1e-4} {
+    incr ref_Compare
+    append err_compare_ref " Reference data - $mass_Ref\n"
+    append err_compare_ref " Current data - $mass_Second ($mass_First)\n"
+    append err_compare_ref "--------------------------------------------------------------------\n"
+    }
+  }
+
+if { $dump_file != 0 } {
+    puts "Error : Running in regeneration mode, comparision was not performed!"
+    if { $mist != 1 } {
+        puts "Generation of test file $groupname/$gridname/$casename successful"
+    } else {
+        puts "Generation of reference data failed"
+    }
+} else {
+    if { $ref_Compare > 0} {
+        puts "Error : $ref_Compare differences with reference data found :\n$err_compare_ref"
+    } else {
+        puts "Comparision of current result with reference data - OK\n"
+    }    
+}
+
+puts "--------------------------------------------------------------------"
+puts ""
+
+puts "TEST COMPLETED"