A new flag theMostAllowedEdgeClass is passed to the methods StdPrs_ShadedShape: Add, FillFaceBoundaries. It describes the most allowed continuity class of edges that will be included into the presentation. The edges with more continuity will be ignored. By default, the value is CN, i.e. all edges are included into the presentation.
The new methods in AIS_Shape: SetMostContinuityClass, MostContinuityClass allows specifying the most allowed continuity class of edges at the level of shape's presentation
myUVRepeat(1.0, 1.0),
myUVScale (1.0, 1.0),
myInitAng (0.0),
- myCompBB (Standard_True)
+ myCompBB (Standard_True),
+ myMostEdgeClass(GeomAbs_CN)
{
//
}
StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer,
myDrawer->ShadingAspect()->Aspect()->ToMapTexture()
&& !myDrawer->ShadingAspect()->Aspect()->TextureMap().IsNull(),
- myUVOrigin, myUVRepeat, myUVScale);
+ myUVOrigin, myUVRepeat, myUVScale, StdPrs_Volume_Autodetection,
+ myMostEdgeClass);
}
catch (Standard_Failure const& anException)
{
aPreviousAngle = myDrawer->PreviousHLRDeviationAngle ();
return myDrawer->HasOwnHLRDeviationAngle();
}
+
+//=======================================================================
+//function : SetMostContinuityClass
+//purpose :
+//=======================================================================
+
+void AIS_Shape::SetMostContinuityClass(const GeomAbs_Shape theMostAllowedEdgeClass)
+{
+ myMostEdgeClass = theMostAllowedEdgeClass;
+}
+
+//=======================================================================
+//function : MostContinuityClass
+//purpose :
+//=======================================================================
+
+GeomAbs_Shape AIS_Shape::MostContinuityClass() const
+{
+ return myMostEdgeClass;
+}
#include <TopoDS_Shape.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_TypeOfHLR.hxx>
+#include <GeomAbs_Shape.hxx>
//! A framework to manage presentation and selection of shapes.
//! AIS_Shape is the interactive object which is used the
//! the current facing model;
Standard_EXPORT virtual Standard_Real Transparency() const Standard_OVERRIDE;
+ //! Set the most edge continuity class
+ //! @param theMostAllowedEdgeClass the most edge continuity class to be included to presentation
+ //! (edges with more continuity should be ignored)
+ Standard_EXPORT void SetMostContinuityClass(const GeomAbs_Shape theMostAllowedEdgeClass);
+
+ //! Get the most edge continuity class
+ Standard_EXPORT GeomAbs_Shape MostContinuityClass() const;
+
//! Return shape type for specified selection mode.
static TopAbs_ShapeEnum SelectionType (const Standard_Integer theSelMode)
{
gp_Pnt2d myUVScale; //!< UV scale vector for generating texture coordinates
Standard_Real myInitAng;
Standard_Boolean myCompBB; //!< if TRUE, then bounding box should be recomputed
-
+ GeomAbs_Shape myMostEdgeClass; //!< the most edge continuity class to be included to the presentation
};
DEFINE_STANDARD_HANDLE(AIS_Shape, AIS_InteractiveObject)
}
//! 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, const GeomAbs_Shape theMostAllowedEdgeClass)
{
// collection of all triangulation nodes on edges
// for computing boundaries presentation
}
const TopoDS_Edge& anEdge = TopoDS::Edge (anEdgeIter.Key());
+ if (anEdgeIter.Value().Extent() > 1)
+ {
+ TopTools_ListIteratorOfListOfShape anIter2(anEdgeIter.Value());
+ anIter2.Next();
+ const TopoDS_Face& aFace2 = TopoDS::Face(anIter2.Value());
+ GeomAbs_Shape aShape = BRep_Tool::Continuity(anEdge, aFace, aFace2);
+ if (aShape > theMostAllowedEdgeClass)
+ 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 (anEdgeIter.Value().Extent() > 1)
+ {
+ TopTools_ListIteratorOfListOfShape anIter2(anEdgeIter.Value());
+ anIter2.Next();
+ const TopoDS_Face& aFace2 = TopoDS::Face(anIter2.Value());
+ GeomAbs_Shape aShape = BRep_Tool::Continuity(anEdge, aFace, aFace2);
+ if (aShape > theMostAllowedEdgeClass)
+ continue;
+ }
+
Handle(Poly_PolygonOnTriangulation) anEdgePoly = BRep_Tool::PolygonOnTriangulation (anEdge, aTriangulation, aTrsf);
if (anEdgePoly.IsNull()
|| anEdgePoly->Nodes().Length () < 2)
void StdPrs_ShadedShape::Add (const Handle(Prs3d_Presentation)& thePrs,
const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer,
- const StdPrs_Volume theVolume)
+ const StdPrs_Volume theVolume,
+ const GeomAbs_Shape theMostAllowedEdgeClass)
{
gp_Pnt2d aDummy;
StdPrs_ShadedShape::Add (thePrs, theShape, theDrawer,
- Standard_False, aDummy, aDummy, aDummy, theVolume);
+ Standard_False, aDummy, aDummy, aDummy, theVolume, theMostAllowedEdgeClass);
}
// =======================================================================
const gp_Pnt2d& theUVOrigin,
const gp_Pnt2d& theUVRepeat,
const gp_Pnt2d& theUVScale,
- const StdPrs_Volume theVolume)
+ const StdPrs_Volume theVolume,
+ const GeomAbs_Shape theMostAllowedEdgeClass)
{
if (theShape.IsNull())
{
if (theDrawer->FaceBoundaryDraw())
{
- Handle(Graphic3d_ArrayOfSegments) aBndSegments = fillFaceBoundaries (theShape);
+ Handle(Graphic3d_ArrayOfSegments) aBndSegments = fillFaceBoundaries (theShape, theMostAllowedEdgeClass);
if (!aBndSegments.IsNull())
{
Handle(Graphic3d_AspectLine3d) aBoundaryAspect = theDrawer->FaceBoundaryAspect()->Aspect();
// function : FillFaceBoundaries
// purpose :
// =======================================================================
-Handle(Graphic3d_ArrayOfSegments) StdPrs_ShadedShape::FillFaceBoundaries (const TopoDS_Shape& theShape)
+Handle(Graphic3d_ArrayOfSegments) StdPrs_ShadedShape::FillFaceBoundaries (const TopoDS_Shape& theShape,
+ const GeomAbs_Shape theMostAllowedEdgeClass)
{
- return fillFaceBoundaries (theShape);
+ return fillFaceBoundaries (theShape, theMostAllowedEdgeClass);
}
// =======================================================================
#include <Prs3d_Drawer.hxx>
#include <StdPrs_Volume.hxx>
#include <Standard_Boolean.hxx>
+#include <GeomAbs_Shape.hxx>
class Graphic3d_ArrayOfSegments;
class Graphic3d_ArrayOfTriangles;
//! @param theVolumeType defines the way how to interpret input shapes - as Closed volumes (to activate back-face
//! culling and capping plane algorithms), as Open volumes (shells or solids with holes)
//! or to perform Autodetection (would split input shape into two groups)
- Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation, const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer, const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection);
+ //! @param theMostAllowedEdgeClass the most edge continuity class to be included to result (edges with more continuity should be ignored)
+ Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation,
+ const TopoDS_Shape& theShape,
+ const Handle(Prs3d_Drawer)& theDrawer,
+ const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection,
+ const GeomAbs_Shape theMostAllowedEdgeClass = GeomAbs_CN);
//! Shades <theShape> with texture coordinates.
//! @param theVolumeType defines the way how to interpret input shapes - as Closed volumes (to activate back-face
//! culling and capping plane algorithms), as Open volumes (shells or solids with holes)
//! or to perform Autodetection (would split input shape into two groups)
- Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation, const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer, const Standard_Boolean theHasTexels, const gp_Pnt2d& theUVOrigin, const gp_Pnt2d& theUVRepeat, const gp_Pnt2d& theUVScale, const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection);
+ //! @param theMostAllowedEdgeClass the most edge continuity class to be included to result (edges with more continuity should be ignored)
+ Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation,
+ const TopoDS_Shape& theShape,
+ const Handle(Prs3d_Drawer)& theDrawer,
+ const Standard_Boolean theHasTexels,
+ const gp_Pnt2d& theUVOrigin,
+ const gp_Pnt2d& theUVRepeat,
+ const gp_Pnt2d& theUVScale,
+ const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection,
+ const GeomAbs_Shape theMostAllowedEdgeClass = GeomAbs_CN);
//! Searches closed and unclosed subshapes in shape structure and puts them
//! into two compounds for separate processing of closed and unclosed sub-shapes
//! 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 theMostAllowedEdgeClass the most edge continuity class to be included to result (edges with more continuity should be ignored)
+ Standard_EXPORT static Handle(Graphic3d_ArrayOfSegments) FillFaceBoundaries
+ (const TopoDS_Shape& theShape, const GeomAbs_Shape theMostAllowedEdgeClass = GeomAbs_CN);
};
#endif // _StdPrs_ShadedShape_HeaderFile
return 0;
}
+//==============================================================================
+//function : VSetMostCont
+//purpose : sets the most continuity class of edges in presentation
+//==============================================================================
+static int VSetMostCont(Draw_Interpretor& theDI,
+ Standard_Integer theArgNb,
+ const char** theArgVec)
+{
+ const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
+ ViewerTest_AutoUpdater anUpdateTool(aCtx, ViewerTest::CurrentView());
+ if (aCtx.IsNull())
+ {
+ std::cerr << "Error: no active view!\n";
+ return 1;
+ }
+
+ if (theArgNb != 3)
+ {
+ std::cout << "Error: wrong number of arguments! See usage:\n";
+ theDI.PrintHelp(theArgVec[0]);
+ return 1;
+ }
+
+ TCollection_AsciiString aName = theArgVec[1];
+ TCollection_AsciiString aClassArg = theArgVec[2];
+ aClassArg.LowerCase();
+
+ GeomAbs_Shape aClass = GeomAbs_CN;
+ if (aClassArg == "c0")
+ aClass = GeomAbs_C0;
+ else if (aClassArg == "c1")
+ aClass = GeomAbs_C1;
+ else if (aClassArg == "c2")
+ aClass = GeomAbs_C2;
+ else if (aClassArg == "c3")
+ aClass = GeomAbs_C3;
+ else if (aClassArg == "cn")
+ aClass = GeomAbs_CN;
+ else
+ {
+ std::cout << "Error: incorrect class! See usage:\n";
+ theDI.PrintHelp(theArgVec[0]);
+ return 1;
+ }
+
+ if (!aName.IsEmpty()
+ && !GetMapOfAIS().IsBound2(aName))
+ {
+ std::cout << "Error: object " << aName << " is not displayed!\n";
+ return 1;
+ }
+
+ for (ViewTest_PrsIter anIter(aName); anIter.More(); anIter.Next())
+ {
+ const Handle(AIS_Shape)& aShape = Handle(AIS_Shape)::DownCast(anIter.Current());
+ if (!aShape.IsNull())
+ {
+ aShape->SetMostContinuityClass(aClass);
+ aCtx->RecomputePrsOnly(aShape, Standard_False, Standard_True);
+ }
+ }
+ return 0;
+}
+
+
+
//! Auxiliary structure for VAspects
struct ViewerTest_AspectsChangeSet
{
"\n\t\t: Where style is: 0 = EMPTY, 1 = HOLLOW, 2 = HATCH, 3 = SOLID, 4 = HIDDENLINE.",
__FILE__,VSetInteriorStyle,group);
+ theCommands.Add("vsetmostcont",
+ "vsetmostcont : ObjectName class"
+ "- sets the most continuity class of edges in presentation",
+ "\n\t\t: Where class is c0, c1, c2, c3, cn"
+ __FILE__, VSetMostCont, 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:"
--- /dev/null
+puts "========"
+puts "0029787: Avoid in presentation edges of certain continuity class"
+puts "========"
+puts ""
+
+pload MODELING VISUALIZATION
+
+vclear
+vinit View1
+vsetcolorbg 255 255 255
+
+psphere sph1 1.0
+psphere sph2 1.0
+psphere sph3 1.0
+
+ttranslate sph2 4.0 0.0 0.0
+ttranslate sph3 8.0 0.0 0.0
+
+vdisplay -dispMode 0 sph1
+vdisplay -dispMode 1 sph2
+vshowfaceboundary sph2 1 255 0 0
+vdisplay -dispMode 1 sph3
+vshowfaceboundary sph3 1 255 0 0
+vsetmostcont sph3 c2
+vfit