OpenLexocad  27.1
Base::InventorBuilder Class Reference

#include <Builder3D.h>

Public Member Functions

 InventorBuilder (std::ostream &str)
 Construction of an InventorBuilder instance. This automatically opens a separator node. More...
 
virtual ~InventorBuilder ()
 Destruction of an InventorBuilder instance. More...
 
void close ()
 If needed closes the first opened separator node. This method must not be used more than one time for an instance. More...
 
void beginSeparator ()
 Sets a separator node. More...
 
void endSeparator ()
 Closes the last added separator node. More...
 
void addInfo (const char *str)
 Sets an info node. More...
 
void addLabel (const char *str)
 Sets a label node. More...
 
Appearance handling
void addBaseColor (float color_r, float color_g, float color_b)
 Sets a base color node. The colors are in the range [0, 1]. More...
 
void addMaterial (float color_r, float color_g, float color_b, float color_a=0)
 Sets a material node. The colors are in the range [0, 1]. More...
 
void beginMaterial ()
 Starts a material node. The node must be closed with endMaterial and the colors must be added with addColor(). More...
 
void endMaterial ()
 Closes a material node. More...
 
void addColor (float color_r, float color_g, float color_b)
 Adds a color to a material node. The colors are in the range [0, 1]. More...
 
void addMaterialBinding (const char *binding="OVERALL")
 Sets a material binding node. More...
 
void addDrawStyle (short pointSize, short lineWidth, unsigned short linePattern=0xffff, const char *style="FILLED")
 Sets a draw style node. More...
 
void addShapeHints (float crease=0.0f)
 Sets a shape hints node. More...
 
void addPolygonOffset (float factor=1.0f, float units=1.0f, const char *styles="FILLED", bool on=true)
 Sets a polygon offset node. More...
 
Add coordinates
void addPoint (float x, float y, float z)
 add a single point More...
 
void addPoint (const Vector3f &vec)
 add a single point More...
 
void addPoints (const std::vector< Vector3f > &vec)
 add a list of points More...
 
Point set handling
void beginPoints ()
 starts a point set More...
 
void endPoints ()
 ends the points set operation More...
 
void addPointSet ()
 add an SoPointSet node More...
 
Normal handling
void beginNormal ()
 starts a point set More...
 
void endNormal ()
 ends the points set operation More...
 
void addNormalBinding (const char *)
 add normal binding node More...
 
Line/Direction handling
void addSingleLine (const Vector3f &pt1, const Vector3f &pt2, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0, unsigned short linePattern=0xffff)
 add a line defined by 2 Vector3D More...
 
void addSingleArrow (const Vector3f &pt1, const Vector3f &pt2, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0, unsigned short linePattern=0xffff)
 add a arrow (directed line) by 2 Vector3D. The arrow shows in direction of point 2. More...
 
void addLineSet (const std::vector< Vector3f > &points, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0, unsigned short linePattern=0xffff)
 add a line defined by a list of points whereat always a pair (i.e. a point and the following point) builds a line. More...
 
void addLineSet ()
 add an SoLineSet node More...
 
Triangle handling
void addSingleTriangle (const Vector3f &pt0, const Vector3f &pt1, const Vector3f &pt2, bool filled=true, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0)
 add a (filled) triangle defined by 3 vectors More...
 
void addSinglePlane (const Vector3f &base, const Vector3f &eX, const Vector3f &eY, float length, float width, bool filled=true, short lineSize=2, float color_r=1.0, float color_g=1.0, float color_b=1.0)
 
void addIndexedFaceSet (const std::vector< int > &indices)
 
void addFaceSet (const std::vector< int > &vertices)
 
Surface handling
void addNurbsSurface (const std::vector< Base::Vector3f > &controlPoints, int numUControlPoints, int numVControlPoints, const std::vector< float > &uKnots, const std::vector< float > &vKnots)
 
void addCylinder (float radius, float height)
 
void addSphere (float radius)
 
Bounding Box handling
void addBoundingBox (const Vector3f &pt1, const Vector3f &pt2, short lineWidth=2, float color_r=1.0, float color_g=1.0, float color_b=1.0)
 
