1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-06-05 11:24:17 +03:00

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
This commit is contained in:
ika 2017-01-25 14:13:45 +03:00 committed by aba
parent 93a4a91644
commit 5c003a4e44
53 changed files with 2807 additions and 76 deletions

View File

@ -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;

View File

@ -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 <BinMXCAFDoc_ClippingPlaneToolDriver.hxx>
#include <BinObjMgt_Persistent.hxx>
#include <CDM_MessageDriver.hxx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
#include <XCAFDoc_ClippingPlaneTool.hxx>
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 {
}

View File

@ -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 <Standard.hxx>
#include <Standard_Type.hxx>
#include <BinMDF_ADriver.hxx>
#include <Standard_Boolean.hxx>
#include <BinObjMgt_RRelocationTable.hxx>
#include <BinObjMgt_SRelocationTable.hxx>
class CDM_MessageDriver;
class TDF_Attribute;
class BinObjMgt_Persistent;
class BinMXCAFDoc_DimTolToolDriver;
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

View File

@ -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

View File

@ -1097,19 +1097,6 @@
#include <StepVisual_ViewVolume.hxx>
#include <TCollection_HAsciiString.hxx>
#include <StepVisual_TessellatedAnnotationOccurrence.hxx>
#include <StepVisual_TessellatedItem.hxx>
#include <StepVisual_TessellatedGeometricSet.hxx>
#include <StepVisual_TessellatedCurveSet.hxx>
#include <StepVisual_CoordinatesList.hxx>
#include <RWStepVisual_RWTessellatedAnnotationOccurrence.hxx>
#include <RWStepVisual_RWTessellatedItem.hxx>
#include <RWStepVisual_RWTessellatedGeometricSet.hxx>
#include <RWStepVisual_RWTessellatedCurveSet.hxx>
#include <RWStepVisual_RWCoordinatesList.hxx>
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 <StepVisual_AnnotationFillAreaOccurrence.hxx>
#include <RWStepVisual_RWAnnotationFillArea.hxx>
#include <RWStepVisual_RWAnnotationFillAreaOccurrence.hxx>
#include <StepVisual_CameraModelD3MultiClipping.hxx>
#include <StepVisual_CameraModelD3MultiClippingIntersection.hxx>
#include <StepVisual_CameraModelD3MultiClippingUnion.hxx>
#include <RWStepVisual_RWCameraModelD3MultiClipping.hxx>
#include <RWStepVisual_RWCameraModelD3MultiClippingIntersection.hxx>
#include <RWStepVisual_RWCameraModelD3MultiClippingUnion.hxx>
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;
}

View File

@ -1398,6 +1398,12 @@ Handle(atype) result = Handle(atype)::DownCast (start)
#include <StepVisual_AnnotationFillAreaOccurrence.hxx>
#include <RWStepVisual_RWAnnotationFillArea.hxx>
#include <RWStepVisual_RWAnnotationFillAreaOccurrence.hxx>
#include <StepVisual_CameraModelD3MultiClipping.hxx>
#include <StepVisual_CameraModelD3MultiClippingIntersection.hxx>
#include <StepVisual_CameraModelD3MultiClippingUnion.hxx>
#include <RWStepVisual_RWCameraModelD3MultiClipping.hxx>
#include <RWStepVisual_RWCameraModelD3MultiClippingIntersection.hxx>
#include <RWStepVisual_RWCameraModelD3MultiClippingUnion.hxx>
// -- 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<TCollection_AsciiString, Standard_Integer> 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;

View File

@ -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

View File

@ -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 <Interface_Check.hxx>
#include <Interface_EntityIterator.hxx>
#include <RWStepVisual_RWCameraModelD3MultiClipping.hxx>
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
#include <StepVisual_CameraModelD3MultiClipping.hxx>
#include <StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect.hxx>
#include <StepVisual_ViewVolume.hxx>
//=======================================================================
//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());
}

View File

@ -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 <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
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

View File

@ -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 <Interface_Check.hxx>
#include <Interface_EntityIterator.hxx>
#include <RWStepVisual_RWCameraModelD3MultiClippingIntersection.hxx>
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include <StepVisual_CameraModelD3MultiClippingIntersection.hxx>
#include <StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect.hxx>
//=======================================================================
//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());
}

