//=======================================================================
Standard_Boolean XCAFDoc_ClippingPlaneTool::GetClippingPlane(const TDF_Label& theLabel,
- gp_Pln& thePlane, TCollection_ExtendedString& theName, Standard_Boolean &theCapping) const
+ gp_Pln& thePlane, TCollection_ExtendedString& theName, Standard_Boolean &theCapping, Standard_Boolean &theVisible) const
{
if (theLabel.Father() != Label())
return Standard_False;
theName = aNameAttribute->Get();
Handle(TDataStd_Integer) aCappingAttribute;
- if (theLabel.FindAttribute(TDataStd_Integer::GetID(), aCappingAttribute))
+ if (theLabel.FindAttribute(XCAFDoc::ClipPlaneCappingRefGUID(), aCappingAttribute))
theCapping = (aCappingAttribute->Get() == 1);
-
+
+ Handle(TDataStd_Integer) aVisibleAttribute;
+ if (theLabel.FindAttribute(XCAFDoc::ClipPlaneVisibleRefGUID(), aVisibleAttribute))
+ theVisible = (aVisibleAttribute->Get() == 1);
+
return Standard_True;
}
//=======================================================================
Standard_Boolean XCAFDoc_ClippingPlaneTool::GetClippingPlane(const TDF_Label& theLabel,
- gp_Pln& thePlane, Handle(TCollection_HAsciiString)& theName, Standard_Boolean &theCapping) const
+ gp_Pln& thePlane, Handle(TCollection_HAsciiString)& theName, Standard_Boolean &theCapping, Standard_Boolean &theVisible) const
{
TCollection_ExtendedString anExtName;
- if (!GetClippingPlane(theLabel, thePlane, anExtName, theCapping))
+ if (!GetClippingPlane(theLabel, thePlane, anExtName, theCapping, theVisible))
return Standard_False;
theName = new TCollection_HAsciiString(anExtName);
return Standard_True;
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);
+ Standard_Boolean aCapping, aVisible;
+ GetClippingPlane(aClippingPlanes.Value(i), aPlane, aName, aCapping, aVisible);
if (!aName.IsEqual(theName))
continue;
if (aPlane.Axis().Angle(thePlane.Axis()) > Precision::Angular())
//purpose :
//=======================================================================
-TDF_Label XCAFDoc_ClippingPlaneTool::AddClippingPlane(const gp_Pln thePlane, const TCollection_ExtendedString theName, const Standard_Boolean theCapping) const
+TDF_Label XCAFDoc_ClippingPlaneTool::AddClippingPlane(const gp_Pln thePlane, const TCollection_ExtendedString theName, const Standard_Boolean theCapping, const Standard_Boolean theVisible) const
{
TDF_Label aLabel = AddClippingPlane(thePlane, theName);
Standard_Integer aCappingVal = (theCapping) ? 1 : 0;
TDataStd_Integer::Set(aLabel, aCappingVal);
+ Standard_Integer aVisibleVal = (theVisible) ? 1 : 0;
+ TDataStd_Integer::Set(aLabel, aVisibleVal);
return aLabel;
}
//purpose :
//=======================================================================
-TDF_Label XCAFDoc_ClippingPlaneTool::AddClippingPlane(const gp_Pln thePlane, const Handle(TCollection_HAsciiString)& theName, const Standard_Boolean theCapping) const
+TDF_Label XCAFDoc_ClippingPlaneTool::AddClippingPlane(const gp_Pln thePlane, const Handle(TCollection_HAsciiString)& theName, const Standard_Boolean theCapping, const Standard_Boolean theVisible) const
{
TCollection_ExtendedString anExtName = TCollection_ExtendedString(theName->String());
- return AddClippingPlane(thePlane, anExtName, theCapping);
+ return AddClippingPlane(thePlane, anExtName, theCapping, theVisible);
}
//=======================================================================
if (theClippingPlaneL.Father() != Label())
return;
- theClippingPlaneL.ForgetAttribute(TDataStd_Integer::GetID());
+ theClippingPlaneL.ForgetAttribute(XCAFDoc::ClipPlaneCappingRefGUID());
Standard_Integer aCappingVal = (theCapping) ? 1 : 0;
- TDataStd_Integer::Set(theClippingPlaneL, aCappingVal);
+ TDataStd_Integer::Set(theClippingPlaneL, XCAFDoc::ClipPlaneCappingRefGUID(), aCappingVal);
}
//=======================================================================
return Standard_False;
Handle(TDataStd_Integer) aCappingAttribute;
- if (theClippingPlaneL.FindAttribute(TDataStd_Integer::GetID(), aCappingAttribute))
+ if (theClippingPlaneL.FindAttribute(XCAFDoc::ClipPlaneCappingRefGUID(), aCappingAttribute))
return (aCappingAttribute->Get() == 1);
return Standard_False;
return Standard_False;
Handle(TDataStd_Integer) aCappingAttribute;
- if (theClippingPlaneL.FindAttribute(TDataStd_Integer::GetID(), aCappingAttribute)) {
+ if (theClippingPlaneL.FindAttribute(XCAFDoc::ClipPlaneCappingRefGUID(), aCappingAttribute)) {
theCapping = (aCappingAttribute->Get() == 1);
return Standard_True;
}
return Standard_False;
}
+//=======================================================================
+//function : SetVisible
+//purpose :
+//=======================================================================
+
+void XCAFDoc_ClippingPlaneTool::SetVisible(const TDF_Label& theClippingPlaneL, const Standard_Boolean theVisible)
+{
+ if (theClippingPlaneL.Father() != Label())
+ return;
+
+ theClippingPlaneL.ForgetAttribute(XCAFDoc::ClipPlaneVisibleRefGUID());
+ Standard_Integer aVisibleVal = (theVisible) ? 1 : 0;
+ TDataStd_Integer::Set(theClippingPlaneL, XCAFDoc::ClipPlaneVisibleRefGUID(), aVisibleVal);
+}
+
+//=======================================================================
+//function : GetVisible
+//purpose :
+//=======================================================================
+
+Standard_Boolean XCAFDoc_ClippingPlaneTool::GetVisible(const TDF_Label& theClippingPlaneL) const
+{
+ if (theClippingPlaneL.Father() != Label())
+ return Standard_False;
+
+ Handle(TDataStd_Integer) aVisibleAttribute;
+ if (theClippingPlaneL.FindAttribute(XCAFDoc::ClipPlaneVisibleRefGUID(), aVisibleAttribute))
+ return (aVisibleAttribute->Get() == 1);
+
+ return Standard_False;
+}
+
+//=======================================================================
+//function : GetVisible
+//purpose :
+//=======================================================================
+
+Standard_Boolean XCAFDoc_ClippingPlaneTool::GetVisible(const TDF_Label& theClippingPlaneL, Standard_Boolean &theVisible) const
+{
+ if (theClippingPlaneL.Father() != Label())
+ return Standard_False;
+
+ Handle(TDataStd_Integer) aVisibleAttribute;
+ if (theClippingPlaneL.FindAttribute(XCAFDoc::ClipPlaneVisibleRefGUID(), aVisibleAttribute)) {
+ theVisible = (aVisibleAttribute->Get() == 1);
+ return Standard_True;
+ }
+
+ return Standard_False;
+}
//=======================================================================
//function : GetID
//! 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;
+ Standard_EXPORT Standard_Boolean GetClippingPlane(const TDF_Label& theLabel, gp_Pln& thePlane, TCollection_ExtendedString& theName, Standard_Boolean &theCapping, Standard_Boolean &theVisible) 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;
+ Standard_EXPORT Standard_Boolean GetClippingPlane(const TDF_Label& theLabel, gp_Pln& thePlane, Handle(TCollection_HAsciiString)& theName, Standard_Boolean &theCapping, Standard_Boolean &theVisible) 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;
+ Standard_EXPORT TDF_Label AddClippingPlane(const gp_Pln thePlane, const TCollection_ExtendedString theName, const Standard_Boolean theCapping, const Standard_Boolean theVisible) 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;
+ Standard_EXPORT TDF_Label AddClippingPlane(const gp_Pln thePlane, const Handle(TCollection_HAsciiString)& theName, const Standard_Boolean theCapping, const Standard_Boolean theVisible) const;
//! Adds a clipping plane definition to a ClippingPlane table and returns
//! its label (returns existing label if the same clipping plane
//! 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;
+
+ //! Set new value of visible for given clipping plane label
+ Standard_EXPORT void SetVisible(const TDF_Label& theClippingPlaneL, const Standard_Boolean theCapping);
+
+ //! Get visible value for given clipping plane label
+ //! Return capping value
+ Standard_EXPORT Standard_Boolean GetVisible(const TDF_Label& theClippingPlaneL) const;
+
+ //! Get visible value for given clipping plane label
+ //! Return true if Label is valid abd capping is exist.
+ Standard_EXPORT Standard_Boolean GetVisible(const TDF_Label& theClippingPlaneL, Standard_Boolean &theCapping) const;
Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
//=======================================================================
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]";
+ if (argc < 6) {
+ di << "Use: XAddClippingPlane Doc plane name capping[0/1] visible[0/1]";
return 1;
}
Handle(TDocStd_Document) aDoc;
aPlane = aSurf->Pln();
Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString(argv[3]);
Standard_Boolean aCapping = (argv[4][0] == '1');
+ Standard_Boolean aVisible = (argv[5][0] == '1');
- TDF_Label aCPlaneL = aCPlaneTool->AddClippingPlane(aPlane, aName, aCapping);
+ TDF_Label aCPlaneL = aCPlaneTool->AddClippingPlane(aPlane, aName, aCapping, aVisible);
TCollection_AsciiString anEntry;
TDF_Tool::Entry(aCPlaneL, anEntry);
di << anEntry << "\n";
}
gp_Pln aPlane;
Handle(TCollection_HAsciiString) aName;
- Standard_Boolean aCapping;
- aClippingPlaneTool->GetClippingPlane(aLabel, aPlane, aName, aCapping);
+ Standard_Boolean aCapping, aVisible;
+ aClippingPlaneTool->GetClippingPlane(aLabel, aPlane, aName, aCapping, aVisible);
Handle(Geom_Plane) aCPlane = new Geom_Plane(aPlane);
DrawTrSurf::Set(aName->ToCString(), aCPlane);
di << aName->ToCString();