From 0c63f2f8b922bc36025a61eed81ca221fdeb37e4 Mon Sep 17 00:00:00 2001 From: ika Date: Wed, 25 Jan 2017 14:13:45 +0300 Subject: [PATCH] 0028389: Data Exchange - Import of STEP Saved Views and Clipping Planes - new STEP entities for Saved Views - import of STEP Saved Views - new XCAF tool for clipping planes - new draw commands - update test --- src/BinMXCAFDoc/BinMXCAFDoc.hxx | 2 + .../BinMXCAFDoc_ClippingPlaneToolDriver.cxx | 65 ++++ .../BinMXCAFDoc_ClippingPlaneToolDriver.hxx | 50 +++ src/BinMXCAFDoc/FILES | 2 + src/QABugs/QABugs_20.cxx | 112 ++++++ src/RWStepAP214/RWStepAP214_GeneralModule.cxx | 52 ++- .../RWStepAP214_ReadWriteModule.cxx | 58 +++ src/RWStepVisual/FILES | 6 + ...tepVisual_RWCameraModelD3MultiClipping.cxx | 118 ++++++ ...tepVisual_RWCameraModelD3MultiClipping.hxx | 48 +++ ...CameraModelD3MultiClippingIntersection.cxx | 98 +++++ ...CameraModelD3MultiClippingIntersection.hxx | 48 +++ ...sual_RWCameraModelD3MultiClippingUnion.cxx | 98 +++++ ...sual_RWCameraModelD3MultiClippingUnion.hxx | 48 +++ src/STEPCAFControl/STEPCAFControl_Reader.cxx | 302 ++++++++++++++- src/STEPCAFControl/STEPCAFControl_Reader.hxx | 37 +- src/StepAP214/StepAP214_Protocol.cxx | 6 + src/StepVisual/FILES | 14 + ...aModelD3MultiClippingInterectionSelect.hxx | 23 ++ ...fCameraModelD3MultiClippingUnionSelect.hxx | 23 ++ .../StepVisual_CameraModelD3MultiClipping.cxx | 45 +++ .../StepVisual_CameraModelD3MultiClipping.hxx | 59 +++ ...aModelD3MultiClippingInterectionSelect.cxx | 45 +++ ...aModelD3MultiClippingInterectionSelect.hxx | 51 +++ ...CameraModelD3MultiClippingIntersection.cxx | 41 +++ ...CameraModelD3MultiClippingIntersection.hxx | 55 +++ ...Visual_CameraModelD3MultiClippingUnion.cxx | 41 +++ ...Visual_CameraModelD3MultiClippingUnion.hxx | 55 +++ ..._CameraModelD3MultiClippingUnionSelect.cxx | 47 +++ ..._CameraModelD3MultiClippingUnionSelect.hxx | 51 +++ ...aModelD3MultiClippingInterectionSelect.hxx | 24 ++ ...fCameraModelD3MultiClippingUnionSelect.hxx | 24 ++ src/XCAFDoc/FILES | 2 + src/XCAFDoc/XCAFDoc.cxx | 22 ++ src/XCAFDoc/XCAFDoc.hxx | 8 + src/XCAFDoc/XCAFDoc_ClippingPlaneTool.cxx | 347 ++++++++++++++++++ src/XCAFDoc/XCAFDoc_ClippingPlaneTool.hxx | 115 ++++++ src/XCAFDoc/XCAFDoc_DimTolTool.cxx | 30 ++ src/XCAFDoc/XCAFDoc_DimTolTool.hxx | 9 + src/XCAFDoc/XCAFDoc_DocumentTool.cxx | 22 ++ src/XCAFDoc/XCAFDoc_DocumentTool.hxx | 7 + src/XCAFDoc/XCAFDoc_View.cxx | 52 ++- src/XCAFDoc/XCAFDoc_ViewTool.cxx | 258 ++++++++++++- src/XCAFDoc/XCAFDoc_ViewTool.hxx | 33 +- src/XCAFView/XCAFView_Object.cxx | 9 +- src/XCAFView/XCAFView_Object.hxx | 61 ++- src/XDEDRAW/XDEDRAW.cxx | 3 + src/XDEDRAW/XDEDRAW_Views.cxx | 275 +++++++++++++- src/XmlMXCAFDoc/FILES | 2 + src/XmlMXCAFDoc/XmlMXCAFDoc.cxx | 2 + src/XmlMXCAFDoc/XmlMXCAFDoc.hxx | 2 + .../XmlMXCAFDoc_ClippingPlaneToolDriver.cxx | 64 ++++ .../XmlMXCAFDoc_ClippingPlaneToolDriver.hxx | 50 +++ tests/bugs/xde/bug22962 | 2 +- tests/bugs/xde/bug28044 | 1 + tests/gdt/export/B9 | 19 + tests/gdt/grids.list | 1 + tests/gdt/presentation/B8 | 8 + tests/gdt/view/A1 | 5 + tests/gdt/view/A2 | 5 + tests/gdt/view/A3 | 7 + tests/gdt/view/A4 | 7 + tests/gdt/view/A5 | 6 + tests/gdt/view/A6 | 8 + tests/gdt/view/A7 | 8 + tests/gdt/view/A8 | 5 + tests/gdt/view/A9 | 8 + tests/gdt/view/B1 | 8 + tests/gdt/view/B2 | 8 + tests/gdt/view/B4 | 5 + tests/gdt/view/B5 | 12 + tests/gdt/view/begin | 1 + tests/gdt/view/end | 25 ++ 73 files changed, 3191 insertions(+), 79 deletions(-) create mode 100644 src/BinMXCAFDoc/BinMXCAFDoc_ClippingPlaneToolDriver.cxx create mode 100644 src/BinMXCAFDoc/BinMXCAFDoc_ClippingPlaneToolDriver.hxx create mode 100644 src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClipping.cxx create mode 100644 src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClipping.hxx create mode 100644 src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClippingIntersection.cxx create mode 100644 src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClippingIntersection.hxx create mode 100644 src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClippingUnion.cxx create mode 100644 src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClippingUnion.hxx create mode 100644 src/StepVisual/StepVisual_Array1OfCameraModelD3MultiClippingInterectionSelect.hxx create mode 100644 src/StepVisual/StepVisual_Array1OfCameraModelD3MultiClippingUnionSelect.hxx create mode 100644 src/StepVisual/StepVisual_CameraModelD3MultiClipping.cxx create mode 100644 src/StepVisual/StepVisual_CameraModelD3MultiClipping.hxx create mode 100644 src/StepVisual/StepVisual_CameraModelD3MultiClippingInterectionSelect.cxx create mode 100644 src/StepVisual/StepVisual_CameraModelD3MultiClippingInterectionSelect.hxx create mode 100644 src/StepVisual/StepVisual_CameraModelD3MultiClippingIntersection.cxx create mode 100644 src/StepVisual/StepVisual_CameraModelD3MultiClippingIntersection.hxx create mode 100644 src/StepVisual/StepVisual_CameraModelD3MultiClippingUnion.cxx create mode 100644 src/StepVisual/StepVisual_CameraModelD3MultiClippingUnion.hxx create mode 100644 src/StepVisual/StepVisual_CameraModelD3MultiClippingUnionSelect.cxx create mode 100644 src/StepVisual/StepVisual_CameraModelD3MultiClippingUnionSelect.hxx create mode 100644 src/StepVisual/StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect.hxx create mode 100644 src/StepVisual/StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect.hxx create mode 100644 src/XCAFDoc/XCAFDoc_ClippingPlaneTool.cxx create mode 100644 src/XCAFDoc/XCAFDoc_ClippingPlaneTool.hxx create mode 100644 src/XmlMXCAFDoc/XmlMXCAFDoc_ClippingPlaneToolDriver.cxx create mode 100644 src/XmlMXCAFDoc/XmlMXCAFDoc_ClippingPlaneToolDriver.hxx create mode 100644 tests/gdt/export/B9 create mode 100644 tests/gdt/presentation/B8 create mode 100644 tests/gdt/view/A1 create mode 100644 tests/gdt/view/A2 create mode 100644 tests/gdt/view/A3 create mode 100644 tests/gdt/view/A4 create mode 100644 tests/gdt/view/A5 create mode 100644 tests/gdt/view/A6 create mode 100644 tests/gdt/view/A7 create mode 100644 tests/gdt/view/A8 create mode 100644 tests/gdt/view/A9 create mode 100644 tests/gdt/view/B1 create mode 100644 tests/gdt/view/B2 create mode 100644 tests/gdt/view/B4 create mode 100644 tests/gdt/view/B5 create mode 100644 tests/gdt/view/begin create mode 100644 tests/gdt/view/end diff --git a/src/BinMXCAFDoc/BinMXCAFDoc.hxx b/src/BinMXCAFDoc/BinMXCAFDoc.hxx index 8a19c5c97d..d18a4ce1b2 100644 --- a/src/BinMXCAFDoc/BinMXCAFDoc.hxx +++ b/src/BinMXCAFDoc/BinMXCAFDoc.hxx @@ -24,6 +24,7 @@ class BinMDF_ADriverTable; class CDM_MessageDriver; class BinMXCAFDoc_AreaDriver; class BinMXCAFDoc_CentroidDriver; +class BinMXCAFDoc_ClippingPlaneToolDriver; class BinMXCAFDoc_ColorDriver; class BinMXCAFDoc_GraphNodeDriver; class BinMXCAFDoc_LocationDriver; @@ -70,6 +71,7 @@ private: friend class BinMXCAFDoc_AreaDriver; friend class BinMXCAFDoc_CentroidDriver; +friend class BinMXCAFDoc_ClippingPlaneToolDriver; friend class BinMXCAFDoc_ColorDriver; friend class BinMXCAFDoc_GraphNodeDriver; friend class BinMXCAFDoc_LocationDriver; diff --git a/src/BinMXCAFDoc/BinMXCAFDoc_ClippingPlaneToolDriver.cxx b/src/BinMXCAFDoc/BinMXCAFDoc_ClippingPlaneToolDriver.cxx new file mode 100644 index 0000000000..54c510547f --- /dev/null +++ b/src/BinMXCAFDoc/BinMXCAFDoc_ClippingPlaneToolDriver.cxx @@ -0,0 +1,65 @@ +// Created on: 2016-11-30 +// 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. + + +#include +#include +#include +#include +#include +#include + +IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_ClippingPlaneToolDriver, BinMDF_ADriver) + +//======================================================================= +//function : +//purpose : +//======================================================================= +BinMXCAFDoc_ClippingPlaneToolDriver::BinMXCAFDoc_ClippingPlaneToolDriver + (const Handle(CDM_MessageDriver)& theMsgDriver) + : BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_ClippingPlaneTool)->Name()) +{ +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +Handle(TDF_Attribute) BinMXCAFDoc_ClippingPlaneToolDriver::NewEmpty() const +{ + return new XCAFDoc_ClippingPlaneTool(); +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +Standard_Boolean BinMXCAFDoc_ClippingPlaneToolDriver::Paste + (const BinObjMgt_Persistent& /*theSource*/, + const Handle(TDF_Attribute)& /*theTarget*/, + BinObjMgt_RRelocationTable& /*theRelocTable*/) const +{ + return Standard_True; +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void BinMXCAFDoc_ClippingPlaneToolDriver::Paste + (const Handle(TDF_Attribute)& /*theSource*/, + BinObjMgt_Persistent& /*theTarget*/, + BinObjMgt_SRelocationTable& /*theRelocTable*/) const { +} diff --git a/src/BinMXCAFDoc/BinMXCAFDoc_ClippingPlaneToolDriver.hxx b/src/BinMXCAFDoc/BinMXCAFDoc_ClippingPlaneToolDriver.hxx new file mode 100644 index 0000000000..b86cc75c55 --- /dev/null +++ b/src/BinMXCAFDoc/BinMXCAFDoc_ClippingPlaneToolDriver.hxx @@ -0,0 +1,50 @@ +// Created on: 2016-11-30 +// 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 _BinMXCAFDoc_ClippingPlaneToolDriver_HeaderFile +#define _BinMXCAFDoc_ClippingPlaneToolDriver_HeaderFile + +#include +#include + +#include +#include +#include +#include +class CDM_MessageDriver; +class TDF_Attribute; +class BinObjMgt_Persistent; + + +class BinMXCAFDoc_ClippingPlaneToolDriver; +DEFINE_STANDARD_HANDLE(BinMXCAFDoc_ClippingPlaneToolDriver, BinMDF_ADriver) + + +class BinMXCAFDoc_ClippingPlaneToolDriver : public BinMDF_ADriver +{ +public: + + Standard_EXPORT BinMXCAFDoc_ClippingPlaneToolDriver(const Handle(CDM_MessageDriver)& theMsgDriver); + + Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; + + Standard_EXPORT virtual Standard_Boolean Paste(const BinObjMgt_Persistent& theSource, const Handle(TDF_Attribute)& theTarget, BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE; + + Standard_EXPORT virtual void Paste(const Handle(TDF_Attribute)& theSource, BinObjMgt_Persistent& theTarget, BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_ClippingPlaneToolDriver, BinMDF_ADriver) + +}; +#endif // _BinMXCAFDoc_ClippingPlaneToolDriver_HeaderFile diff --git a/src/BinMXCAFDoc/FILES b/src/BinMXCAFDoc/FILES index 5d89c2af9c..fe29702e24 100644 --- a/src/BinMXCAFDoc/FILES +++ b/src/BinMXCAFDoc/FILES @@ -4,6 +4,8 @@ BinMXCAFDoc_AreaDriver.cxx BinMXCAFDoc_AreaDriver.hxx BinMXCAFDoc_CentroidDriver.cxx BinMXCAFDoc_CentroidDriver.hxx +BinMXCAFDoc_ClippingPlaneToolDriver.cxx +BinMXCAFDoc_ClippingPlaneToolDriver.hxx BinMXCAFDoc_ColorDriver.cxx BinMXCAFDoc_ColorDriver.hxx BinMXCAFDoc_ColorToolDriver.cxx diff --git a/src/QABugs/QABugs_20.cxx b/src/QABugs/QABugs_20.cxx index 2b88cf893e..0fc575a01d 100644 --- a/src/QABugs/QABugs_20.cxx +++ b/src/QABugs/QABugs_20.cxx @@ -2182,6 +2182,117 @@ static Standard_Integer OCC28217(Draw_Interpretor& theDI, return 0; } +#include +#include +#include +#include +#include +static Standard_Integer OCC28389(Draw_Interpretor& di, Standard_Integer argc, const char** argv) +{ + if (argc < 20) { + di << "Use: OCC28389 Doc label nb_shapes nb_GDT nb_planes name type pp_x pp_y pp_z vd_x vd_y vd_z ud_x ud_y ud_z zoom width height"; + return 1; + } + Handle(TDocStd_Document) aDoc; + DDocStd::GetDocument(argv[1], aDoc); + if (aDoc.IsNull()) { + di << "Error: Wrong document"; + return 1; + } + Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main()); + + TDF_Label aLabel; + TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel); + if (aLabel.IsNull()) { + di << "Error: Wrong label"; + return 1; + } + Handle(XCAFDoc_View) aView; + if (!aLabel.FindAttribute(XCAFDoc_View::GetID(), aView)) { + di << "Error: Wrong label"; + return 1; + } + Handle(XCAFView_Object) anObj = aView->GetObject(); + if (anObj.IsNull()) { + di << "Error: Wrong label"; + return 1; + } + + Standard_Boolean isOK = Standard_True; + // check links + Standard_Integer nbShapes = Draw::Atoi(argv[3]); + Standard_Integer nbGDTs = Draw::Atoi(argv[4]); + Standard_Integer nbPlanes = Draw::Atoi(argv[5]); + TDF_LabelSequence aSequence; + aViewTool->GetRefShapeLabel(aLabel, aSequence); + if (aSequence.Length() != nbShapes) + isOK = Standard_False; + aSequence.Clear(); + aViewTool->GetRefGDTLabel(aLabel, aSequence); + if (aSequence.Length() != nbGDTs) + isOK = Standard_False; + aSequence.Clear(); + aViewTool->GetRefClippingPlaneLabel(aLabel, aSequence); + if (aSequence.Length() != nbPlanes) + isOK = Standard_False; + if (!isOK) { + di << "Error: Wrong references"; + return 1; + } + + if (anObj->Name()->IsDifferent(new TCollection_HAsciiString(argv[6]))) { + di << "Error: Wrong name"; + return 1; + } + + XCAFView_ProjectionType aType = XCAFView_ProjectionType_NoCamera; + if (argv[7][0] == 'p') + aType = XCAFView_ProjectionType_Parallel; + else if (argv[7][0] == 'c') + aType = XCAFView_ProjectionType_Central; + + if (anObj->Type()!= aType) { + di << "Error: Wrong type"; + return 1; + } + + gp_Pnt aPP(Draw::Atof(argv[8]), Draw::Atof(argv[9]), Draw::Atof(argv[10])); + if (aPP.Distance(anObj->ProjectionPoint()) > Precision::Confusion()) { + di << "Error: Wrong projection point"; + return 1; + } + + gp_Dir aVD(Draw::Atof(argv[11]), Draw::Atof(argv[12]), Draw::Atof(argv[13])); + if (!aVD.IsEqual(anObj->ViewDirection(), Precision::Angular())) { + di << "Error: Wrong view direction"; + return 1; + } + + gp_Dir aUD(Draw::Atof(argv[14]), Draw::Atof(argv[15]), Draw::Atof(argv[16])); + if (!aUD.IsEqual(anObj->UpDirection(), Precision::Angular())) { + di << "Error: Wrong up direction"; + return 1; + } + + if (fabs(anObj->ZoomFactor() - Draw::Atof(argv[17])) > Precision::Confusion()) { + di << "Error: Wrong zoom factor"; + return 1; + } + + if (fabs(anObj->WindowHorizontalSize() - Draw::Atof(argv[18])) > Precision::Confusion()) + isOK = Standard_False; + if (fabs(anObj->WindowVerticalSize() - Draw::Atof(argv[19])) > Precision::Confusion()) + isOK = Standard_False; + if (!isOK) { + di << "Error: Wrong Window size"; + return 1; + } + + di << argv[2] << " OK"; + return 0; +} + + void QABugs::Commands_20(Draw_Interpretor& theCommands) { const char *group = "QABugs"; @@ -2203,6 +2314,7 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) { theCommands.Add ("OCC27552", "OCC27552", __FILE__, OCC27552, group); theCommands.Add("OCC27875", "OCC27875 curve", __FILE__, OCC27875, group); theCommands.Add("OCC28217", "OCC28217", __FILE__, OCC28217, group); + theCommands.Add("OCC28389", "OCC28389", __FILE__, OCC28389, group); return; } diff --git a/src/RWStepAP214/RWStepAP214_GeneralModule.cxx b/src/RWStepAP214/RWStepAP214_GeneralModule.cxx index 7ddad401cb..bf5961c606 100644 --- a/src/RWStepAP214/RWStepAP214_GeneralModule.cxx +++ b/src/RWStepAP214/RWStepAP214_GeneralModule.cxx @@ -1097,19 +1097,6 @@ #include #include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - - IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_GeneralModule,StepData_GeneralModule) //#define DeclareAndCast(atype,result,start) \ NON car Name @@ -1363,6 +1350,12 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_GeneralModule,StepData_GeneralModule) #include #include #include +#include +#include +#include +#include +#include +#include static Standard_Integer catsh,catdr,catstr,catdsc,cataux; @@ -5135,6 +5128,27 @@ void RWStepAP214_GeneralModule::FillSharedCase(const Standard_Integer CN, RWStepVisual_RWCharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation tool; tool.Share(anent, iter); } + break; + case 716: + { + DeclareAndCast(StepVisual_CameraModelD3MultiClipping, anent, ent); + RWStepVisual_RWCameraModelD3MultiClipping tool; + tool.Share(anent, iter); + } + break; + case 717: + { + DeclareAndCast(StepVisual_CameraModelD3MultiClippingIntersection, anent, ent); + RWStepVisual_RWCameraModelD3MultiClippingIntersection tool; + tool.Share(anent, iter); + } + break; + case 718: + { + DeclareAndCast(StepVisual_CameraModelD3MultiClippingUnion, anent, ent); + RWStepVisual_RWCameraModelD3MultiClippingUnion tool; + tool.Share(anent, iter); + } break; default : break; } @@ -7136,6 +7150,15 @@ Standard_Boolean RWStepAP214_GeneralModule::NewVoid case 715: ent = new StepVisual_CharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation; break; + case 716: + ent = new StepVisual_CameraModelD3MultiClipping; + break; + case 717: + ent = new StepVisual_CameraModelD3MultiClippingIntersection; + break; + case 718: + ent = new StepVisual_CameraModelD3MultiClippingUnion; + break; default: @@ -7732,6 +7755,9 @@ Standard_Integer RWStepAP214_GeneralModule::CategoryNumber case 713: return catsh; case 714: return catstr; case 715: return catdsc; + case 716: + case 717: + case 718: return cataux; default : break; } diff --git a/src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx b/src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx index 0d3edcba7a..e9e0354707 100644 --- a/src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx +++ b/src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx @@ -1398,6 +1398,12 @@ Handle(atype) result = Handle(atype)::DownCast (start) #include #include #include +#include +#include +#include +#include +#include +#include // -- General Declarations (Recognize, StepType) --- @@ -2037,6 +2043,9 @@ static TCollection_AsciiString Reco_CoordinatesList("COORDINATES_LIST"); static TCollection_AsciiString Reco_ConstructiveGeometryRepresentation("CONSTRUCTIVE_GEOMETRY_REPRESENTATION"); static TCollection_AsciiString Reco_ConstructiveGeometryRepresentationRelationship("CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP"); static TCollection_AsciiString Reco_CharacterizedRepresentation("CHARACTERIZED_REPRESENTATION"); +static TCollection_AsciiString Reco_CameraModelD3MultiClipping("CAMERA_MODEL_D3_MULTI_CLIPPING"); +static TCollection_AsciiString Reco_CameraModelD3MultiClippingIntersection("CAMERA_MODEL_D3_MULTI_CLIPPING_INTERSECTION"); +static TCollection_AsciiString Reco_CameraModelD3MultiClippingUnion("CAMERA_MODEL_D3_MULTI_CLIPPING_UNION"); // -- Definition of the libraries -- static NCollection_DataMap typenums; @@ -2690,6 +2699,9 @@ RWStepAP214_ReadWriteModule::RWStepAP214_ReadWriteModule () typenums.Bind ( Reco_ConstructiveGeometryRepresentation, 712); typenums.Bind ( Reco_ConstructiveGeometryRepresentationRelationship, 713); typenums.Bind ( Reco_CharacterizedRepresentation, 714); + typenums.Bind ( Reco_CameraModelD3MultiClipping, 716); + typenums.Bind ( Reco_CameraModelD3MultiClippingIntersection, 717); + typenums.Bind ( Reco_CameraModelD3MultiClippingUnion, 718); // SHORT NAMES @@ -4519,6 +4531,9 @@ const TCollection_AsciiString& RWStepAP214_ReadWriteModule::StepType case 712 : return Reco_ConstructiveGeometryRepresentation; case 713 : return Reco_ConstructiveGeometryRepresentationRelationship; case 714 : return Reco_CharacterizedRepresentation; + case 716 : return Reco_CameraModelD3MultiClipping; + case 717 : return Reco_CameraModelD3MultiClippingIntersection; + case 718 : return Reco_CameraModelD3MultiClippingUnion; default : return PasReco; } @@ -9383,6 +9398,27 @@ void RWStepAP214_ReadWriteModule::ReadStep(const Standard_Integer CN, tool.ReadStep(data, num, ach, anent); } break; + case 716: + { + DeclareAndCast(StepVisual_CameraModelD3MultiClipping, anent, ent); + RWStepVisual_RWCameraModelD3MultiClipping tool; + tool.ReadStep(data, num, ach, anent); + } + break; + case 717: + { + DeclareAndCast(StepVisual_CameraModelD3MultiClippingIntersection, anent, ent); + RWStepVisual_RWCameraModelD3MultiClippingIntersection tool; + tool.ReadStep(data, num, ach, anent); + } + break; + case 718: + { + DeclareAndCast(StepVisual_CameraModelD3MultiClippingUnion, anent, ent); + RWStepVisual_RWCameraModelD3MultiClippingUnion tool; + tool.ReadStep(data, num, ach, anent); + } + break; default: ach->AddFail("Type Mismatch when reading - Entity"); @@ -14211,6 +14247,28 @@ void RWStepAP214_ReadWriteModule::WriteStep(const Standard_Integer CN, tool.WriteStep(SW, anent); } break; + case 716: + { + DeclareAndCast(StepVisual_CameraModelD3MultiClipping, anent, ent); + RWStepVisual_RWCameraModelD3MultiClipping tool; + tool.WriteStep(SW, anent); + } + break; + case 717: + { + DeclareAndCast(StepVisual_CameraModelD3MultiClippingIntersection, anent, ent); + RWStepVisual_RWCameraModelD3MultiClippingIntersection tool; + tool.WriteStep(SW, anent); + } + break; + case 718: + { + DeclareAndCast(StepVisual_CameraModelD3MultiClippingUnion, anent, ent); + RWStepVisual_RWCameraModelD3MultiClippingUnion tool; + tool.WriteStep(SW, anent); + } + break; + default: return; diff --git a/src/RWStepVisual/FILES b/src/RWStepVisual/FILES index f6f964ded4..83090daf37 100644 --- a/src/RWStepVisual/FILES +++ b/src/RWStepVisual/FILES @@ -20,6 +20,12 @@ RWStepVisual_RWCameraModelD2.cxx RWStepVisual_RWCameraModelD2.hxx RWStepVisual_RWCameraModelD3.cxx RWStepVisual_RWCameraModelD3.hxx +RWStepVisual_RWCameraModelD3MultiClipping.cxx +RWStepVisual_RWCameraModelD3MultiClipping.hxx +RWStepVisual_RWCameraModelD3MultiClippingIntersection.cxx +RWStepVisual_RWCameraModelD3MultiClippingIntersection.hxx +RWStepVisual_RWCameraModelD3MultiClippingUnion.cxx +RWStepVisual_RWCameraModelD3MultiClippingUnion.hxx RWStepVisual_RWCameraUsage.cxx RWStepVisual_RWCameraUsage.hxx RWStepVisual_RWCharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation.cxx diff --git a/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClipping.cxx b/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClipping.cxx new file mode 100644 index 0000000000..697936572a --- /dev/null +++ b/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClipping.cxx @@ -0,0 +1,118 @@ +// Created on: 2016-10-25 +// 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. + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : RWStepVisual_RWCameraModelD3MultiClipping +//purpose : +//======================================================================= +RWStepVisual_RWCameraModelD3MultiClipping::RWStepVisual_RWCameraModelD3MultiClipping() {} + +//======================================================================= +//function : ReadStep +//purpose : +//======================================================================= +void RWStepVisual_RWCameraModelD3MultiClipping::ReadStep + (const Handle(StepData_StepReaderData)& data, + const Standard_Integer num, + Handle(Interface_Check)& ach, + const Handle(StepVisual_CameraModelD3MultiClipping)& ent) const +{ + // Number of Parameter Control + if (!data->CheckNbParams(num, 4, ach, "camera_model_d3_multi_clipping")) + return; + + // Inherited field : name + Handle(TCollection_HAsciiString) aName; + data->ReadString (num, 1, "name", ach, aName); + + //Inherited field : view_reference_system + Handle(StepGeom_Axis2Placement3d) aViewReferenceSystem; + data->ReadEntity(num, 2, "view_reference_system", ach, STANDARD_TYPE(StepGeom_Axis2Placement3d), aViewReferenceSystem); + + // Inherited field : perspective_of_volume + Handle(StepVisual_ViewVolume) aPerspectiveOfVolume; + data->ReadEntity(num, 3, "perspective_of_volume", ach, STANDARD_TYPE(StepVisual_ViewVolume), aPerspectiveOfVolume); + + // Own field : shape_clipping + Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect) aShapeClipping; + StepVisual_CameraModelD3MultiClippingInterectionSelect anEnt; + Standard_Integer nbSub; + if (data->ReadSubList(num, 4, "shape_clipping", ach, nbSub)) { + Standard_Integer nbElements = data->NbParams(nbSub); + aShapeClipping = new StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect(1, nbElements); + for (Standard_Integer i = 1; i <= nbElements; i++) { + if (data->ReadEntity(nbSub, i, "shape_clipping", ach, anEnt)) + aShapeClipping->SetValue(i, anEnt); + } + } + + // Initialization of the read entity + ent->Init(aName, aViewReferenceSystem, aPerspectiveOfVolume, aShapeClipping); +} + +//======================================================================= +//function : WriteStep +//purpose : +//======================================================================= +void RWStepVisual_RWCameraModelD3MultiClipping::WriteStep + (StepData_StepWriter& SW, + const Handle(StepVisual_CameraModelD3MultiClipping)& ent) const +{ + // Inherited field name + SW.Send(ent->Name()); + + // Inherited field view_reference_system + SW.Send(ent->ViewReferenceSystem()); + + // Inherited field view_reference_system + SW.Send(ent->PerspectiveOfVolume()); + + // Own field: shape_clipping + SW.OpenSub(); + for (Standard_Integer i = 1; i <= ent->ShapeClipping()->Length(); i++) { + SW.Send(ent->ShapeClipping()->Value(i).Value()); + } + SW.CloseSub(); +} + +//======================================================================= +//function : Share +//purpose : +//======================================================================= +void RWStepVisual_RWCameraModelD3MultiClipping::Share + (const Handle(StepVisual_CameraModelD3MultiClipping)& ent, + Interface_EntityIterator& iter) const +{ + // Inherited field view_reference_system + iter.GetOneItem(ent->ViewReferenceSystem()); + // Inherited field : perspective_of_volume + iter.GetOneItem(ent->PerspectiveOfVolume()); + // Own field: shape_clipping + Standard_Integer i, nb = ent->ShapeClipping()->Length(); + for (i = 1; i <= nb; i++) + iter.AddItem(ent->ShapeClipping()->Value(i).Value()); +} + diff --git a/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClipping.hxx b/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClipping.hxx new file mode 100644 index 0000000000..725d83089b --- /dev/null +++ b/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClipping.hxx @@ -0,0 +1,48 @@ +// Created on: 2016-10-25 +// 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 _RWStepVisual_RWCameraModelD3MultiClipping_HeaderFile +#define _RWStepVisual_RWCameraModelD3MultiClipping_HeaderFile + +#include +#include +#include + +#include +class StepData_StepReaderData; +class Interface_Check; +class StepVisual_CameraModelD3MultiClipping; +class StepData_StepWriter; +class Interface_EntityIterator; + +//! Read & Write Module for CameraModelD3MultiClipping +class RWStepVisual_RWCameraModelD3MultiClipping +{ +public: + + DEFINE_STANDARD_ALLOC + + Standard_EXPORT RWStepVisual_RWCameraModelD3MultiClipping(); + + Standard_EXPORT void ReadStep (const Handle(StepData_StepReaderData)& data, + const Standard_Integer num, + Handle(Interface_Check)& ach, + const Handle(StepVisual_CameraModelD3MultiClipping)& ent) const; + + Standard_EXPORT void WriteStep (StepData_StepWriter& SW, const Handle(StepVisual_CameraModelD3MultiClipping)& ent) const; + + Standard_EXPORT void Share(const Handle(StepVisual_CameraModelD3MultiClipping)& ent, Interface_EntityIterator& iter) const; +}; +#endif // _RWStepVisual_RWCameraModelD3MultiClipping_HeaderFile diff --git a/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClippingIntersection.cxx b/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClippingIntersection.cxx new file mode 100644 index 0000000000..75cb3fe307 --- /dev/null +++ b/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClippingIntersection.cxx @@ -0,0 +1,98 @@ +// Created on: 2016-11-14 +// 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. + + +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : RWStepVisual_RWCameraModelD3MultiClippingIntersection +//purpose : +//======================================================================= +RWStepVisual_RWCameraModelD3MultiClippingIntersection::RWStepVisual_RWCameraModelD3MultiClippingIntersection() {} + +//======================================================================= +//function : ReadStep +//purpose : +//======================================================================= +void RWStepVisual_RWCameraModelD3MultiClippingIntersection::ReadStep + (const Handle(StepData_StepReaderData)& data, + const Standard_Integer num, + Handle(Interface_Check)& ach, + const Handle(StepVisual_CameraModelD3MultiClippingIntersection)& ent) const +{ + // Number of Parameter Control + if (!data->CheckNbParams(num, 2, ach, "camera_model_d3_multi_clipping_intersection")) + return; + + // Inherited field : name + Handle(TCollection_HAsciiString) aName; + data->ReadString (num, 1, "name", ach, aName); + + // Own field : shape_clipping + Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect) aShapeClipping; + StepVisual_CameraModelD3MultiClippingInterectionSelect anEnt; + Standard_Integer nbSub; + if (data->ReadSubList(num, 2, "shape_clipping", ach, nbSub)) { + Standard_Integer nbElements = data->NbParams(nbSub); + aShapeClipping = new StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect(1, nbElements); + for (Standard_Integer i = 1; i <= nbElements; i++) { + if (data->ReadEntity(nbSub, i, "shape_clipping", ach, anEnt)) + aShapeClipping->SetValue(i, anEnt); + } + } + + // Initialization of the read entity + ent->Init(aName, aShapeClipping); +} + +//======================================================================= +//function : WriteStep +//purpose : +//======================================================================= +void RWStepVisual_RWCameraModelD3MultiClippingIntersection::WriteStep + (StepData_StepWriter& SW, + const Handle(StepVisual_CameraModelD3MultiClippingIntersection)& ent) const +{ + // Inherited field name + SW.Send(ent->Name()); + + // Own field: shape_clipping + SW.OpenSub(); + for (Standard_Integer i = 1; i <= ent->ShapeClipping()->Length(); i++) { + SW.Send(ent->ShapeClipping()->Value(i).Value()); + } + SW.CloseSub(); +} + +//======================================================================= +//function : Share +//purpose : +//======================================================================= +void RWStepVisual_RWCameraModelD3MultiClippingIntersection::Share + (const Handle(StepVisual_CameraModelD3MultiClippingIntersection)& ent, + Interface_EntityIterator& iter) const +{ + // Own field: shape_clipping + Standard_Integer i, nb = ent->ShapeClipping()->Length(); + for (i = 1; i <= nb; i++) + iter.AddItem(ent->ShapeClipping()->Value(i).Value()); +} + diff --git a/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClippingIntersection.hxx b/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClippingIntersection.hxx new file mode 100644 index 0000000000..bc35496763 --- /dev/null +++ b/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClippingIntersection.hxx @@ -0,0 +1,48 @@ +// Created on: 2016-11-14 +// 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 _RWStepVisual_RWCameraModelD3MultiClippingIntersection_HeaderFile +#define _RWStepVisual_RWCameraModelD3MultiClippingIntersection_HeaderFile + +#include +#include +#include + +#include +class StepData_StepReaderData; +class Interface_Check; +class StepVisual_CameraModelD3MultiClippingIntersection; +class StepData_StepWriter; +class Interface_EntityIterator; + +//! Read & Write Module for CameraModelD3MultiClippingIntersection +class RWStepVisual_RWCameraModelD3MultiClippingIntersection +{ +public: + + DEFINE_STANDARD_ALLOC + + Standard_EXPORT RWStepVisual_RWCameraModelD3MultiClippingIntersection(); + + Standard_EXPORT void ReadStep (const Handle(StepData_StepReaderData)& data, + const Standard_Integer num, + Handle(Interface_Check)& ach, + const Handle(StepVisual_CameraModelD3MultiClippingIntersection)& ent) const; + + Standard_EXPORT void WriteStep (StepData_StepWriter& SW, const Handle(StepVisual_CameraModelD3MultiClippingIntersection)& ent) const; + + Standard_EXPORT void Share(const Handle(StepVisual_CameraModelD3MultiClippingIntersection)& ent, Interface_EntityIterator& iter) const; +}; +#endif // _RWStepVisual_RWCameraModelD3MultiClippingIntersection_HeaderFile diff --git a/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClippingUnion.cxx b/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClippingUnion.cxx new file mode 100644 index 0000000000..c6e41e2eab --- /dev/null +++ b/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClippingUnion.cxx @@ -0,0 +1,98 @@ +// Created on: 2016-11-14 +// 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. + + +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : RWStepVisual_RWCameraModelD3MultiClippingUnion +//purpose : +//======================================================================= +RWStepVisual_RWCameraModelD3MultiClippingUnion::RWStepVisual_RWCameraModelD3MultiClippingUnion() {} + +//======================================================================= +//function : ReadStep +//purpose : +//======================================================================= +void RWStepVisual_RWCameraModelD3MultiClippingUnion::ReadStep + (const Handle(StepData_StepReaderData)& data, + const Standard_Integer num, + Handle(Interface_Check)& ach, + const Handle(StepVisual_CameraModelD3MultiClippingUnion)& ent) const +{ + // Number of Parameter Control + if (!data->CheckNbParams(num, 2, ach, "camera_model_d3_multi_clipping_union")) + return; + + // Inherited field : name + Handle(TCollection_HAsciiString) aName; + data->ReadString (num, 1, "name", ach, aName); + + // Own field : shape_clipping + Handle(StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect) aShapeClipping; + StepVisual_CameraModelD3MultiClippingUnionSelect anEnt; + Standard_Integer nbSub; + if (data->ReadSubList(num, 2, "shape_clipping", ach, nbSub)) { + Standard_Integer nbElements = data->NbParams(nbSub); + aShapeClipping = new StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect(1, nbElements); + for (Standard_Integer i = 1; i <= nbElements; i++) { + if (data->ReadEntity(nbSub, i, "shape_clipping", ach, anEnt)) + aShapeClipping->SetValue(i, anEnt); + } + } + + // Initialization of the read entity + ent->Init(aName, aShapeClipping); +} + +//======================================================================= +//function : WriteStep +//purpose : +//======================================================================= +void RWStepVisual_RWCameraModelD3MultiClippingUnion::WriteStep + (StepData_StepWriter& SW, + const Handle(StepVisual_CameraModelD3MultiClippingUnion)& ent) const +{ + // Inherited field name + SW.Send(ent->Name()); + + // Own field: shape_clipping + SW.OpenSub(); + for (Standard_Integer i = 1; i <= ent->ShapeClipping()->Length(); i++) { + SW.Send(ent->ShapeClipping()->Value(i).Value()); + } + SW.CloseSub(); +} + +//======================================================================= +//function : Share +//purpose : +//======================================================================= +void RWStepVisual_RWCameraModelD3MultiClippingUnion::Share + (const Handle(StepVisual_CameraModelD3MultiClippingUnion)& ent, + Interface_EntityIterator& iter) const +{ + // Own field: shape_clipping + Standard_Integer i, nb = ent->ShapeClipping()->Length(); + for (i = 1; i <= nb; i++) + iter.AddItem(ent->ShapeClipping()->Value(i).Value()); +} + diff --git a/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClippingUnion.hxx b/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClippingUnion.hxx new file mode 100644 index 0000000000..d62fc19887 --- /dev/null +++ b/src/RWStepVisual/RWStepVisual_RWCameraModelD3MultiClippingUnion.hxx @@ -0,0 +1,48 @@ +// Created on: 2016-11-14 +// 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 _RWStepVisual_RWCameraModelD3MultiClippingUnion_HeaderFile +#define _RWStepVisual_RWCameraModelD3MultiClippingUnion_HeaderFile + +#include +#include +#include + +#include +class StepData_StepReaderData; +class Interface_Check; +class StepVisual_CameraModelD3MultiClippingUnion; +class StepData_StepWriter; +class Interface_EntityIterator; + +//! Read & Write Module for CameraModelD3MultiClippingUnion +class RWStepVisual_RWCameraModelD3MultiClippingUnion +{ +public: + + DEFINE_STANDARD_ALLOC + + Standard_EXPORT RWStepVisual_RWCameraModelD3MultiClippingUnion(); + + Standard_EXPORT void ReadStep (const Handle(StepData_StepReaderData)& data, + const Standard_Integer num, + Handle(Interface_Check)& ach, + const Handle(StepVisual_CameraModelD3MultiClippingUnion)& ent) const; + + Standard_EXPORT void WriteStep (StepData_StepWriter& SW, const Handle(StepVisual_CameraModelD3MultiClippingUnion)& ent) const; + + Standard_EXPORT void Share(const Handle(StepVisual_CameraModelD3MultiClippingUnion)& ent, Interface_EntityIterator& iter) const; +}; +#endif // _RWStepVisual_RWCameraModelD3MultiClippingUnion_HeaderFile diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/STEPCAFControl/STEPCAFControl_Reader.cxx index b318b48294..674093f9ab 100644 --- a/src/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -16,6 +16,8 @@ #include #include +#include +#include #include #include #include @@ -109,6 +111,7 @@ #include #include #include +#include #include #include #include @@ -117,6 +120,7 @@ #include #include #include +#include #include #include #include @@ -177,6 +181,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -187,6 +198,7 @@ #include #include #include +#include #include #include #include @@ -218,6 +230,7 @@ #include #include #include +#include #include #include #include @@ -229,12 +242,15 @@ #include #include #include +#include +#include #include #include #include #include #include #include +#include #include #include #include @@ -321,7 +337,8 @@ STEPCAFControl_Reader::STEPCAFControl_Reader (): myPropsMode( Standard_True ), mySHUOMode ( Standard_False ), myGDTMode ( Standard_True ), - myMatMode ( Standard_True ) + myMatMode(Standard_True), + myViewMode(Standard_True) { STEPCAFControl_Controller::Init(); } @@ -340,7 +357,8 @@ STEPCAFControl_Reader::STEPCAFControl_Reader (const Handle(XSControl_WorkSession myPropsMode( Standard_True ), mySHUOMode ( Standard_False ), myGDTMode ( Standard_True ), - myMatMode ( Standard_True ) + myMatMode(Standard_True), + myViewMode(Standard_True) { STEPCAFControl_Controller::Init(); Init ( WS, scratch ); @@ -685,6 +703,10 @@ Standard_Boolean STEPCAFControl_Reader::Transfer (STEPControl_Reader &reader, if(GetMatMode()) ReadMaterials(reader.WS(),doc,SeqPDS); + // read View entities from STEP model + if (GetViewMode()) + ReadViews(reader.WS(), doc); + // Expand resulting CAF structure for sub-shapes (optionally with their // names) if requested ExpandSubShapes(STool, map, ShapePDMap); @@ -2346,14 +2368,14 @@ static TDF_Label getShapeLabel(const Handle(StepRepr_RepresentationItem)& theIte //purpose : //======================================================================= -static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat, - const TDF_Label theGDTL, - const Standard_Integer thePositionCounter, - const XCAFDimTolObjects_DatumModifiersSequence& theXCAFModifiers, - const XCAFDimTolObjects_DatumModifWithValue theXCAFModifWithVal, - const Standard_Real theModifValue, - const Handle(TDocStd_Document)& theDoc, - const Handle(XSControl_WorkSession)& theWS) +Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat, + const TDF_Label theGDTL, + const Standard_Integer thePositionCounter, + const XCAFDimTolObjects_DatumModifiersSequence& theXCAFModifiers, + const XCAFDimTolObjects_DatumModifWithValue theXCAFModifWithVal, + const Standard_Real theModifValue, + const Handle(TDocStd_Document)& theDoc, + const Handle(XSControl_WorkSession)& theWS) { Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main()); Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool(theDoc->Main()); @@ -2532,6 +2554,8 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat, // Create datum target object if (isValidDT) { TDF_Label aDatL = aDGTTool->AddDatum(); + myGDTMap.Bind(aDT, aDatL); + aDGTTool->Lock(aDatL); aDat = XCAFDoc_Datum::Set(aDatL); aDGTTool->SetDatum(aDTShapeLabels, aDatL); aDatTargetObj->SetName(theDat->Identification()); @@ -2552,6 +2576,8 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat, if (aShapeLabels.Length() > 0 || !isExistDatumTarget) { // Create object for datum TDF_Label aDatL = aDGTTool->AddDatum(); + myGDTMap.Bind(theDat, aDatL); + aDGTTool->Lock(aDatL); aDat = XCAFDoc_Datum::Set(aDatL); aDGTTool->SetDatum(aShapeLabels, aDatL); aDatObj->SetName(theDat->Identification()); @@ -2576,10 +2602,10 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat, //function : ReadDatums //purpose : auxilary //======================================================================= -static Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt, - const TDF_Label theGDTL, - const Handle(TDocStd_Document)& theDoc, - const Handle(XSControl_WorkSession)& theWS) +Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Transient)& theEnt, + const TDF_Label theGDTL, + const Handle(TDocStd_Document)& theDoc, + const Handle(XSControl_WorkSession)& theWS) { const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader(); const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess(); @@ -2724,9 +2750,9 @@ static Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt //function : createGeomTolObjectInXCAF //purpose : //======================================================================= -static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt, - const Handle(TDocStd_Document)& theDoc, - const Handle(XSControl_WorkSession)& theWS) +TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt, + const Handle(TDocStd_Document)& theDoc, + const Handle(XSControl_WorkSession)& theWS) { TDF_Label aGDTL; if(!theEnt->IsKind(STANDARD_TYPE(StepShape_DimensionalSize)) && @@ -3092,6 +3118,8 @@ static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt, if(!theEnt->IsKind(STANDARD_TYPE(StepDimTol_GeometricTolerance))) { aGDTL = aDGTTool->AddDimension(); + myGDTMap.Bind(theEnt, aGDTL); + aDGTTool->Lock(aGDTL); Handle(XCAFDoc_Dimension) aDim = XCAFDoc_Dimension::Set(aGDTL); TCollection_AsciiString aStr("DGT:Dimensional_"); if(theEnt->IsKind(STANDARD_TYPE(StepShape_DimensionalSize))) @@ -3117,6 +3145,8 @@ static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt, else { aGDTL = aDGTTool->AddGeomTolerance(); + myGDTMap.Bind(theEnt, aGDTL); + aDGTTool->Lock(aGDTL); Handle(XCAFDoc_GeomTolerance) aGTol = XCAFDoc_GeomTolerance::Set(aGDTL); TCollection_AsciiString aStr("DGT:GeomTolerance"); TDataStd_Name::Set(aGDTL, aStr); @@ -3791,7 +3821,7 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt, //======================================================================= Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSession)& theWS, - Handle(TDocStd_Document)& theDoc) const + Handle(TDocStd_Document)& theDoc) { const Handle(Interface_InterfaceModel) &aModel = theWS->Model(); const Interface_Graph& aGraph = theWS->Graph(); @@ -3920,6 +3950,8 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess // Set object to XCAF TDF_Label aGDTL = aDGTTool->AddDimension(); + myGDTMap.Bind(anEnt, aGDTL); + aDGTTool->Lock(aGDTL); Handle(XCAFDimTolObjects_DimensionObject) aDimObj = new XCAFDimTolObjects_DimensionObject(); Handle(XCAFDoc_Dimension) aDim = XCAFDoc_Dimension::Set(aGDTL); TCollection_AsciiString aStr("DGT:"); @@ -4095,6 +4127,220 @@ Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_Wor return Standard_True; } +//======================================================================= +//function : collectViewShapes +//purpose : collect all labels of representations in given representation +//======================================================================= + +void collectViewShapes(const Handle(XSControl_WorkSession)& theWS, + const Handle(TDocStd_Document)& theDoc, + const Handle(StepRepr_Representation) theRepr, + TDF_LabelSequence& theShapes) +{ + Handle(XSControl_TransferReader) aTR = theWS->TransferReader(); + Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess(); + const Interface_Graph& aGraph = aTP->Graph(); + Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main()); + Standard_Integer anIndex = aTP->MapIndex(theRepr); + TopoDS_Shape aSh; + if (anIndex > 0) { + Handle(Transfer_Binder) aBinder = aTP->MapItem(anIndex); + aSh = TransferBRep::ShapeResult(aBinder); + } + if (!aSh.IsNull()) { + TDF_Label aShL; + aSTool->FindShape(aSh, aShL); + if (!aShL.IsNull()) + theShapes.Append(aShL); + } + Interface_EntityIterator anIter = aGraph.Sharings(theRepr); + for (; anIter.More(); anIter.Next()) { + if (!anIter.Value()->IsKind(STANDARD_TYPE(StepRepr_RepresentationRelationship))) + continue; + Handle(StepRepr_RepresentationRelationship) aReprRelationship = Handle(StepRepr_RepresentationRelationship)::DownCast(anIter.Value()); + if (aReprRelationship->Rep1() != theRepr) + collectViewShapes(theWS, theDoc, aReprRelationship->Rep1(), theShapes); + } +} + +//======================================================================= +//function : buildClippingPlanes +//purpose : +//======================================================================= +Handle(TCollection_HAsciiString) buildClippingPlanes(const Handle(StepGeom_GeometricRepresentationItem)& theClippingCameraModel, + TDF_LabelSequence& theClippingPlanes, + const Handle(XCAFDoc_ClippingPlaneTool) theTool) +{ + Handle(TCollection_HAsciiString) anExpression = new TCollection_HAsciiString(); + NCollection_Sequence aPlanes; + Handle(TCollection_HAsciiString) anOperation = new TCollection_HAsciiString("*"); + + // Store operands + if (theClippingCameraModel->IsKind(STANDARD_TYPE(StepVisual_CameraModelD3MultiClipping))) { + Handle(StepVisual_CameraModelD3MultiClipping) aCameraModel = + Handle(StepVisual_CameraModelD3MultiClipping)::DownCast(theClippingCameraModel); + // Root of clipping planes tree + if (aCameraModel->ShapeClipping()->Length() == 1) { + Handle(StepVisual_CameraModelD3MultiClippingUnion) aCameraModelUnion = + aCameraModel->ShapeClipping()->Value(1).CameraModelD3MultiClippingUnion(); + if (!aCameraModelUnion.IsNull()) + return buildClippingPlanes(aCameraModelUnion, theClippingPlanes, theTool); + } + for (Standard_Integer i = 1; i <= aCameraModel->ShapeClipping()->Length(); i++) { + aPlanes.Append(Handle(StepGeom_GeometricRepresentationItem)::DownCast(aCameraModel->ShapeClipping()->Value(i).Value())); + } + } + else if (theClippingCameraModel->IsKind(STANDARD_TYPE(StepVisual_CameraModelD3MultiClippingUnion))) { + Handle(StepVisual_CameraModelD3MultiClippingUnion) aCameraModel = + Handle(StepVisual_CameraModelD3MultiClippingUnion)::DownCast(theClippingCameraModel); + anOperation = new TCollection_HAsciiString("+"); + for (Standard_Integer i = 1; i <= aCameraModel->ShapeClipping()->Length(); i++) { + aPlanes.Append(Handle(StepGeom_GeometricRepresentationItem)::DownCast(aCameraModel->ShapeClipping()->Value(i).Value())); + } + } + else if (theClippingCameraModel->IsKind(STANDARD_TYPE(StepVisual_CameraModelD3MultiClippingIntersection))) { + Handle(StepVisual_CameraModelD3MultiClippingIntersection) aCameraModel = + Handle(StepVisual_CameraModelD3MultiClippingIntersection)::DownCast(theClippingCameraModel); + for (Standard_Integer i = 1; i <= aCameraModel->ShapeClipping()->Length(); i++) { + aPlanes.Append(Handle(StepGeom_GeometricRepresentationItem)::DownCast(aCameraModel->ShapeClipping()->Value(i).Value())); + } + } + // Build expression + anExpression->AssignCat("("); + for (Standard_Integer i = 1; i <= aPlanes.Length(); i++) { + Handle(StepGeom_Plane) aPlaneEnt = Handle(StepGeom_Plane)::DownCast(aPlanes.Value(i)); + if (!aPlaneEnt.IsNull()) { + Handle(Geom_Plane) aPlane = StepToGeom::MakePlane(aPlaneEnt); + if (!aPlane.IsNull()) { + TDF_Label aPlaneL = theTool->AddClippingPlane(aPlane->Pln(), aPlaneEnt->Name()); + theClippingPlanes.Append(aPlaneL); + TCollection_AsciiString anEntry; + TDF_Tool::Entry(aPlaneL, anEntry); + anExpression->AssignCat(new TCollection_HAsciiString(anEntry)); + } + } + else { + anExpression->AssignCat(buildClippingPlanes(aPlanes.Value(i), theClippingPlanes, theTool)); + } + anExpression->AssignCat(anOperation); + } + // Insert brace instead of operation after last operand. + anExpression->SetValue(anExpression->Length(), ')'); + return anExpression; +} + + +//======================================================================= +//function : ReadViews +//purpose : +//======================================================================= +Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSession)& theWS, Handle(TDocStd_Document)& theDoc) const +{ + const Handle(Interface_InterfaceModel) &aModel = theWS->Model(); + Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main()); + Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool(theDoc->Main()); + Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(theDoc->Main()); + if (aDGTTool.IsNull()) return Standard_False; + + Standard_Integer nb = aModel->NbEntities(); + for (Standard_Integer i = 1; i <= nb; i++) { + Handle(Standard_Transient) anEnt = aModel->Value(i); + if (!anEnt->IsKind(STANDARD_TYPE(StepVisual_CameraModelD3))) + continue; + Handle(XCAFView_Object) anObj = new XCAFView_Object(); + // Import attributes of view + Handle(StepVisual_CameraModelD3) aCameraModel = Handle(StepVisual_CameraModelD3)::DownCast(anEnt); + anObj->SetName(aCameraModel->Name()); + Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aCameraModel->ViewReferenceSystem()); + anObj->SetViewDirection(anAxis->Direction()); + anObj->SetUpDirection(anAxis->Direction() ^ anAxis->XDirection()); + Handle(StepVisual_ViewVolume) aViewVolume = aCameraModel->PerspectiveOfVolume(); + XCAFView_ProjectionType aType = XCAFView_ProjectionType_NoCamera; + if (aViewVolume->ProjectionType() == StepVisual_copCentral) + aType = XCAFView_ProjectionType_Central; + else if (aViewVolume->ProjectionType() == StepVisual_copParallel) + aType = XCAFView_ProjectionType_Parallel; + anObj->SetType(aType); + Handle(Geom_CartesianPoint) aPoint = StepToGeom::MakeCartesianPoint(aViewVolume->ProjectionPoint()); + anObj->SetProjectionPoint(aPoint->Pnt()); + anObj->SetZoomFactor(aViewVolume->ViewPlaneDistance()); + anObj->SetWindowHorizontalSize(aViewVolume->ViewWindow()->SizeInX()); + anObj->SetWindowVerticalSize(aViewVolume->ViewWindow()->SizeInY()); + if (aViewVolume->FrontPlaneClipping()) + anObj->SetFrontPlaneDistance(aViewVolume->FrontPlaneDistance()); + if (aViewVolume->BackPlaneClipping()) + anObj->SetBackPlaneDistance(aViewVolume->BackPlaneDistance()); + anObj->SetViewVolumeSidesClipping(aViewVolume->ViewVolumeSidesClipping()); + // Clipping plane + Handle(StepVisual_CameraModelD3MultiClipping) aClippingCameraModel = + Handle(StepVisual_CameraModelD3MultiClipping)::DownCast(aCameraModel); + TDF_LabelSequence aClippingPlanes; + if (!aClippingCameraModel.IsNull()) { + Handle(TCollection_HAsciiString) aClippingExpression; + Handle(XCAFDoc_ClippingPlaneTool) aClippingPlaneTool = XCAFDoc_DocumentTool::ClippingPlaneTool(theDoc->Main()); + aClippingExpression = buildClippingPlanes(aClippingCameraModel, aClippingPlanes, aClippingPlaneTool); + anObj->SetClippingExpression(aClippingExpression); + } + // Collect shapes and GDTs + TDF_LabelSequence aShapes, aGDTs; + Handle(XSControl_TransferReader) aTR = theWS->TransferReader(); + Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess(); + const Interface_Graph& aGraph = aTP->Graph(); + Handle(StepVisual_DraughtingModel) aDModel; + Interface_EntityIterator anIter = aGraph.Sharings(aCameraModel); + for (; anIter.More() && aDModel.IsNull(); anIter.Next()) { + aDModel = Handle(StepVisual_DraughtingModel)::DownCast(anIter.Value()); + } + if (aDModel.IsNull()) + return Standard_False; + + anIter = aGraph.Shareds(aDModel); + for (; anIter.More(); anIter.Next()) { + if (anIter.Value()->IsKind(STANDARD_TYPE(StepRepr_MappedItem))) { + Handle(StepRepr_MappedItem) anItem = Handle(StepRepr_MappedItem)::DownCast(anIter.Value()); + Handle(StepRepr_Representation) aRepr = anItem->MappingSource()->MappedRepresentation(); + collectViewShapes(theWS, theDoc, aRepr, aShapes); + } + else if (anIter.Value()->IsKind(STANDARD_TYPE(StepVisual_AnnotationOccurrence)) || + anIter.Value()->IsKind(STANDARD_TYPE(StepVisual_DraughtingCallout))) { + Interface_EntityIterator aDMIAIter = aGraph.Sharings(anIter.Value()); + for (; aDMIAIter.More(); aDMIAIter.Next()) { + if (!aDMIAIter.Value()->IsKind(STANDARD_TYPE(StepAP242_DraughtingModelItemAssociation))) + continue; + Handle(StepAP242_DraughtingModelItemAssociation) aDMIA = + Handle(StepAP242_DraughtingModelItemAssociation)::DownCast(aDMIAIter.Value()); + TDF_Label aGDTL; + Standard_Boolean isFind = myGDTMap.Find(aDMIA->Definition().Value(), aGDTL); + if (isFind) + aGDTs.Append(aGDTL); + } + } + else if (anIter.Value()->IsKind(STANDARD_TYPE(StepVisual_AnnotationPlane))) { + Handle(StepVisual_AnnotationPlane) aPlane = Handle(StepVisual_AnnotationPlane)::DownCast(anIter.Value()); + for (Standard_Integer i = 1; i <= aPlane->NbElements(); i++) { + Interface_EntityIterator aDMIAIter = aGraph.Sharings(anIter.Value()); + for (; aDMIAIter.More(); aDMIAIter.Next()) { + if (!aDMIAIter.Value()->IsKind(STANDARD_TYPE(StepAP242_DraughtingModelItemAssociation))) + continue; + Handle(StepAP242_DraughtingModelItemAssociation) aDMIA = + Handle(StepAP242_DraughtingModelItemAssociation)::DownCast(aDMIAIter.Value()); + TDF_Label aGDTL; + Standard_Boolean isFind = myGDTMap.Find(aDMIA->Definition().Value(), aGDTL); + if (isFind) + aGDTs.Append(aGDTL); + } + } + } + } + TDF_Label aViewL = aViewTool->AddView(); + Handle(XCAFDoc_View) aView = XCAFDoc_View::Set(aViewL); + aView->SetObject(anObj); + aViewTool->SetView(aShapes, aGDTs, aClippingPlanes, aViewL); + aViewTool->Lock(aViewL); + } + return Standard_True; +} + //======================================================================= //function : SettleShapeData //purpose : @@ -4474,3 +4720,23 @@ Standard_Boolean STEPCAFControl_Reader::GetMatMode () const { return myMatMode; } + +//======================================================================= +//function : SetViewMode +//purpose : +//======================================================================= + +void STEPCAFControl_Reader::SetViewMode(const Standard_Boolean viewmode) +{ + myViewMode = viewmode; +} + +//======================================================================= +//function : GetViewMode +//purpose : +//======================================================================= + +Standard_Boolean STEPCAFControl_Reader::GetViewMode() const +{ + return myViewMode; +} diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.hxx b/src/STEPCAFControl/STEPCAFControl_Reader.hxx index 07e9eb55ea..548a32c5c5 100644 --- a/src/STEPCAFControl/STEPCAFControl_Reader.hxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.hxx @@ -31,6 +31,8 @@ #include #include #include +#include +#include class XSControl_WorkSession; class TDocStd_Document; class TCollection_AsciiString; @@ -44,6 +46,7 @@ class Transfer_TransientProcess; class StepShape_ConnectedFaceSet; class StepRepr_NextAssemblyUsageOccurrence; class STEPConstruct_Tool; +class StepDimTol_Datum; //! Provides a tool to read STEP file and put it into @@ -153,6 +156,12 @@ public: Standard_EXPORT void SetMatMode (const Standard_Boolean matmode); Standard_EXPORT Standard_Boolean GetMatMode() const; + + //! Set View mode + Standard_EXPORT void SetViewMode(const Standard_Boolean viewmode); + + //! Get View mode + Standard_EXPORT Standard_Boolean GetViewMode() const; @@ -201,12 +210,15 @@ protected: //! Reads D> for instances defined in the STEP model and //! set reference between shape instances from different assemblyes - Standard_EXPORT Standard_Boolean ReadGDTs (const Handle(XSControl_WorkSession)& WS, Handle(TDocStd_Document)& doc) const; + Standard_EXPORT Standard_Boolean ReadGDTs (const Handle(XSControl_WorkSession)& WS, Handle(TDocStd_Document)& doc); //! Reads materials for instances defined in the STEP model and //! set reference between shape instances from different assemblyes Standard_EXPORT Standard_Boolean ReadMaterials (const Handle(XSControl_WorkSession)& WS, Handle(TDocStd_Document)& doc, const Handle(TColStd_HSequenceOfTransient)& SeqPDS) const; + //! Reads Views for instances defined in the STEP model + Standard_EXPORT Standard_Boolean ReadViews(const Handle(XSControl_WorkSession)& theWS, Handle(TDocStd_Document)& theDoc) const; + //! Populates the sub-Label of the passed TDF Label with shape //! data associated with the given STEP Representation Item, //! including naming and topological information. @@ -238,6 +250,26 @@ protected: private: + //! Internal method. Import all Datum attributes and set them to XCAF object. Set connection of Datum to GeomTolerance (theGDTL). + Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat, + const TDF_Label theGDTL, + const Standard_Integer thePositionCounter, + const XCAFDimTolObjects_DatumModifiersSequence& theXCAFModifiers, + const XCAFDimTolObjects_DatumModifWithValue theXCAFModifWithVal, + const Standard_Real theModifValue, + const Handle(TDocStd_Document)& theDoc, + const Handle(XSControl_WorkSession)& theWS); + + //! Internal method. Read Datums, connected to GeomTolerance theGDTL. + Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt, + const TDF_Label theGDTL, + const Handle(TDocStd_Document)& theDoc, + const Handle(XSControl_WorkSession)& theWS); + + //! Internal method. Read Dimension or GeomTolerance. + TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt, + const Handle(TDocStd_Document)& theDoc, + const Handle(XSControl_WorkSession)& theWS); STEPControl_Reader myReader; @@ -249,7 +281,8 @@ private: Standard_Boolean mySHUOMode; Standard_Boolean myGDTMode; Standard_Boolean myMatMode; - + Standard_Boolean myViewMode; + NCollection_DataMap myGDTMap; }; diff --git a/src/StepAP214/StepAP214_Protocol.cxx b/src/StepAP214/StepAP214_Protocol.cxx index df010c12e3..8c87c04035 100644 --- a/src/StepAP214/StepAP214_Protocol.cxx +++ b/src/StepAP214/StepAP214_Protocol.cxx @@ -745,6 +745,9 @@ static Standard_CString schemaAP242DIS = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERI #include #include #include +#include +#include +#include static int init = 0; static Interface_DataMapOfTransientInteger types(800); @@ -1448,6 +1451,9 @@ StepAP214_Protocol::StepAP214_Protocol () types.Bind (STANDARD_TYPE(StepRepr_ConstructiveGeometryRepresentationRelationship), 713); types.Bind (STANDARD_TYPE(StepRepr_CharacterizedRepresentation), 714); types.Bind (STANDARD_TYPE(StepVisual_CharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation), 715); + types.Bind (STANDARD_TYPE(StepVisual_CameraModelD3MultiClipping), 716); + types.Bind (STANDARD_TYPE(StepVisual_CameraModelD3MultiClippingIntersection), 717); + types.Bind (STANDARD_TYPE(StepVisual_CameraModelD3MultiClippingUnion), 718); } diff --git a/src/StepVisual/FILES b/src/StepVisual/FILES index 641d3fcbfe..015bf1612c 100644 --- a/src/StepVisual/FILES +++ b/src/StepVisual/FILES @@ -20,6 +20,8 @@ StepVisual_AreaOrView.cxx StepVisual_AreaOrView.hxx StepVisual_Array1OfAnnotationPlaneElement.hxx StepVisual_Array1OfBoxCharacteristicSelect.hxx +StepVisual_Array1OfCameraModelD3MultiClippingInterectionSelect.hxx +StepVisual_Array1OfCameraModelD3MultiClippingUnionSelect.hxx StepVisual_Array1OfCurveStyleFontPattern.hxx StepVisual_Array1OfDirectionCountSelect.hxx StepVisual_Array1OfDraughtingCalloutElement.hxx @@ -47,6 +49,16 @@ StepVisual_CameraModelD2.cxx StepVisual_CameraModelD2.hxx StepVisual_CameraModelD3.cxx StepVisual_CameraModelD3.hxx +StepVisual_CameraModelD3MultiClipping.cxx +StepVisual_CameraModelD3MultiClipping.hxx +StepVisual_CameraModelD3MultiClippingInterectionSelect.cxx +StepVisual_CameraModelD3MultiClippingInterectionSelect.hxx +StepVisual_CameraModelD3MultiClippingIntersection.cxx +StepVisual_CameraModelD3MultiClippingIntersection.hxx +StepVisual_CameraModelD3MultiClippingUnion.cxx +StepVisual_CameraModelD3MultiClippingUnion.hxx +StepVisual_CameraModelD3MultiClippingUnionSelect.cxx +StepVisual_CameraModelD3MultiClippingUnionSelect.hxx StepVisual_CameraUsage.cxx StepVisual_CameraUsage.hxx StepVisual_CentralOrParallel.hxx @@ -102,6 +114,8 @@ StepVisual_FontSelect.cxx StepVisual_FontSelect.hxx StepVisual_HArray1OfAnnotationPlaneElement.hxx StepVisual_HArray1OfBoxCharacteristicSelect.hxx +StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect.hxx +StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect.hxx StepVisual_HArray1OfCurveStyleFontPattern.hxx StepVisual_HArray1OfDirectionCountSelect.hxx StepVisual_HArray1OfDraughtingCalloutElement.hxx diff --git a/src/StepVisual/StepVisual_Array1OfCameraModelD3MultiClippingInterectionSelect.hxx b/src/StepVisual/StepVisual_Array1OfCameraModelD3MultiClippingInterectionSelect.hxx new file mode 100644 index 0000000000..4102d90c8b --- /dev/null +++ b/src/StepVisual/StepVisual_Array1OfCameraModelD3MultiClippingInterectionSelect.hxx @@ -0,0 +1,23 @@ +// Created on: 2016-10-25 +// 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_Array1OfCameraModelD3MultiClippingInterectionSelect_HeaderFile +#define _StepVisual_Array1OfCameraModelD3MultiClippingInterectionSelect_HeaderFile + +#include +#include + +typedef NCollection_Array1 StepVisual_Array1OfCameraModelD3MultiClippingInterectionSelect; +#endif // _StepVisual_Array1OfCameraModelD3MultiClippingInterectionSelect_HeaderFile diff --git a/src/StepVisual/StepVisual_Array1OfCameraModelD3MultiClippingUnionSelect.hxx b/src/StepVisual/StepVisual_Array1OfCameraModelD3MultiClippingUnionSelect.hxx new file mode 100644 index 0000000000..98ad13313d --- /dev/null +++ b/src/StepVisual/StepVisual_Array1OfCameraModelD3MultiClippingUnionSelect.hxx @@ -0,0 +1,23 @@ +// Created on: 2016-11-14 +// 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_Array1OfCameraModelD3MultiClippingUnionSelect_HeaderFile +#define _StepVisual_Array1OfCameraModelD3MultiClippingUnionSelect_HeaderFile + +#include +#include + +typedef NCollection_Array1 StepVisual_Array1OfCameraModelD3MultiClippingUnionSelect; +#endif // _StepVisual_Array1OfCameraModelD3MultiClippingUnionSelect_HeaderFile diff --git a/src/StepVisual/StepVisual_CameraModelD3MultiClipping.cxx b/src/StepVisual/StepVisual_CameraModelD3MultiClipping.cxx new file mode 100644 index 0000000000..192702a31a --- /dev/null +++ b/src/StepVisual/StepVisual_CameraModelD3MultiClipping.cxx @@ -0,0 +1,45 @@ +// Created on: 2016-10-25 +// 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. + + +#include +#include +#include +#include +#include + +IMPLEMENT_STANDARD_RTTIEXT(StepVisual_CameraModelD3MultiClipping, StepVisual_CameraModelD3) + +//======================================================================= +//function : StepVisual_CameraModelD3MultiClipping +//purpose : +//======================================================================= +StepVisual_CameraModelD3MultiClipping::StepVisual_CameraModelD3MultiClipping() {} + +//======================================================================= +//function : Init +//purpose : +//======================================================================= +void StepVisual_CameraModelD3MultiClipping::Init( + const Handle(TCollection_HAsciiString)& theName, + const Handle(StepGeom_Axis2Placement3d)& theViewReferenceSystem, + const Handle(StepVisual_ViewVolume)& thePerspectiveOfVolume, + const Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect)& theShapeClipping) +{ + // Own field + myShapeClipping = theShapeClipping; + // Inherited fields + StepVisual_CameraModelD3::Init(theName, theViewReferenceSystem, thePerspectiveOfVolume); +} diff --git a/src/StepVisual/StepVisual_CameraModelD3MultiClipping.hxx b/src/StepVisual/StepVisual_CameraModelD3MultiClipping.hxx new file mode 100644 index 0000000000..494641e1f3 --- /dev/null +++ b/src/StepVisual/StepVisual_CameraModelD3MultiClipping.hxx @@ -0,0 +1,59 @@ +// Created on: 2016-10-25 +// 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_CameraModelD3MultiClipping_HeaderFile +#define _StepVisual_CameraModelD3MultiClipping_HeaderFile + +#include +#include + +#include +class StepGeom_Axis2Placement3d; +class StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect; +class StepVisual_ViewVolume; +class TCollection_HAsciiString; + +class StepVisual_CameraModelD3; +DEFINE_STANDARD_HANDLE(StepVisual_CameraModelD3MultiClipping, StepVisual_CameraModelD3) + +class StepVisual_CameraModelD3MultiClipping : public StepVisual_CameraModelD3 +{ +public: + + + //! Returns a CameraModelD3MultiClipping + Standard_EXPORT StepVisual_CameraModelD3MultiClipping(); + + Standard_EXPORT void Init (const Handle(TCollection_HAsciiString)& theName, + const Handle(StepGeom_Axis2Placement3d)& theViewReferenceSystem, + const Handle(StepVisual_ViewVolume)& thePerspectiveOfVolume, + const Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect)& theShapeClipping); + + Standard_EXPORT void SetShapeClipping(const Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect)& theShapeClipping) + { + myShapeClipping = theShapeClipping; + } + + Standard_EXPORT const Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect) ShapeClipping() + { + return myShapeClipping; + } + DEFINE_STANDARD_RTTIEXT(StepVisual_CameraModelD3MultiClipping, StepVisual_CameraModelD3) + +private: + +Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect) myShapeClipping; +}; +#endif // _StepVisual_CameraModelD3MultiClipping_HeaderFile diff --git a/src/StepVisual/StepVisual_CameraModelD3MultiClippingInterectionSelect.cxx b/src/StepVisual/StepVisual_CameraModelD3MultiClippingInterectionSelect.cxx new file mode 100644 index 0000000000..8a9496dc87 --- /dev/null +++ b/src/StepVisual/StepVisual_CameraModelD3MultiClippingInterectionSelect.cxx @@ -0,0 +1,45 @@ +// Created on: 2015-07-10 +// 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 +#include +#include +#include + +//======================================================================= +//function : StepVisual_CameraModelD3MultiClippingInterectionSelect +//purpose : +//======================================================================= +StepVisual_CameraModelD3MultiClippingInterectionSelect::StepVisual_CameraModelD3MultiClippingInterectionSelect () { } + +//======================================================================= +//function : CaseNum +//purpose : +//======================================================================= +Standard_Integer StepVisual_CameraModelD3MultiClippingInterectionSelect::CaseNum(const Handle(Standard_Transient)& ent) const +{ + if (ent.IsNull()) return 0; + if (ent->IsKind(STANDARD_TYPE(StepGeom_Plane))) return 1; + if (ent->IsInstance(STANDARD_TYPE(StepVisual_CameraModelD3MultiClippingUnion))) return 2; + return 0; +} + +Handle(StepGeom_Plane) StepVisual_CameraModelD3MultiClippingInterectionSelect::Plane() const +{ return GetCasted(StepGeom_Plane, Value()); } + +Handle(StepVisual_CameraModelD3MultiClippingUnion) StepVisual_CameraModelD3MultiClippingInterectionSelect::CameraModelD3MultiClippingUnion() const +{ + return GetCasted(StepVisual_CameraModelD3MultiClippingUnion, Value()); +} diff --git a/src/StepVisual/StepVisual_CameraModelD3MultiClippingInterectionSelect.hxx b/src/StepVisual/StepVisual_CameraModelD3MultiClippingInterectionSelect.hxx new file mode 100644 index 0000000000..6b5a28b913 --- /dev/null +++ b/src/StepVisual/StepVisual_CameraModelD3MultiClippingInterectionSelect.hxx @@ -0,0 +1,51 @@ +// Created on: 2016-10-25 +// 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_CameraModelD3MultiClippingInterectionSelect_HeaderFile +#define _StepVisual_CameraModelD3MultiClippingInterectionSelect_HeaderFile + +#include +#include +#include + +#include +#include +class Standard_Transient; +class StepGeom_Plane; +class StepVisual_CameraModelD3MultiClippingUnion; + +class StepVisual_CameraModelD3MultiClippingInterectionSelect : public StepData_SelectType +{ +public: + + DEFINE_STANDARD_ALLOC + + //! Returns a CameraModelD3MultiClippingInterectionSelect select type + Standard_EXPORT StepVisual_CameraModelD3MultiClippingInterectionSelect(); + + //! Recognizes a IdAttributeSelect Kind Entity that is : + //! 1 -> Plane + //! 2 -> CameraModelD3MultiClippingUnion + //! 0 else + Standard_EXPORT Standard_Integer CaseNum (const Handle(Standard_Transient)& ent) const; + + //! returns Value as a Plane (Null if another type) + Standard_EXPORT Handle(StepGeom_Plane) Plane() const; + + //! returns Value as a CameraModelD3MultiClippingUnion (Null if another type) + Standard_EXPORT Handle(StepVisual_CameraModelD3MultiClippingUnion) CameraModelD3MultiClippingUnion() const; + +}; +#endif // StepVisual_CameraModelD3MultiClippingInterectionSelect diff --git a/src/StepVisual/StepVisual_CameraModelD3MultiClippingIntersection.cxx b/src/StepVisual/StepVisual_CameraModelD3MultiClippingIntersection.cxx new file mode 100644 index 0000000000..10e92918d1 --- /dev/null +++ b/src/StepVisual/StepVisual_CameraModelD3MultiClippingIntersection.cxx @@ -0,0 +1,41 @@ +// Created on: 2016-11-14 +// 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. + + +#include +#include +#include + +IMPLEMENT_STANDARD_RTTIEXT(StepVisual_CameraModelD3MultiClippingIntersection, StepGeom_GeometricRepresentationItem) + +//======================================================================= +//function : StepVisual_CameraModelD3MultiClippingIntersection +//purpose : +//======================================================================= +StepVisual_CameraModelD3MultiClippingIntersection::StepVisual_CameraModelD3MultiClippingIntersection() {} + +//======================================================================= +//function : Init +//purpose : +//======================================================================= +void StepVisual_CameraModelD3MultiClippingIntersection::Init( + const Handle(TCollection_HAsciiString)& theName, + const Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect)& theShapeClipping) +{ + // Own field + myShapeClipping = theShapeClipping; + // Inherited fields + StepGeom_GeometricRepresentationItem::Init(theName); +} diff --git a/src/StepVisual/StepVisual_CameraModelD3MultiClippingIntersection.hxx b/src/StepVisual/StepVisual_CameraModelD3MultiClippingIntersection.hxx new file mode 100644 index 0000000000..61016faeb7 --- /dev/null +++ b/src/StepVisual/StepVisual_CameraModelD3MultiClippingIntersection.hxx @@ -0,0 +1,55 @@ +// Created on: 2016-11-14 +// 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_CameraModelD3MultiClippingIntersection_HeaderFile +#define _StepVisual_CameraModelD3MultiClippingIntersection_HeaderFile + +#include +#include + +#include +class StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect; +class TCollection_HAsciiString; + +class StepGeom_GeometricRepresentationItem; +DEFINE_STANDARD_HANDLE(StepVisual_CameraModelD3MultiClippingIntersection, StepGeom_GeometricRepresentationItem) + +class StepVisual_CameraModelD3MultiClippingIntersection : public StepGeom_GeometricRepresentationItem +{ +public: + + + //! Returns a StepVisual_CameraModelD3MultiClippingIntersection + Standard_EXPORT StepVisual_CameraModelD3MultiClippingIntersection(); + + Standard_EXPORT void Init (const Handle(TCollection_HAsciiString)& theName, + const Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect)& theShapeClipping); + + Standard_EXPORT void SetShapeClipping(const Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect)& theShapeClipping) + { + myShapeClipping = theShapeClipping; + } + + Standard_EXPORT const Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect) ShapeClipping() + { + return myShapeClipping; + } + DEFINE_STANDARD_RTTIEXT(StepVisual_CameraModelD3MultiClippingIntersection, StepGeom_GeometricRepresentationItem) + +private: + +Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect) myShapeClipping; +}; +#endif // _StepVisual_CameraModelD3MultiClippingIntersection_HeaderFile diff --git a/src/StepVisual/StepVisual_CameraModelD3MultiClippingUnion.cxx b/src/StepVisual/StepVisual_CameraModelD3MultiClippingUnion.cxx new file mode 100644 index 0000000000..4173a14328 --- /dev/null +++ b/src/StepVisual/StepVisual_CameraModelD3MultiClippingUnion.cxx @@ -0,0 +1,41 @@ +// Created on: 2016-11-14 +// 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. + + +#include +#include +#include + +IMPLEMENT_STANDARD_RTTIEXT(StepVisual_CameraModelD3MultiClippingUnion, StepGeom_GeometricRepresentationItem) + +//======================================================================= +//function : StepVisual_CameraModelD3MultiClippingUnion +//purpose : +//======================================================================= +StepVisual_CameraModelD3MultiClippingUnion::StepVisual_CameraModelD3MultiClippingUnion() {} + +//======================================================================= +//function : Init +//purpose : +//======================================================================= +void StepVisual_CameraModelD3MultiClippingUnion::Init( + const Handle(TCollection_HAsciiString)& theName, + const Handle(StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect)& theShapeClipping) +{ + // Own field + myShapeClipping = theShapeClipping; + // Inherited fields + StepGeom_GeometricRepresentationItem::Init(theName); +} diff --git a/src/StepVisual/StepVisual_CameraModelD3MultiClippingUnion.hxx b/src/StepVisual/StepVisual_CameraModelD3MultiClippingUnion.hxx new file mode 100644 index 0000000000..e7b699581c --- /dev/null +++ b/src/StepVisual/StepVisual_CameraModelD3MultiClippingUnion.hxx @@ -0,0 +1,55 @@ +// Created on: 2016-11-14 +// 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_CameraModelD3MultiClippingUnion_HeaderFile +#define _StepVisual_CameraModelD3MultiClippingUnion_HeaderFile + +#include +#include + +#include +class StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect; +class TCollection_HAsciiString; + +class StepGeom_GeometricRepresentationItem; +DEFINE_STANDARD_HANDLE(StepVisual_CameraModelD3MultiClippingUnion, StepGeom_GeometricRepresentationItem) + +class StepVisual_CameraModelD3MultiClippingUnion : public StepGeom_GeometricRepresentationItem +{ +public: + + + //! Returns a StepVisual_CameraModelD3MultiClippingUnion + Standard_EXPORT StepVisual_CameraModelD3MultiClippingUnion(); + + Standard_EXPORT void Init (const Handle(TCollection_HAsciiString)& theName, + const Handle(StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect)& theShapeClipping); + + Standard_EXPORT void SetShapeClipping(const Handle(StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect)& theShapeClipping) + { + myShapeClipping = theShapeClipping; + } + + Standard_EXPORT const Handle(StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect) ShapeClipping() + { + return myShapeClipping; + } + DEFINE_STANDARD_RTTIEXT(StepVisual_CameraModelD3MultiClippingUnion, StepGeom_GeometricRepresentationItem) + +private: + +Handle(StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect) myShapeClipping; +}; +#endif // _StepVisual_CameraModelD3MultiClippingUnion_HeaderFile diff --git a/src/StepVisual/StepVisual_CameraModelD3MultiClippingUnionSelect.cxx b/src/StepVisual/StepVisual_CameraModelD3MultiClippingUnionSelect.cxx new file mode 100644 index 0000000000..be8979f628 --- /dev/null +++ b/src/StepVisual/StepVisual_CameraModelD3MultiClippingUnionSelect.cxx @@ -0,0 +1,47 @@ +// Created on: 2016-11-14 +// 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. + +#include +#include +#include +#include + +//======================================================================= +//function : StepVisual_CameraModelD3MultiClippingUnionSelect +//purpose : +//======================================================================= +StepVisual_CameraModelD3MultiClippingUnionSelect::StepVisual_CameraModelD3MultiClippingUnionSelect () { } + +//======================================================================= +//function : CaseNum +//purpose : +//======================================================================= +Standard_Integer StepVisual_CameraModelD3MultiClippingUnionSelect::CaseNum(const Handle(Standard_Transient)& ent) const +{ + if (ent.IsNull()) return 0; + if (ent->IsKind(STANDARD_TYPE(StepGeom_Plane))) return 1; + if (ent->IsInstance(STANDARD_TYPE(StepVisual_CameraModelD3MultiClippingIntersection))) return 2; + return 0; +} + +Handle(StepGeom_Plane) StepVisual_CameraModelD3MultiClippingUnionSelect::Plane() const +{ + return GetCasted(StepGeom_Plane, Value()); +} + +Handle(StepVisual_CameraModelD3MultiClippingIntersection) StepVisual_CameraModelD3MultiClippingUnionSelect::CameraModelD3MultiClippingIntersection() const +{ + return GetCasted(StepVisual_CameraModelD3MultiClippingIntersection, Value()); +} diff --git a/src/StepVisual/StepVisual_CameraModelD3MultiClippingUnionSelect.hxx b/src/StepVisual/StepVisual_CameraModelD3MultiClippingUnionSelect.hxx new file mode 100644 index 0000000000..ee3ebde023 --- /dev/null +++ b/src/StepVisual/StepVisual_CameraModelD3MultiClippingUnionSelect.hxx @@ -0,0 +1,51 @@ +// Created on: 2016-11-14 +// 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_CameraModelD3MultiClippingUnionSelect_HeaderFile +#define _StepVisual_CameraModelD3MultiClippingUnionSelect_HeaderFile + +#include +#include +#include + +#include +#include +class Standard_Transient; +class StepGeom_Plane; +class StepVisual_CameraModelD3MultiClippingIntersection; + +class StepVisual_CameraModelD3MultiClippingUnionSelect : public StepData_SelectType +{ +public: + + DEFINE_STANDARD_ALLOC + + //! Returns a CameraModelD3MultiClippingUnionSelect select type + Standard_EXPORT StepVisual_CameraModelD3MultiClippingUnionSelect(); + + //! Recognizes a IdAttributeSelect Kind Entity that is : + //! 1 -> Plane + //! 2 -> CameraModelD3MultiClippingIntersection + //! 0 else + Standard_EXPORT Standard_Integer CaseNum (const Handle(Standard_Transient)& ent) const; + + //! returns Value as a Plane (Null if another type) + Standard_EXPORT Handle(StepGeom_Plane) Plane() const; + + //! returns Value as a CameraModelD3MultiClippingIntersection (Null if another type) + Standard_EXPORT Handle(StepVisual_CameraModelD3MultiClippingIntersection) CameraModelD3MultiClippingIntersection() const; + +}; +#endif // StepVisual_CameraModelD3MultiClippingUnionSelect diff --git a/src/StepVisual/StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect.hxx b/src/StepVisual/StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect.hxx new file mode 100644 index 0000000000..24597001eb --- /dev/null +++ b/src/StepVisual/StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect.hxx @@ -0,0 +1,24 @@ +// Created on: 2016-10-25 +// 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. + +#ifndef _StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect_HeaderFile +#define _StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect_HeaderFile + +#include +#include +#include + +DEFINE_HARRAY1(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect, StepVisual_Array1OfCameraModelD3MultiClippingInterectionSelect) +#endif // _StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect_HeaderFile diff --git a/src/StepVisual/StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect.hxx b/src/StepVisual/StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect.hxx new file mode 100644 index 0000000000..6ff1fb1994 --- /dev/null +++ b/src/StepVisual/StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect.hxx @@ -0,0 +1,24 @@ +// Created on: 2016-11-14 +// 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_HArray1OfCameraModelD3MultiClippingUnionSelect_HeaderFile +#define _StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect_HeaderFile + +#include +#include +#include + +DEFINE_HARRAY1(StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect, StepVisual_Array1OfCameraModelD3MultiClippingUnionSelect) +#endif // _StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect_HeaderFile diff --git a/src/XCAFDoc/FILES b/src/XCAFDoc/FILES index 4d51a8cc05..a30837c6fe 100755 --- a/src/XCAFDoc/FILES +++ b/src/XCAFDoc/FILES @@ -6,6 +6,8 @@ XCAFDoc_Area.cxx XCAFDoc_Area.hxx XCAFDoc_Centroid.cxx XCAFDoc_Centroid.hxx +XCAFDoc_ClippingPlaneTool.cxx +XCAFDoc_ClippingPlaneTool.hxx XCAFDoc_Color.cxx XCAFDoc_Color.hxx XCAFDoc_ColorTool.cxx diff --git a/src/XCAFDoc/XCAFDoc.cxx b/src/XCAFDoc/XCAFDoc.cxx index 590e462cf1..2299ae3293 100644 --- a/src/XCAFDoc/XCAFDoc.cxx +++ b/src/XCAFDoc/XCAFDoc.cxx @@ -227,3 +227,25 @@ Standard_GUID XCAFDoc::ViewRefGDTGUID() static Standard_GUID ID("efd213e7-6dfd-11d4-b9c8-0060b0ee281b"); return ID; } + +//======================================================================= +//function : ViewRefPlaneGUID +//purpose : +//======================================================================= + +Standard_GUID XCAFDoc::ViewRefPlaneGUID() +{ + static Standard_GUID ID("efd213e9-6dfd-11d4-b9c8-0060b0ee281b"); + return ID; +} + +//======================================================================= +//function : LockGUID +//purpose : +//======================================================================= + +Standard_GUID XCAFDoc::LockGUID() +{ + static Standard_GUID ID("efd213eb-6dfd-11d4-b9c8-0060b0ee281b"); + return ID; +} diff --git a/src/XCAFDoc/XCAFDoc.hxx b/src/XCAFDoc/XCAFDoc.hxx index a806cae7a3..1812029d9e 100644 --- a/src/XCAFDoc/XCAFDoc.hxx +++ b/src/XCAFDoc/XCAFDoc.hxx @@ -33,6 +33,7 @@ class XCAFDoc_Material; class XCAFDoc_Volume; class XCAFDoc_Area; class XCAFDoc_Centroid; +class XCAFDoc_ClippingPlaneTool; class XCAFDoc_ShapeTool; class XCAFDoc_ShapeMapTool; class XCAFDoc_ColorTool; @@ -113,6 +114,12 @@ public: //! Return GUIDs for TreeNode representing specified types of View Standard_EXPORT static Standard_GUID ViewRefGDTGUID(); + + //! Return GUIDs for TreeNode representing specified types of View + Standard_EXPORT static Standard_GUID ViewRefPlaneGUID(); + + //! Returns GUID for UAttribute identifying lock flag + Standard_EXPORT static Standard_GUID LockGUID(); protected: @@ -134,6 +141,7 @@ friend class XCAFDoc_Material; friend class XCAFDoc_Volume; friend class XCAFDoc_Area; friend class XCAFDoc_Centroid; +friend class XCAFDoc_ClippingPlaneTool; friend class XCAFDoc_ShapeTool; friend class XCAFDoc_ShapeMapTool; friend class XCAFDoc_ColorTool; diff --git a/src/XCAFDoc/XCAFDoc_ClippingPlaneTool.cxx b/src/XCAFDoc/XCAFDoc_ClippingPlaneTool.cxx new file mode 100644 index 0000000000..da90dfd2d9 --- /dev/null +++ b/src/XCAFDoc/XCAFDoc_ClippingPlaneTool.cxx @@ -0,0 +1,347 @@ +// Created on: 2016-11-29 +// 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. + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_ClippingPlaneTool, TDF_Attribute) + +//======================================================================= +//function : BaseLabel +//purpose : +//======================================================================= + +TDF_Label XCAFDoc_ClippingPlaneTool::BaseLabel() const +{ + return Label(); +} + +//======================================================================= +//function : IsClippingPlane +//purpose : +//======================================================================= + +Standard_Boolean XCAFDoc_ClippingPlaneTool::IsClippingPlane(const TDF_Label& theLabel) const +{ + if (theLabel.Father() != Label()) + return Standard_False; + + Handle(TDataXtd_Plane) aPlaneAttribute; + if (!theLabel.FindAttribute(TDataXtd_Plane::GetID(), aPlaneAttribute)) + return Standard_False; + return Standard_True; +} + +//======================================================================= +//function : GetClippingPlane +//purpose : +//======================================================================= + +Standard_Boolean XCAFDoc_ClippingPlaneTool::GetClippingPlane(const TDF_Label& theLabel, + gp_Pln& thePlane, TCollection_ExtendedString& theName, Standard_Boolean &theCapping) const +{ + if (theLabel.Father() != Label()) + return Standard_False; + + Handle(TDataXtd_Plane) aPlaneAttribute; + if (!theLabel.FindAttribute(TDataXtd_Plane::GetID(), aPlaneAttribute)) + return Standard_False; + + TDataXtd_Geometry::Plane(aPlaneAttribute->Label(), thePlane); + Handle(TDataStd_Name) aNameAttribute; + if (theLabel.FindAttribute(TDataStd_Name::GetID(), aNameAttribute)) + theName = aNameAttribute->Get(); + + Handle(TDataStd_Integer) aCappingAttribute; + if (theLabel.FindAttribute(TDataStd_Integer::GetID(), aCappingAttribute)) + theCapping = (aCappingAttribute->Get() == 1); + + return Standard_True; +} + +//======================================================================= +//function : GetClippingPlane +//purpose : +//======================================================================= + +Standard_Boolean XCAFDoc_ClippingPlaneTool::GetClippingPlane(const TDF_Label& theLabel, + gp_Pln& thePlane, Handle(TCollection_HAsciiString)& theName, Standard_Boolean &theCapping) const +{ + TCollection_ExtendedString anExtName; + if (!GetClippingPlane(theLabel, thePlane, anExtName, theCapping)) + return Standard_False; + theName = new TCollection_HAsciiString(anExtName); + return Standard_True; +} + +//======================================================================= +//function : AddClippingPlane +//purpose : +//======================================================================= + +TDF_Label XCAFDoc_ClippingPlaneTool::AddClippingPlane(const gp_Pln thePlane, const TCollection_ExtendedString theName) const +{ + TDF_Label aLabel; + TDF_LabelSequence aClippingPlanes; + GetClippingPlanes(aClippingPlanes); + for (Standard_Integer i = 1; i <= aClippingPlanes.Length(); i++) { + gp_Pln aPlane; + TCollection_ExtendedString aName; + Standard_Boolean aCapping; + GetClippingPlane(aClippingPlanes.Value(i), aPlane, aName, aCapping); + if (!aName.IsEqual(theName)) + continue; + if (aPlane.Axis().Angle(thePlane.Axis()) > Precision::Angular()) + continue; + if (aPlane.XAxis().Angle(thePlane.XAxis()) > Precision::Angular()) + continue; + if (aPlane.YAxis().Angle(thePlane.YAxis()) > Precision::Angular()) + continue; + return aClippingPlanes.Value(i); + } + + // create a new clipping plane entry + TDF_TagSource aTag; + aLabel = aTag.NewChild(Label()); + + TDataXtd_Plane::Set(aLabel, thePlane); + if (!theName.IsEmpty()) + TDataStd_Name::Set(aLabel, theName); + + return aLabel; +} + +//======================================================================= +//function : AddClippingPlane +//purpose : +//======================================================================= + +TDF_Label XCAFDoc_ClippingPlaneTool::AddClippingPlane(const gp_Pln thePlane, const Handle(TCollection_HAsciiString)& theName) const +{ + TCollection_ExtendedString anExtName = TCollection_ExtendedString(theName->String()); + return AddClippingPlane(thePlane, anExtName); +} + + +//======================================================================= +//function : AddClippingPlane +//purpose : +//======================================================================= + +TDF_Label XCAFDoc_ClippingPlaneTool::AddClippingPlane(const gp_Pln thePlane, const TCollection_ExtendedString theName, const Standard_Boolean theCapping) const +{ + TDF_Label aLabel = AddClippingPlane(thePlane, theName); + Standard_Integer aCappingVal = (theCapping) ? 1 : 0; + TDataStd_Integer::Set(aLabel, aCappingVal); + + return aLabel; +} + +//======================================================================= +//function : AddClippingPlane +//purpose : +//======================================================================= + +TDF_Label XCAFDoc_ClippingPlaneTool::AddClippingPlane(const gp_Pln thePlane, const Handle(TCollection_HAsciiString)& theName, const Standard_Boolean theCapping) const +{ + TCollection_ExtendedString anExtName = TCollection_ExtendedString(theName->String()); + return AddClippingPlane(thePlane, anExtName, theCapping); +} + +//======================================================================= +//function : RemoveClippingPlane +//purpose : +//======================================================================= + +Standard_Boolean XCAFDoc_ClippingPlaneTool::RemoveClippingPlane(const TDF_Label& theLabel) const +{ + Handle(TDataStd_TreeNode) Node; + if (!IsClippingPlane(theLabel) || theLabel.FindAttribute(XCAFDoc::ViewRefPlaneGUID(), Node)) + return Standard_False; + + theLabel.ForgetAllAttributes(Standard_True); + return Standard_True; +} + +//======================================================================= +//function : GetClippingPlanes +//purpose : +//======================================================================= + +void XCAFDoc_ClippingPlaneTool::GetClippingPlanes(TDF_LabelSequence& theLabels) const +{ + theLabels.Clear(); + + TDF_ChildIDIterator ChildIDIterator(Label(), TDataXtd_Plane::GetID()); + for (; ChildIDIterator.More(); ChildIDIterator.Next()) { + TDF_Label aLabel = ChildIDIterator.Value()->Label(); + if (IsClippingPlane(aLabel)) theLabels.Append(aLabel); + } +} + +//======================================================================= +//function : UpdateClippingPlane +//purpose : +//======================================================================= + +void XCAFDoc_ClippingPlaneTool::UpdateClippingPlane(const TDF_Label& theLabel, + const gp_Pln thePlane, const TCollection_ExtendedString theName) const +{ + if (theLabel.Father() != Label()) + return; + + Handle(TDataXtd_Plane) aPlaneAttribute; + if (!theLabel.FindAttribute(TDataXtd_Plane::GetID(), aPlaneAttribute)) + return; + theLabel.ForgetAttribute(TDataXtd_Plane::GetID()); + TDataXtd_Plane::Set(theLabel, thePlane); + theLabel.ForgetAttribute(TDataStd_Name::GetID()); + TDataStd_Name::Set(theLabel, theName); +} + +//======================================================================= +//function : SetCapping +//purpose : +//======================================================================= + +void XCAFDoc_ClippingPlaneTool::SetCapping(const TDF_Label& theClippingPlaneL, const Standard_Boolean theCapping) +{ + if (theClippingPlaneL.Father() != Label()) + return; + + theClippingPlaneL.ForgetAttribute(TDataStd_Integer::GetID()); + Standard_Integer aCappingVal = (theCapping) ? 1 : 0; + TDataStd_Integer::Set(theClippingPlaneL, aCappingVal); +} + +//======================================================================= +//function : GetCapping +//purpose : +//======================================================================= + +Standard_Boolean XCAFDoc_ClippingPlaneTool::GetCapping(const TDF_Label& theClippingPlaneL) const +{ + if (theClippingPlaneL.Father() != Label()) + return Standard_False; + + Handle(TDataStd_Integer) aCappingAttribute; + if (theClippingPlaneL.FindAttribute(TDataStd_Integer::GetID(), aCappingAttribute)) + return (aCappingAttribute->Get() == 1); + + return Standard_False; +} + +//======================================================================= +//function : GetCapping +//purpose : +//======================================================================= + +Standard_Boolean XCAFDoc_ClippingPlaneTool::GetCapping(const TDF_Label& theClippingPlaneL, Standard_Boolean &theCapping) const +{ + if (theClippingPlaneL.Father() != Label()) + return Standard_False; + + Handle(TDataStd_Integer) aCappingAttribute; + if (theClippingPlaneL.FindAttribute(TDataStd_Integer::GetID(), aCappingAttribute)) { + theCapping = (aCappingAttribute->Get() == 1); + return Standard_True; + } + + return Standard_False; +} + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= + +const Standard_GUID& XCAFDoc_ClippingPlaneTool::GetID() +{ + static Standard_GUID ColorTblID ("efd213ea-6dfd-11d4-b9c8-0060b0ee281b"); + return ColorTblID; +} + +//======================================================================= +//function : Set +//purpose : +//======================================================================= + +Handle(XCAFDoc_ClippingPlaneTool) XCAFDoc_ClippingPlaneTool::Set(const TDF_Label& L) +{ + Handle(XCAFDoc_ClippingPlaneTool) A; + if (!L.FindAttribute(XCAFDoc_ClippingPlaneTool::GetID(), A)) { + A = new XCAFDoc_ClippingPlaneTool(); + L.AddAttribute(A); + } + return A; +} + +//======================================================================= +//function : ID +//purpose : +//======================================================================= + +const Standard_GUID& XCAFDoc_ClippingPlaneTool::ID() const +{ + return GetID(); +} + +//======================================================================= +//function : Restore +//purpose : +//======================================================================= + +void XCAFDoc_ClippingPlaneTool::Restore(const Handle(TDF_Attribute)& /*with*/) +{ +} + +//======================================================================= +//function : NewEmpty +//purpose : +//======================================================================= + +Handle(TDF_Attribute) XCAFDoc_ClippingPlaneTool::NewEmpty() const +{ + return new XCAFDoc_ClippingPlaneTool; +} + +//======================================================================= +//function : Paste +//purpose : +//======================================================================= + +void XCAFDoc_ClippingPlaneTool::Paste(const Handle(TDF_Attribute)& /*into*/, + const Handle(TDF_RelocationTable)& /*RT*/) const +{ +} + +//======================================================================= +//function : XCAFDoc_ClippingPlaneTool +//purpose : +//======================================================================= + +XCAFDoc_ClippingPlaneTool::XCAFDoc_ClippingPlaneTool() +{ +} + diff --git a/src/XCAFDoc/XCAFDoc_ClippingPlaneTool.hxx b/src/XCAFDoc/XCAFDoc_ClippingPlaneTool.hxx new file mode 100644 index 0000000000..3dd3d5c34e --- /dev/null +++ b/src/XCAFDoc/XCAFDoc_ClippingPlaneTool.hxx @@ -0,0 +1,115 @@ +// Created on: 2016-11-29 +// 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 _XCAFDoc_ClippingPlaneTool_HeaderFile +#define _XCAFDoc_ClippingPlaneTool_HeaderFile + +#include +#include + +class XCAFDoc_ClippingPlaneTool; +DEFINE_STANDARD_HANDLE(XCAFDoc_ClippingPlaneTool, TDF_Attribute) + +//! Provide tool for management of ClippingPlane section of document. +//! Provide tool to store, retrieve, remove and modify clipping planes. +//! Each clipping plane consists of gp_Pln and its name. +class XCAFDoc_ClippingPlaneTool : public TDF_Attribute +{ + +public: + + + Standard_EXPORT XCAFDoc_ClippingPlaneTool(); + + //! Creates (if not exist) ClippingPlaneTool. + Standard_EXPORT static Handle(XCAFDoc_ClippingPlaneTool) Set (const TDF_Label& theLabel); + + Standard_EXPORT static const Standard_GUID& GetID(); + + //! returns the label under which ClippingPlanes are stored + Standard_EXPORT TDF_Label BaseLabel() const; + + //! Returns True if label belongs to a ClippingPlane table and + //! is a ClippingPlane definition + Standard_EXPORT Standard_Boolean IsClippingPlane (const TDF_Label& theLabel) const; + + //! Returns ClippingPlane defined by label lab + //! Returns False if the label is not in ClippingPlane table + //! or does not define a ClippingPlane + Standard_EXPORT Standard_Boolean GetClippingPlane(const TDF_Label& theLabel, gp_Pln& thePlane, TCollection_ExtendedString& theName, Standard_Boolean &theCapping) const; + + //! Returns ClippingPlane defined by label lab + //! Returns False if the label is not in ClippingPlane table + //! or does not define a ClippingPlane + Standard_EXPORT Standard_Boolean GetClippingPlane(const TDF_Label& theLabel, gp_Pln& thePlane, Handle(TCollection_HAsciiString)& theName, Standard_Boolean &theCapping) const; + + //! Adds a clipping plane definition to a ClippingPlane table and returns + //! its label (returns existing label if the same clipping plane + //! is already defined) + Standard_EXPORT TDF_Label AddClippingPlane(const gp_Pln thePlane, const TCollection_ExtendedString theName, const Standard_Boolean theCapping) const; + + //! Adds a clipping plane definition to a ClippingPlane table and returns + //! its label (returns existing label if the same clipping plane + //! is already defined) + Standard_EXPORT TDF_Label AddClippingPlane(const gp_Pln thePlane, const Handle(TCollection_HAsciiString)& theName, const Standard_Boolean theCapping) const; + + //! Adds a clipping plane definition to a ClippingPlane table and returns + //! its label (returns existing label if the same clipping plane + //! is already defined) + Standard_EXPORT TDF_Label AddClippingPlane(const gp_Pln thePlane, const TCollection_ExtendedString theName) const; + + //! Adds a clipping plane definition to a ClippingPlane table and returns + //! its label (returns existing label if the same clipping plane + //! is already defined) + Standard_EXPORT TDF_Label AddClippingPlane(const gp_Pln thePlane, const Handle(TCollection_HAsciiString)& theName) const; + + //! Removes clipping plane from the ClippingPlane table + //! Return false and do nothing if clipping plane is referenced in at least one View + Standard_EXPORT Standard_Boolean RemoveClippingPlane(const TDF_Label& theLabel) const; + + //! Returns a sequence of clipping planes currently stored + //! in the ClippingPlane table + Standard_EXPORT void GetClippingPlanes(TDF_LabelSequence& Labels) const; + + //! Sets new value of plane and name to the given clipping plane label + //! or do nothing, if the given label is not a clipping plane label + Standard_EXPORT void UpdateClippingPlane(const TDF_Label& theLabelL, const gp_Pln thePlane, const TCollection_ExtendedString theName) const; + + //! Set new value of capping for given clipping plane label + Standard_EXPORT void SetCapping(const TDF_Label& theClippingPlaneL, const Standard_Boolean theCapping); + + //! Get capping value for given clipping plane label + //! Return capping value + Standard_EXPORT Standard_Boolean GetCapping(const TDF_Label& theClippingPlaneL) const; + + //! Get capping value for given clipping plane label + //! Return true if Label is valid abd capping is exist. + Standard_EXPORT Standard_Boolean GetCapping(const TDF_Label& theClippingPlaneL, Standard_Boolean &theCapping) const; + + Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; + + Standard_EXPORT void Restore (const Handle(TDF_Attribute)& with) Standard_OVERRIDE; + + Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; + + Standard_EXPORT void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE; + + + + + DEFINE_STANDARD_RTTIEXT(XCAFDoc_ClippingPlaneTool, TDF_Attribute) + +}; +#endif // _XCAFDoc_ClippingPlaneTool_HeaderFile diff --git a/src/XCAFDoc/XCAFDoc_DimTolTool.cxx b/src/XCAFDoc/XCAFDoc_DimTolTool.cxx index 371e8bf122..974391514b 100644 --- a/src/XCAFDoc/XCAFDoc_DimTolTool.cxx +++ b/src/XCAFDoc/XCAFDoc_DimTolTool.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -918,7 +919,36 @@ Standard_Boolean XCAFDoc_DimTolTool::GetTolerOfDatumLabels(const TDF_Label& theD return Standard_True; } +//======================================================================= +//function : IsLocked +//purpose : +//======================================================================= + +Standard_Boolean XCAFDoc_DimTolTool::IsLocked(const TDF_Label& theViewL) const +{ + Handle(TDataStd_UAttribute) anAttr; + return theViewL.FindAttribute(XCAFDoc::LockGUID(), anAttr); +} + +//======================================================================= +//function : Lock +//purpose : +//======================================================================= +void XCAFDoc_DimTolTool::Lock(const TDF_Label& theViewL) const +{ + TDataStd_UAttribute::Set(theViewL, XCAFDoc::LockGUID()); +} + +//======================================================================= +//function : Unlock +//purpose : +//======================================================================= + +void XCAFDoc_DimTolTool::Unlock(const TDF_Label& theViewL) const +{ + theViewL.ForgetAttribute(XCAFDoc::LockGUID()); +} //======================================================================= //function : ID diff --git a/src/XCAFDoc/XCAFDoc_DimTolTool.hxx b/src/XCAFDoc/XCAFDoc_DimTolTool.hxx index f12b2f2228..66c920001c 100644 --- a/src/XCAFDoc/XCAFDoc_DimTolTool.hxx +++ b/src/XCAFDoc/XCAFDoc_DimTolTool.hxx @@ -187,6 +187,15 @@ public: //! Returns Datum label defined for label ShapeL Standard_EXPORT Standard_Boolean GetRefDatumLabel (const TDF_Label& theShapeL, TDF_LabelSequence& theDatum) const; + + //! Returns true if the given GDT is marked as locked + Standard_EXPORT Standard_Boolean IsLocked(const TDF_Label& theViewL) const; + + //! Mark the given GDT as locked + Standard_EXPORT void Lock(const TDF_Label& theViewL) const; + + //! Unlock the given GDT + Standard_EXPORT void Unlock(const TDF_Label& theViewL) const; Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; diff --git a/src/XCAFDoc/XCAFDoc_DocumentTool.cxx b/src/XCAFDoc/XCAFDoc_DocumentTool.cxx index 52dd3d7e0c..fdaa9c5448 100644 --- a/src/XCAFDoc/XCAFDoc_DocumentTool.cxx +++ b/src/XCAFDoc/XCAFDoc_DocumentTool.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -83,6 +84,7 @@ Handle(XCAFDoc_DocumentTool) XCAFDoc_DocumentTool::Set(const TDF_Label& L, XCAFDoc_DimTolTool::Set(DGTsLabel(L)); XCAFDoc_MaterialTool::Set(MaterialsLabel(L)); XCAFDoc_ViewTool::Set(ViewsLabel(L)); + XCAFDoc_ClippingPlaneTool::Set(ClippingPlanesLabel(L)); } return A; } @@ -197,6 +199,17 @@ TDF_Label XCAFDoc_DocumentTool::ViewsLabel(const TDF_Label& acces) return L; } +//======================================================================= +//function : ClippingPlanesLabel +//purpose : +//======================================================================= + +TDF_Label XCAFDoc_DocumentTool::ClippingPlanesLabel(const TDF_Label& acces) +{ + TDF_Label L = DocLabel(acces).FindChild(8, Standard_True); + TDataStd_Name::Set(L, "Clipping Planes"); + return L; +} //======================================================================= //function : ShapeTool @@ -262,6 +275,15 @@ Handle(XCAFDoc_ViewTool) XCAFDoc_DocumentTool::ViewTool(const TDF_Label& acces) return XCAFDoc_ViewTool::Set(ViewsLabel(acces)); } +//======================================================================= +//function : ClippingPlaneTool +//purpose : +//======================================================================= + +Handle(XCAFDoc_ClippingPlaneTool) XCAFDoc_DocumentTool::ClippingPlaneTool(const TDF_Label& acces) +{ + return XCAFDoc_ClippingPlaneTool::Set(ClippingPlanesLabel(acces)); +} //======================================================================= //function : ID diff --git a/src/XCAFDoc/XCAFDoc_DocumentTool.hxx b/src/XCAFDoc/XCAFDoc_DocumentTool.hxx index 5da41aa5d8..5f467a4f4f 100644 --- a/src/XCAFDoc/XCAFDoc_DocumentTool.hxx +++ b/src/XCAFDoc/XCAFDoc_DocumentTool.hxx @@ -26,6 +26,7 @@ class TDF_Label; class TDocStd_Document; class XCAFDoc_ShapeTool; class XCAFDoc_ColorTool; +class XCAFDoc_ClippingPlaneTool; class XCAFDoc_LayerTool; class XCAFDoc_DimTolTool; class XCAFDoc_MaterialTool; @@ -81,6 +82,9 @@ public: //! Returns sub-label of DocLabel() with tag 7. Standard_EXPORT static TDF_Label ViewsLabel(const TDF_Label& acces); + //! Returns sub-label of DocLabel() with tag 8. + Standard_EXPORT static TDF_Label ClippingPlanesLabel(const TDF_Label& acces); + //! Creates (if it does not exist) ShapeTool attribute on ShapesLabel(). Standard_EXPORT static Handle(XCAFDoc_ShapeTool) ShapeTool (const TDF_Label& acces); @@ -99,6 +103,9 @@ public: //! Creates (if it does not exist) ViewTool attribute on ViewsLabel(). Standard_EXPORT static Handle(XCAFDoc_ViewTool) ViewTool(const TDF_Label& acces); + //! Creates (if it does not exist) ClippingPlaneTool attribute on ClippingPlanesLabel(). + Standard_EXPORT static Handle(XCAFDoc_ClippingPlaneTool) ClippingPlaneTool(const TDF_Label& acces); + Standard_EXPORT XCAFDoc_DocumentTool(); //! to be called when reading this attribute from file diff --git a/src/XCAFDoc/XCAFDoc_View.cxx b/src/XCAFDoc/XCAFDoc_View.cxx index dad74ff1c5..73c0ccf780 100644 --- a/src/XCAFDoc/XCAFDoc_View.cxx +++ b/src/XCAFDoc/XCAFDoc_View.cxx @@ -41,10 +41,11 @@ enum ChildLab ChildLab_ZoomFactor, ChildLab_WindowHorizontalSize, ChildLab_WindowVerticalSize, - ChildLab_ClippingPlane, ChildLab_FrontPlaneDistance, ChildLab_BackPlaneDistance, - ChildLab_ViewVolumeSidesClipping + ChildLab_ViewVolumeSidesClipping, + ChildLab_ClippingExpression, + ChildLab_GDTPoints }; //======================================================================= @@ -120,12 +121,6 @@ void XCAFDoc_View::SetObject (const Handle(XCAFView_Object)& theObject) // Window vertical size TDataStd_Real::Set(Label().FindChild(ChildLab_WindowVerticalSize), theObject->WindowVerticalSize()); - // Clipping plane - if (theObject->HasClippingPlane()) - { - TDataXtd_Plane::Set(Label().FindChild(ChildLab_ClippingPlane), theObject->ClippingPlane()); - } - // Front plane clipping if (theObject->HasFrontPlaneClipping()) { @@ -141,6 +136,19 @@ void XCAFDoc_View::SetObject (const Handle(XCAFView_Object)& theObject) // View volume sides clipping Standard_Integer aValue = theObject->HasViewVolumeSidesClipping() ? 1 : 0; TDataStd_Integer::Set(Label().FindChild(ChildLab_ViewVolumeSidesClipping), aValue); + + // Clipping Expression + if (!theObject->ClippingExpression().IsNull()) + TDataStd_AsciiString::Set(Label().FindChild(ChildLab_ClippingExpression), theObject->ClippingExpression()->String()); + + // GDT points + if (theObject->HasGDTPoints()) + { + TDF_Label aPointsLabel = Label().FindChild(ChildLab_GDTPoints); + for (Standard_Integer i = 1; i <= theObject->NbGDTPoints(); i++) { + TDataXtd_Point::Set(aPointsLabel.FindChild(i), theObject->GDTPoint(i)); + } + } } //======================================================================= @@ -210,14 +218,6 @@ Handle(XCAFView_Object) XCAFDoc_View::GetObject() const anObj->SetWindowVerticalSize(aWindowVerticalSize->Get()); } - // Clipping plane - Handle(TDataXtd_Plane) aPlaneAttr; - if (Label().FindChild(ChildLab_ClippingPlane).FindAttribute(TDataXtd_Plane::GetID(), aPlaneAttr)) { - gp_Pln aPlane; - TDataXtd_Geometry::Plane(aPlaneAttr->Label(), aPlane); - anObj->SetClippingPlane(aPlane); - } - // Front plane clipping Handle(TDataStd_Real) aFrontPlaneDistance; if (Label().FindChild(ChildLab_FrontPlaneDistance).FindAttribute(TDataStd_Real::GetID(), aFrontPlaneDistance)) @@ -240,6 +240,26 @@ Handle(XCAFView_Object) XCAFDoc_View::GetObject() const anObj->SetViewVolumeSidesClipping(aValue); } + // Name + Handle(TDataStd_AsciiString) aClippingExpression; + if (Label().FindChild(ChildLab_ClippingExpression).FindAttribute(TDataStd_AsciiString::GetID(), aClippingExpression)) + { + anObj->SetClippingExpression(new TCollection_HAsciiString(aClippingExpression->Get())); + } + + // GDT Points + if (!Label().FindChild(ChildLab_GDTPoints, Standard_False).IsNull()) { + TDF_Label aPointsLabel = Label().FindChild(ChildLab_GDTPoints); + anObj->CreateGDTPoints(aPointsLabel.NbChildren()); + for (Standard_Integer i = 1; i <= aPointsLabel.NbChildren(); i++) { + gp_Pnt aPoint; + Handle(TDataXtd_Point) aPointAttr; + aPointsLabel.FindChild(i).FindAttribute(TDataXtd_Point::GetID(), aPointAttr); + TDataXtd_Geometry::Point(aPointAttr->Label(), aPoint); + anObj->SetGDTPoint(i, aPoint); + } + } + return anObj; } diff --git a/src/XCAFDoc/XCAFDoc_ViewTool.cxx b/src/XCAFDoc/XCAFDoc_ViewTool.cxx index 62e91935c8..9bf93ca729 100644 --- a/src/XCAFDoc/XCAFDoc_ViewTool.cxx +++ b/src/XCAFDoc/XCAFDoc_ViewTool.cxx @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -122,6 +123,7 @@ TDF_Label XCAFDoc_ViewTool::AddView() //======================================================================= void XCAFDoc_ViewTool::SetView(const TDF_LabelSequence& theShapeLabels, const TDF_LabelSequence& theGDTLabels, + const TDF_LabelSequence& theClippingPlaneLabels, const TDF_Label& theViewL) const { if(!IsView(theViewL)) @@ -130,6 +132,7 @@ void XCAFDoc_ViewTool::SetView(const TDF_LabelSequence& theShapeLabels, Handle(XCAFDoc_GraphNode) aChGNode; Handle(XCAFDoc_GraphNode) aShapeGNode; Handle(XCAFDoc_GraphNode) aGDTGNode; + Handle(XCAFDoc_GraphNode) aPlaneGNode; if ( theViewL.FindAttribute (XCAFDoc::ViewRefShapeGUID(), aChGNode) ) { while (aChGNode->NbFathers() > 0) { @@ -142,13 +145,22 @@ void XCAFDoc_ViewTool::SetView(const TDF_LabelSequence& theShapeLabels, } if ( theViewL.FindAttribute (XCAFDoc::ViewRefGDTGUID(), aChGNode) ) { while (aChGNode->NbFathers() > 0) { - aShapeGNode = aChGNode->GetFather(1); - aShapeGNode->UnSetChild(aChGNode); - if(aShapeGNode->NbChildren() == 0) - aShapeGNode->ForgetAttribute( XCAFDoc::ViewRefGDTGUID() ); + aGDTGNode = aChGNode->GetFather(1); + aGDTGNode->UnSetChild(aChGNode); + if(aGDTGNode->NbChildren() == 0) + aGDTGNode->ForgetAttribute( XCAFDoc::ViewRefGDTGUID() ); } theViewL.ForgetAttribute ( XCAFDoc::ViewRefGDTGUID() ); } + if (theViewL.FindAttribute(XCAFDoc::ViewRefPlaneGUID(), aChGNode)) { + while (aChGNode->NbFathers() > 0) { + aPlaneGNode = aChGNode->GetFather(1); + aPlaneGNode->UnSetChild(aChGNode); + if (aPlaneGNode->NbChildren() == 0) + aPlaneGNode->ForgetAttribute(XCAFDoc::ViewRefGDTGUID()); + } + theViewL.ForgetAttribute(XCAFDoc::ViewRefPlaneGUID()); + } if (!theViewL.FindAttribute(XCAFDoc::ViewRefShapeGUID(), aChGNode) && theShapeLabels.Length() > 0) { aChGNode = new XCAFDoc_GraphNode; @@ -181,6 +193,170 @@ void XCAFDoc_ViewTool::SetView(const TDF_LabelSequence& theShapeLabels, aGDTGNode->SetChild(aChGNode); aChGNode->SetFather(aGDTGNode); } + + if (!theViewL.FindAttribute(XCAFDoc::ViewRefPlaneGUID(), aChGNode) && theClippingPlaneLabels.Length() > 0) { + aChGNode = new XCAFDoc_GraphNode; + aChGNode = XCAFDoc_GraphNode::Set(theViewL); + aChGNode->SetGraphID(XCAFDoc::ViewRefPlaneGUID()); + } + for (Standard_Integer i = theClippingPlaneLabels.Lower(); i <= theClippingPlaneLabels.Upper(); i++) + { + if (!theClippingPlaneLabels.Value(i).FindAttribute(XCAFDoc::ViewRefPlaneGUID(), aPlaneGNode)) { + aPlaneGNode = new XCAFDoc_GraphNode; + aPlaneGNode = XCAFDoc_GraphNode::Set(theClippingPlaneLabels.Value(i)); + } + aPlaneGNode->SetGraphID(XCAFDoc::ViewRefPlaneGUID()); + aPlaneGNode->SetChild(aChGNode); + aChGNode->SetFather(aPlaneGNode); + } +} + +//======================================================================= +//function : SetView +//purpose : +//======================================================================= +void XCAFDoc_ViewTool::SetView(const TDF_LabelSequence& theShapeLabels, + const TDF_LabelSequence& theGDTLabels, + const TDF_Label& theViewL) const +{ + if (!IsView(theViewL)) + return; + + Handle(XCAFDoc_GraphNode) aChGNode; + Handle(XCAFDoc_GraphNode) aShapeGNode; + Handle(XCAFDoc_GraphNode) aGDTGNode; + + if (theViewL.FindAttribute(XCAFDoc::ViewRefShapeGUID(), aChGNode)) { + while (aChGNode->NbFathers() > 0) { + aShapeGNode = aChGNode->GetFather(1); + aShapeGNode->UnSetChild(aChGNode); + if (aShapeGNode->NbChildren() == 0) + aShapeGNode->ForgetAttribute(XCAFDoc::ViewRefShapeGUID()); + } + theViewL.ForgetAttribute(XCAFDoc::ViewRefShapeGUID()); + } + if (theViewL.FindAttribute(XCAFDoc::ViewRefGDTGUID(), aChGNode)) { + while (aChGNode->NbFathers() > 0) { + aGDTGNode = aChGNode->GetFather(1); + aGDTGNode->UnSetChild(aChGNode); + if (aGDTGNode->NbChildren() == 0) + aGDTGNode->ForgetAttribute(XCAFDoc::ViewRefGDTGUID()); + } + theViewL.ForgetAttribute(XCAFDoc::ViewRefGDTGUID()); + } + + if (!theViewL.FindAttribute(XCAFDoc::ViewRefShapeGUID(), aChGNode) && theShapeLabels.Length() > 0) { + aChGNode = new XCAFDoc_GraphNode; + aChGNode = XCAFDoc_GraphNode::Set(theViewL); + aChGNode->SetGraphID(XCAFDoc::ViewRefShapeGUID()); + } + for (Standard_Integer i = theShapeLabels.Lower(); i <= theShapeLabels.Upper(); i++) + { + if (!theShapeLabels.Value(i).FindAttribute(XCAFDoc::ViewRefShapeGUID(), aShapeGNode)) { + aShapeGNode = new XCAFDoc_GraphNode; + aShapeGNode = XCAFDoc_GraphNode::Set(theShapeLabels.Value(i)); + } + aShapeGNode->SetGraphID(XCAFDoc::ViewRefShapeGUID()); + aShapeGNode->SetChild(aChGNode); + aChGNode->SetFather(aShapeGNode); + } + + if (!theViewL.FindAttribute(XCAFDoc::ViewRefGDTGUID(), aChGNode) && theGDTLabels.Length() > 0) { + aChGNode = new XCAFDoc_GraphNode; + aChGNode = XCAFDoc_GraphNode::Set(theViewL); + aChGNode->SetGraphID(XCAFDoc::ViewRefGDTGUID()); + } + for (Standard_Integer i = theGDTLabels.Lower(); i <= theGDTLabels.Upper(); i++) + { + if (!theGDTLabels.Value(i).FindAttribute(XCAFDoc::ViewRefGDTGUID(), aGDTGNode)) { + aGDTGNode = new XCAFDoc_GraphNode; + aGDTGNode = XCAFDoc_GraphNode::Set(theGDTLabels.Value(i)); + } + aGDTGNode->SetGraphID(XCAFDoc::ViewRefGDTGUID()); + aGDTGNode->SetChild(aChGNode); + aChGNode->SetFather(aGDTGNode); + } +} + +//======================================================================= +//function : SetClippingPlanes +//purpose : +//======================================================================= +void XCAFDoc_ViewTool::SetClippingPlanes(const TDF_LabelSequence& theClippingPlaneLabels, + const TDF_Label& theViewL) const +{ + if (!IsView(theViewL)) + return; + + Handle(XCAFDoc_GraphNode) aChGNode; + Handle(XCAFDoc_GraphNode) aPlaneGNode; + + if (theViewL.FindAttribute(XCAFDoc::ViewRefPlaneGUID(), aChGNode)) { + while (aChGNode->NbFathers() > 0) { + aPlaneGNode = aChGNode->GetFather(1); + aPlaneGNode->UnSetChild(aChGNode); + if (aPlaneGNode->NbChildren() == 0) + aPlaneGNode->ForgetAttribute(XCAFDoc::ViewRefGDTGUID()); + } + theViewL.ForgetAttribute(XCAFDoc::ViewRefPlaneGUID()); + } + + if (!theViewL.FindAttribute(XCAFDoc::ViewRefPlaneGUID(), aChGNode) && theClippingPlaneLabels.Length() > 0) { + aChGNode = new XCAFDoc_GraphNode; + aChGNode = XCAFDoc_GraphNode::Set(theViewL); + aChGNode->SetGraphID(XCAFDoc::ViewRefPlaneGUID()); + } + for (Standard_Integer i = theClippingPlaneLabels.Lower(); i <= theClippingPlaneLabels.Upper(); i++) + { + if (!theClippingPlaneLabels.Value(i).FindAttribute(XCAFDoc::ViewRefPlaneGUID(), aPlaneGNode)) { + aPlaneGNode = new XCAFDoc_GraphNode; + aPlaneGNode = XCAFDoc_GraphNode::Set(theClippingPlaneLabels.Value(i)); + } + aPlaneGNode->SetGraphID(XCAFDoc::ViewRefPlaneGUID()); + aPlaneGNode->SetChild(aChGNode); + aChGNode->SetFather(aPlaneGNode); + } +} + +//======================================================================= +//function : RemoveView +//purpose : +//======================================================================= +void XCAFDoc_ViewTool::RemoveView(const TDF_Label& theViewL) +{ + if (!IsView(theViewL)) + return; + + Handle(XCAFDoc_GraphNode) aChGNode; + Handle(XCAFDoc_GraphNode) aShapeGNode; + Handle(XCAFDoc_GraphNode) aGDTGNode; + Handle(XCAFDoc_GraphNode) aPlaneGNode; + + if (theViewL.FindAttribute(XCAFDoc::ViewRefShapeGUID(), aChGNode)) { + while (aChGNode->NbFathers() > 0) { + aShapeGNode = aChGNode->GetFather(1); + aShapeGNode->UnSetChild(aChGNode); + if (aShapeGNode->NbChildren() == 0) + aShapeGNode->ForgetAttribute(XCAFDoc::ViewRefShapeGUID()); + } + } + if (theViewL.FindAttribute(XCAFDoc::ViewRefGDTGUID(), aChGNode)) { + while (aChGNode->NbFathers() > 0) { + aGDTGNode = aChGNode->GetFather(1); + aGDTGNode->UnSetChild(aChGNode); + if (aGDTGNode->NbChildren() == 0) + aGDTGNode->ForgetAttribute(XCAFDoc::ViewRefGDTGUID()); + } + } + if (theViewL.FindAttribute(XCAFDoc::ViewRefPlaneGUID(), aChGNode)) { + while (aChGNode->NbFathers() > 0) { + aPlaneGNode = aChGNode->GetFather(1); + aPlaneGNode->UnSetChild(aChGNode); + if (aPlaneGNode->NbChildren() == 0) + aPlaneGNode->ForgetAttribute(XCAFDoc::ViewRefGDTGUID()); + } + } + theViewL.ForgetAllAttributes(); } //======================================================================= @@ -231,6 +407,30 @@ Standard_Boolean XCAFDoc_ViewTool::GetRefGDTLabel(const TDF_Label& theViewL, return Standard_True; } +//======================================================================= +//function : GetRefClippingPlaneLabel +//purpose : +//======================================================================= +Standard_Boolean XCAFDoc_ViewTool::GetRefClippingPlaneLabel(const TDF_Label& theViewL, + TDF_LabelSequence& theClippingPlaneLabels) const +{ + theClippingPlaneLabels.Clear(); + Handle(TDataStd_TreeNode) aNode; + if (!theViewL.FindAttribute(XCAFDoc::ViewRefGUID(), aNode) || !aNode->HasFather()) { + Handle(XCAFDoc_GraphNode) aGNode; + if (theViewL.FindAttribute(XCAFDoc::ViewRefPlaneGUID(), aGNode) && aGNode->NbFathers() > 0) { + for (Standard_Integer i = 1; i <= aGNode->NbFathers(); i++) + theClippingPlaneLabels.Append(aGNode->GetFather(i)->Label()); + return Standard_True; + } + else + return Standard_False; + } + + theClippingPlaneLabels.Append(aNode->Father()->Label()); + return Standard_True; +} + //======================================================================= //function : GetViewLabelsForShape //purpose : @@ -269,6 +469,56 @@ Standard_Boolean XCAFDoc_ViewTool::GetViewLabelsForGDT(const TDF_Label& theGDTL, return aResult; } +//======================================================================= +//function : GetViewLabelsForClippingPlane +//purpose : +//======================================================================= +Standard_Boolean XCAFDoc_ViewTool::GetViewLabelsForClippingPlane(const TDF_Label& theClippingPlaneL, + TDF_LabelSequence& theViews) const +{ + Handle(XCAFDoc_GraphNode) aGNode; + Standard_Boolean aResult = Standard_False; + if (theClippingPlaneL.FindAttribute(XCAFDoc::ViewRefPlaneGUID(), aGNode) && aGNode->NbChildren() > 0) { + for (Standard_Integer i = 1; i <= aGNode->NbChildren(); i++) + { + theViews.Append(aGNode->GetChild(i)->Label()); + } + aResult = Standard_True; + } + return aResult; +} + +//======================================================================= +//function : IsLocked +//purpose : +//======================================================================= + +Standard_Boolean XCAFDoc_ViewTool::IsLocked(const TDF_Label& theViewL) const +{ + Handle(TDataStd_UAttribute) anAttr; + return theViewL.FindAttribute(XCAFDoc::LockGUID(), anAttr); +} + +//======================================================================= +//function : Lock +//purpose : +//======================================================================= + +void XCAFDoc_ViewTool::Lock(const TDF_Label& theViewL) const +{ + TDataStd_UAttribute::Set(theViewL, XCAFDoc::LockGUID()); +} + +//======================================================================= +//function : Unlock +//purpose : +//======================================================================= + +void XCAFDoc_ViewTool::Unlock(const TDF_Label& theViewL) const +{ + theViewL.ForgetAttribute(XCAFDoc::LockGUID()); +} + //======================================================================= //function : ID //purpose : diff --git a/src/XCAFDoc/XCAFDoc_ViewTool.hxx b/src/XCAFDoc/XCAFDoc_ViewTool.hxx index 39827a930b..a995df5255 100644 --- a/src/XCAFDoc/XCAFDoc_ViewTool.hxx +++ b/src/XCAFDoc/XCAFDoc_ViewTool.hxx @@ -65,13 +65,31 @@ public: Standard_EXPORT void GetViewLabels (TDF_LabelSequence& theLabels) const; //! Sets a link with GUID - Standard_EXPORT void SetView (const TDF_LabelSequence& theShapes, const TDF_LabelSequence& theGDTs, const TDF_Label& theViewL) const; + Standard_EXPORT void SetView (const TDF_LabelSequence& theShapes, + const TDF_LabelSequence& theGDTs, + const TDF_LabelSequence& theClippingPlanes, + const TDF_Label& theViewL) const; + + //! Sets a link with GUID + Standard_EXPORT void SetView(const TDF_LabelSequence& theShapes, + const TDF_LabelSequence& theGDTs, + const TDF_Label& theViewL) const; + + //! Set Clipping planes to given View + Standard_EXPORT void SetClippingPlanes(const TDF_LabelSequence& theClippingPlaneLabels, + const TDF_Label& theViewL) const; + + //! Remove View + Standard_EXPORT void RemoveView(const TDF_Label& theViewL); //! Returns all View labels defined for label ShapeL Standard_EXPORT Standard_Boolean GetViewLabelsForShape (const TDF_Label& theShapeL, TDF_LabelSequence& theViews) const; //! Returns all View labels defined for label GDTL Standard_EXPORT Standard_Boolean GetViewLabelsForGDT (const TDF_Label& theGDTL, TDF_LabelSequence& theViews) const; + + //! Returns all View labels defined for label ClippingPlaneL + Standard_EXPORT Standard_Boolean GetViewLabelsForClippingPlane(const TDF_Label& theClippingPlaneL, TDF_LabelSequence& theViews) const; //! Adds a view definition to a View table and returns its label Standard_EXPORT TDF_Label AddView() ; @@ -83,6 +101,19 @@ public: //! Returns GDT labels defined for label theViewL //! Returns False if the theViewL is not in View table Standard_EXPORT Standard_Boolean GetRefGDTLabel (const TDF_Label& theViewL, TDF_LabelSequence& theGDTLabels) const; + + //! Returns ClippingPlane labels defined for label theViewL + //! Returns False if the theViewL is not in View table + Standard_EXPORT Standard_Boolean GetRefClippingPlaneLabel(const TDF_Label& theViewL, TDF_LabelSequence& theClippingPlaneLabels) const; + + //! Returns true if the given View is marked as locked + Standard_EXPORT Standard_Boolean IsLocked(const TDF_Label& theViewL) const; + + //! Mark the given View as locked + Standard_EXPORT void Lock(const TDF_Label& theViewL) const; + + //! Unlock the given View + Standard_EXPORT void Unlock(const TDF_Label& theViewL) const; Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; diff --git a/src/XCAFView/XCAFView_Object.cxx b/src/XCAFView/XCAFView_Object.cxx index 40ff068dbc..bc1e06f1de 100644 --- a/src/XCAFView/XCAFView_Object.cxx +++ b/src/XCAFView/XCAFView_Object.cxx @@ -23,10 +23,11 @@ IMPLEMENT_STANDARD_RTTIEXT(XCAFView_Object,Standard_Transient) //======================================================================= XCAFView_Object::XCAFView_Object() { - myHasClippingPlane = Standard_False; + myClippingExpression = new TCollection_HAsciiString(); myFrontPlaneClipping = Standard_False; myBackPlaneClipping = Standard_False; myViewVolumeSidesClipping = Standard_False; + myGDTPoints = NULL; } //======================================================================= @@ -35,7 +36,6 @@ XCAFView_Object::XCAFView_Object() //======================================================================= XCAFView_Object::XCAFView_Object(const Handle(XCAFView_Object)& theObj) { - myType = theObj->myType; myProjectionPoint = theObj->myProjectionPoint; myViewDirection = theObj->myViewDirection; @@ -43,11 +43,12 @@ XCAFView_Object::XCAFView_Object(const Handle(XCAFView_Object)& theObj) myZoomFactor = theObj->myZoomFactor; myWindowHorizontalSize = theObj->myWindowHorizontalSize; myWindowVerticalSize = theObj->myWindowVerticalSize; - myHasClippingPlane = theObj->myHasClippingPlane; - myClippingPlane = theObj->myClippingPlane; + myClippingExpression = theObj->myClippingExpression; myFrontPlaneClipping = theObj->myFrontPlaneClipping; myFrontPlaneDistance = theObj->myFrontPlaneDistance; myBackPlaneClipping = theObj->myBackPlaneClipping; myBackPlaneDistance = theObj->myBackPlaneDistance; myViewVolumeSidesClipping = theObj->myViewVolumeSidesClipping; + myGDTPoints = NULL; } + diff --git a/src/XCAFView/XCAFView_Object.hxx b/src/XCAFView/XCAFView_Object.hxx index a5ca708ab9..98b340796e 100644 --- a/src/XCAFView/XCAFView_Object.hxx +++ b/src/XCAFView/XCAFView_Object.hxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -119,25 +120,14 @@ public: return myWindowVerticalSize; } - Standard_EXPORT void UnsetClippingPlane() + Standard_EXPORT void SetClippingExpression(Handle(TCollection_HAsciiString) theExpression) { - myHasClippingPlane = Standard_False; + myClippingExpression = theExpression; } - Standard_EXPORT Standard_Boolean HasClippingPlane() + Standard_EXPORT Handle(TCollection_HAsciiString) ClippingExpression() { - return myHasClippingPlane; - } - - Standard_EXPORT void SetClippingPlane(gp_Pln thePlane) - { - myClippingPlane = thePlane; - myHasClippingPlane = Standard_True; - } - - Standard_EXPORT gp_Pln ClippingPlane() - { - return myClippingPlane; + return myClippingExpression; } Standard_EXPORT void UnsetFrontPlaneClipping() @@ -191,6 +181,42 @@ public: { return myViewVolumeSidesClipping; } + + Standard_EXPORT void CreateGDTPoints(const Standard_Integer theLenght) + { + if (theLenght > 0) + myGDTPoints = new TColgp_HArray1OfPnt(1, theLenght); + } + + Standard_EXPORT Standard_Boolean HasGDTPoints() + { + return (!myGDTPoints.IsNull()); + } + + Standard_EXPORT Standard_Integer NbGDTPoints() + { + if (myGDTPoints.IsNull()) + return 0; + return myGDTPoints->Length(); + } + + Standard_EXPORT void SetGDTPoint(const Standard_Integer theIndex, const gp_Pnt thePoint) + { + if (myGDTPoints.IsNull()) + return; + if (theIndex > 0 && theIndex <= myGDTPoints->Length()) + myGDTPoints->SetValue(theIndex, thePoint); + } + + Standard_EXPORT gp_Pnt GDTPoint(const Standard_Integer theIndex) + { + if (myGDTPoints.IsNull()) + return gp_Pnt(); + if (theIndex > 0 && theIndex <= myGDTPoints->Length()) + return myGDTPoints->Value(theIndex); + else + return gp_Pnt(); + } DEFINE_STANDARD_RTTIEXT(XCAFView_Object,Standard_Transient) @@ -204,14 +230,13 @@ private: Standard_Real myZoomFactor; Standard_Real myWindowHorizontalSize; Standard_Real myWindowVerticalSize; - Standard_Boolean myHasClippingPlane; - gp_Pln myClippingPlane; + Handle(TCollection_HAsciiString) myClippingExpression; Standard_Boolean myFrontPlaneClipping; Standard_Real myFrontPlaneDistance; Standard_Boolean myBackPlaneClipping; Standard_Real myBackPlaneDistance; Standard_Boolean myViewVolumeSidesClipping; - + Handle(TColgp_HArray1OfPnt) myGDTPoints; // Point for each GDT to describe position of GDT frame in View. }; #endif // _XCAFView_Object_HeaderFile diff --git a/src/XDEDRAW/XDEDRAW.cxx b/src/XDEDRAW/XDEDRAW.cxx index 7e698c8022..34a0d28076 100644 --- a/src/XDEDRAW/XDEDRAW.cxx +++ b/src/XDEDRAW/XDEDRAW.cxx @@ -800,6 +800,9 @@ static Standard_Integer XAttributeValue (Draw_Interpretor& di, Standard_Integer else if (att->ID() == XCAFDoc::ViewRefGDTGUID()){ type = "View GD&T Link"; } + else if (att->ID() == XCAFDoc::ViewRefPlaneGUID()) { + type = "View Clipping Plane Link"; + } else return 0; Handle(XCAFDoc_GraphNode) DETGN = Handle(XCAFDoc_GraphNode)::DownCast(att); diff --git a/src/XDEDRAW/XDEDRAW_Views.cxx b/src/XDEDRAW/XDEDRAW_Views.cxx index 45ccc1f057..758774364c 100644 --- a/src/XDEDRAW/XDEDRAW_Views.cxx +++ b/src/XDEDRAW/XDEDRAW_Views.cxx @@ -18,11 +18,14 @@ #include #include #include +#include +#include #include #include #include #include #include +#include #include #include #include @@ -73,6 +76,74 @@ static Standard_Integer setView(Draw_Interpretor& di, Standard_Integer argc, con return 0; } +//======================================================================= +//function : removeView +//purpose : +//======================================================================= +static Standard_Integer removeView(Draw_Interpretor& di, Standard_Integer argc, const char** argv) +{ + if (argc < 3) { + di << "Use: XRemoveView Doc View_Label\n"; + return 1; + } + Handle(TDocStd_Document) aDoc; + DDocStd::GetDocument(argv[1], aDoc); + if (aDoc.IsNull()) { + di << argv[1] << " is not a document\n"; + return 1; + } + Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main()); + + TDF_Label aLabel; + TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel); + if (aLabel.IsNull()) + { + di << "View " << argv[2] << " is absent in " << argv[1] << "\n"; + return 1; + } + aViewTool->RemoveView(aLabel); + return 0; +} + + +//======================================================================= +//function : setClippingPlanes +//purpose : +//======================================================================= +static Standard_Integer setClippingPlanes(Draw_Interpretor& di, Standard_Integer argc, const char** argv) +{ + if (argc < 3) { + di << "Use: XSetClippingPlanes Doc view_label plane_label1 ... plane_labelN"; + return 1; + } + Handle(TDocStd_Document) aDoc; + DDocStd::GetDocument(argv[1], aDoc); + if (aDoc.IsNull()) { + di << argv[1] << " is not a document\n"; + return 1; + } + Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main()); + Handle(XCAFDoc_ClippingPlaneTool) aCPlaneTool = XCAFDoc_DocumentTool::ClippingPlaneTool(aDoc->Main()); + + TDF_LabelSequence aCPlanes; + for (Standard_Integer i = 3; i < argc; i++) { + TDF_Label aLabel; + TDF_Tool::Label(aDoc->GetData(), argv[i], aLabel); + if (aLabel.IsNull()) + continue; + if (aCPlaneTool->IsClippingPlane(aLabel)) + aCPlanes.Append(aLabel); + } + + if (aCPlanes.Length() == 0) + return 1; + + TDF_Label aViewL; + TDF_Tool::Label(aDoc->GetData(), argv[2], aViewL); + aViewTool->SetClippingPlanes(aCPlanes, aViewL); + return 0; +} + //======================================================================= //function : isView //purpose : @@ -170,7 +241,7 @@ static Standard_Integer getRefGDTs(Draw_Interpretor& di, Standard_Integer argc, } TDF_LabelSequence aGDTs; - aViewTool->GetRefShapeLabel(aLabel, aGDTs); + aViewTool->GetRefGDTLabel(aLabel, aGDTs); if (aGDTs.Length() == 0) { di << "No GDTs in the given View\n"; } @@ -182,6 +253,45 @@ static Standard_Integer getRefGDTs(Draw_Interpretor& di, Standard_Integer argc, return 0; } +//======================================================================= +//function : getRefClippingPlanes +//purpose : +//======================================================================= +static Standard_Integer getRefClippingPlanes(Draw_Interpretor& di, Standard_Integer argc, const char** argv) +{ + if (argc < 3) { + di << "Use: XGetViewClippingPlanes Doc ViewLabel\n"; + return 1; + } + Handle(TDocStd_Document) aDoc; + DDocStd::GetDocument(argv[1], aDoc); + if (aDoc.IsNull()) { + di << argv[1] << " is not a document\n"; + return 1; + } + Handle(XCAFDoc_ViewTool) aViewTool = XCAFDoc_DocumentTool::ViewTool(aDoc->Main()); + + TDF_Label aLabel; + TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel); + if (aLabel.IsNull() || !aViewTool->IsView(aLabel)) + { + di << "Invalid label\n"; + return 1; + } + + TDF_LabelSequence aCPlanes; + aViewTool->GetRefClippingPlaneLabel(aLabel, aCPlanes); + if (aCPlanes.Length() == 0) { + di << "No Clipping Planes in the given View\n"; + } + for (Standard_Integer i = 1; i <= aCPlanes.Length(); i++) { + TCollection_AsciiString anEntry; + TDF_Tool::Entry(aCPlanes.Value(i), anEntry); + di << anEntry << " "; + } + return 0; +} + //======================================================================= //function : setName //purpose : @@ -960,7 +1070,7 @@ static Standard_Integer getViewVolumeSidesClipping(Draw_Interpretor& di, Standar } //======================================================================= -//function : getName +//function : dump //purpose : //======================================================================= static Standard_Integer dump(Draw_Interpretor& di, Standard_Integer argc, const char** argv) @@ -1006,6 +1116,16 @@ static Standard_Integer dump(Draw_Interpretor& di, Standard_Integer argc, const } di << "\n"; + TDF_LabelSequence aCPlanes; + aViewTool->GetRefClippingPlaneLabel(aLabel, aCPlanes); + di << "Reference Clipping Planes: "; + for (Standard_Integer i = 1; i <= aCPlanes.Length(); i++) { + TCollection_AsciiString anEntry; + TDF_Tool::Entry(aCPlanes.Value(i), anEntry); + di << anEntry << " "; + } + di << "\n"; + di << "Name: " << aView->GetObject()->Name()->String() << "\n"; XCAFView_ProjectionType aType = aView->GetObject()->Type(); @@ -1049,6 +1169,136 @@ static Standard_Integer dump(Draw_Interpretor& di, Standard_Integer argc, const return 0; } +//======================================================================= +//function : addClippingPlane +//purpose : +//======================================================================= +static Standard_Integer addClippingPlane(Draw_Interpretor& di, Standard_Integer argc, const char** argv) +{ + if (argc < 5) { + di << "Use: XAddClippingPlane Doc plane name capping[0/1]"; + return 1; + } + Handle(TDocStd_Document) aDoc; + DDocStd::GetDocument(argv[1], aDoc); + if (aDoc.IsNull()) { + di << argv[1] << " is not a document\n"; + return 1; + } + Handle(XCAFDoc_ClippingPlaneTool) aCPlaneTool = XCAFDoc_DocumentTool::ClippingPlaneTool(aDoc->Main()); + gp_Pln aPlane; + Handle(Geom_Plane) aSurf = Handle(Geom_Plane)::DownCast(DrawTrSurf::GetSurface(argv[2])); + if (aSurf.IsNull()) { + cout << argv[2] << " is not a plane" << endl; + return 1; + } + aPlane = aSurf->Pln(); + Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString(argv[3]); + Standard_Boolean aCapping = (argv[4][0] == '1'); + + TDF_Label aCPlaneL = aCPlaneTool->AddClippingPlane(aPlane, aName, aCapping); + TCollection_AsciiString anEntry; + TDF_Tool::Entry(aCPlaneL, anEntry); + di << anEntry << "\n"; + return 0; +} + +//======================================================================= +//function : getClippingPlane +//purpose : +//======================================================================= +static Standard_Integer getClippingPlane(Draw_Interpretor& di, Standard_Integer argc, const char** argv) +{ + if (argc < 3) { + di << "Use: XGetClippingPlane Doc ClippingPlane_Label\n"; + return 1; + } + Handle(TDocStd_Document) aDoc; + DDocStd::GetDocument(argv[1], aDoc); + if (aDoc.IsNull()) { + di << argv[1] << " is not a document\n"; + return 1; + } + Handle(XCAFDoc_ClippingPlaneTool) aClippingPlaneTool = XCAFDoc_DocumentTool::ClippingPlaneTool(aDoc->Main()); + + TDF_Label aLabel; + TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel); + if (aLabel.IsNull()) + { + di << "ClippingPlane " << argv[2] << " is absent in " << argv[1] << "\n"; + return 1; + } + gp_Pln aPlane; + Handle(TCollection_HAsciiString) aName; + Standard_Boolean aCapping; + aClippingPlaneTool->GetClippingPlane(aLabel, aPlane, aName, aCapping); + Handle(Geom_Plane) aCPlane = new Geom_Plane(aPlane); + DrawTrSurf::Set(aName->ToCString(), aCPlane); + di << aName->ToCString(); + return 0; +} + +//======================================================================= +//function : removeClippingPlane +//purpose : +//======================================================================= +static Standard_Integer removeClippingPlane(Draw_Interpretor& di, Standard_Integer argc, const char** argv) +{ + if (argc < 3) { + di << "Use: XRemoveClippingPlane Doc ClippingPlane_Label\n"; + return 1; + } + Handle(TDocStd_Document) aDoc; + DDocStd::GetDocument(argv[1], aDoc); + if (aDoc.IsNull()) { + di << argv[1] << " is not a document\n"; + return 1; + } + Handle(XCAFDoc_ClippingPlaneTool) aClippingPlaneTool = XCAFDoc_DocumentTool::ClippingPlaneTool(aDoc->Main()); + + TDF_Label aLabel; + TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel); + if (aLabel.IsNull()) + { + di << "ClippingPlane " << argv[2] << " is absent in " << argv[1] << "\n"; + return 1; + } + Standard_Boolean isRemoved = aClippingPlaneTool->RemoveClippingPlane(aLabel); + if (isRemoved) + di << "removed\n"; + else + di << "clipping plane is not free, not removed\n"; + return 0; +} + +//======================================================================= +//function : getClippingPlaneCapping +//purpose : +//======================================================================= +static Standard_Integer getClippingPlaneCapping(Draw_Interpretor& di, Standard_Integer argc, const char** argv) +{ + if (argc < 3) { + di << "Use: XGetClippingPlaneCapping Doc ClippingPlane_Label\n"; + return 1; + } + Handle(TDocStd_Document) aDoc; + DDocStd::GetDocument(argv[1], aDoc); + if (aDoc.IsNull()) { + di << argv[1] << " is not a document\n"; + return 1; + } + Handle(XCAFDoc_ClippingPlaneTool) aClippingPlaneTool = XCAFDoc_DocumentTool::ClippingPlaneTool(aDoc->Main()); + + TDF_Label aLabel; + TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel); + if (aLabel.IsNull()) + { + di << "ClippingPlane " << argv[2] << " is absent in " << argv[1] << "\n"; + return 1; + } + di << aClippingPlaneTool->GetCapping(aLabel); + return 0; +} //======================================================================= //function : InitCommands @@ -1067,6 +1317,12 @@ void XDEDRAW_Views::InitCommands(Draw_Interpretor& di) di.Add("XSetView", "XSetView Doc shape_label1 ... shape_labelN gdt_label1 ... gdt_labelN", __FILE__, setView, g); + di.Add("XRemoveView", "XRemoveView Doc ViewLabel", + __FILE__, removeView, g); + + di.Add("XSetClippingPlanes", "XSetView Doc view_plane plane_label1 ... plane_labelN", + __FILE__, setClippingPlanes, g); + di.Add("XIsView", "XIsView Doc Label", __FILE__, isView, g); @@ -1076,6 +1332,9 @@ void XDEDRAW_Views::InitCommands(Draw_Interpretor& di) di.Add("XGetViewGDTs", "XGetViewGDTs Doc ViewLabel" "Return labels of reference GDTs", __FILE__, getRefGDTs, g); + di.Add("XGetViewClippingPlanes", "XGetViewClippingPlanes Doc ViewLabel" "Return labels of reference Clipping Planes", + __FILE__, getRefClippingPlanes, g); + di.Add("XSetViewName", "XSetViewName Doc ViewLabel name", __FILE__, setName, g); @@ -1144,4 +1403,16 @@ void XDEDRAW_Views::InitCommands(Draw_Interpretor& di) di.Add("XDumpView", "XDumpView Doc ViewLabel", __FILE__, dump, g); + + di.Add("XAddClippingPlane", "XAddClippingPlane Doc plane name capping[0/1]", + __FILE__, addClippingPlane, g); + + di.Add("XGetClippingPlaneCapping", "XGetClippingPlaneCapping Doc ClippingPlane_Label", + __FILE__, getClippingPlaneCapping, g); + + di.Add("XGetClippingPlane", "XGetClippingPlane Doc ClippingPlane_Label", + __FILE__, getClippingPlane, g); + + di.Add("XRemoveClippingPlane", "XRemoveClippingPlane Doc ClippingPlane_Label", + __FILE__, removeClippingPlane, g); } diff --git a/src/XmlMXCAFDoc/FILES b/src/XmlMXCAFDoc/FILES index 6cab473520..d93ba3b27c 100644 --- a/src/XmlMXCAFDoc/FILES +++ b/src/XmlMXCAFDoc/FILES @@ -4,6 +4,8 @@ XmlMXCAFDoc_AreaDriver.cxx XmlMXCAFDoc_AreaDriver.hxx XmlMXCAFDoc_CentroidDriver.cxx XmlMXCAFDoc_CentroidDriver.hxx +XmlMXCAFDoc_ClippingPlaneToolDriver.cxx +XmlMXCAFDoc_ClippingPlaneToolDriver.hxx XmlMXCAFDoc_ColorDriver.cxx XmlMXCAFDoc_ColorDriver.hxx XmlMXCAFDoc_ColorToolDriver.cxx diff --git a/src/XmlMXCAFDoc/XmlMXCAFDoc.cxx b/src/XmlMXCAFDoc/XmlMXCAFDoc.cxx index 0d7decdd8c..fe596313b0 100644 --- a/src/XmlMXCAFDoc/XmlMXCAFDoc.cxx +++ b/src/XmlMXCAFDoc/XmlMXCAFDoc.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -73,4 +74,5 @@ void XmlMXCAFDoc::AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable, aDriverTable -> AddDriver (new XmlMXCAFDoc_DimTolToolDriver (anMsgDrv)); aDriverTable -> AddDriver (new XmlMXCAFDoc_MaterialToolDriver (anMsgDrv)); aDriverTable -> AddDriver (new XmlMXCAFDoc_ViewToolDriver (anMsgDrv)); + aDriverTable -> AddDriver (new XmlMXCAFDoc_ClippingPlaneToolDriver(anMsgDrv)); } diff --git a/src/XmlMXCAFDoc/XmlMXCAFDoc.hxx b/src/XmlMXCAFDoc/XmlMXCAFDoc.hxx index 6b23d133c9..b82e95b358 100644 --- a/src/XmlMXCAFDoc/XmlMXCAFDoc.hxx +++ b/src/XmlMXCAFDoc/XmlMXCAFDoc.hxx @@ -31,6 +31,7 @@ class XmlMXCAFDoc_VolumeDriver; class XmlMXCAFDoc_DatumDriver; class XmlMXCAFDoc_DimTolDriver; class XmlMXCAFDoc_MaterialDriver; +class XmlMXCAFDoc_ClippingPlaneToolDriver; class XmlMXCAFDoc_ColorToolDriver; class XmlMXCAFDoc_DocumentToolDriver; class XmlMXCAFDoc_LayerToolDriver; @@ -75,6 +76,7 @@ friend class XmlMXCAFDoc_VolumeDriver; friend class XmlMXCAFDoc_DatumDriver; friend class XmlMXCAFDoc_DimTolDriver; friend class XmlMXCAFDoc_MaterialDriver; +friend class XmlMXCAFDoc_ClippingPlaneToolDriver; friend class XmlMXCAFDoc_ColorToolDriver; friend class XmlMXCAFDoc_DocumentToolDriver; friend class XmlMXCAFDoc_LayerToolDriver; diff --git a/src/XmlMXCAFDoc/XmlMXCAFDoc_ClippingPlaneToolDriver.cxx b/src/XmlMXCAFDoc/XmlMXCAFDoc_ClippingPlaneToolDriver.cxx new file mode 100644 index 0000000000..e2d504bbb4 --- /dev/null +++ b/src/XmlMXCAFDoc/XmlMXCAFDoc_ClippingPlaneToolDriver.cxx @@ -0,0 +1,64 @@ +// Created on: 2016-11-30 +// 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. + + +#include +#include +#include +#include +#include +#include + +IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_ClippingPlaneToolDriver,XmlMDF_ADriver) + +//======================================================================= +//function : +//purpose : +//======================================================================= +XmlMXCAFDoc_ClippingPlaneToolDriver::XmlMXCAFDoc_ClippingPlaneToolDriver + (const Handle(CDM_MessageDriver)& theMsgDriver) +: XmlMDF_ADriver (theMsgDriver, "xcaf", "ClippingPlaneTool") +{ +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +Handle(TDF_Attribute) XmlMXCAFDoc_ClippingPlaneToolDriver::NewEmpty() const +{ + return new XCAFDoc_ClippingPlaneTool(); +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +Standard_Boolean XmlMXCAFDoc_ClippingPlaneToolDriver::Paste(const XmlObjMgt_Persistent& , + const Handle(TDF_Attribute)& , + XmlObjMgt_RRelocationTable& ) const +{ + return Standard_True; +} + +//======================================================================= +//function : +//purpose : +//======================================================================= +void XmlMXCAFDoc_ClippingPlaneToolDriver::Paste(const Handle(TDF_Attribute)& , + XmlObjMgt_Persistent& , + XmlObjMgt_SRelocationTable& ) const +{ +} diff --git a/src/XmlMXCAFDoc/XmlMXCAFDoc_ClippingPlaneToolDriver.hxx b/src/XmlMXCAFDoc/XmlMXCAFDoc_ClippingPlaneToolDriver.hxx new file mode 100644 index 0000000000..f7d54775ae --- /dev/null +++ b/src/XmlMXCAFDoc/XmlMXCAFDoc_ClippingPlaneToolDriver.hxx @@ -0,0 +1,50 @@ +// Created on: 2016-11-30 +// 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 _XmlMXCAFDoc_ClippingPlaneToolDriver_HeaderFile +#define _XmlMXCAFDoc_ClippingPlaneToolDriver_HeaderFile + +#include +#include + +#include +#include +#include +#include +class CDM_MessageDriver; +class TDF_Attribute; +class XmlObjMgt_Persistent; + + +class XmlMXCAFDoc_ClippingPlaneToolDriver; +DEFINE_STANDARD_HANDLE(XmlMXCAFDoc_ClippingPlaneToolDriver, XmlMDF_ADriver) + +//! Attribute Driver. +class XmlMXCAFDoc_ClippingPlaneToolDriver : public XmlMDF_ADriver +{ +public: + + Standard_EXPORT XmlMXCAFDoc_ClippingPlaneToolDriver(const Handle(CDM_MessageDriver)& theMsgDriver); + + Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; + + Standard_EXPORT virtual Standard_Boolean Paste(const XmlObjMgt_Persistent& theSource, const Handle(TDF_Attribute)& theTarget, XmlObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE; + + Standard_EXPORT virtual void Paste(const Handle(TDF_Attribute)& theSource, XmlObjMgt_Persistent& theTarget, XmlObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE; + + DEFINE_STANDARD_RTTIEXT(XmlMXCAFDoc_ClippingPlaneToolDriver, XmlMDF_ADriver) + +}; +#endif // _XmlMXCAFDoc_ClippingPlaneToolDriver_HeaderFile diff --git a/tests/bugs/xde/bug22962 b/tests/bugs/xde/bug22962 index 4155ca96b1..53b527dc9e 100755 --- a/tests/bugs/xde/bug22962 +++ b/tests/bugs/xde/bug22962 @@ -7,7 +7,7 @@ puts "" ####################################################################### set BugNumber OCC22962 -set check_value 94 +set check_value 96 pload DCAF ReadStep D1 [locate_data_file OCC22962-dm1-oc-214.stp] diff --git a/tests/bugs/xde/bug28044 b/tests/bugs/xde/bug28044 index aeba7d2d6e..6bfbac46d4 100644 --- a/tests/bugs/xde/bug28044 +++ b/tests/bugs/xde/bug28044 @@ -45,6 +45,7 @@ Close D_Second set ref_data {Reference shapes: 0:1:1:1 0:1:1:2 Reference GD&Ts: 0:1:4:1 +Reference Clipping Planes: Name: ALL Type: parallel Projection point: 2 3 5 diff --git a/tests/gdt/export/B9 b/tests/gdt/export/B9 new file mode 100644 index 0000000000..cb01dc54dd --- /dev/null +++ b/tests/gdt/export/B9 @@ -0,0 +1,19 @@ +# !!!! This file is generated automatically, do not edit manually! See end script +set filename bug28389_CONFIDENTIAL_SHEET_METAL_F3D.stp + +set ref_data { + + NbOfDimensions : 36 + NbOfDimensionalSize : 7 + NbOfDimensionalLocation: 6 + NbOfAngular : 0 + NbOfWithPath : 0 + NbOfCommonLabels : 13 + NbOfTolerances : 0 + NbOfGTWithModifiers : 0 + NbOfGTWithMaxTolerance : 0 + NbOfGTWithDatums : 0 + NbOfDatumFeature : 0 + NbOfAttachedDatum : 0 + NbOfDatumTarget : 0 +} diff --git a/tests/gdt/grids.list b/tests/gdt/grids.list index 2d4b1d896b..4f3ed5aea2 100644 --- a/tests/gdt/grids.list +++ b/tests/gdt/grids.list @@ -3,3 +3,4 @@ 003 import 004 export 005 presentation +006 view diff --git a/tests/gdt/presentation/B8 b/tests/gdt/presentation/B8 new file mode 100644 index 0000000000..861eb0dd70 --- /dev/null +++ b/tests/gdt/presentation/B8 @@ -0,0 +1,8 @@ +# !!!! This file is generated automatically, do not edit manually! See end script +set filename bug28389_CONFIDENTIAL_SHEET_METAL_F3D.stp + +set ref_data { +Centre of mass: -133.54424889461592 -395.07689804798758 -73.538998823214285 +Mass: 10016.368114030625 + +} diff --git a/tests/gdt/view/A1 b/tests/gdt/view/A1 new file mode 100644 index 0000000000..e83eda9134 --- /dev/null +++ b/tests/gdt/view/A1 @@ -0,0 +1,5 @@ +set filename bug26689_nist_ctc_01_asme1_ap242.stp + +set ref_data { +D_First 0:1:7:1 1 14 0 MBD_0 parallel 1230.3895263672 -1022.8276367188 1167.5091552734 0.6190726083 -0.4816746353 0.6202730458 -0.53944112655925491 0.3131943118951574 0.78160897766914172 1983.5583496094 952.4203145992 952.4203145992 +} diff --git a/tests/gdt/view/A2 b/tests/gdt/view/A2 new file mode 100644 index 0000000000..652ffc7a0b --- /dev/null +++ b/tests/gdt/view/A2 @@ -0,0 +1,5 @@ +set filename bug26689_nist_ctc_04_asme1_ap242.stp + +set ref_data { +D_First 0:1:7:1 2 15 0 MBD_0 parallel 782.2305297852 -719.3034667969 -926.3039550781 0.5081233954 -0.6832230654 -0.5244204973 -0.29474161432145901 0.43418265038181109 -0.85124192031091028 1593.740234375 765.2461871912 765.2461871912 +} diff --git a/tests/gdt/view/A3 b/tests/gdt/view/A3 new file mode 100644 index 0000000000..847ad57dac --- /dev/null +++ b/tests/gdt/view/A3 @@ -0,0 +1,7 @@ +set filename bug27645_nist_ftc_06_asme1_cr3000_rd.prt.stp + +set ref_data { +D_First 0:1:7:1 2 14 0 MBD_A parallel 1003.2130229675 933.1983040089 -966.2677894877 -0.5983635664 -0.5566034856 0.5763276865 -0.34864265817483364 0.82851635272424506 0.43818825882182255 20.0 40.0 40.0 +D_First 0:1:7:2 2 1 0 MBD_B parallel -1003.2130229675 933.1983040089 966.2677894877 0.5983635664 -0.5566034856 -0.5763276865 0.34864265817483364 0.82851635272424506 -0.43818825882182255 20.0 40.0 40.0 +D_First 0:1:7:3 2 8 0 MBD_C parallel 0.0 1359.2608224096 -1359.2608224096 -0.0 -0.7071067812 0.7071067812 0 0.70710678118654757 0.70710678118654757 20.0 40.0 40.0 +} diff --git a/tests/gdt/view/A4 b/tests/gdt/view/A4 new file mode 100644 index 0000000000..506efaecb5 --- /dev/null +++ b/tests/gdt/view/A4 @@ -0,0 +1,7 @@ +set filename bug27808_nist_ftc_06_asme1_ct5240_rd.stp + +set ref_data { +D_First 0:1:7:1 2 23 0 MBD_A parallel 30.8084683155 26.0037688008 -25.0004637711 0.5773502692 0.5773502692 -0.5773502692 -0.40824829046386307 0.81649658092772615 0.40824829046386307 1104.2341308594 530.2063197413 530.2063197413 +D_First 0:1:7:2 2 10 0 MBD_B central -31.9257504921 33.3287805272 27.9693987989 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 1349.3127441406 647.8826584485 647.8826584485 +D_First 0:1:7:3 2 22 0 MBD_C central -0.4196386262 31.1460383858 -33.088921975 0.0 0.6979703596 -0.7161266488 0 0.71612664879940147 0.69797035959941667 1053.7369384766 505.9597131727 505.9597131727 +} diff --git a/tests/gdt/view/A5 b/tests/gdt/view/A5 new file mode 100644 index 0000000000..a9fff8fa19 --- /dev/null +++ b/tests/gdt/view/A5 @@ -0,0 +1,6 @@ +set filename bug27645_nist_ftc_06_asme1_ct5240_rd-1.stp + +set ref_data { +D_First 0:1:7:1 2 23 0 MBD_A parallel 782.5350952148 660.4957275391 -635.0117797852 0.5773502692 0.5773502692 -0.5773502692 -0.40824829046386307 0.81649658092772615 0.40824829046386307 1104.2341308594 530.2063197413 530.2063197413 +D_First 0:1:7:2 2 16 0 MBD_C central -10.658821106 791.109375 -840.4586181641 0.0 0.6979703596 -0.7161266488 0 0.71612664879940147 0.69797035959941667 1053.7369384766 505.9597131727 505.9597131727 +} diff --git a/tests/gdt/view/A6 b/tests/gdt/view/A6 new file mode 100644 index 0000000000..7dc0c5866f --- /dev/null +++ b/tests/gdt/view/A6 @@ -0,0 +1,8 @@ +set filename bug27645_nist_ftc_08_asme1_cr3000_rc.prt.stp + +set ref_data { +D_First 0:1:7:1 3 7 0 MBD_A parallel 960.208198256 960.2081982559 -996.2072738181 -0.5701373455 -0.5701373455 0.5915123113 -0.41826236649918141 -0.41826236649918141 -0.80629596646703439 20.0 40.0 40.0 +D_First 0:1:7:2 3 2 0 MBD_B parallel 960.208198256 -960.2081982559 996.2072738181 -0.5701373455 0.5701373455 -0.5915123113 -0.41826236649918141 0.41826236649918141 0.80629596646703439 20.0 40.0 40.0 +D_First 0:1:7:3 3 3 0 MBD_C parallel 960.208198256 -960.2081982559 996.2072738181 -0.5701373455 0.5701373455 -0.5915123113 -0.41826236649918141 0.41826236649918141 0.80629596646703439 20.0 40.0 40.0 +D_First 0:1:7:4 3 8 0 MBD_D parallel 960.2081982559 960.2081982559 996.2072738181 -0.5701373455 -0.5701373455 -0.5915123113 -0.41826236649918141 -0.41826236649918141 0.80629596646703439 20.0 40.0 40.0 +} diff --git a/tests/gdt/view/A7 b/tests/gdt/view/A7 new file mode 100644 index 0000000000..5414be274e --- /dev/null +++ b/tests/gdt/view/A7 @@ -0,0 +1,8 @@ +set filename bug27808_nist_ftc_08_asme1_ct5240_rc.stp + +set ref_data { +D_First 0:1:7:1 3 10 0 MBD_A parallel 20.6276528666 24.7090209 -21.2968288632 0.5773502692 0.5773502692 -0.5773502692 -0.40824829046386302 -0.40824829046386302 -0.81649658092772603 1133.0983886719 544.065710136 544.065710136 +D_First 0:1:7:2 3 13 0 MBD_B parallel 21.6691096749 -22.3932077002 22.6894396684 0.5773502692 -0.5773502692 0.5773502692 -0.40824829046386302 0.40824829046386302 0.81649658092772603 972.7067871094 467.0524767961 467.0524767961 +D_First 0:1:7:3 3 6 0 MBD_C central 22.5691379337 -20.4109059732 21.0932597964 0.5773502692 -0.5773502692 0.5773502692 -0.40824829046386302 0.40824829046386302 0.81649658092772603 856.7503051758 411.3751002162 411.3751002162 +D_First 0:1:7:4 3 14 0 MBD_D parallel 23.6742659441 21.3498117041 22.1304297259 0.5773502692 0.5773502692 0.5773502692 -0.40824829046386302 -0.40824829046386302 0.81649658092772603 891.8790283203 428.2424207374 428.2424207374 +} diff --git a/tests/gdt/view/A8 b/tests/gdt/view/A8 new file mode 100644 index 0000000000..9a2e5949c7 --- /dev/null +++ b/tests/gdt/view/A8 @@ -0,0 +1,5 @@ +set filename bug27645_nist_ftc_08_asme1_ct5240_rc-1.stp + +set ref_data { +D_First 0:1:7:1 3 13 0 MBD_B parallel 550.3953857422 -568.7874755859 576.3117675781 0.5773502692 -0.5773502692 0.5773502692 -0.40824829046386302 0.40824829046386302 0.81649658092772603 972.7067871094 467.0524767961 467.0524767961 +} diff --git a/tests/gdt/view/A9 b/tests/gdt/view/A9 new file mode 100644 index 0000000000..81da6776f6 --- /dev/null +++ b/tests/gdt/view/A9 @@ -0,0 +1,8 @@ +set filename bug27645_nist_ftc_09_asme1_cr3000_rd.prt.stp + +set ref_data { +D_First 0:1:7:1 2 10 0 MBD_A parallel -1175.8873057482 925.9850617285 1405.1817250125 0.5727731186 -0.4510460731 -0.6844621206 0.29048014152512924 0.89249988323766694 -0.34505832231709999 20.0 40.0 40.0 +D_First 0:1:7:2 2 6 0 MBD_B parallel -1175.8873057482 925.9850617285 1405.1817250125 0.5727731186 -0.4510460731 -0.6844621206 0.29048014152512924 0.89249988323766694 -0.34505832231709999 20.0 40.0 40.0 +D_First 0:1:7:3 2 4 0 MBD_C parallel -951.665243989 749.4151823838 1137.2370486915 0.5727731186 -0.4510460731 -0.6844621206 0.29048014152512924 0.89249988323766694 -0.34505832231709999 20.0 40.0 40.0 +D_First 0:1:7:4 2 8 0 MBD_D parallel 1052.959289197 925.9850617285 1499.5077096909 -0.5128950478 -0.4510460731 -0.7304081804 -0.25811895222709652 0.89249988325203511 -0.3698899361922266 20.0 40.0 40.0 +} diff --git a/tests/gdt/view/B1 b/tests/gdt/view/B1 new file mode 100644 index 0000000000..cbea367d84 --- /dev/null +++ b/tests/gdt/view/B1 @@ -0,0 +1,8 @@ +set filename bug27808_nist_ftc_09_asme1_ct5240_rd.stp + +set ref_data { +D_First 0:1:7:1 2 18 0 MBD_A central -20.8553716705 19.0487334484 16.8668443575 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 948.7595214844 455.5540171668 455.5540171668 +D_First 0:1:7:2 2 10 0 MBD_B parallel -16.8234421137 16.8832385446 16.8234313004 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 740.1318359375 355.3798654551 355.3798654551 +D_First 0:1:7:3 2 11 0 MBD_C central -10.8134556568 14.3968068521 12.8345579613 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 557.039855957 267.4668747527 267.4668747527 +D_First 0:1:7:4 2 15 0 MBD_D central 16.8234325018 16.8832397461 16.8234373078 0.5773502692 0.5773502692 0.5773502692 -0.40824829046386307 0.81649658092772615 -0.40824829046386307 740.1318359375 355.3798654551 355.3798654551 +} diff --git a/tests/gdt/view/B2 b/tests/gdt/view/B2 new file mode 100644 index 0000000000..5db160aa91 --- /dev/null +++ b/tests/gdt/view/B2 @@ -0,0 +1,8 @@ +set filename bug27645_nist_ftc_09_asme1_ct5240_rd-1.stp + +set ref_data { +D_First 0:1:7:1 2 18 0 MBD_A central -529.7264404297 483.8378295898 428.4178466797 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 948.7595214844 455.5540171668 455.5540171668 +D_First 0:1:7:2 2 10 0 MBD_B parallel -427.3154296875 428.8342590332 427.3151550293 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 740.1318359375 355.3798654551 355.3798654551 +D_First 0:1:7:3 2 11 0 MBD_C central -274.6617736816 365.678894043 325.9977722168 -0.5773502692 0.5773502692 0.5773502692 0.40824829046386307 0.81649658092772615 -0.40824829046386307 557.039855957 267.4668747527 267.4668747527 +D_First 0:1:7:4 2 15 0 MBD_D central 427.3151855469 428.8342895508 427.3153076172 0.5773502692 0.5773502692 0.5773502692 -0.40824829046386307 0.81649658092772615 -0.40824829046386307 740.1318359375 355.3798654551 355.3798654551 +} diff --git a/tests/gdt/view/B4 b/tests/gdt/view/B4 new file mode 100644 index 0000000000..6e730ad16c --- /dev/null +++ b/tests/gdt/view/B4 @@ -0,0 +1,5 @@ +set filename bug28315_part_step-pmi.stp + +set ref_data { +D_First 0:1:7:1 0 0 0 "Nyn\\X2\\11b\\X0\\j\\X2\\161\\X0\\S\\m pohled modelu" parallel 13.0973082 1.62908566 -570.319287 0.0 0.0 -1.0 0 1 0 0.0 342.494354 342.494354 +} diff --git a/tests/gdt/view/B5 b/tests/gdt/view/B5 new file mode 100644 index 0000000000..4711d69d71 --- /dev/null +++ b/tests/gdt/view/B5 @@ -0,0 +1,12 @@ +set filename bug28389_CONFIDENTIAL_SHEET_METAL_F3D.stp + +set ref_data { +D_First 0:1:7:1 3 13 0 "ALL ANNOTATIONS" parallel -5825.9008789063 -3248.3400878906 815.1171264648 -0.9365057375 -0.3148685702 0.1543204044 0.15697924864928148 0.017062391432409261 0.98745450036551774 6462.505859375 3103.0200919329 3103.0200919329 +D_First 0:1:7:2 3 0 0 "ISO VIEW" parallel -1938.3376464844 -511.2386169434 224.3153076172 -0.9365057375 -0.3148685702 0.1543204044 0.15697924645824046 0.017062398063723512 0.98745450059925199 1868.7774658203 897.3073525929 897.3073525929 +D_First 0:1:7:3 3 0 0 NOTES parallel -1892.8060302734 66.0814208984 -23.3611030579 -1.0 0.0 -0.0 0 0 1 1892.0059814453 908.4606965524 908.4606965524 +D_First 0:1:7:4 3 4 0 "FRONT VIEW" parallel -933.7789916992 176.1425476074 -141.4060668945 -1.0 0.0 -0.0 0 0 1 932.9789428711 447.9767551591 447.9767551591 +D_First 0:1:7:5 3 4 0 "RIGHT VIEW" parallel -200.9252166748 -920.0938720703 -82.4965591431 -0.0022161137 -0.9999975186 0.000227049 0.00056416539672814506 0.00022579926371258001 0.99999981536603189 920.1341552734 441.8092675779 441.8092675779 +D_First 0:1:7:6 3 3 0 "BOTTOM VIEW" parallel -46.1214942932 25.5572605133 -1529.6362304688 0.0 0.0 -1.0 0 -1 0 1239.6362304688 595.2205685525 595.2205685525 +D_First 0:1:7:7 3 2 0 "REAR VIEW" parallel 1274.4870605469 94.8712005615 -67.2203521729 1.0 0.0 0.0 0 0 1 1274.4870605469 611.9544093021 611.9544093021 +D_First 0:1:7:8 3 2 0 TITLEBLOCK parallel -2945.3461914063 -3886.63671875 -83.6480560303 -0.9999980773 -0.0019537281 0.0001685321 0.00016672821871442924 0.00092342821712457039 0.99999955974091759 575.3185424805 276.2434627411 276.2434627411 +} diff --git a/tests/gdt/view/begin b/tests/gdt/view/begin new file mode 100644 index 0000000000..f012867a66 --- /dev/null +++ b/tests/gdt/view/begin @@ -0,0 +1 @@ +pload QAcommands diff --git a/tests/gdt/view/end b/tests/gdt/view/end new file mode 100644 index 0000000000..667a7c276b --- /dev/null +++ b/tests/gdt/view/end @@ -0,0 +1,25 @@ +set mist 0 +# 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 about translation +if { $mist < 1} { + set ref_list [split $ref_data \n] + puts [llength $ref_list] + for { set i 1 } { $i < [llength $ref_list] - 1 } { incr i } { + set ref [lindex $ref_list $i] + set res [OCC28389 {*}$ref] + } +} + +puts "TEST COMPLETED" -- 2.20.1