View File

@ -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 <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
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

View File

@ -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 <Interface_Check.hxx>
#include <Interface_EntityIterator.hxx>
#include <RWStepVisual_RWCameraModelD3MultiClippingUnion.hxx>
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include <StepVisual_CameraModelD3MultiClippingUnion.hxx>
#include <StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect.hxx>
//=======================================================================
//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());
}

View File

@ -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 <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
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

View File

@ -16,6 +16,8 @@
#include <BRep_Builder.hxx>
#include <Geom_Axis2Placement.hxx>
#include <Geom_CartesianPoint.hxx>
#include <Geom_Plane.hxx>
#include <Interface_EntityIterator.hxx>
#include <Interface_InterfaceModel.hxx>
#include <StepData_StepModel.hxx>
@ -109,6 +111,7 @@
#include <StepRepr_DerivedShapeAspect.hxx>
#include <StepRepr_DescriptiveRepresentationItem.hxx>
#include <StepRepr_HArray1OfRepresentationItem.hxx>
#include <StepRepr_MappedItem.hxx>
#include <StepRepr_MeasureRepresentationItem.hxx>
#include <StepRepr_NextAssemblyUsageOccurrence.hxx>
#include <StepRepr_ProductDefinitionShape.hxx>
@ -117,6 +120,7 @@
#include <StepRepr_Representation.hxx>
#include <StepRepr_RepresentationItem.hxx>
#include <StepRepr_HArray1OfRepresentationItem.hxx>
#include <StepRepr_RepresentationMap.hxx>
#include <StepRepr_RepresentationRelationship.hxx>
#include <StepRepr_RepresentedDefinition.hxx>
#include <StepRepr_ReprItemAndLengthMeasureWithUnit.hxx>
@ -177,6 +181,13 @@
#include <StepVisual_AnnotationCurveOccurrence.hxx>
#include <StepVisual_AnnotationFillArea.hxx>
#include <StepVisual_AnnotationPlane.hxx>
#include <StepVisual_CameraModelD3.hxx>
#include <StepVisual_CameraModelD3MultiClipping.hxx>
#include <StepVisual_CameraModelD3MultiClippingIntersection.hxx>
#include <StepVisual_CameraModelD3MultiClippingUnion.hxx>
#include <StepVisual_CoordinatesList.hxx>
#include <StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect.hxx>
#include <StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect.hxx>
#include <StepVisual_DraughtingCallout.hxx>
#include <StepVisual_DraughtingCalloutElement.hxx>
#include <StepVisual_DraughtingModel.hxx>
@ -187,6 +198,7 @@
#include <StepVisual_PresentationStyleByContext.hxx>
#include <StepVisual_StyleContextSelect.hxx>
#include <StepVisual_StyledItem.hxx>
#include <StepVisual_ViewVolume.hxx>
#include <StepShape_TypeQualifier.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_HAsciiString.hxx>
@ -218,6 +230,7 @@
#include <XCAFDoc.hxx>
#include <XCAFDoc_Area.hxx>
#include <XCAFDoc_Centroid.hxx>
#include <XCAFDoc_ClippingPlaneTool.hxx>
#include <XCAFDoc_ColorTool.hxx>
#include <XCAFDoc_DataMapOfShapeLabel.hxx>
#include <XCAFDoc_DimTolTool.hxx>
@ -229,12 +242,15 @@
#include <XCAFDoc_LayerTool.hxx>
#include <XCAFDoc_MaterialTool.hxx>
#include <XCAFDoc_ShapeTool.hxx>
#include <XCAFDoc_View.hxx>
#include <XCAFDoc_ViewTool.hxx>
#include <XCAFDoc_Volume.hxx>
#include <XCAFDimTolObjects_DimensionModifiersSequence.hxx>
#include <XCAFDimTolObjects_GeomToleranceType.hxx>
#include <XCAFDimTolObjects_DimensionObject.hxx>
#include <XCAFDimTolObjects_GeomToleranceObject.hxx>
#include <XCAFDimTolObjects_DatumObject.hxx>
#include <XCAFView_Object.hxx>
#include <XSControl_TransferReader.hxx>
#include <XSControl_WorkSession.hxx>
#include <StepAP242_DraughtingModelItemAssociation.hxx>
@ -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,7 +2368,7 @@ static TDF_Label getShapeLabel(const Handle(StepRepr_RepresentationItem)& theIte
//purpose :
//=======================================================================
static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
const TDF_Label theGDTL,
const Standard_Integer thePositionCounter,
const XCAFDimTolObjects_DatumModifiersSequence& theXCAFModifiers,
@ -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,7 +2602,7 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
//function : ReadDatums
//purpose : auxilary
//=======================================================================
static Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt,
Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Transient)& theEnt,
const TDF_Label theGDTL,
const Handle(TDocStd_Document)& theDoc,
const Handle(XSControl_WorkSession)& theWS)
@ -2724,7 +2750,7 @@ static Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt
//function : createGeomTolObjectInXCAF
//purpose :
//=======================================================================
static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
const Handle(TDocStd_Document)& theDoc,
const Handle(XSControl_WorkSession)& theWS)
{
@ -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<Handle(StepGeom_GeometricRepresentationItem)> 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;
}

