Open CASCADE Technology 6.6.0
|
#include <NIS_Surface.hxx>
Public Types | |
enum | DisplayMode { Shading, Wireframe } |
Public Member Functions | |
NIS_Surface (const Handle_Poly_Triangulation &theTri, const Handle_NCollection_BaseAllocator &theAlloc=0L) | |
NIS_Surface (const TopoDS_Shape &theShape, const Standard_Real theDeflection, const Handle_NCollection_BaseAllocator &theAl=0L) | |
virtual | ~NIS_Surface () |
void | Init (const TopoDS_Shape &theShape, const Standard_Real theDefl) |
void | Clear () |
Standard_Integer | NNodes () const |
Standard_Integer | NTriangles () const |
Standard_Integer | NEdges () const |
const Standard_ShortReal * | Node (const Standard_Integer theIndex) const |
const Standard_Integer * | Triangle (const Standard_Integer theIndex) const |
const Standard_Integer * | Edge (const Standard_Integer theIndex) const |
const Standard_ShortReal * | Normal (const Standard_Integer theIndex) const |
virtual NIS_Drawer * | DefaultDrawer (NIS_Drawer *) const |
void | SetColor (const Quantity_Color &theColor) |
void | SetBackColor (const Quantity_Color &theColor) |
void | SetPolygonOffset (const Standard_Real theValue) |
void | SetDisplayMode (const DisplayMode theMode) |
DisplayMode | GetDisplayMode () const |
virtual void | Clone (const Handle_NCollection_BaseAllocator &theAll, Handle_NIS_InteractiveObject &theDest) const |
virtual Standard_Real | Intersect (const gp_Ax1 &theAxis, const Standard_Real theOver) const |
virtual Standard_Boolean | Intersect (const Bnd_B3f &theBox, const gp_Trsf &theTrf, const Standard_Boolean isFull) const |
virtual Standard_Boolean | Intersect (const NCollection_List< gp_XY > &thePolygon, const gp_Trsf &theTrf, const Standard_Boolean isFullIn) const |
Protected Member Functions | |
NIS_Surface (const Handle_NCollection_BaseAllocator &theAl) | |
virtual void | computeBox () |
Standard_Boolean | computeNormal (Standard_Integer theIndex, gp_XYZ &theNormal) const |
Presentation of a meshed surface. Consists of 4 arrays: Nodes, Triangles, Normals and Edges. Normals are defined in nodes, so the number of stored normals is strictly the number of nodes. Edges is an array of pointers: each pointer starts an array of node indices that define a single edge (i.e., a polygon that can be closed or open, no matter). The first number in the edge is the number of nodes in it.
Instances of this class can be initialized either atomically (setting every node and triangle and edge) or from a TopoDS_Shape object. In side the TopoDS_Shape only triangulations in faces are used; edges are taken from PolygonOnTriangulation also belonging to faces.
This class is conceived as replacement of AIS_Shape; both wireframe and shading modes are available for dynamic switching.
NIS_Surface::NIS_Surface | ( | const Handle_Poly_Triangulation & | theTri, |
const Handle_NCollection_BaseAllocator & | theAlloc = 0L |
||
) |
Constructor
NIS_Surface::NIS_Surface | ( | const TopoDS_Shape & | theShape, |
const Standard_Real | theDeflection, | ||
const Handle_NCollection_BaseAllocator & | theAl = 0L |
||
) |
Constructor. Creates the presentation of all faces in 'theShape' object.
theShape | Source geometry. It should contain triangulations inside. |
theDeflection | Absolute deflection for meshing 'theShape' if such meshing is needed. |
theAl | Allocator used for nodes and triangles in this presentation. |
virtual NIS_Surface::~NIS_Surface | ( | ) | [virtual] |
Destructor
NIS_Surface::NIS_Surface | ( | const Handle_NCollection_BaseAllocator & | theAl | ) | [protected] |
Allocator for method Clone().
void NIS_Surface::Clear | ( | ) |
Deallocate all internal data structures.
virtual void NIS_Surface::Clone | ( | const Handle_NCollection_BaseAllocator & | theAll, |
Handle_NIS_InteractiveObject & | theDest | ||
) | const [virtual] |
Create a copy of theObject except its ID.
theAll | Allocator where the Dest should store its private data. |
theDest | [in-out] The target object where the data are copied. If passed NULL then the target should be created. |
Reimplemented from NIS_InteractiveObject.
virtual void NIS_Surface::computeBox | ( | ) | [protected, virtual] |
Create a 3D bounding box of the object.
Implements NIS_InteractiveObject.
Standard_Boolean NIS_Surface::computeNormal | ( | Standard_Integer | theIndex, |
gp_XYZ & | theNormal | ||
) | const [protected] |
Compute normal to the surface at the node with the given index. Returns true if the vertex is artificial at this node.
virtual NIS_Drawer* NIS_Surface::DefaultDrawer | ( | NIS_Drawer * | ) | const [virtual] |
Create a default drawer instance.
Implements NIS_InteractiveObject.
const Standard_Integer* NIS_Surface::Edge | ( | const Standard_Integer | theIndex | ) | const [inline] |
Access to array of integers that represents an Edge.
DisplayMode NIS_Surface::GetDisplayMode | ( | ) | const |
Query the current display mode: Shading or Wireframe.
void NIS_Surface::Init | ( | const TopoDS_Shape & | theShape, |
const Standard_Real | theDefl | ||
) |
Initialize the instance with a TopoDS_Shape. Used in constructor but can be called any time to redefine the geometry.
virtual Standard_Real NIS_Surface::Intersect | ( | const gp_Ax1 & | theAxis, |
const Standard_Real | theOver | ||
) | const [virtual] |
Intersect the surface shading/wireframe geometry with a line/ray.
theAxis | The line or ray in 3D space. |
theOver | Half-thickness of the selecting line - ignored. |
Implements NIS_InteractiveObject.
virtual Standard_Boolean NIS_Surface::Intersect | ( | const NCollection_List< gp_XY > & | thePolygon, |
const gp_Trsf & | theTrf, | ||
const Standard_Boolean | isFullIn | ||
) | const [virtual] |
Intersect the surface shading/wireframe geometry with a selection polygon.
thePolygon | the list of vertices of a free-form closed polygon without self-intersections. The last point should not coincide with the first point of the list. Any two neighbor points should not be confused. |
theTrf | Position/Orientation of the polygon. |
isFullIn | True if full inclusion is required, False - if partial. |
Reimplemented from NIS_InteractiveObject.
virtual Standard_Boolean NIS_Surface::Intersect | ( | const Bnd_B3f & | theBox, |
const gp_Trsf & | theTrf, | ||
const Standard_Boolean | isFull | ||
) | const [virtual] |
Intersect the surface shading/wireframe geometry with an oriented box.
theBox | 3D box of selection |
theTrf | Position/Orientation of the box. |
isFull | True if full inclusion is required, False - if partial. |
Reimplemented from NIS_InteractiveObject.
Standard_Integer NIS_Surface::NEdges | ( | ) | const [inline] |
Query the number of edges for wireframe display.
Standard_Integer NIS_Surface::NNodes | ( | ) | const [inline] |
Query the number of nodes.
const Standard_ShortReal* NIS_Surface::Node | ( | const Standard_Integer | theIndex | ) | const [inline] |
Query the node by its index.
const Standard_ShortReal* NIS_Surface::Normal | ( | const Standard_Integer | theIndex | ) | const [inline] |
Query the normal vector at the given triangulation node (by index)
Standard_Integer NIS_Surface::NTriangles | ( | ) | const [inline] |
Query the number of triangles.
void NIS_Surface::SetBackColor | ( | const Quantity_Color & | theColor | ) |
Set the color for presentation of the back side of triangles.
theColor | New color to use for the presentation. |
void NIS_Surface::SetColor | ( | const Quantity_Color & | theColor | ) |
Set the normal color for presentation.
theColor | New color to use for the presentation. |
void NIS_Surface::SetDisplayMode | ( | const DisplayMode | theMode | ) |
Set the display mode: Shading or Wireframe. The default mode is Shading.
void NIS_Surface::SetPolygonOffset | ( | const Standard_Real | theValue | ) |
Set the offset for the presentation.
theValue | New offset to use for the presentation. |
const Standard_Integer* NIS_Surface::Triangle | ( | const Standard_Integer | theIndex | ) | const [inline] |
Query the triangle by its index.