cee::ug::ElementHighlighter

class ElementHighlighter

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.

Public Functions

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.

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.

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

Vec3d 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 ug::DataElements *elementsFromHitItem(const HitItem &item) const

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

const ug::DataNodes *nodesFromHitItem(const HitItem &item) const

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