cee::ug::VectorSettings

class VectorSettings : public RefCountedObject

Settings for a specific vector result.

See topic Vector results

A vector result is a collection of vector values which are mapped on a part per node, per element, per element node or per element surface.

../_images/vector.png

The vector result has various settings that can be configured to make a better visual appearance of your result data, for instance scaling and color mode. Each vector result has its own settings. Get vector settings for a specific vector result by calling UnstructGridModel::vectorSettings() with the requested id.

int vectorId = vectorResultInfos[0].id();
cee::ug::VectorSettings* settings = ugModel->vectorSettings(vectorId);

Scaling

The vector result can be scaled to enhance the visual representation. The scaling can be either absolute or relative. Check current scale mode with scaleMode(). Set the scaling factor with setScaleFactor() with a scaling factor and an enumerator telling whether the scaling should be relative or absolute. Get current scaling factor with scaleFactor().

Colors

The vector can be colored either by a single color (ColorMode::SINGLE) or by the scalar value in the mapped scalar result (ColorMode::COLOR_BY_FRINGES). Set color mode with setColorMode() and get current color mode with colorMode(). Set the single vector color with setSingleVectorColor() and get current vector color with singleVectorColor().

Clamping

The length of the vectors (for all non-zero vectors) can be clamped into a given range. By enabling clamping with setClampingRange() all vectors will be drawn with the minimum length of clampingRangeMin() and the maximum length of clampingRangeMax(). One use case for this could be specify the same amount for clamp min and max (thus making all the vectors equal in length) to indicate the orientation of a vector field. Then coloring the vectors by a scalar (e.g. magnitude) could be used to indicate the intensity of the vector field for each arrow.

Example

This example will set the relative scaling for the current vector result and set a single vector color.

Gets the vector setting for the vector result shown on the model

int vectorId = vectorResultInfos[0].id();
cee::ug::VectorSettings* settings = ugModel->vectorSettings(vectorId);

Sets number relative scaling to 0.2.

settings->setScaleFactor(cee::ug::VectorSettings::RELATIVE_SCALING, 0.2);

Sets the single vector color to yellow.

settings->setSingleVectorColor(cee::Color3f(1.0, 1.0, 0.0));

See the complete source code at: UnstructGrid: Set vector settings on a loaded model

Public Types

enum ColorMode

List of vector color modes.

Values:

enumerator SINGLE

Single vector color.

enumerator COLOR_BY_FRINGES

Color vector by scalar fringes.

enum ScaleMode

List of vector scaling modes.

Values:

enumerator ABSOLUTE_SCALING

Absolute scaling of vectors.

enumerator RELATIVE_SCALING

Scales vectors relative to model extent.

enum DrawMode

List of vector draw modes.

Values:

enumerator NORMAL

3D primitive with shading

enumerator SIMPLE

Simple and unlit geometry.

enum VectorType

List of vector visualization types.

Values:

enumerator ARROW

A standard vector arrow.

enumerator SYMMETRIC_ARROW

A vector centered in the node/vertex, with arrow heads pointing outwards in both directions.

enumerator REVERSE_SYMMETRIC_ARROW

A vector centered in the node/vertex, with arrow heads pointing inward in both directions.

Public Functions

ScaleMode scaleMode() const

Returns current scale mode.

double scaleFactor() const

Returns scale factor.

void setScaleFactor(ScaleMode mode, double scaleFactor)

Sets the scale factor to apply to vectors.

If the scale mode is RELATIVE_SCALING, vectors will be scaled relative to model extent using the specified factor. If mode is ABSOLUTE_SCALING the vectors will be scaled using scaleFactor regardless of model extent.

bool resultInLocalCoordinates() const

Returns true if the vector result is defined in local coordinates and will follow the part transformations (default true).

void setResultInLocalCoordinates(bool localCoordinates)

Sets if the vector result is specified in local coordinates (true) or world coordinates (false).

If local coordinates (default), the vector results will be transformed with the current part transformation matrix. If world coordinates, the direction of the vector result will not be changed by the part transformation matrix.

ColorMode colorMode() const

Returns the current color mode.

void setColorMode(ColorMode colorMode)

Sets the color mode for the vector coloring.

Available modes are:

  • SINGLE: Uses a single color for all vectors

  • COLOR_BY_FRINGES: Uses the color for the mapped scalar result.

Color3f singleVectorColor() const

