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),
}
// =======================================================================
-// function : SetShaderProgram
+// function : SetOwnLineAspects
// purpose :
// =======================================================================
void Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram,
#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);
};
return 1;
}
- if ((argc != 3 && argc < 6) || argc > 8)
+ if ((argc != 3 && argc < 6) || argc > 9)
{
std::cout << "Usage :\n " << argv[0]
<< " ObjectName isOn [R G B [LineWidth [LineStyle]]]\n"
Standard_Real aBlue = 0.0;
Standard_Real aWidth = 1.0;
Aspect_TypeOfLine aLineType = Aspect_TOL_SOLID;
+ GeomAbs_Shape aMaxContinuity = GeomAbs_CN;
// find object
Handle(AIS_InteractiveObject) anInterObj;
}
// select appropriate line type
- if (argc == 8)
+ if (argc >= 8)
{
if (!ViewerTest::ParseLineType (argv[7], aLineType))
{
}
}
+ if (argc >= 9)
+ {
+ TCollection_AsciiString aClassArg (argv[8]);
+ aClassArg.LowerCase();
+ if (aClassArg == "c0")
+ {
+ aMaxContinuity = GeomAbs_C0;
+ }
+ else if (aClassArg == "c1")
+ {
+ aMaxContinuity = GeomAbs_C1;
+ }
+ else if (aClassArg == "g1")
+ {
+ aMaxContinuity = GeomAbs_G1;
+ }
+ else if (aClassArg == "c2")
+ {
+ aMaxContinuity = GeomAbs_C2;
+ }
+ else if (aClassArg == "g2")
+ {
+ aMaxContinuity = GeomAbs_G2;
+ }
+ else if (aClassArg == "c3")
+ {
+ aMaxContinuity = GeomAbs_C3;
+ }
+ else if (aClassArg == "cn")
+ {
+ aMaxContinuity = GeomAbs_CN;
+ }
+ else
+ {
+ std::cout << "Syntax error at '" << aClassArg << "'\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);
+ aDrawer->SetFaceBoundaryUpperContinuity (aMaxContinuity);
TheAISContext()->Redisplay (anInterObj, Standard_True);
__FILE__, VPolygonOffset, group);
theCommands.Add ("vshowfaceboundary",
- "vshowfaceboundary : ObjectName isOn (1/0) [R G B [LineWidth [LineStyle]]]"
+ "vshowfaceboundary : ObjectName isOn (1/0) [R G B [LineWidth [LineStyle]]] [{c0|c1|c2|c3|cn}]"
"- turns on/off drawing of face boundaries for ais object "
"and defines boundary line style.",
__FILE__, VShowFaceBoundary, group);