cee::ug::ElementHighlighter Class Reference

Helper class for annotating elements. More...

Public Member Functions

 ElementHighlighter (const UnstructGridModel *model, vis::MarkupModel *markupModel)
 Creates the helper class with the given unstruct model and the markup model. More...
 
void addElementHighlight (const HitItem &item, const Color3f &surfaceColor)
 Adds triangles for all surfaces of the element specified by the hit item to the markup model. More...
 
void addElementHighlight (const HitItem &item, const Color3f &surfaceColor, const Color3f &lineColor)
 Adds triangles and lines for all surfaces of the element specified by the hit item to the markup model. More...
 
void addElementLabel (const HitItem &item, vis::MarkupPartLabels::LabelDrawMode labelDrawMode=vis::MarkupPartLabels::DRAW_WITHOUT_ZBUFFER_TEST, cee::vis::Font *font=NULL)
 Adds a label with the element id/index in the elementLabelPosition() to the markup model. More...
 
void addElementNodeLabels (const HitItem &item, vis::MarkupPartLabels::LabelDrawMode labelDrawMode=vis::MarkupPartLabels::DRAW_WITHOUT_ZBUFFER_TEST, cee::vis::Font *font=NULL)
 Adds labels with the element node id/index to the markup model. More...
 
void addElementSurfaceHighlight (const HitItem &item, const Color3f &surfaceColor)
 Adds triangles for the surface of the element specified by the hit item to the markup model. More...
 
void addElementSurfaceHighlight (const HitItem &item, const Color3f &surfaceColor, const Color3f &lineColor)
 Adds triangles and lines for all surfaces of the element specified by the hit item to the markup model. More...
 
void addElementSurfaceLabel (const HitItem &item, vis::MarkupPartLabels::LabelDrawMode labelDrawMode, cee::vis::Font *font)
 Adds a label with the element id/index and surface index in the elementLabelPosition() to the markup model. More...
 
void addElementSurfaceNodeLabels (const HitItem &item, vis::MarkupPartLabels::LabelDrawMode labelDrawMode, cee::vis::Font *font)
 Adds labels with the element node id/index and surface index to the markup model. More...
 
Vec3d elementLabelPosition (const HitItem &item) const
 Returns a suitable position for drawing a label with element information. More...
 
const ug::DataElementselementsFromHitItem (const HitItem &item) const
 Returns the DataElements object specified by the item. NULL if not found or invalid. More...
 
const ug::DataNodesnodesFromHitItem (const HitItem &item) const
 Returns the DataNodes object specified by the item. NULL if not found or invalid. More...
 

Detailed Description

Helper class for annotating elements.

Creates MarkupModel triangles to highlight the element surfaces and label to show the element id/index. Also helper methods to get access to data referenced by the given hit item.

Constructor & Destructor Documentation

cee::ug::ElementHighlighter::ElementHighlighter ( const UnstructGridModel model,
vis::MarkupModel markupModel 
)

Creates the helper class with the given unstruct model and the markup model.

The add* methods in this class will add items to the given markup model. This class does not remove or modify any existing parts in the markup model, so this needs to be handled outside this class.

Member Function Documentation

void cee::ug::ElementHighlighter::addElementHighlight ( const HitItem item,
const Color3f surfaceColor 
)

Adds triangles for all surfaces of the element specified by the hit item to the markup model.

The method will create a MarkupPartTriangles part and add it to the markup model. The part will contain a triangulation of all element surfaces on the given element. The part will be given the specified color and will use Polygon Offset so it can be rendered together with the UnstructGridModel and still be visible.

void cee::ug::ElementHighlighter::addElementHighlight ( const HitItem item,
const Color3f surfaceColor,
const Color3f lineColor 
)

Adds triangles and lines for all surfaces of the element specified by the hit item to the markup model.

The method will create a MarkupPartTriangles part and add it to the markup model. The part will contain a triangulation of all element surfaces on the given element. A MarkupPartLines part drawing the element edges as lines are also added to the model. The parts will be given the specified colors and will use Polygon Offset so it can be rendered together with the UnstructGridModel and still be visible.

void cee::ug::ElementHighlighter::addElementLabel ( const HitItem item,
vis::MarkupPartLabels::LabelDrawMode  labelDrawMode = vis::MarkupPartLabels::DRAW_WITHOUT_ZBUFFER_TEST,
cee::vis::Font font = NULL 
)

Adds a label with the element id/index in the elementLabelPosition() to the markup model.

void cee::ug::ElementHighlighter::addElementNodeLabels ( const HitItem item,
vis::MarkupPartLabels::LabelDrawMode  labelDrawMode = vis::MarkupPartLabels::DRAW_WITHOUT_ZBUFFER_TEST,
cee::vis::Font font = NULL 
)

Adds labels with the element node id/index to the markup model.

void cee::ug::ElementHighlighter::addElementSurfaceHighlight ( const HitItem item,
const Color3f surfaceColor 
)

Adds triangles for the surface of the element specified by the hit item to the markup model.

The method will create a MarkupPartTriangles part and add it to the markup model. The part will contain a triangulation of the element surface on the given element. The part will be given the specified color and will use Polygon Offset so it can be rendered together with the UnstructGridModel and still be visible.

void cee::ug::ElementHighlighter::addElementSurfaceHighlight ( const HitItem item,
const Color3f surfaceColor,
const Color3f lineColor 
)

Adds triangles and lines for all surfaces of the element specified by the hit item to the markup model.

The method will create a MarkupPartTriangles part and add it to the markup model. The part will contain a triangulation of all element surfaces on the given element. A MarkupPartLines part drawing the element edges as lines are also added to the model. The parts will be given the specified colors and will use Polygon Offset so it can be rendered together with the UnstructGridModel and still be visible.

void cee::ug::ElementHighlighter::addElementSurfaceLabel ( const HitItem item,
vis::MarkupPartLabels::LabelDrawMode  labelDrawMode,
cee::vis::Font font 
)

Adds a label with the element id/index and surface index in the elementLabelPosition() to the markup model.

void cee::ug::ElementHighlighter::addElementSurfaceNodeLabels ( const HitItem item,
vis::MarkupPartLabels::LabelDrawMode  labelDrawMode,
cee::vis::Font font 
)

Adds labels with the element node id/index and surface index to the markup model.

cee::Vec3d cee::ug::ElementHighlighter::elementLabelPosition ( const HitItem item) const

Returns a suitable position for drawing a label with element information.

If the element has multiple surfaces (volume element) it will return the centroid of the surface that is specified in the hit item. For other elements (shell, beam, points) it will return the centroid of the element.

const cee::ug::DataElements * cee::ug::ElementHighlighter::elementsFromHitItem ( const HitItem item) const

Returns the DataElements object specified by the item. NULL if not found or invalid.

const cee::ug::DataNodes * cee::ug::ElementHighlighter::nodesFromHitItem ( const HitItem item) const

Returns the DataNodes object specified by the item. NULL if not found or invalid.