Returns the single vector color.

void setSingleVectorColor(const Color3f &color)

Sets the single vector color to apply to all vectors in the result.

int simpleVectorLineWidth() const

Returns the line width used when drawing DrawMode::SIMPLE vectors.

See also

setDrawMode

void setSimpleVectorLineWidth(int width)

Sets the line width used when drawing DrawMode::SIMPLE vectors.

See also

setDrawMode

VectorType vectorType() const

Returns the current vector type.

void setVectorType(VectorType vectorType)

Sets the vector type.

Available modes are:

  • ARROW: A standard vector arrow

  • SYMMETRIC_ARROW: A vector centered in the node/vertex, with arrow heads pointing outwards in both directions

  • REVERSE_SYMMETRIC_ARROW: A vector centered in the node/vertex, with arrow heads pointing inward in both directions

DrawMode drawMode() const

Returns the current draw mode.

void setDrawMode(DrawMode mode)

Sets the draw mode.

Available modes are:

  • NORMAL: Draw using a more complex 3D model with shading.

  • SIMPLE: Draw using an unlit and simple geometry.

double arrowShaftRelativeRadius() const

Returns the radius of the vector arrow shaft relative to the vector length.

void setArrowShaftRelativeRadius(double shaftRelativeRadius)

Sets the radius of the vector arrow shaft as a fraction of the vector length.

Default 0.025

double arrowHeadRelativeRadius() const

Returns the radius of the vector arrow head relative to the vector length.

void setArrowHeadRelativeRadius(double headRelativeRadius)

Sets the radius of the vector arrow head relative to the vector length.

Default 0.085

double arrowHeadRelativeLength() const

Returns the length of the vector arrow head relative to the vector length.

void setArrowHeadRelativeLength(double headRelativeLength)

Sets the length of the vector arrow head relative to the vector length.

Default 0.25

bool isClampingEnabled() const

Returns true if vector clamping is enabled.

If enabled, the (non-zero length) vectors will be drawn with a length that is within the range given by the setClampingRange() method.

double clampingRangeMinimum() const

Returns the minimum length the (non-zero) vectors will be drawn as (if clamping is enabled)

double clampingRangeMaximum() const

Returns the maximum length the (non-zero) vectors will be drawn as (if clamping is enabled)

void setClampingRange(double min, double max)

Specifies the min and max length of the vectors to be drawn.

The (non-zero) vectors will be drawn with a length that is within the given range.

void disableClamping()

Disables use of vector clamping.

bool isLengthFilteringEnabled() const

Returns true if vector filtering is enabled.

If enabled, only the vectors with length in the specified range given by the setLengthFilteringRange() method will be drawn. All other vectors will be skipped.

double lengthFilteringMinimum() const

Returns the required min length of the vectors in order to be drawn.

double lengthFilteringMaximum() const

Returns the required max length of the vectors in order to be drawn.

void setLengthFilteringRange(double min, double max)

Specifies the required min and max length of the vectors in order to be drawn.

Only vectors with the length in the given range will be drawn. All other vectors will be skipped.

void disableLengthFiltering()

Disables filtering of vectors. All vectors will be drawn.

bool showInteriorVectors() const

Returns whether interior vectors are shown or only those defined on the display model.

void setShowInteriorVectors(bool show)

Sets whether to show the vectors that are inside the display model or not.

unsigned int drawSkipBy() const

Returns the number of arrows to skip between each arrow that is drawn.

Default is 0. Used to reduce the total amount of arrows.

void setDrawSkipBy(unsigned int skipBy)

Sets the number of arrows to skip between each arrow that is drawn.

Default is 0. Used to reduce the total amount of arrows.

size_t drawMaximumCount() const

Returns maximum number of vector arrows to draw.

If there are more vectors than specified with setDrawMaximumCount(), every n’th vector arrow will be skipped to reduce the number of arrows to within maximum count.

When set to 0, all vectors will be drawn.

Note! If setDrawSkipBy() is set to value other than 0, this skip by value will be used and maximum count ignored!

void setDrawMaximumCount(size_t maximumCount)

Sets the maximum number of vector arrows do draw.

If there are more vectors than specified with setDrawMaximumCount(), every n’th vector arrow will be skipped to reduce the number of arrows to within maximum count.

When set to 0, all vectors will be drawn.

Note! If setDrawSkipBy() is set to value other than 0, this skip by value will be used and