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. More...
#include <Builder3D.h>
Public Member Functions | |
| void | addInfo (const char *str) |
| Sets an info node. More... | |
| void | addLabel (const char *str) |
| Sets a label node. More... | |
| void | beginSeparator () |
| Sets a separator node. 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 | endSeparator () |
| Closes the last added separator node. More... | |
| InventorBuilder (std::ostream &str) | |
| Construction of an InventorBuilder instance. This automatically opens a separator node. More... | |
| virtual | ~InventorBuilder () |
| Destruction of an InventorBuilder instance. 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) |
| The number of control points must be numUControlPoints * numVControlPoints. More... | |
| 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... | |
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.
| InventorBuilder::InventorBuilder | ( | std::ostream & | str | ) |
Construction of an InventorBuilder instance. This automatically opens a separator node.
| str | - stream to write the content into |
References beginSeparator().
|
virtual |
Destruction of an InventorBuilder instance.
References close().
| void InventorBuilder::addBaseColor | ( | float | color_r, |
| float | color_g, | ||
| float | color_b | ||
| ) |
Sets a base color node. The colors are in the range [0, 1].
| color_r | - red color |
| color_g | - green color |
| color_b | - blue color |
References Base::blanks().
| void 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].
| color_r | - red color |
| color_g | - green color |
| color_b | - blue color |
Referenced by importIFClegacy.IfcWriter::addExtrudedCircle(), importIFClegacy.IfcWriter::addExtrudedCompositeCurve(), importIFClegacy.IfcWriter::addExtrudedEllipse(), and importIFClegacy.IfcWriter::addExtrudedPolyline().
| void InventorBuilder::addCylinder | ( | float | radius, |
| float | height | ||
| ) |
References Base::blanks().
| void InventorBuilder::addDrawStyle | ( | short | pointSize, |
| short | lineWidth, | ||
| unsigned short | linePattern = 0xffff, |
||
| const char * | style = "FILLED" |
||
| ) |
Sets a draw style node.
| pointSize | - the point size |
| lineWidth | - the line width |
| linePattern | - the line pattern |
| style | - the draw style |
References Base::blanks().
| void InventorBuilder::addFaceSet | ( | const std::vector< int > & | vertices | ) |
References Base::blanks().
| void InventorBuilder::addIndexedFaceSet | ( | const std::vector< int > & | indices | ) |
References Base::blanks().
Referenced by Part::TopoShape::exportFaceSet(), and MeshCore::MeshOutput::SaveInventor().
| void InventorBuilder::addInfo | ( | const char * | str | ) |
Sets an info node.
| str | - text set to the info node |
References Base::blanks().
Referenced by MeshCore::MeshOutput::SaveInventor().
| void InventorBuilder::addLabel | ( | const char * | str | ) |
Sets a label node.
| str | - text set to the label node |
References Base::blanks().
Referenced by MeshCore::MeshOutput::SaveInventor().
| void InventorBuilder::addLineSet | ( | ) |
add an SoLineSet node
Adds a SoLineSet node after creating a SoCordinate3 node with beginPoints() and endPoints().
References Base::blanks().
| void 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.
Add a line defined by a list of points whereat always a pair (i.e.
a point and the following point) builds a line. The size of the list must then be even.
Referenced by Part::TopoShape::exportLineSet().
| void 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].
| color_r | - red color |
| color_g | - green color |
| color_b | - blue color |
| color_a | - transparency |
References Base::blanks().
Referenced by Part::TopoShape::exportFaceSet().
| void InventorBuilder::addMaterialBinding | ( | const char * | binding = "OVERALL" | ) |
Sets a material binding node.
| 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. |
References draftgeoutils.faces::bind(), and Base::blanks().
| void InventorBuilder::addNormalBinding | ( | const char * | binding | ) |
add normal binding node
References Base::blanks().
Referenced by MeshCore::MeshOutput::SaveInventor().
| void InventorBuilder::addNurbsSurface | ( | const std::vector< Base::Vector3f > & | controlPoints, |
| int | numUControlPoints, | ||
| int | numVControlPoints, | ||
| const std::vector< float > & | uKnots, | ||
| const std::vector< float > & | vKnots | ||
| ) |
The number of control points must be numUControlPoints * numVControlPoints.
The order in u or v direction of the NURBS surface is implicitly given by number of elements in uKnots - numUControlPoints or number of elements in vKnots - numVControlPoints.
| void InventorBuilder::addPoint | ( | const Vector3f & | vec | ) |
add a single point
add a vector to a point set
References addPoint(), and draftgeoutils.general::vec().
Referenced by draftguitools.gui_stretch.Stretch::action(), and draftguitools.gui_stretch.Stretch::numericInput().
| void InventorBuilder::addPoint | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
add a single point
insert a point in a point set
References Base::blanks().
Referenced by draftguitools.gui_stretch.Stretch::action(), addPoint(), addPoints(), draftguitools.gui_stretch.Stretch::numericInput(), and MeshCore::MeshOutput::SaveInventor().
| void InventorBuilder::addPoints | ( | const std::vector< Vector3f > & | vec | ) |
add a list of points
References addPoint(), and draftgeoutils.general::vec().
Referenced by Part::TopoShape::exportFaceSet().
| void InventorBuilder::addPointSet | ( | ) |
add an SoPointSet node
Adds an SoPointSet node after creating an SoCordinate3 node with beginPoints() and endPoints().
References Base::blanks().
| void InventorBuilder::addPolygonOffset | ( | float | factor = 1.0f, |
| float | units = 1.0f, |
||
| const char * | styles = "FILLED", |
||
| bool | on = true |
||
| ) |
Sets a polygon offset node.
| factor | - Offset multiplication factor. |
| units | - Offset translation multiplication factor. |
| styles | - Can be FILLED, LINES or POINTS. |
| on | - Whether the offset is on or off. |
References Base::blanks().
| void InventorBuilder::addShapeHints | ( | float | crease = 0.0f | ) |
Sets a shape hints node.
| crease | - the crease angle in radians |
References Base::blanks().
Referenced by Part::TopoShape::exportFaceSet().
| void 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.
References Base::blanks(), Base::Vector3< _Precision >::GetAngle(), Base::Vector3< _Precision >::Normalize(), Base::Vector3< _Precision >::Scale(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
| void 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
References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
| void 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
References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
| void InventorBuilder::addSphere | ( | float | radius | ) |
References Base::blanks().
| void 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
References addText(), and draftgeoutils.general::vec().
| void 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
Add a Text with a given position to the 3D set.
The origin is the lower leftmost corner.
| pos_x,pos_y,pos_z | origin of the text |
| text | the text to display. |
| color_r | red part of the text color (0.0 - 1.0). |
| color_g | green part of the text color (0.0 - 1.0). |
| color_b | blue part of the text color (0.0 - 1.0). |
References Base::blanks().
Referenced by addText().
| void InventorBuilder::addTransformation | ( | const Matrix4D & | transform | ) |
adds a transformation
References addTransformation(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by addTransformation().
| void InventorBuilder::beginMaterial | ( | ) |
Starts a material node. The node must be closed with endMaterial and the colors must be added with addColor().
References Base::blanks().
| void InventorBuilder::beginNormal | ( | ) |
| void InventorBuilder::beginPoints | ( | ) |
starts a point set
Starts the definition of point set.
If possible don't make too many beginPoints() and endPoints() calls. Try to put all points in one set.
References Base::blanks().
Referenced by Part::TopoShape::exportFaceSet(), and MeshCore::MeshOutput::SaveInventor().
| void InventorBuilder::beginSeparator | ( | ) |
Sets a separator node.
References Base::blanks().
Referenced by Part::TopoShape::exportFaceSet(), InventorBuilder(), and MeshCore::MeshOutput::SaveInventor().
| void InventorBuilder::close | ( | ) |
If needed closes the first opened separator node. This method must not be used more than one time for an instance.
References endSeparator().
Referenced by femexamples.examplesgui.FemExamples::reject(), and ~InventorBuilder().
| void InventorBuilder::endMaterial | ( | ) |
Closes a material node.
References Base::blanks().
| void InventorBuilder::endNormal | ( | ) |
ends the points set operation
References Base::blanks().
Referenced by MeshCore::MeshOutput::SaveInventor().
| void InventorBuilder::endPoints | ( | ) |
ends the points set operation
Ends the point set operations and write the resulting inventor string.
References Base::blanks().
Referenced by Part::TopoShape::exportFaceSet(), and MeshCore::MeshOutput::SaveInventor().
| void InventorBuilder::endSeparator | ( | ) |
Closes the last added separator node.
References Base::blanks().
Referenced by close(), Part::TopoShape::exportFaceSet(), and MeshCore::MeshOutput::SaveInventor().