Transformation
void addTransformation (const Matrix4D &)
 adds a transformation More...
 
void addTransformation (const Vector3f &translation, const Vector3f &rotationaxis, float fAngle)
 
Text handling
void addText (float pos_x, float pos_y, float pos_z, const char *text, float color_r=1.0, float color_g=1.0, float color_b=1.0)
 add a text More...
 
void addText (const Vector3f &vec, const char *text, float color_r=1.0, float color_g=1.0, float color_b=1.0)
 add a text More...
 

Detailed Description

This class does basically the same as Builder3D except that it writes the data directly into a given stream without buffering the output data in a string stream. Compared to file streams, string streams are quite slow when writing data with more than a few hundred lines. Due to performance reasons the user should use a file stream in this case.

Author
Werner Mayer

Constructor & Destructor Documentation

◆ InventorBuilder()

Base::InventorBuilder::InventorBuilder ( std::ostream &  str)

Construction of an InventorBuilder instance. This automatically opens a separator node.

Parameters
str- stream to write the content into

◆ ~InventorBuilder()

virtual Base::InventorBuilder::~InventorBuilder ( )
virtual

Destruction of an InventorBuilder instance.

Member Function Documentation

◆ addBaseColor()

void Base::InventorBuilder::addBaseColor ( float  color_r,
float  color_g,
float  color_b 
)

Sets a base color node. The colors are in the range [0, 1].

Parameters
color_r- red color
color_g- green color
color_b- blue color

◆ addBoundingBox()

void Base::InventorBuilder::addBoundingBox ( const Vector3f pt1,
const Vector3f pt2,
short  lineWidth = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0 
)

◆ addColor()

void Base::InventorBuilder::addColor ( float  color_r,
float  color_g,
float  color_b 
)

Adds a color to a material node. The colors are in the range [0, 1].

Parameters
color_r- red color
color_g- green color
color_b- blue color

◆ addCylinder()

void Base::InventorBuilder::addCylinder ( float  radius,
float  height 
)

◆ addDrawStyle()

void Base::InventorBuilder::addDrawStyle ( short  pointSize,
short  lineWidth,
unsigned short  linePattern = 0xffff,
const char *  style = "FILLED" 
)

Sets a draw style node.

Parameters
pointSize- the point size
lineWidth- the line width
linePattern- the line pattern
style- the draw style

◆ addFaceSet()

void Base::InventorBuilder::addFaceSet ( const std::vector< int > &  vertices)

◆ addIndexedFaceSet()

void Base::InventorBuilder::addIndexedFaceSet ( const std::vector< int > &  indices)

◆ addInfo()

void Base::InventorBuilder::addInfo ( const char *  str)

Sets an info node.

Parameters
str- text set to the info node

◆ addLabel()

void Base::InventorBuilder::addLabel ( const char *  str)

Sets a label node.

Parameters
str- text set to the label node

◆ addLineSet() [1/2]

void Base::InventorBuilder::addLineSet ( const std::vector< Vector3f > &  points,
short  lineSize = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0,
unsigned short  linePattern = 0xffff 
)

add a line defined by a list of points whereat always a pair (i.e. a point and the following point) builds a line.

◆ addLineSet() [2/2]

void Base::InventorBuilder::addLineSet ( )

add an SoLineSet node

◆ addMaterial()

void Base::InventorBuilder::addMaterial ( float  color_r,
float  color_g,
float  color_b,
float  color_a = 0 
)

Sets a material node. The colors are in the range [0, 1].

Parameters
color_r- red color
color_g- green color
color_b- blue color
color_a- transparency

◆ addMaterialBinding()

void Base::InventorBuilder::addMaterialBinding ( const char *  binding = "OVERALL")

Sets a material binding node.

Parameters
binding- binding of the material. Allowed values are: OVERALL, PER_PART, PER_PART_INDEXED, PER_FACE, PER_FACE_INDEXED, PER_VERTEX, PER_VERTEX_INDEXED and DEFAULT.

◆ addNormalBinding()

void Base::InventorBuilder::addNormalBinding ( const char *  )

add normal binding node

◆ addNurbsSurface()