View File

@ -31,6 +31,8 @@
#include <STEPCAFControl_DataMapOfPDExternFile.hxx>
#include <XCAFDoc_DataMapOfShapeLabel.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <XCAFDimTolObjects_DatumModifiersSequence.hxx>
#include <XCAFDimTolObjects_DatumModifWithValue.hxx>
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
@ -154,6 +157,12 @@ public:
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&GT 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<Handle(Standard_Transient), TDF_Label> myGDTMap;
};

View File

@ -745,6 +745,9 @@ static Standard_CString schemaAP242DIS = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERI
#include <StepVisual_CharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation.hxx>
#include <StepVisual_AnnotationFillArea.hxx>
#include <StepVisual_AnnotationFillAreaOccurrence.hxx>
#include <StepVisual_CameraModelD3MultiClipping.hxx>
#include <StepVisual_CameraModelD3MultiClippingIntersection.hxx>
#include <StepVisual_CameraModelD3MultiClippingUnion.hxx>
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);
}

View File

@ -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

View File

@ -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 <StepVisual_CameraModelD3MultiClippingInterectionSelect.hxx>
#include <NCollection_Array1.hxx>
typedef NCollection_Array1<StepVisual_CameraModelD3MultiClippingInterectionSelect> StepVisual_Array1OfCameraModelD3MultiClippingInterectionSelect;
#endif // _StepVisual_Array1OfCameraModelD3MultiClippingInterectionSelect_HeaderFile

View File

@ -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 <StepVisual_CameraModelD3MultiClippingUnionSelect.hxx>
#include <NCollection_Array1.hxx>
typedef NCollection_Array1<StepVisual_CameraModelD3MultiClippingUnionSelect> StepVisual_Array1OfCameraModelD3MultiClippingUnionSelect;
#endif // _StepVisual_Array1OfCameraModelD3MultiClippingUnionSelect_HeaderFile

View File

@ -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 <Standard_Type.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
#include <StepVisual_CameraModelD3MultiClipping.hxx>
#include <StepVisual_ViewVolume.hxx>
#include <TCollection_HAsciiString.hxx>
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);
}

View File

@ -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 <Standard.hxx>
#include <Standard_Type.hxx>
#include <StepVisual_CameraModelD3.hxx>
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

View File

@ -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 <StepVisual_CameraModelD3MultiClippingInterectionSelect.hxx>
#include <Interface_Macros.hxx>
#include <StepGeom_Plane.hxx>
#include <StepVisual_CameraModelD3MultiClippingUnion.hxx>
//=======================================================================
//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());
}

View File

@ -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 <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <StepData_SelectType.hxx>
#include <Standard_Integer.hxx>
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

View File

@ -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 <Standard_Type.hxx>
#include <StepVisual_CameraModelD3MultiClippingIntersection.hxx>
#include <TCollection_HAsciiString.hxx>
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);
}

View File

@ -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_CameraModelD3MultiClippingIntersction_HeaderFile
#define _StepVisual_CameraModelD3MultiClippingIntersction_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <StepGeom_GeometricRepresentationItem.hxx>
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

View File

