pload VISUALIZATION
vinit Driver1/Viewer1/View1
vsetcolorbg 200 200 255
-vdisplay result
+vdisplay -dispMode 1 result
vfit
-vsetdispmode 1
-vshowfaceboundary result 1
+vaspects result -setFaceBoundaryDraw 1 -mostContinuity c2
pload VISUALIZATION
vinit Driver1/Viewer1/View1
vsetcolorbg 200 200 255
-vdisplay result
+vdisplay -dispMode 1 result
vfit
-vsetdispmode 1
-vshowfaceboundary result 1
+vaspects result -setFaceBoundaryDraw 1
# show result
donly res
trotate res 0 0 0 0 0 1 90
-vinit
-vdisplay res
-vsetdispmode 1
-vshowfaceboundary res 1 255 255 255
-vaspects -isoontriangulation 1
+vinit View1
+vdisplay -dispMode 1 res
+vaspects res -setFaceBoundaryDraw 1 -setFaceBoundaryColor WHITE -isoontriangulation 1
vfit
const DataMapOfDrawerCompd& theDrawerClosedFaces,
const Standard_Integer theMode)
{
- Handle(Graphic3d_Group) anOpenGroup, aClosedGroup;
+ Handle(Graphic3d_Group) anOpenGroup, aClosedGroup, anEdgesGroup;
for (size_t aShType = 0; aShType <= (size_t )TopAbs_SHAPE; ++aShType)
{
const Standard_Boolean isClosed = aShType == TopAbs_SHAPE;
{
if (aShadedGroup.IsNull())
{
- aShadedGroup = Prs3d_Root::NewGroup (thePrs);
+ aShadedGroup = thePrs->NewGroup();
aShadedGroup->SetClosed (isClosed);
}
aShadedGroup->SetPrimitivesAspect (aDrawer->ShadingAspect()->Aspect());
if (aDrawer->FaceBoundaryDraw())
{
- Handle(Graphic3d_ArrayOfSegments) aBndSegments = StdPrs_ShadedShape::FillFaceBoundaries (aShapeDraw);
- if (!aBndSegments.IsNull())
+ if (Handle(Graphic3d_ArrayOfSegments) aBndSegments = StdPrs_ShadedShape::FillFaceBoundaries (aShapeDraw, aDrawer->FaceBoundaryUpperContinuity()))
{
- if (aShadedGroup.IsNull())
+ if (anEdgesGroup.IsNull())
{
- aShadedGroup = Prs3d_Root::NewGroup (thePrs);
- aShadedGroup->SetClosed (isClosed);
+ anEdgesGroup = thePrs->NewGroup();
}
- Handle(Graphic3d_AspectLine3d) aBoundaryAspect = aDrawer->FaceBoundaryAspect()->Aspect();
- aShadedGroup->SetPrimitivesAspect (aBoundaryAspect);
- aShadedGroup->AddPrimitiveArray (aBndSegments);
+ anEdgesGroup->SetPrimitivesAspect (aDrawer->FaceBoundaryAspect()->Aspect());
+ anEdgesGroup->AddPrimitiveArray (aBndSegments);
}
}
}
return Standard_False;
}
+//=======================================================================
+//function : MaxContinuity
+//purpose :
+//=======================================================================
+GeomAbs_Shape BRep_Tool::MaxContinuity (const TopoDS_Edge& theEdge)
+{
+ GeomAbs_Shape aMaxCont = GeomAbs_C0;
+ for (BRep_ListIteratorOfListOfCurveRepresentation aReprIter ((*((Handle(BRep_TEdge)*)&theEdge.TShape()))->ChangeCurves());
+ aReprIter.More(); aReprIter.Next())
+ {
+ const Handle(BRep_CurveRepresentation)& aRepr = aReprIter.Value();
+ if (aRepr->IsRegularity())
+ {
+ const GeomAbs_Shape aCont = aRepr->Continuity();
+ if ((Standard_Integer )aCont > (Standard_Integer )aMaxCont)
+ {
+ aMaxCont = aCont;
+ }
+ }
+ }
+ return aMaxCont;
+}
+
//=======================================================================
//function : Pnt
//purpose : Returns the 3d point.
//! Returns True if the edge has regularity on some
//! two surfaces
Standard_EXPORT static Standard_Boolean HasContinuity (const TopoDS_Edge& E);
+
+ //! Returns the max continuity of edge between some surfaces or GeomAbs_C0 if there no such surfaces.
+ Standard_EXPORT static GeomAbs_Shape MaxContinuity (const TopoDS_Edge& theEdge);
//! Returns the 3d point.
Standard_EXPORT static gp_Pnt Pnt (const TopoDS_Vertex& V);
myHasOwnUnFreeBoundaryAspect (Standard_False),
myUnFreeBoundaryDraw (Standard_True),
myHasOwnUnFreeBoundaryDraw (Standard_False),
+ myFaceBoundaryUpperContinuity(-1),
myHasOwnFaceBoundaryAspect (Standard_False),
myFaceBoundaryDraw (Standard_False),
myHasOwnFaceBoundaryDraw (Standard_False),
myTypeOfHLR = Prs3d_TOH_NotSet;
}
+// =======================================================================
+// function : SetupOwnFaceBoundaryAspect
+// purpose :
+// =======================================================================
+Standard_Boolean Prs3d_Drawer::SetupOwnFaceBoundaryAspect (const Handle(Prs3d_Drawer)& theDefaults)
+{
+ if (myHasOwnFaceBoundaryAspect)
+ {
+ return false;
+ }
+
+ myFaceBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_FaceBoundary, Aspect_TOL_SOLID, 1.0);
+ myHasOwnFaceBoundaryAspect = true;
+
+ const Handle(Prs3d_Drawer)& aLink = (!theDefaults.IsNull() && theDefaults != this) ? theDefaults : myLink;
+ if (!aLink.IsNull())
+ {
+ *myFaceBoundaryAspect->Aspect() = *aLink->FaceBoundaryAspect()->Aspect();
+ }
+ return true;
+}
+
// =======================================================================
// function : SetOwnLineAspects
// purpose :
*myUnFreeBoundaryAspect->Aspect() = *aLink->UnFreeBoundaryAspect()->Aspect();
}
}
- if (!myHasOwnFaceBoundaryAspect)
- {
- isUpdateNeeded = true;
- myFaceBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_FaceBoundary, Aspect_TOL_SOLID, 1.0);
- myHasOwnFaceBoundaryAspect = true;
- if (!aLink.IsNull())
- {
- *myFaceBoundaryAspect->Aspect() = *aLink->FaceBoundaryAspect()->Aspect();
- }
- }
+ isUpdateNeeded = SetupOwnFaceBoundaryAspect (theDefaults) || isUpdateNeeded;
return isUpdateNeeded;
}
#include <Prs3d_DimensionUnits.hxx>
#include <Prs3d_TypeOfHLR.hxx>
#include <Standard_Transient.hxx>
+#include <GeomAbs_Shape.hxx>
class Prs3d_IsoAspect;
class Prs3d_LineAspect;
//! face boundaries aspect that overrides the one in the link.
Standard_Boolean HasOwnFaceBoundaryAspect() const { return myHasOwnFaceBoundaryAspect; }
+ //! Sets own face boundary aspect.
+ //! Returns FALSE if the drawer already has its own attribute for face boundary aspect.
+ Standard_EXPORT Standard_Boolean SetupOwnFaceBoundaryAspect (const Handle(Prs3d_Drawer)& theDefaults = Handle(Prs3d_Drawer)());
+
//! Enables or disables face boundary drawing for shading presentations.
//! The method sets drawing flag owned by the drawer that will be used during
//! visualization instead of the one set in link.
//! "draw face boundaries" flag that overrides the one in the link.
Standard_Boolean HasOwnFaceBoundaryDraw() const { return myHasOwnFaceBoundaryDraw; }
+ //! Returns true if the drawer has its own attribute for face boundaries upper edge continuity class that overrides the one in the link.
+ Standard_Boolean HasOwnFaceBoundaryUpperContinuity() const { return myFaceBoundaryUpperContinuity != -1; }
+
+ //! Get the most edge continuity class; GeomAbs_CN by default (all edges).
+ GeomAbs_Shape FaceBoundaryUpperContinuity() const
+ {
+ return HasOwnFaceBoundaryUpperContinuity()
+ ? (GeomAbs_Shape )myFaceBoundaryUpperContinuity
+ : (!myLink.IsNull()
+ ? myLink->FaceBoundaryUpperContinuity()
+ : GeomAbs_CN);
+ }
+
+ //! Set the most edge continuity class for face boundaries.
+ void SetFaceBoundaryUpperContinuity (GeomAbs_Shape theMostAllowedEdgeClass) { myFaceBoundaryUpperContinuity = theMostAllowedEdgeClass; }
+
+ //! Unset the most edge continuity class for face boundaries.
+ void UnsetFaceBoundaryUpperContinuity() { myFaceBoundaryUpperContinuity = -1; }
+
//! Returns settings for the appearance of dimensions.
Standard_EXPORT const Handle(Prs3d_DimensionAspect)& DimensionAspect();
Standard_Boolean myUnFreeBoundaryDraw;
Standard_Boolean myHasOwnUnFreeBoundaryDraw;
Handle(Prs3d_LineAspect) myFaceBoundaryAspect;
+ Standard_Integer myFaceBoundaryUpperContinuity; //!< the most edge continuity class (GeomAbs_Shape) to be included to face boundaries presentation, or -1 if undefined
Standard_Boolean myHasOwnFaceBoundaryAspect;
Standard_Boolean myFaceBoundaryDraw;
Standard_Boolean myHasOwnFaceBoundaryDraw;
Prs3d_DimensionUnits myDimensionDisplayUnits;
Standard_Boolean myHasOwnDimLengthDisplayUnits;
Standard_Boolean myHasOwnDimAngleDisplayUnits;
-
};
Standard_DEPRECATED("Class name is deprecated - use Prs3d_Drawer instead")
}
//! Compute boundary presentation for faces of the shape.
- static Handle(Graphic3d_ArrayOfSegments) fillFaceBoundaries (const TopoDS_Shape& theShape)
+ static Handle(Graphic3d_ArrayOfSegments) fillFaceBoundaries (const TopoDS_Shape& theShape,
+ GeomAbs_Shape theUpperContinuity)
{
// collection of all triangulation nodes on edges
// for computing boundaries presentation
}
const TopoDS_Edge& anEdge = TopoDS::Edge (anEdgeIter.Key());
+ if (theUpperContinuity < GeomAbs_CN
+ && anEdgeIter.Value().Extent() >= 2
+ && BRep_Tool::MaxContinuity (anEdge) > theUpperContinuity)
+ {
+ continue;
+ }
+
Handle(Poly_PolygonOnTriangulation) anEdgePoly = BRep_Tool::PolygonOnTriangulation (anEdge, aTriangulation, aTrsf);
if (!anEdgePoly.IsNull()
&& anEdgePoly->Nodes().Length() >= 2)
}
const TopoDS_Edge& anEdge = TopoDS::Edge (anEdgeIter.Key());
+ if (theUpperContinuity < GeomAbs_CN
+ && anEdgeIter.Value().Extent() >= 2
+ && BRep_Tool::MaxContinuity (anEdge) > theUpperContinuity)
+ {
+ continue;
+ }
+
Handle(Poly_PolygonOnTriangulation) anEdgePoly = BRep_Tool::PolygonOnTriangulation (anEdge, aTriangulation, aTrsf);
if (anEdgePoly.IsNull()
|| anEdgePoly->Nodes().Length () < 2)
if (theDrawer->FaceBoundaryDraw())
{
- Handle(Graphic3d_ArrayOfSegments) aBndSegments = fillFaceBoundaries (theShape);
- if (!aBndSegments.IsNull())
+ if (Handle(Graphic3d_ArrayOfSegments) aBndSegments = fillFaceBoundaries (theShape, theDrawer->FaceBoundaryUpperContinuity()))
{
- Handle(Graphic3d_AspectLine3d) aBoundaryAspect = theDrawer->FaceBoundaryAspect()->Aspect();
Handle(Graphic3d_Group) aPrsGrp = Prs3d_Root::CurrentGroup (thePrs);
- aPrsGrp->SetGroupPrimitivesAspect (aBoundaryAspect);
+ aPrsGrp->SetGroupPrimitivesAspect (theDrawer->FaceBoundaryAspect()->Aspect());
aPrsGrp->AddPrimitiveArray (aBndSegments);
}
}
// function : FillFaceBoundaries
// purpose :
// =======================================================================
-Handle(Graphic3d_ArrayOfSegments) StdPrs_ShadedShape::FillFaceBoundaries (const TopoDS_Shape& theShape)
+Handle(Graphic3d_ArrayOfSegments) StdPrs_ShadedShape::FillFaceBoundaries (const TopoDS_Shape& theShape,
+ GeomAbs_Shape theUpperContinuity)
{
- return fillFaceBoundaries (theShape);
+ return fillFaceBoundaries (theShape, theUpperContinuity);
}
// =======================================================================
#ifndef _StdPrs_ShadedShape_HeaderFile
#define _StdPrs_ShadedShape_HeaderFile
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
+#include <GeomAbs_Shape.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_Drawer.hxx>
#include <StdPrs_Volume.hxx>
//! Define primitive array of boundary segments for specified shape.
//! @param theShape segments array or NULL if specified face does not have computed triangulation
- Standard_EXPORT static Handle(Graphic3d_ArrayOfSegments) FillFaceBoundaries (const TopoDS_Shape& theShape);
+ //! @param theUpperContinuity the most edge continuity class to be included to result (edges with more continuity will be ignored)
+ Standard_EXPORT static Handle(Graphic3d_ArrayOfSegments) FillFaceBoundaries (const TopoDS_Shape& theShape,
+ GeomAbs_Shape theUpperContinuity = GeomAbs_CN);
};
Standard_Integer ToEnableIsoOnTriangulation;
+ Standard_Integer ToSetFaceBoundaryDraw;
+ Standard_Integer ToSetFaceBoundaryUpperContinuity;
+ GeomAbs_Shape FaceBoundaryUpperContinuity;
+
+ Standard_Integer ToSetFaceBoundaryColor;
+ Quantity_Color FaceBoundaryColor;
+
+ Standard_Integer ToSetFaceBoundaryWidth;
+ Standard_Real FaceBoundaryWidth;
+
+ Standard_Integer ToSetTypeOfFaceBoundaryLine;
+ Aspect_TypeOfLine TypeOfFaceBoundaryLine;
+
Standard_Integer ToSetMaxParamValue;
Standard_Real MaxParamValue;
FreeBoundaryWidth (1.0),
ToSetFreeBoundaryColor (0),
FreeBoundaryColor (DEFAULT_FREEBOUNDARY_COLOR),
- ToEnableIsoOnTriangulation (-1),
+ ToEnableIsoOnTriangulation (0),
+ //
+ ToSetFaceBoundaryDraw (0),
+ ToSetFaceBoundaryUpperContinuity (0),
+ FaceBoundaryUpperContinuity(GeomAbs_CN),
+ ToSetFaceBoundaryColor (0),
+ FaceBoundaryColor (Quantity_NOC_BLACK),
+ ToSetFaceBoundaryWidth (0),
+ FaceBoundaryWidth (1.0f),
+ ToSetTypeOfFaceBoundaryLine(0),
+ TypeOfFaceBoundaryLine (Aspect_TOL_SOLID),
+ //
ToSetMaxParamValue (0),
MaxParamValue (500000),
ToSetSensitivity (0),
&& ToSetShowFreeBoundary == 0
&& ToSetFreeBoundaryColor == 0
&& ToSetFreeBoundaryWidth == 0
+ && ToEnableIsoOnTriangulation == 0
+ && ToSetFaceBoundaryDraw == 0
+ && ToSetFaceBoundaryUpperContinuity == 0
+ && ToSetFaceBoundaryColor == 0
+ && ToSetFaceBoundaryWidth == 0
+ && ToSetTypeOfFaceBoundaryLine == 0
&& ToSetMaxParamValue == 0
&& ToSetSensitivity == 0
&& ToSetHatch == 0
toRecompute = true;
}
}
+ if (ToSetFaceBoundaryDraw != 0)
+ {
+ if (ToSetFaceBoundaryDraw != -1
+ || theDrawer->HasOwnFaceBoundaryDraw())
+ {
+ toRecompute = true;
+ theDrawer->SetFaceBoundaryDraw (ToSetFaceBoundaryDraw == 1);
+ }
+ }
+ if (ToSetFaceBoundaryUpperContinuity != 0)
+ {
+ if (ToSetFaceBoundaryUpperContinuity != -1
+ || theDrawer->HasOwnFaceBoundaryUpperContinuity())
+ {
+ toRecompute = true;
+ if (ToSetFaceBoundaryUpperContinuity == -1)
+ {
+ theDrawer->UnsetFaceBoundaryUpperContinuity();
+ }
+ else
+ {
+ theDrawer->SetFaceBoundaryUpperContinuity (FaceBoundaryUpperContinuity);
+ }
+ }
+ }
+ if (ToSetFaceBoundaryColor != 0)
+ {
+ if (ToSetFaceBoundaryColor != -1
+ || theDrawer->HasOwnFaceBoundaryAspect())
+ {
+ if (ToSetFaceBoundaryColor == -1)
+ {
+ toRecompute = true;
+ theDrawer->SetFaceBoundaryAspect (Handle(Prs3d_LineAspect)());
+ }
+ else
+ {
+ toRecompute = theDrawer->SetupOwnFaceBoundaryAspect (aDefDrawer) || toRecompute;
+ theDrawer->FaceBoundaryAspect()->SetColor (FaceBoundaryColor);
+ }
+ }
+ }
+ if (ToSetFaceBoundaryWidth != 0)
+ {
+ if (ToSetFaceBoundaryWidth != -1
+ || theDrawer->HasOwnFaceBoundaryAspect())
+ {
+ toRecompute = theDrawer->SetupOwnFaceBoundaryAspect (aDefDrawer) || toRecompute;
+ theDrawer->FaceBoundaryAspect()->SetWidth (FaceBoundaryWidth);
+ }
+ }
+ if (ToSetTypeOfFaceBoundaryLine != 0)
+ {
+ if (ToSetTypeOfFaceBoundaryLine != -1
+ || theDrawer->HasOwnFaceBoundaryAspect())
+ {
+ toRecompute = theDrawer->SetupOwnFaceBoundaryAspect (aDefDrawer) || toRecompute;
+ theDrawer->FaceBoundaryAspect()->SetTypeOfLine (TypeOfFaceBoundaryLine);
+ }
+ }
if (ToSetShadingModel != 0)
{
if (ToSetShadingModel != -1
aChangeSet->ToSetTypeOfEdge = -1;
aChangeSet->TypeOfEdge = Aspect_TOL_SOLID;
}
+ else if (aCmdName == "vshowfaceboundary")
+ {
+ aChangeSet->ToSetFaceBoundaryDraw = 1;
+ toParseAliasArgs = true;
+ if (aNames.Size() >= 2
+ && aNames.Value (2).IsIntegerValue())
+ {
+ if (aNames.Size() == 7)
+ {
+ if (ViewerTest::ParseLineType (aNames.Value (7).ToCString(), aChangeSet->TypeOfFaceBoundaryLine))
+ {
+ aChangeSet->ToSetTypeOfFaceBoundaryLine = 1;
+ aNames.Remove (7);
+ }
+ }
+ if (aNames.Size() == 6
+ && aNames.Value (6).IsRealValue())
+ {
+ aChangeSet->ToSetFaceBoundaryWidth = 1;
+ aChangeSet->FaceBoundaryWidth = aNames.Value (6).RealValue();
+ aNames.Remove (6);
+ }
+ if (aNames.Size() == 5
+ && aNames.Value (3).IsIntegerValue()
+ && aNames.Value (4).IsIntegerValue()
+ && aNames.Value (5).IsIntegerValue())
+ {
+ aChangeSet->ToSetFaceBoundaryColor = 1;
+ aChangeSet->FaceBoundaryColor = Quantity_Color (aNames.Value (3).IntegerValue() / 255.0,
+ aNames.Value (4).IntegerValue() / 255.0,
+ aNames.Value (5).IntegerValue() / 255.0,
+ Quantity_TOC_RGB);
+ aNames.Remove (5);
+ aNames.Remove (4);
+ aNames.Remove (3);
+ }
+ if (aNames.Size() == 2)
+ {
+ toParseAliasArgs = false;
+ aChangeSet->ToSetFaceBoundaryDraw = aNames.Value (2).IntegerValue() == 1 ? 1 : -1;
+ aNames.Remove (2);
+ }
+ }
+ }
else if (anArgIter >= theArgNb)
{
std::cout << "Error: not enough arguments!\n";
|| anArg == "-setedgewidth"
|| anArg == "-setedgeswidth"
|| anArg == "-edgewidth"
- || anArg == "-edgeswidth")
+ || anArg == "-edgeswidth"
+ || anArg == "-setfaceboundarywidth"
+ || anArg == "-setboundarywidth"
+ || anArg == "-faceboundarywidth"
+ || anArg == "-boundarywidth")
{
if (++anArgIter >= theArgNb)
{
std::cout << "Error: wrong syntax at " << anArg << "\n";
return 1;
}
+
+ const Standard_Real aWidth = Draw::Atof (theArgVec[anArgIter]);
if (anArg == "-setedgewidth"
|| anArg == "-setedgeswidth"
|| anArg == "-edgewidth"
|| aCmdName == "vsetedgetype")
{
aChangeSet->ToSetEdgeWidth = 1;
- aChangeSet->EdgeWidth = Draw::Atof (theArgVec[anArgIter]);
+ aChangeSet->EdgeWidth = aWidth;
+ }
+ else if (anArg == "-setfaceboundarywidth"
+ || anArg == "-setboundarywidth"
+ || anArg == "-faceboundarywidth"
+ || anArg == "-boundarywidth"
+ || aCmdName == "vshowfaceboundary")
+ {
+ aChangeSet->ToSetFaceBoundaryWidth = 1;
+ aChangeSet->FaceBoundaryWidth = aWidth;
}
else
{
aChangeSet->ToSetLineWidth = 1;
- aChangeSet->LineWidth = Draw::Atof (theArgVec[anArgIter]);
+ aChangeSet->LineWidth = aWidth;
}
}
else if (anArg == "-unsetwidth"
aChangeSet->Transparency = 0.0;
}
else if (anArg == "-setcolor"
- || anArg == "-color")
+ || anArg == "-color"
+ || anArg == "-setfaceboundarycolor"
+ || anArg == "-setboundarycolor"
+ || anArg == "-faceboundarycolor"
+ || anArg == "-boundarycolor")
{
Quantity_Color aColor;
Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
aChangeSet->ToSetEdgeColor = 1;
aChangeSet->EdgeColor = Quantity_ColorRGBA (aColor);
}
+ else if (aCmdName == "vshowfaceboundary"
+ || anArg == "-setfaceboundarycolor"
+ || anArg == "-setboundarycolor"
+ || anArg == "-faceboundarycolor"
+ || anArg == "-boundarycolor")
+ {
+ aChangeSet->ToSetFaceBoundaryColor = 1;
+ aChangeSet->FaceBoundaryColor = aColor;
+ }
else
{
aChangeSet->ToSetColor = 1;
|| anArg == "-setedgestype"
|| anArg == "-edgetype"
|| anArg == "-edgestype"
+ || anArg == "-setfaceboundarystyle"
+ || anArg == "-faceboundarystyle"
+ || anArg == "-boundarystyle"
+ || anArg == "-setfaceboundarytype"
+ || anArg == "-faceboundarytype"
+ || anArg == "-setboundarytype"
+ || anArg == "-boundarytype"
|| anArg == "-type")
{
if (++anArgIter >= theArgNb)
aChangeSet->TypeOfEdge = aLineType;
aChangeSet->ToSetTypeOfEdge = 1;
}
+ else if (anArg == "-setfaceboundarystyle"
+ || anArg == "-faceboundarystyle"
+ || anArg == "-boundarystyle"
+ || anArg == "-setfaceboundarytype"
+ || anArg == "-faceboundarytype"
+ || anArg == "-setboundarytype"
+ || anArg == "-boundarytype"
+ || aCmdName == "vshowfaceboundary")
+ {
+ aChangeSet->TypeOfFaceBoundaryLine = aLineType;
+ aChangeSet->ToSetTypeOfFaceBoundaryLine = 1;
+ }
else
{
aChangeSet->TypeOfLine = aLineType;
|| anArg == "-setfb"
|| anArg == "-fb")
{
- if (++anArgIter >= theArgNb)
- {
- std::cout << "Error: wrong syntax at " << anArg << "\n";
- return 1;
- }
- TCollection_AsciiString aValue (theArgVec[anArgIter]);
- aValue.LowerCase();
- if (aValue == "on"
- || aValue == "1")
- {
- aChangeSet->ToSetShowFreeBoundary = 1;
- }
- else if (aValue == "off"
- || aValue == "0")
- {
- aChangeSet->ToSetShowFreeBoundary = -1;
- }
- else
+ bool toEnable = true;
+ if (!ViewerTest::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
{
std::cout << "Error: wrong syntax at " << anArg << "\n";
return 1;
}
+ ++anArgIter;
+ aChangeSet->ToSetShowFreeBoundary = toEnable ? 1 : -1;
}
else if (anArg == "-setfreeboundarywidth"
|| anArg == "-freeboundarywidth"
|| anArg == "-setisoontriang"
|| anArg == "-isoontriang")
{
- if (++anArgIter >= theArgNb)
+ bool toEnable = true;
+ if (!ViewerTest::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
{
std::cout << "Error: wrong syntax at " << anArg << "\n";
return 1;
}
- TCollection_AsciiString aValue (theArgVec[anArgIter]);
- aValue.LowerCase();
- if (aValue == "on"
- || aValue == "1")
+ ++anArgIter;
+ aChangeSet->ToEnableIsoOnTriangulation = toEnable ? 1 : -1;
+ }
+ else if (anArg == "-setfaceboundarydraw"
+ || anArg == "-setdrawfaceboundary"
+ || anArg == "-setdrawfaceboundaries"
+ || anArg == "-setshowfaceboundary"
+ || anArg == "-setshowfaceboundaries"
+ || anArg == "-setdrawfaceedges"
+ || anArg == "-faceboundarydraw"
+ || anArg == "-drawfaceboundary"
+ || anArg == "-drawfaceboundaries"
+ || anArg == "-showfaceboundary"
+ || anArg == "-showfaceboundaries"
+ || anArg == "-drawfaceedges"
+ || anArg == "-faceboundary"
+ || anArg == "-faceboundaries"
+ || anArg == "-faceedges")
+ {
+ bool toEnable = true;
+ if (!ViewerTest::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
+ {
+ std::cout << "Error: wrong syntax at " << anArg << "\n";
+ return 1;
+ }
+ ++anArgIter;
+ aChangeSet->ToSetFaceBoundaryDraw = toEnable ? 1 : -1;
+ }
+ else if (anArg == "-unsetfaceboundary"
+ || anArg == "-unsetboundary")
+ {
+ aChangeSet->ToSetFaceBoundaryDraw = -1;
+ aChangeSet->ToSetFaceBoundaryColor = -1;
+ }
+ else if (anArg == "-setmostcontinuity"
+ || anArg == "-mostcontinuity")
+ {
+ TCollection_AsciiString aClassArg (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "");
+ aClassArg.LowerCase();
+ GeomAbs_Shape aClass = GeomAbs_CN;
+ if (aClassArg == "c0"
+ || aClassArg == "0")
{
- aChangeSet->ToEnableIsoOnTriangulation = 1;
+ aClass = GeomAbs_C0;
}
- else if (aValue == "off"
- || aValue == "0")
+ else if (aClassArg == "c1"
+ || aClassArg == "1")
{
- aChangeSet->ToEnableIsoOnTriangulation = 0;
+ aClass = GeomAbs_C1;
+ }
+ else if (aClassArg == "c2"
+ || aClassArg == "2")
+ {
+ aClass = GeomAbs_C2;
+ }
+ else if (aClassArg == "c3"
+ || aClassArg == "3")
+ {
+ aClass = GeomAbs_C3;
+ }
+ else if (aClassArg == "cn"
+ || aClassArg == "n")
+ {
+ aClass = GeomAbs_CN;
}
else
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ std::cout << "Syntax error at '" << anArg << "'\n";
return 1;
}
+
+ ++anArgIter;
+ aChangeSet->ToSetFaceBoundaryUpperContinuity = 1;
+ aChangeSet->FaceBoundaryUpperContinuity = aClass;
}
else if (anArg == "-setmaxparamvalue"
|| anArg == "-maxparamvalue")
aChangeSet->FreeBoundaryColor = DEFAULT_FREEBOUNDARY_COLOR;
aChangeSet->ToSetFreeBoundaryWidth = -1;
aChangeSet->FreeBoundaryWidth = 1.0;
+ aChangeSet->ToEnableIsoOnTriangulation = -1;
+ //
+ aChangeSet->ToSetFaceBoundaryDraw = -1;
+ aChangeSet->ToSetFaceBoundaryUpperContinuity = -1;
+ aChangeSet->FaceBoundaryUpperContinuity = GeomAbs_CN;
+ aChangeSet->ToSetFaceBoundaryColor = -1;
+ aChangeSet->FaceBoundaryColor = Quantity_NOC_BLACK;
+ aChangeSet->ToSetFaceBoundaryWidth = -1;
+ aChangeSet->FaceBoundaryWidth = 1.0f;
+ aChangeSet->ToSetTypeOfFaceBoundaryLine = -1;
+ aChangeSet->TypeOfFaceBoundaryLine = Aspect_TOL_SOLID;
+ //
aChangeSet->ToSetHatch = -1;
aChangeSet->StdHatchStyle = -1;
aChangeSet->PathToHatchPattern.Clear();
{
aDrawer->ShadingAspect()->SetMaterial (aChangeSet->Material);
}
- if (aChangeSet->ToEnableIsoOnTriangulation != -1)
+ if (aChangeSet->ToEnableIsoOnTriangulation != 0)
{
aDrawer->SetIsoOnTriangulation (aChangeSet->ToEnableIsoOnTriangulation == 1);
}
{
aCtx->UnsetWidth (aPrs, Standard_False);
}
- else if (aChangeSet->ToEnableIsoOnTriangulation != -1)
+ else if (aChangeSet->ToEnableIsoOnTriangulation != 0)
{
aCtx->IsoOnTriangulation (aChangeSet->ToEnableIsoOnTriangulation == 1, aPrs);
toRedisplay = Standard_True;
"\n\t\t: [-unsetShadingModel]"
"\n\t\t: [-setInterior {solid|hatch|hidenline|point}]"
"\n\t\t: [-unsetInterior] [-setHatch HatchStyle]"
+ "\n\t\t: [-setFaceBoundaryDraw {0|1}] [-setMostContinuity {c0|c1|c2|c3|cn}"
+ "\n\t\t: [-setFaceBoundaryWidth LineWidth] [-setFaceBoundaryColor R G B] [-setFaceBoundaryType LineType]"
"\n\t\t: [-setDrawEdges {0|1}] [-setEdgeType LineType] [-setEdgeColor R G B] [-setQuadEdges {0|1}]"
"\n\t\t: [-setAlphaMode {opaque|mask|blend|blendauto} [alphaCutOff=0.5]]"
"\n\t\t: Manage presentation properties of all, selected or named objects."
"\n\t\t: Alias for vaspects [name] -unsetEdgeType.",
__FILE__, VAspects, group);
+ theCommands.Add ("vshowfaceboundary",
+ "vshowfaceboundary [name]"
+ "\n\t\t: Alias for vaspects [name] -setFaceBoundaryDraw on",
+ __FILE__, VAspects, group);
+
theCommands.Add("vsensdis",
"vsensdis : Display active entities (sensitive entities of one of the standard types corresponding to active selection modes)."
"\n\t\t: Standard entity types are those defined in Select3D package:"
return 0;
}
-//=======================================================================
-//function : VShowFaceBoundaries
-//purpose : Set face boundaries drawing on/off for ais object
-//=======================================================================
-static Standard_Integer VShowFaceBoundary (Draw_Interpretor& /*di*/,
- Standard_Integer argc,
- const char ** argv)
-{
- Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext ();
- if (aContext.IsNull ())
- {
- std::cout << argv[0] << " Call 'vinit' before!\n";
- return 1;
- }
-
- if ((argc != 3 && argc < 6) || argc > 8)
- {
- std::cout << "Usage :\n " << argv[0]
- << " ObjectName isOn [R G B [LineWidth [LineStyle]]]\n"
- << " ObjectName - name of AIS interactive object. \n"
- << " if ObjectName = \"\", then set as default\n"
- << " settings for all newly displayed objects\n"
- << " isOn - flag indicating whether the boundaries\n"
- << " should be turned on or off (can be set\n"
- << " to 0 (off) or 1 (on)).\n"
- << " R, G, B - red, green and blue components of boundary\n"
- << " color in range (0 - 255).\n"
- << " (default is (0, 0, 0)\n"
- << " LineWidth - line width\n"
- << " (default is 1)\n"
- << " LineStyle - line fill style :\n"
- << " 0 - solid \n"
- << " 1 - dashed \n"
- << " 2 - dot \n"
- << " 3 - dashdot\n"
- << " (default is solid)";
- return 1;
- }
-
- TCollection_AsciiString aName (argv[1]);
-
- Standard_Real aRed = 0.0;
- Standard_Real aGreen = 0.0;
- Standard_Real aBlue = 0.0;
- Standard_Real aWidth = 1.0;
- Aspect_TypeOfLine aLineType = Aspect_TOL_SOLID;
-
- // find object
- Handle(AIS_InteractiveObject) anInterObj;
-
- // if name is empty - apply attributes for default aspect
- if (!aName.IsEmpty ())
- {
- if (!GetMapOfAIS().Find2 (aName, anInterObj)
- || anInterObj.IsNull())
- {
- std::cout << "Use 'vdisplay' on " << aName << " before" << std::endl;
- return 1;
- }
- }
-
- const Handle(Prs3d_Drawer)& aDrawer = (aName.IsEmpty ()) ?
- TheAISContext ()->DefaultDrawer () : anInterObj->Attributes ();
-
- // turn boundaries on/off
- Standard_Boolean isBoundaryDraw = (Draw::Atoi (argv[2]) == 1);
- aDrawer->SetFaceBoundaryDraw (isBoundaryDraw);
-
- // set boundary line color
- if (argc >= 6)
- {
- // Text color
- aRed = Draw::Atof (argv[3])/255.;
- aGreen = Draw::Atof (argv[4])/255.;
- aBlue = Draw::Atof (argv[5])/255.;
- }
-
- // set line width
- if (argc >= 7)
- {
- aWidth = (Standard_Real)Draw::Atof (argv[6]);
- }
-
- // select appropriate line type
- if (argc == 8)
- {
- if (!ViewerTest::ParseLineType (argv[7], aLineType))
- {
- std::cout << "Syntax error: unknown line type '" << argv[7] << "'\n";
- return 1;
- }
- }
-
- Quantity_Color aColor (aRed, aGreen, aBlue, Quantity_TOC_RGB);
-
- Handle(Prs3d_LineAspect) aBoundaryAspect =
- new Prs3d_LineAspect (aColor, aLineType, aWidth);
-
- aDrawer->SetFaceBoundaryAspect (aBoundaryAspect);
-
- TheAISContext()->Redisplay (anInterObj, Standard_True);
-
- return 0;
-}
-
// This class is used for testing markers.
-
class ViewerTest_MarkersArrayObject : public AIS_InteractiveObject
{
"vpolygonoffset : [object [mode factor units]] - sets/gets polygon offset parameters for an object, without arguments prints the default values",
__FILE__, VPolygonOffset, group);
- theCommands.Add ("vshowfaceboundary",
- "vshowfaceboundary : ObjectName isOn (1/0) [R G B [LineWidth [LineStyle]]]"
- "- turns on/off drawing of face boundaries for ais object "
- "and defines boundary line style.",
- __FILE__, VShowFaceBoundary, group);
-
theCommands.Add ("vmarkerstest",
"vmarkerstest: name X Y Z [PointsOnSide=10] [MarkerType=0] [Scale=1.0] [FileName=ImageFile]\n",
__FILE__, VMarkersTest, group);
vinit View1
vdisplay b
vsetdispmode 1
-vshowfaceboundary b 1 255 0 0 5 1
+vaspects b -setFaceBoundaryDraw 1 -setFaceBoundaryColor RED -setFaceBoundaryWidth 5 -setFaceBoundaryType dash
vfit
vaspects -setwidth 10
vinit View1
box b 10 10 10
vdisplay b
-vshowfaceboundary b 1
+vaspects b -setFaceBoundaryDraw 1
vclipplane create pln1
vclipplane set pln1 object b
vclipplane change pln1 equation 0 1 0 -5
pcone c 0 5 10
vdisplay c; vfit
vsetdispmode c 1
-vshowfaceboundary c 1 64 64 0
+vaspects c -setFaceBoundaryDraw 1 -setFaceBoundaryColor 0.25 0.25 0
vselect 200 200
vdump $imagedir/${casename}_wf_no_triang.png
# Computing wireframe after triangulation, then checking face boundaries and selection
vsetdispmode 1
vdisplay c; vfit
-vshowfaceboundary c 1 64 64 0
+vaspects c -setFaceBoundaryDraw 1 -setFaceBoundaryColor 0.25 0.25 0
vselect 200 200
vdump $imagedir/${casename}_wf_with_triang.png
vdisplay -noupdate -dispMode 1 b
vfit
-vshowfaceboundary b 1 255 0 0 3
+vaspects b -setFaceBoundaryDraw 1 -setFaceBoundaryColor RED -setFaceBoundaryWidth 3
vraytrace 1
if {[vreadpixel 295 255 name] != "GOLDENROD4 0"} {
vdisplay -noupdate -dispMode 0 s
vaspects s -subshapes s_1 -setcolor RED
vdisplay -noupdate -dispMode 1 s
-vshowfaceboundary s 1 255 0 0 2
+vaspects s -unsetFaceBoundary
+vaspects s -setFaceBoundaryDraw 1 -setFaceBoundaryColor RED -setFaceBoundaryWidth 2
vfit
vselect 250 250
--- /dev/null
+puts "========"
+puts "0029787: Visualization - Avoid in presentation edges of certain continuity class"
+puts "========"
+puts ""
+
+pload MODELING VISUALIZATION
+
+vclear
+vinit View1
+vsetcolorbg 255 255 255
+
+psphere s1 1
+psphere s2 1
+psphere s3 1
+ttranslate s2 4 0 0
+ttranslate s3 8 0 0
+
+vdisplay -dispMode 0 s1
+vdisplay -dispMode 1 s2 s3
+vfit
+
+vaspects s2 -setFaceBoundaryDraw 1 -setFaceBoundaryColor RED
+vaspects s3 -setFaceBoundaryDraw 1 -setFaceBoundaryColor RED -setMostContinuity c2
+
+vdump $::imagedir/${::casename}.png
#vinit
vdisplay res
vsetdispmode 1
-#vshowfaceboundary res 1 255 255 255
+#vaspects res -setFaceBoundaryDraw 1 -setFaceBoundaryColor WHITE
vfit
vrenderparams -rayTrace -reflections