void Base::InventorBuilder::addNurbsSurface ( const std::vector< Base::Vector3f > &  controlPoints,
int  numUControlPoints,
int  numVControlPoints,
const std::vector< float > &  uKnots,
const std::vector< float > &  vKnots 
)

◆ addPoint() [1/2]

void Base::InventorBuilder::addPoint ( float  x,
float  y,
float  z 
)

add a single point

◆ addPoint() [2/2]

void Base::InventorBuilder::addPoint ( const Vector3f vec)

add a single point

◆ addPoints()

void Base::InventorBuilder::addPoints ( const std::vector< Vector3f > &  vec)

add a list of points

◆ addPointSet()

void Base::InventorBuilder::addPointSet ( )

add an SoPointSet node

◆ addPolygonOffset()

void Base::InventorBuilder::addPolygonOffset ( float  factor = 1.0f,
float  units = 1.0f,
const char *  styles = "FILLED",
bool  on = true 
)

Sets a polygon offset node.

Parameters
factor- Offset multiplication factor.
units- Offset translation multiplication factor.
styles- Can be FILLED, LINES or POINTS.
on- Whether the offset is on or off.

◆ addShapeHints()

void Base::InventorBuilder::addShapeHints ( float  crease = 0.0f)

Sets a shape hints node.

Parameters
crease- the crease angle in radians

◆ addSingleArrow()

void Base::InventorBuilder::addSingleArrow ( const Vector3f pt1,
const Vector3f pt2,
short  lineSize = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0,
unsigned short  linePattern = 0xffff 
)

add a arrow (directed line) by 2 Vector3D. The arrow shows in direction of point 2.

◆ addSingleLine()

void Base::InventorBuilder::addSingleLine ( const Vector3f pt1,
const Vector3f pt2,
short  lineSize = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0,
unsigned short  linePattern = 0xffff 
)

add a line defined by 2 Vector3D

◆ addSinglePlane()

void Base::InventorBuilder::addSinglePlane ( const Vector3f base,
const Vector3f eX,
const Vector3f eY,
float  length,
float  width,
bool  filled = true,
short  lineSize = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0 
)

◆ addSingleTriangle()

void Base::InventorBuilder::addSingleTriangle ( const Vector3f pt0,
const Vector3f pt1,
const Vector3f pt2,
bool  filled = true,
short  lineSize = 2,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0 
)

add a (filled) triangle defined by 3 vectors

◆ addSphere()

void Base::InventorBuilder::addSphere ( float  radius)

◆ addText() [1/2]

void Base::InventorBuilder::addText ( float  pos_x,
float  pos_y,
float  pos_z,
const char *  text,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0 
)

add a text

◆ addText() [2/2]

void Base::InventorBuilder::addText ( const Vector3f vec,
const char *  text,
float  color_r = 1.0,
float  color_g = 1.0,
float  color_b = 1.0 
)

add a text

◆ addTransformation() [1/2]

void Base::InventorBuilder::addTransformation ( const Matrix4D )

adds a transformation

◆ addTransformation() [2/2]

void Base::InventorBuilder::addTransformation ( const Vector3f translation,
const Vector3f rotationaxis,
float  fAngle 
)

◆ beginMaterial()

void Base::InventorBuilder::beginMaterial ( )

Starts a material node. The node must be closed with endMaterial and the colors must be added with addColor().

◆ beginNormal()

void Base::InventorBuilder::beginNormal ( )

starts a point set

◆ beginPoints()

void Base::InventorBuilder::beginPoints ( )

starts a point set

◆ beginSeparator()

void Base::InventorBuilder::beginSeparator ( )

Sets a separator node.

◆ close()

void Base::InventorBuilder::close ( )

If needed closes the first opened separator node. This method must not be used more than one time for an instance.

◆ endMaterial()

void Base::InventorBuilder::endMaterial ( )

Closes a material node.

◆ endNormal()

void Base::InventorBuilder::endNormal ( )

ends the points set operation

◆ endPoints()

void Base::InventorBuilder::endPoints ( )

ends the points set operation

◆ endSeparator()

void Base::InventorBuilder::endSeparator ( )

Closes the last added separator node.


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