@ -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 <Standard_Type.hxx>
#include <StepVisual_CameraModelD3MultiClippingUnion.hxx>
#include <TCollection_HAsciiString.hxx>
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);
}

View File

@ -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 <Standard.hxx>
#include <Standard_Type.hxx>
#include <StepGeom_GeometricRepresentationItem.hxx>
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

View File

@ -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 <StepVisual_CameraModelD3MultiClippingUnionSelect.hxx>
#include <Interface_Macros.hxx>
#include <StepGeom_Plane.hxx>
#include <StepVisual_CameraModelD3MultiClippingIntersection.hxx>
//=======================================================================
//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());
}

View File

@ -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 <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <StepData_SelectType.hxx>
#include <Standard_Integer.hxx>
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

View File

@ -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 <StepVisual_CameraModelD3MultiClippingInterectionSelect.hxx>
#include <StepVisual_Array1OfCameraModelD3MultiClippingInterectionSelect.hxx>
#include <NCollection_DefineHArray1.hxx>
DEFINE_HARRAY1(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect, StepVisual_Array1OfCameraModelD3MultiClippingInterectionSelect)
#endif // _StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect_HeaderFile

View File

@ -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 <StepVisual_CameraModelD3MultiClippingUnionSelect.hxx>
#include <StepVisual_Array1OfCameraModelD3MultiClippingUnionSelect.hxx>
#include <NCollection_DefineHArray1.hxx>
DEFINE_HARRAY1(StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect, StepVisual_Array1OfCameraModelD3MultiClippingUnionSelect)
#endif // _StepVisual_HArray1OfCameraModelD3MultiClippingUnionSelect_HeaderFile

View File

@ -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

View File

@ -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;
}

View File

@ -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;
@ -114,6 +115,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;

View File

@ -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 <TCollection_HAsciiString.hxx>
#include <TDataStd_Integer.hxx>
#include <TDataStd_Name.hxx>
#include <TDataStd_TreeNode.hxx>
#include <TDataXtd_Geometry.hxx>
#include <TDataXtd_Plane.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_ChildIDIterator.hxx>
#include <XCAFDoc.hxx>
#include <XCAFDoc_ClippingPlaneTool.hxx>
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()
{
}

View File

@ -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 <gp_Pln.hxx>
#include <TDF_LabelSequence.hxx>
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

View File

@ -19,6 +19,7 @@
#include <TColStd_MapOfAsciiString.hxx>
#include <TDataStd_Name.hxx>
#include <TDataStd_TreeNode.hxx>
#include <TDataStd_UAttribute.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_AttributeIterator.hxx>
#include <TDF_ChildIDIterator.hxx>
@ -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

View File

@ -188,6 +188,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;
Standard_EXPORT void Restore (const Handle(TDF_Attribute)& with) Standard_OVERRIDE;

View File

@ -25,6 +25,7 @@
#include <TDF_Tool.hxx>
#include <TDocStd_Document.hxx>
#include <XCAFDoc_ColorTool.hxx>
#include <XCAFDoc_ClippingPlaneTool.hxx>
#include <XCAFDoc_DimTolTool.hxx>
#include <XCAFDoc_DocumentTool.hxx>
#include <XCAFDoc_LayerTool.hxx>
@ -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

View File

@ -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

View File

@ -41,10 +41,10 @@ enum ChildLab
ChildLab_ZoomFactor,
ChildLab_WindowHorizontalSize,
ChildLab_WindowVerticalSize,
ChildLab_ClippingPlane,
ChildLab_FrontPlaneDistance,
ChildLab_BackPlaneDistance,
ChildLab_ViewVolumeSidesClipping
ChildLab_ViewVolumeSidesClipping,
ChildLab_GDTPoints
};
//=======================================================================
@ -120,12 +120,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 +135,15 @@ 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);
// 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 +213,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 +235,19 @@ Handle(XCAFView_Object) XCAFDoc_View::GetObject() const
anObj->SetViewVolumeSidesClipping(aValue);
}
// 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;
}

View File

@ -17,6 +17,7 @@
#include <Standard_Type.hxx>
#include <TDataStd_Name.hxx>
#include <TDataStd_TreeNode.hxx>
#include <TDataStd_UAttribute.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_ChildIDIterator.hxx>
#include <TDF_Label.hxx>
@ -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,130 @@ 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);
}
}
//=======================================================================
@ -231,6 +367,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 +429,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 :

View File

@ -65,7 +65,19 @@ 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;
//! Returns all View labels defined for label ShapeL
Standard_EXPORT Standard_Boolean GetViewLabelsForShape (const TDF_Label& theShapeL, TDF_LabelSequence& theViews) const;
@ -73,6 +85,9 @@ public:
//! 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() ;
@ -84,6 +99,19 @@ public:
//! 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;
Standard_EXPORT void Restore (const Handle(TDF_Attribute)& with) Standard_OVERRIDE;

View File

@ -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;
}

View File

@ -23,6 +23,7 @@
#include <gp_Dir.hxx>
#include <gp_Pln.hxx>
#include <gp_Pnt.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <TCollection_HAsciiString.hxx>
#include <XCAFView_ProjectionType.hxx>
@ -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()
@ -192,6 +182,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)
private:
@ -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

View File

@ -770,6 +770,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);

View File

@ -18,11 +18,14 @@
#include <DBRep.hxx>
#include <DDocStd.hxx>
#include <Draw.hxx>
#include <DrawTrSurf.hxx>
#include <Geom_Plane.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TDF_Tool.hxx>
#include <TDF_Label.hxx>
#include <TDF_LabelSequence.hxx>
#include <TDocStd_Document.hxx>
#include <XCAFDoc_ClippingPlaneTool.hxx>
#include <XCAFDoc_DimTolTool.hxx>
#include <XCAFDoc_DocumentTool.hxx>
#include <XCAFDoc_ShapeTool.hxx>
@ -73,6 +76,44 @@ static Standard_Integer setView(Draw_Interpretor& di, Standard_Integer argc, con
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 +211,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 +223,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 +1040,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 +1086,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 +1139,104 @@ 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 : 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 +1255,9 @@ 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("XSetClippingPlanes", "XSetView Doc view_plane plane_label1 ... plane_labelN",
__FILE__, setClippingPlanes, g);
di.Add("XIsView", "XIsView Doc Label",
__FILE__, isView, g);
@ -1076,6 +1267,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 +1338,13 @@ 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);
}

View File

@ -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

View File

@ -21,6 +21,7 @@
#include <XmlMXCAFDoc.hxx>
#include <XmlMXCAFDoc_AreaDriver.hxx>
#include <XmlMXCAFDoc_CentroidDriver.hxx>
#include <XmlMXCAFDoc_ClippingPlaneToolDriver.hxx>
#include <XmlMXCAFDoc_ColorDriver.hxx>
#include <XmlMXCAFDoc_ColorToolDriver.hxx>
#include <XmlMXCAFDoc_DatumDriver.hxx>
@ -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));
}

View File

@ -24,6 +24,7 @@ class XmlMDF_ADriverTable;
class CDM_MessageDriver;
class XmlMXCAFDoc_AreaDriver;
class XmlMXCAFDoc_CentroidDriver;
class XmlMXCAFDoc_ClippingPlaneDriver;
class XmlMXCAFDoc_ColorDriver;
class XmlMXCAFDoc_GraphNodeDriver;
class XmlMXCAFDoc_LocationDriver;
@ -68,6 +69,7 @@ private:
friend class XmlMXCAFDoc_AreaDriver;
friend class XmlMXCAFDoc_CentroidDriver;
friend class XmlMXCAFDoc_ClippingPlaneDriver;
friend class XmlMXCAFDoc_ColorDriver;
friend class XmlMXCAFDoc_GraphNodeDriver;
friend class XmlMXCAFDoc_LocationDriver;

View File

@ -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 <CDM_MessageDriver.hxx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
#include <XCAFDoc_ClippingPlaneTool.hxx>
#include <XmlMXCAFDoc_ClippingPlaneToolDriver.hxx>
#include <XmlObjMgt_Persistent.hxx>
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
{
}

View File

@ -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 <Standard.hxx>
#include <Standard_Type.hxx>
#include <XmlMDF_ADriver.hxx>
#include <Standard_Boolean.hxx>
#include <XmlObjMgt_RRelocationTable.hxx>
#include <XmlObjMgt_SRelocationTable.hxx>
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

View File

@ -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