A MarkupModel part for drawing labels. More...
Public Types | |
enum | LabelDrawMode { DRAW_ONLY_VISIBLE, DRAW_WITH_ZBUFFER_TEST, DRAW_WITHOUT_ZBUFFER_TEST } |
Enum specifying the way to draw the labels. Controls the visibility of the label. More... | |
enum | Orientation { HORIZONTAL, VERTICAL_UP, VERTICAL_DOWN } |
Enum specifying the direction to draw the labels. More... | |
enum | HorizontalTextAlignment { LEFT, CENTER, RIGHT } |
Horizontal alignment of the text when drawing multiple lines. More... | |
![]() | |
enum | PartType { LABELS, TEXTS_3D, TRIANGLES, INSTANCED_GEOMETRY, LINES, POINTS, ARROWS, FIXED_SIZE_ARROW, FIXED_SIZE_SPHERE, FIXED_SIZE_IMAGE_GLYPH } |
Enum specifying the type of MarkupPart. More... | |
Public Member Functions | |
MarkupPartLabels () | |
Constructs an empty part. More... | |
MarkupPartLabels (LabelDrawMode labelDrawMode, const Color3f &textColor, const Color3f &borderColor, const Color3f &backgroundColor) | |
Constructs a part with the given settings. More... | |
MarkupPartLabels (LabelDrawMode labelDrawMode, const Color3f &textColor, const Color3f &borderColor, const Color3f &backgroundColor, const Color3f &markerColor) | |
Constructs a part with the given settings. More... | |
virtual PartType | type () const |
Returns the type of the part. Always MarkupPart::LABELS. More... | |
virtual BoundingBox | boundingBox () const |
Returns the current bounding box of the part. More... | |
virtual void | setPriority (int priority) |
Sets render priority of the part. More... | |
virtual int | priority () const |
Returns the render priority of the part. More... | |
virtual const Mat4d & | transformation () const |
Returns the current transformation matrix for the part. More... | |
virtual void | setTransformation (const Mat4d &matrix) |
Sets the transformation matrix to use for the part. More... | |
void | setAbsoluteOffset (int x, int y) |
Sets the absolute offset in pixels from the anchor point to the label. More... | |
int | absoluteOffsetX () const |
Returns the horizontal absolute offset in pixels from the anchor point to the label. More... | |
int | absoluteOffsetY () const |
Returns the vertical absolute offset in pixels from the anchor point to the label. More... | |
void | setRelativeOffset (double x, double y) |
Sets the normalized relative offset of the label size from the anchor point to the label. More... | |
double | relativeOffsetX () const |
Returns the normalized horizontal relative offset of the label width from the anchor point to the label. More... | |
double | relativeOffsetY () const |
Returns the normalized vertical relative offset of the label height from the anchor point to the label. More... | |
LabelDrawMode | drawMode () const |
Returns the current draw mode of the label. More... | |
void | setDrawMode (LabelDrawMode mode) |
Sets the current draw mode of the label. More... | |
Orientation | orientation () const |
Sets the current orientation of the label. More... | |
void | setOrientation (Orientation direction) |
Returns the current orientation of the label. More... | |
HorizontalTextAlignment | horizontalTextAlignment () const |
Returns the horizontal alignment of the text used when drawing multiple lines. More... | |
void | setHorizontalTextAlignment (HorizontalTextAlignment alignment) |
Sets the horizontal alignment of the text used when drawing multiple lines. More... | |
unsigned int | maximumNumberOfLabelsToDraw () const |
Returns the maximum number of labels to draw in this part. More... | |
void | setMaximumNumberOfLabelsToDraw (unsigned int maximumNumberToDraw) |
Sets the maximum number of labels to draw in the part. More... | |
float | eyeLiftFactor () const |
Returns the eye lift factor of the labels. More... | |
void | setEyeLiftFactor (float factor) |
Sets the eye lift factor for the labels. More... | |
const Font * | font () const |
Returns the font used to draw the labels in the part. More... | |
void | setFont (Font *labelFont) |
Sets the font to use for drawing the labels in the part. More... | |
const Color3f & | textColor () const |
Returns the current text color. More... | |
void | setTextColor (const Color3f &color) |
Sets the text color of the labels in the part. More... | |
const Color3f & | backgroundColor () const |
Returns the background color. More... | |
void | setBackgroundColor (const Color3f &color) |
Sets the background color of the labels in the part. More... | |
const Color3f & | borderColor () const |
Returns the border color of the labels in the part. More... | |
void | setBorderColor (const Color3f &color) |
Sets the border color of the labels in the part. More... | |
const Color3f & | markerColor () const |
Returns the marker color of the labels in the part. More... | |
void | setMarkerColor (const Color3f &color) |
Sets the marker color of the labels in the part. More... | |
float | borderWidth () const |
Returns the line width of the border. More... | |
void | setBorderWidth (float width) |
Sets the line width of the border. More... | |
float | markerPointSize () const |
Returns the point size of the marker. More... | |
void | setMarkerPointSize (float pointSize) |
Sets the point size of the marker. More... | |
bool | drawBackground () const |
Returns true if the labels will be drawn with a filled background. More... | |
void | setDrawBackground (bool drawBackground) |
Sets if the filled background of the labels should be drawn or not. More... | |
bool | drawBorder () const |
Returns true if the labels will be drawn with a border around the text. More... | |
void | setDrawBorder (bool drawBorder) |
Sets if the labels will be drawn with a border around the text or not. More... | |
bool | drawMarker () const |
Returns true if the labels will be drawn with a marker at the label position. More... | |
void | setDrawMarker (bool drawMarker) |
Sets if the labels will be drawn with a marker at the label position or not. More... | |
bool | offsetLabelToFitInView () const |
Returns true if the labels will be adjusted so the label would be fully visible in the attachment point is visible. More... | |
void | setOffsetLabelToFitInView (bool offsetLabel) |
Sets if the labels will be adjusted so the label would be fully visible in the attachment point is visible. More... | |
size_t | count () const |
Returns the number of labels in the part. More... | |
const cee::Str & | text (size_t index) const |
Returns the text of the label at the given index. More... | |
const cee::Vec3d & | position (size_t index) const |
Returns the position of the label at the given index. More... | |
unsigned int | width (size_t index) |
Returns the width of the drawn label in pixels. More... | |
unsigned int | height (size_t index) |
Returns the height of the drawn label in pixels. More... | |
size_t | add (const Vec3d &position, const Str &text) |
Adds a label to the part with the given text and position. More... | |
void | set (size_t index, const Vec3d &position, const Str &text) |
Sets the text and position of the label at the given index. More... | |
void | remove (size_t index) |
Removes the label at the given index. More... | |
void | removeAll () |
Removes all labels in the part. More... | |
![]() | |
bool | visible () const |
Returns true if the part is visible. More... | |
void | setVisible (bool visible) |
Sets if the part should be visible or not. More... | |
![]() | |
void | addRef () const |
Increments the reference count for this object. More... | |
void | release () const |
Decrements the reference count for this object. More... | |
int | refCount () const |
Returns the reference count for this object. More... | |
void | setRefCountZero () const |
Sets the ref count to zero, but DOES NOT delete the object. More... | |
Static Public Member Functions | |
static PtrRef< MarkupPartLabels > | create (const Vec3d &position, const Str &text, LabelDrawMode drawMode=DRAW_WITHOUT_ZBUFFER_TEST) |
Returns a newly created part with the given settings. More... | |
static PtrRef< MarkupPartLabels > | createWithMarker (const Vec3d &position, const Str &text, const Color3f &markerColor, LabelDrawMode drawMode=DRAW_WITHOUT_ZBUFFER_TEST) |
Returns a newly created part with the given settings. More... | |
A MarkupModel part for drawing labels.
The part can contain any number of labels, but all labels will share the same settings for
The default label is a label with black text and border on a light yellow background (like a standard tooltip in most systems).
Enum specifying the way to draw the labels. Controls the visibility of the label.
Enumerator | |
---|---|
DRAW_ONLY_VISIBLE |
Label is visible if the position of the label (position provided in the add()) is visible. |
DRAW_WITH_ZBUFFER_TEST |
Draw the label as geometry with z buffer test. |
DRAW_WITHOUT_ZBUFFER_TEST |
Draw the label without z buffer test. The label will always be visible. |
cee::vis::MarkupPartLabels::MarkupPartLabels | ( | ) |
Constructs an empty part.
cee::vis::MarkupPartLabels::MarkupPartLabels | ( | LabelDrawMode | labelDrawMode, |
const Color3f & | textColor, | ||
const Color3f & | borderColor, | ||
const Color3f & | backgroundColor | ||
) |
Constructs a part with the given settings.
cee::vis::MarkupPartLabels::MarkupPartLabels | ( | LabelDrawMode | labelDrawMode, |
const Color3f & | textColor, | ||
const Color3f & | borderColor, | ||
const Color3f & | backgroundColor, | ||
const Color3f & | markerColor | ||
) |
Constructs a part with the given settings.
int cee::vis::MarkupPartLabels::absoluteOffsetX | ( | ) | const |
Returns the horizontal absolute offset in pixels from the anchor point to the label.
int cee::vis::MarkupPartLabels::absoluteOffsetY | ( | ) | const |
Returns the vertical absolute offset in pixels from the anchor point to the label.
Adds a label to the part with the given text and position.
const Color3f & cee::vis::MarkupPartLabels::backgroundColor | ( | ) | const |
Returns the background color.
const Color3f & cee::vis::MarkupPartLabels::borderColor | ( | ) | const |
Returns the border color of the labels in the part.
float cee::vis::MarkupPartLabels::borderWidth | ( | ) | const |
Returns the line width of the border.
|
virtual |
Returns the current bounding box of the part.
Implements cee::vis::MarkupPart.
size_t cee::vis::MarkupPartLabels::count | ( | ) | const |
Returns the number of labels in the part.
|
static |
Returns a newly created part with the given settings.
The returned part will have the specified draw mode and have one label with the given position and text.
|
static |
Returns a newly created part with the given settings.
The returned part will have the specified draw mode and have one label with the given position and text.
bool cee::vis::MarkupPartLabels::drawBackground | ( | ) | const |
Returns true if the labels will be drawn with a filled background.
bool cee::vis::MarkupPartLabels::drawBorder | ( | ) | const |
Returns true if the labels will be drawn with a border around the text.
bool cee::vis::MarkupPartLabels::drawMarker | ( | ) | const |
Returns true if the labels will be drawn with a marker at the label position.
MarkupPartLabels::LabelDrawMode cee::vis::MarkupPartLabels::drawMode | ( | ) | const |
Returns the current draw mode of the label.
float cee::vis::MarkupPartLabels::eyeLiftFactor | ( | ) | const |
Returns the eye lift factor of the labels.
const Font * cee::vis::MarkupPartLabels::font | ( | ) | const |
Returns the font used to draw the labels in the part.
unsigned int cee::vis::MarkupPartLabels::height | ( | size_t | index | ) |
Returns the height of the drawn label in pixels.
cee::vis::MarkupPartLabels::HorizontalTextAlignment cee::vis::MarkupPartLabels::horizontalTextAlignment | ( | ) | const |
Returns the horizontal alignment of the text used when drawing multiple lines.
const Color3f & cee::vis::MarkupPartLabels::markerColor | ( | ) | const |
Returns the marker color of the labels in the part.
float cee::vis::MarkupPartLabels::markerPointSize | ( | ) | const |
Returns the point size of the marker.
unsigned int cee::vis::MarkupPartLabels::maximumNumberOfLabelsToDraw | ( | ) | const |
Returns the maximum number of labels to draw in this part.
bool cee::vis::MarkupPartLabels::offsetLabelToFitInView | ( | ) | const |
Returns true if the labels will be adjusted so the label would be fully visible in the attachment point is visible.
cee::vis::MarkupPartLabels::Orientation cee::vis::MarkupPartLabels::orientation | ( | ) | const |
Sets the current orientation of the label.
const cee::Vec3d & cee::vis::MarkupPartLabels::position | ( | size_t | index | ) | const |
Returns the position of the label at the given index.
|
virtual |
Returns the render priority of the part.
Implements cee::vis::MarkupPart.
double cee::vis::MarkupPartLabels::relativeOffsetX | ( | ) | const |
Returns the normalized horizontal relative offset of the label width from the anchor point to the label.
double cee::vis::MarkupPartLabels::relativeOffsetY | ( | ) | const |
Returns the normalized vertical relative offset of the label height from the anchor point to the label.
void cee::vis::MarkupPartLabels::remove | ( | size_t | index | ) |
Removes the label at the given index.
void cee::vis::MarkupPartLabels::removeAll | ( | ) |
Removes all labels in the part.
Sets the text and position of the label at the given index.
void cee::vis::MarkupPartLabels::setAbsoluteOffset | ( | int | x, |
int | y | ||
) |
Sets the absolute offset in pixels from the anchor point to the label.
void cee::vis::MarkupPartLabels::setBackgroundColor | ( | const Color3f & | color | ) |
Sets the background color of the labels in the part.
void cee::vis::MarkupPartLabels::setBorderColor | ( | const Color3f & | color | ) |
Sets the border color of the labels in the part.
void cee::vis::MarkupPartLabels::setBorderWidth | ( | float | width | ) |
Sets the line width of the border.
void cee::vis::MarkupPartLabels::setDrawBackground | ( | bool | drawBackground | ) |
Sets if the filled background of the labels should be drawn or not.
void cee::vis::MarkupPartLabels::setDrawBorder | ( | bool | drawBorder | ) |
Sets if the labels will be drawn with a border around the text or not.
void cee::vis::MarkupPartLabels::setDrawMarker | ( | bool | drawMarker | ) |
Sets if the labels will be drawn with a marker at the label position or not.
void cee::vis::MarkupPartLabels::setDrawMode | ( | LabelDrawMode | mode | ) |
Sets the current draw mode of the label.
void cee::vis::MarkupPartLabels::setEyeLiftFactor | ( | float | factor | ) |
Sets the eye lift factor for the labels.
The eye lift factor specifies if the label should be moved towards the camera (or away from the camera if the factor is negative).
This is useful for controlling the ordering of items that are defined in the same plane.
void cee::vis::MarkupPartLabels::setFont | ( | Font * | labelFont | ) |
Sets the font to use for drawing the labels in the part.
Default is the normal built-in font (Font::createNormalFont())
void cee::vis::MarkupPartLabels::setHorizontalTextAlignment | ( | HorizontalTextAlignment | alignment | ) |
Sets the horizontal alignment of the text used when drawing multiple lines.
void cee::vis::MarkupPartLabels::setMarkerColor | ( | const Color3f & | color | ) |
Sets the marker color of the labels in the part.
void cee::vis::MarkupPartLabels::setMarkerPointSize | ( | float | pointSize | ) |
Sets the point size of the marker.
void cee::vis::MarkupPartLabels::setMaximumNumberOfLabelsToDraw | ( | unsigned int | maximumNumberToDraw | ) |
Sets the maximum number of labels to draw in the part.
The labels within the view volume will be sorted and the closest labels up to the given number will be drawn.-
void cee::vis::MarkupPartLabels::setOffsetLabelToFitInView | ( | bool | offsetLabel | ) |
Sets if the labels will be adjusted so the label would be fully visible in the attachment point is visible.
If enabled, the label will be moved to the left or bottom of the attachment point if needed to keep the label fully visible.
void cee::vis::MarkupPartLabels::setOrientation | ( | Orientation | direction | ) |
Returns the current orientation of the label.
|
virtual |
Sets render priority of the part.
The render priority determines the order in which parts get rendered. Parts with lower priorities get rendered first. The default priority is 100.
Implements cee::vis::MarkupPart.
void cee::vis::MarkupPartLabels::setRelativeOffset | ( | double | x, |
double | y | ||
) |
Sets the normalized relative offset of the label size from the anchor point to the label.
void cee::vis::MarkupPartLabels::setTextColor | ( | const Color3f & | color | ) |
Sets the text color of the labels in the part.
|
virtual |
Sets the transformation matrix to use for the part.
Implements cee::vis::MarkupPart.
const cee::Str & cee::vis::MarkupPartLabels::text | ( | size_t | index | ) | const |
Returns the text of the label at the given index.
const Color3f & cee::vis::MarkupPartLabels::textColor | ( | ) | const |
Returns the current text color.
|
virtual |
Returns the current transformation matrix for the part.
Implements cee::vis::MarkupPart.
|
virtual |
Returns the type of the part. Always MarkupPart::LABELS.
Implements cee::vis::MarkupPart.
unsigned int cee::vis::MarkupPartLabels::width | ( | size_t | index | ) |
Returns the width of the drawn label in pixels.