Open CASCADE Technology  6.9.0
Public Types | Public Member Functions | Protected Member Functions

NIS_Surface Class Reference

#include <NIS_Surface.hxx>

Inheritance diagram for NIS_Surface:
Inheritance graph
[legend]

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_ShortRealNode (const Standard_Integer theIndex) const
 
const Standard_IntegerTriangle (const Standard_Integer theIndex) const
 
const Standard_IntegerEdge (const Standard_Integer theIndex) const
 
const Standard_ShortRealNormal (const Standard_Integer theIndex) const
 
virtual NIS_DrawerDefaultDrawer (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
 
- Public Member Functions inherited from NIS_InteractiveObject
 NIS_InteractiveObject ()
 
virtual ~NIS_InteractiveObject ()
 
Standard_Integer ID () const
 
NIS_Drawer::DrawType DrawType () const
 
const Handle< NIS_Drawer > & SetDrawer (const Handle< NIS_Drawer > &theDrawer, const Standard_Boolean setUpdated=Standard_True)
 
const Handle< NIS_Drawer > & GetDrawer () const
 
const Bnd_B3fGetBox ()
 
Standard_Boolean IsTransparent () const
 
Standard_Boolean IsHidden () const
 
Standard_Boolean IsDisplayed () const
 
Standard_Boolean IsDynHilighted () const
 
virtual Standard_Boolean IsSelectable () const
 
virtual void SetSelectable (const Standard_Boolean isSel=Standard_True) const
 
Standard_ShortReal Transparency () const
 
void SetTransparency (const Standard_Real theValue=0.6)
 
void UnsetTransparency ()
 
void CloneWithID (const Handle< NCollection_BaseAllocator > &, Handle< NIS_InteractiveObject > &)
 
void SetAttribute (void *theAttributePtr)
 
void * GetAttribute () const
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual void Delete () const
 Memory deallocator for transient classes. More...
 
virtual const
Handle_Standard_Type & 
DynamicType () const
 Returns a type information object about this object. More...
 
Standard_Boolean IsInstance (const Handle_Standard_Type &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
Standard_Boolean IsKind (const Handle_Standard_Type &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_Boolean IsKind (const Standard_CString theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
virtual Handle_Standard_Transient This () const
 Returns a Handle which references this object. Must never be called to objects created in stack. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 

Protected Member Functions

 NIS_Surface (const Handle< NCollection_BaseAllocator > &theAl)
 
virtual void computeBox ()
 
Standard_Boolean computeNormal (Standard_Integer theIndex, gp_XYZ &theNormal) const
 
- Protected Member Functions inherited from NIS_InteractiveObject
void setDrawerUpdate () const
 
Standard_Boolean isUpdateBox () const
 
void setIsUpdateBox (const Standard_Boolean isUpdate)
 

Additional Inherited Members

- Protected Attributes inherited from NIS_InteractiveObject
Bnd_B3f myBox
 
void * myAttributePtr
 

Detailed Description

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.

Member Enumeration Documentation

Enumerator
Shading 
Wireframe 

Constructor & Destructor Documentation

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.

Parameters
theShapeSource geometry. It should contain triangulations inside.
theDeflectionAbsolute deflection for meshing 'theShape' if such meshing is needed.
theAlAllocator 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().

Member Function Documentation

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.

Parameters
theAllAllocator 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 ( )
protectedvirtual

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.

Returns
Pointer to array where the 0th element is the number of nodes in the edge and the elements starting from the 1st are node indices.
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.

Parameters
theAxisThe line or ray in 3D space.
theOverHalf-thickness of the selecting line - ignored.
Returns
If the return value is more than 0.1*RealLast() then no intersection is detected. Otherwise returns the coordinate of the nearest intersection on the ray. May be negative.

Implements 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.

Parameters
theBox3D box of selection
theTrfPosition/Orientation of the box.
isFullTrue if full inclusion is required, False - if partial.
Returns
True if the InteractiveObject geometry intersects the box or is inside it

Reimplemented from 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.

Parameters
thePolygonthe 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.
theTrfPosition/Orientation of the polygon.
isFullInTrue if full inclusion is required, False - if partial.
Returns
True if the InteractiveObject geometry intersects the polygon or is inside it

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.

Returns
pointer to array of 3 Standard_ShortReal values (X,Y,Z coordinates)
const Standard_ShortReal* NIS_Surface::Normal ( const Standard_Integer  theIndex) const
inline

Query the normal vector at the given triangulation node (by index)

Returns
pointer to array of 3 Standard_ShortReal values (X,Y,Z coordinates)
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.

Parameters
theColorNew color to use for the presentation.
void NIS_Surface::SetColor ( const Quantity_Color theColor)

Set the normal color for presentation.

Parameters
theColorNew 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.

Parameters
theValueNew offset to use for the presentation.
const Standard_Integer* NIS_Surface::Triangle ( const Standard_Integer  theIndex) const
inline

Query the triangle by its index.

Returns
pointer to array of 3 Standard_Integer values (nodes 0, 1, 2)

The documentation for this class was generated from the following file: