Open CASCADE Technology
6.9.0
|
#include <NIS_Triangulated.hxx>
Public Types | |
enum | PolygonType { Polygon_Default = 0, Polygon_Line = 1, Polygon_Fill = 2 } |
Public Member Functions | |
NIS_Triangulated (const Standard_Integer nNodes=0, const Standard_Boolean is2D=Standard_False, const Handle< NCollection_BaseAllocator > &theAlloc=0L) | |
void | SetPolygonsPrs (const Standard_Integer nPolygons, const Standard_Integer nNodes=0) |
void | SetTriangulationPrs (const Standard_Integer nTriangles, const Standard_Integer nNodes=0) |
void | SetLinePrs (const Standard_Integer nPoints, const Standard_Boolean isClosed, const Standard_Integer nNodes=0) |
void | SetSegmentPrs (const Standard_Integer nSegments, const Standard_Integer nNodes=0) |
Standard_Boolean | IsTriangulation () const |
Standard_Boolean | IsPolygons () const |
Standard_Boolean | IsLine (Standard_Boolean &isLoop) const |
Standard_Boolean | IsSegments () const |
void | Clear () |
virtual | ~NIS_Triangulated () |
virtual NIS_Drawer * | DefaultDrawer (NIS_Drawer *) const |
void | SetNode (const Standard_Integer ind, const gp_XYZ &thePnt) |
void | SetNode (const Standard_Integer ind, const gp_XY &thePnt) |
void | SetTriangle (const Standard_Integer ind, const Standard_Integer iNode0, const Standard_Integer iNode1, const Standard_Integer iNode2) |
void | SetPolygon (const Standard_Integer ind, const Standard_Integer theSz) |
void | SetLineNode (const Standard_Integer ind, const Standard_Integer iNode) |
Standard_Integer | NNodes () const |
Standard_Integer | NTriangles () const |
Standard_Integer | NLineNodes () const |
Standard_Integer | NPolygons () const |
const Standard_ShortReal * | Node (const Standard_Integer ind) const |
void | SetPolygonNode (const Standard_Integer indPoly, const Standard_Integer ind, const Standard_Integer iNode) |
Standard_Integer | PolygonNode (const Standard_Integer indPoly, const Standard_Integer ind) const |
Standard_Integer | NPolygonNodes (const Standard_Integer indPoly) const |
void | SetDrawPolygons (const Standard_Boolean isDrawPolygons) |
void | SetPolygonType (const PolygonType theType) |
void | SetColor (const Quantity_Color &theColor) |
Quantity_Color | GetColor (const NIS_Drawer::DrawType theDrawType) const |
void | SetHilightColor (const Quantity_Color &theColor) |
void | SetDynHilightColor (const Quantity_Color &theColor) |
void | SetLineWidth (const Standard_Real theWidth) |
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 |
virtual void | Delete () 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_B3f & | GetBox () |
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_Transient & | operator= (const Standard_Transient &) |
Assignment operator, needed to avoid copying reference counter. More... | |
virtual | ~Standard_Transient () |
Destructor must be virtual. 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... | |
Static Public Member Functions | |
static int | tri_line_intersect (const double start[3], const double dir[3], const float V0[3], const float V1[3], const float V2[3], double *tInter) |
static int | tri2d_line_intersect (const double start[3], const double dir[3], const float V0[2], const float V1[2], const float V2[2], double *tInter) |
static int | seg_line_intersect (const gp_XYZ &aStart, const gp_XYZ &aDir, const double over2, const float V0[3], const float V1[3], double *tInter) |
static int | seg2d_line_intersect (const gp_XYZ &aStart, const gp_XYZ &aDir, const double over2, const float V0[2], const float V1[2], double *tInter) |
static int | seg_box_intersect (const Bnd_B3f &theBox, const gp_Pnt thePnt[2]) |
static int | seg_box_included (const Bnd_B3f &theBox, const gp_Pnt thePnt[2]) |
static int | seg_polygon_intersect (const NCollection_List< gp_XY > &thePolygon, const gp_XY thePnt[2]) |
static int | seg_polygon_included (const NCollection_List< gp_XY > &thePolygon, const gp_XY thePnt[2]) |
static void | ComputeBox (Bnd_B3f &theBox, const Standard_Integer nNodes, const Standard_ShortReal *pNodes, const Standard_Integer nCoord) |
static Standard_Boolean | IsIn (const NCollection_List< gp_XY > &thePolygon, const gp_XY &thePoint) |
Protected Types | |
enum | { Type_None = 0, Type_Loop = 1, Type_Line = 2, Type_Segments = 4, Type_Triangulation = 8, Type_Polygons = 16 } |
Protected Member Functions | |
virtual void | computeBox () |
void | allocateNodes (const Standard_Integer nNodes) |
gp_Pnt | nodeAtInd (const Standard_Integer *theArr, const Standard_Integer i) const |
float * | nodeArrAtInd (const Standard_Integer *theArr, const Standard_Integer i) const |
Protected Member Functions inherited from NIS_InteractiveObject | |
void | setDrawerUpdate () const |
Standard_Boolean | isUpdateBox () const |
void | setIsUpdateBox (const Standard_Boolean isUpdate) |
Protected Attributes | |
NCollection_BaseAllocator * | myAlloc |
Usually from InteractiveContext. More... | |
Standard_Integer | myType |
Combination of Type_* constants. More... | |
Standard_ShortReal * | mypNodes |
Standard_Integer * | mypTriangles |
Standard_Integer * | mypLines |
Standard_Integer ** | mypPolygons |
Standard_Integer | myNNodes |
Standard_Integer | myNTriangles |
Standard_Integer | myNLineNodes |
unsigned int | myNPolygons: 24 |
Standard_Boolean | myIsDrawPolygons: 1 |
Standard_Boolean | myIsCloned: 1 |
How it is allocated. More... | |
unsigned int | myIndexType: 2 |
0:8bit, 1:16bit, 2:32bit More... | |
unsigned int | myNodeCoord: 2 |
2 or 3 coordinates More... | |
unsigned int | myPolygonType: 2 |
Protected Attributes inherited from NIS_InteractiveObject | |
Bnd_B3f | myBox |
void * | myAttributePtr |
Interactive object that consists of triangles, lines and polygons without normals. Particularly can be used to render planar 2D shapes.
|
protected |
NIS_Triangulated::NIS_Triangulated | ( | const Standard_Integer | nNodes = 0 , |
const Standard_Boolean | is2D = Standard_False , |
||
const Handle< NCollection_BaseAllocator > & | theAlloc = 0L |
||
) |
Constructor. Optionally defines the number of nodes that will be allocated (this number may be defined later in methods Set*Prs) as well as the memory allocator where the nodes, lines and triangles will be stored by this instance.
nNodes | Total number of nodes that will be initialized for this object |
is2D | If true then the nodes will be 2D in plane Z=0, otherwise normal 3D. |
theAlloc | Allocator for internal data |
|
virtual |
Destructor.
|
protected |
Create the memory buffer for the declared number of nodes, old nodes are deallocated.
void NIS_Triangulated::Clear | ( | ) |
Reset all data memebers and free all allocated memory. Called from the destructor, also can be usedto re-initialize a given Interactive Objects.
|
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.
|
static |
|
protectedvirtual |
Allocator-based operator new for dynamic allocations in method Clone() Create a 3D bounding box of the object.
Implements NIS_InteractiveObject.
|
virtual |
Create a default drawer instance.
Implements NIS_InteractiveObject.
|
virtual |
Implements deallocation of the object instance
Reimplemented from Standard_Transient.
Quantity_Color NIS_Triangulated::GetColor | ( | const NIS_Drawer::DrawType | theDrawType | ) | const |
Get Normal, Transparent or Hilighted color of the presentation.
theDrawType | The draw type, for which the color is retrieved. |
|
virtual |
Intersect the InteractiveObject geometry with a line/ray.
theAxis | The line or ray in 3D space. |
theOver | Half-thickness of the selecting line. |
Implements NIS_InteractiveObject.
|
virtual |
Intersect the InteractiveObject 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.
|
virtual |
Intersect the InteractiveObject 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.
|
static |
Classification of thePoint with respect to thePolygon.
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. |
thePoint | the point to be classified. |
|
inline |
Query if there is Line component in the presentation.
|
inline |
Query if there is Polygons component in the presentation.
|
inline |
Query if there is Segments component in the presentation.
|
inline |
Query if there is Triangulation component in the presentation.
|
inline |
Query the number of line points.
|
inline |
Query the number of nodes.
|
inline |
Query the node by its index.
|
protected |
Get the node pointed by the i-th index in the array.
|
protected |
Get the node pointed by the i-th index in the array.
Standard_Integer NIS_Triangulated::NPolygonNodes | ( | const Standard_Integer | indPoly | ) | const |
Get the number of nodes for the polygon number 'indPoly'.
|
inline |
Query the number of polygons.
|
inline |
Query the number of triangles.
Standard_Integer NIS_Triangulated::PolygonNode | ( | const Standard_Integer | indPoly, |
const Standard_Integer | ind | ||
) | const |
Get the node with index 'ind' from the polygon number 'indPoly'.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
void NIS_Triangulated::SetColor | ( | const Quantity_Color & | theColor | ) |
Set the normal color for presentation.
theColor | New color to use for the presentation. |
void NIS_Triangulated::SetDrawPolygons | ( | const Standard_Boolean | isDrawPolygons | ) |
Set the boolean flag defining if the polygons or the triangulation should be drawn. This method does not affect the presentation of Line/Segments.
isDrawPolygons | True defines that no triangulation is drawn, only polygons are. False defines that only triangulation is drawn, no polygons. |
void NIS_Triangulated::SetDynHilightColor | ( | const Quantity_Color & | theColor | ) |
Set the color for dynamic hilight presentation.
theColor | New color to use for the presentation. |
void NIS_Triangulated::SetHilightColor | ( | const Quantity_Color & | theColor | ) |
Set the color for hilighted presentation.
theColor | New color to use for the presentation. |
void NIS_Triangulated::SetLineNode | ( | const Standard_Integer | ind, |
const Standard_Integer | iNode | ||
) |
Define the line node by index.
void NIS_Triangulated::SetLinePrs | ( | const Standard_Integer | nPoints, |
const Standard_Boolean | isClosed, | ||
const Standard_Integer | nNodes = 0 |
||
) |
Define the line presentration (polygon through points)
nPoints | Number of nodes defining the line. If set to 0, line is cancelled |
isClosed | True if the polygon is closed, so the segment between the first and the last points is created automatically. |
nNodes | Optional: Number of nodes to allocate. If left as 0, the previous nodes allocation is used, otherwise a new allocation is created. |
void NIS_Triangulated::SetLineWidth | ( | const Standard_Real | theWidth | ) |
Set the width of line presentations in pixels.
theWidth | New line width to use for the presentation. |
void NIS_Triangulated::SetNode | ( | const Standard_Integer | ind, |
const gp_XYZ & | thePnt | ||
) |
Define the coordinates of node [ind].
void NIS_Triangulated::SetNode | ( | const Standard_Integer | ind, |
const gp_XY & | thePnt | ||
) |
Define the coordinates of node [ind]. Z coordinate is assigned to 0.
void NIS_Triangulated::SetPolygon | ( | const Standard_Integer | ind, |
const Standard_Integer | theSz | ||
) |
Allocate a single polygon, should be called for each polygon following the call SetPolygonsPrs(). The polygon can be filled by node indices using the method SetPolygonNode().
ind | Index of the polygon, should be [0..Npolygons-1] |
theSz | Number of points (segments) in the polygon. |
void NIS_Triangulated::SetPolygonNode | ( | const Standard_Integer | indPoly, |
const Standard_Integer | ind, | ||
const Standard_Integer | iNode | ||
) |
Define the node of a polygon by index.
indPoly | Index of the Polygon, should be less than the number of polygons that is defined in SetPolygonsPrs() and can be returned by NPOlygons(). |
ind | Index of the node in the Polygon. Should be less than the parameter theSz in the corresponding previous SetPolygon() call. |
iNode | Index of the node in the given position of the Polygon. |
void NIS_Triangulated::SetPolygonsPrs | ( | const Standard_Integer | nPolygons, |
const Standard_Integer | nNodes = 0 |
||
) |
Define the polygonal presentration.
nPolygons | Number of separate polygons. If set to 0, polygons are cancelled |
nNodes | Optional: Number of nodes to allocate. If left as 0, the previous nodes allocation is used, otherwise a new allocation is created. |
void NIS_Triangulated::SetPolygonType | ( | const PolygonType | theType | ) |
Set the type of polygon rendering.
void NIS_Triangulated::SetSegmentPrs | ( | const Standard_Integer | nSegments, |
const Standard_Integer | nNodes = 0 |
||
) |
Define the segments presentration. Each segment is defined by 2 nodes
nSegments | Number of segments. If set to 0, segments presentation is cancelled |
nNodes | Optional: Number of nodes to allocate. If left as 0, the previous nodes allocation is used, otherwise a new allocation is created. |
void NIS_Triangulated::SetTriangle | ( | const Standard_Integer | ind, |
const Standard_Integer | iNode0, | ||
const Standard_Integer | iNode1, | ||
const Standard_Integer | iNode2 | ||
) |
Define the triangle [ind] by indices of its three nodes.
void NIS_Triangulated::SetTriangulationPrs | ( | const Standard_Integer | nTriangles, |
const Standard_Integer | nNodes = 0 |
||
) |
Define the triangulated presentration.
nTriangles | Number of triangles. If set to 0, triangulation is cancelled |
nNodes | Optional: Number of nodes to allocate. If left as 0, the previous nodes allocation is used, otherwise a new allocation is created. |
|
static |
|
static |
|
protected |
Usually from InteractiveContext.
|
protected |
0:8bit, 1:16bit, 2:32bit
|
protected |
How it is allocated.
|
protected |
|
protected |
|
protected |
|
protected |
2 or 3 coordinates
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Combination of Type_* constants.