ImFusion SDK 4.3

#include <ImFusion/GL/GlLoop.h>

Loop annotation. More...

+ Inheritance diagram for GlLoop:

Detailed Description

Loop annotation.

Renders a circle, ellipse or pseudo-spline, depending on number of points. In pseudo-spline mode, it also renders how the annotation would look without the currently active point. The pseudo-spline initially approximates the shape of the previous ellipse and tries to avoid intersecting itself. I strongly advise against inheriting from or otherwise trying to mess with the internals of this class.

Public Member Functions

 GlLoop (const std::vector< vec3 > &points={})
 
int hitTestHandles2D (int x, int y, const GlView &view) const override
 Returns the index of the handle being hit, or -1 when missing.
 
int hitTestHandles3D (int x, int y, const GlView &view) const override
 
bool hitTestLine2D (int x, int y, const GlView &view) const override
 Checks whether the line between handles gets hit (if not a straight line, override this in the annotation)
 
bool hitTest (int x, int y, const GlView &view) const override
 Perform hit test with points of underlying object. Return true if object is hit, false otherwise.
 
bool addPoint (const vec3 &p) override
 Adds a new point at world coords p and sets it as active point.
 
void undoAdd ()
 Reverts to the state before adding the most recent point.
 
void removePoint (int idx)
 Removes a single point without reverting the entire state.
 
void setPoints (const std::vector< vec3 > &points) override
 Create annotation from scratch using the given points.
 
void updatePoint (size_t idx, const vec3 &pos)
 
void setActivePoint (int idx)
 Flags a point as active for the purpose of deforming the spline and rendering the previous outline. Pass -1 for none.
 
void setPointColor (const vec3 &color) override
 Set point color.
 
void rotate (float angle) override
 Change the GlObject matrix to reflect a rotation around the current m_rotationPoint Since this matrix is ignored by most renderers at the moment, this does not currently rotate anything.
 
void rotateNoMatrix (float angle) override
 Rotate the annotation by changing the handle positions instead of the matrix.
 
void setRotationPoint (vec3 &point) override
 Set the axis for rotation.
 
void setPointSize (float s) override
 Set the point size.
 
void setShowPointsAsCrosses (bool flag) override
 Set the rendering of points.
 
void setMatrix (const mat4 &m) override
 Overwritten method to update points in world coordinates if the matrix has changed.
 
void setMatrixWithoutMoving (const mat4 &m) override
 Change the matrix witout moving the annotation, e.g. for linking it with an image transformation.
 
bool sampleRenderPath (int samples, std::vector< vec3 > &out) const override
 For annotations where the rendered shape differs from the stored points, this method returns true and a set of points on the rendered curve.
 
void setLineWidth (float value) override
 Set annotation line width.
 
void setColor (const vec3 &color) override
 Set annotation color.
 
void setAlpha (double v) override
 Set alpha channel.
 
void setLabelVisible (bool visible) override
 Set annotation label visibility.
 
void setLabelDepthTest (bool depthTest) override
 Set annotation label depth test flag.
 
void setLabelColor (const vec3 &color) override
 Set annotation label color.
 
void setLabelText (const std::string &label) override
 Set annotation label text.
 
void setLabelTextPrefix (const std::string &labelPrefix) override
 Set annotation label text prefix.
 
void setLabelTextSuffix (const std::string &labelSuffix) override
 Set annotation label text suffix.
 
void setVisible (bool visible) override
 Set object visibility.
 
void setAlwaysVisible (bool alwaysVisible) override
 Set if object is always visible.
 
void configure (const Properties *p) override
 Set one or multiple properties.
 
void configuration (Properties *p) const override
 Retrieve the properties of this object.
 
void setSelected (bool m) override
 When a GlAnnotation is selected, it may be rendered differently to distinguish it from non-selected annotations.
 
bool selected ()
 
void draw (const GlView &view) override
 Draw the object in 3D space.
 
Geometry::AlignedBox bounds () const override
 Get the axis-aligned bounding box of this GlObject in world space.
 
std::string typeName () const override
 Return unique identifier for this object class used for serialization.
 
void setEditable (bool editable) override
 When a GlAnnotation is editable it may alter its visualization and render UI elements for its manipulation.
 
void updatePoints () override
 Update the internal point structure.
 
const std::vector< vec3 > & internalPoints () const
 Read access to the internal points used by the wrapped annotation.
 
- Public Member Functions inherited from GlImplicitlyPlanarPointBasedAnnotation
vec3 xAxis () const
 
vec3 yAxis () const
 
void setXAxis (vec3 xAxis)
 
void setYAxis (vec3 yAxis)
 
- Public Member Functions inherited from GlPointBasedAnnotation
void setView (const GlView *view) override
 Set the view through which this annotation is currently being manipulated.
 
bool hitTest (int x, int y, const GlView &view) const override
 Perform hit test at screen coordinates (x,y) (OpenGL screen coordinate system) for the specified view.
 
virtual bool hitTestLabel (int x, int y, const GlView &view) const
 
const std::vector< vec3 > & points () const
 Return points making up the annotation.
 
int maxPoints () const
 Return maximum number of points allowed for annotation. -1 means no limit.
 
int minPoints () const
 Return minimum number of points required for annotation. -1 means no limit.
 
void setEditable (bool editable) override
 Set annotation to be editable, i.e.
 
vec3 pointColor () const
 Get point color.
 
void configure (const Properties *p) override
 Set one or multiple properties.
 
void configuration (Properties *p) const override
 Retrieve the properties of this object.
 
Geometry::AlignedBox bounds () const override
 Get the axis-aligned bounding box of this GlObject in world space.
 
virtual void setLabelPixelOffset (const vec2 &offset)
 Set the label's pixel offset.
 
float pointSize () const
 Retrieve the point size.
 
void copyStyle (const GlPointBasedAnnotation &other)
 
virtual std::optional< vec3 > labelPosition (const GL::ViewState &state) const
 Position of the label If there is no valid position for the label, returns an empty optional.
 
- Public Member Functions inherited from GlAnnotation
virtual const GlViewview () const
 Get the view through which this annotation is currently being manipulated.
 
virtual bool editable () const
 When a GlAnnotation is editable it may alter its visualization and render UI elements for its manipulation.
 
virtual vec3 color () const
 Return annotation color.
 
virtual double alpha () const
 Get alpha channel.
 
virtual float lineWidth () const
 Return annotation line width.
 
virtual bool labelVisible () const
 Return annotation label visibility.
 
virtual void setLabelBackgroundVisible (bool visible)
 Set annotation label background visibility.
 
virtual bool labelBackgroundVisible () const
 Return annotation label background visibility.
 
virtual void setLabelBackgroundColor (vec4 color)
 Set annotation label background color.
 
virtual vec4 labelBackgroundColor () const
 Return annotation label background color.
 
virtual void setLabelBackgroundMargin (int margin)
 Set annotation label background margin in pixels.
 
virtual int labelBackgroundMargin () const
 Return annotation label background margin in pixels.
 
virtual bool labelDepthTest () const
 Return annotation label depth test flag.
 
virtual vec3 labelColor () const
 Return annotation label color.
 
virtual std::string labelText () const
 Return annotation label text.
 
std::string labelTextPrefix () const
 Return annotation label text prefix.
 
std::string labelTextSuffix () const
 Return annotation label text suffix.
 
virtual void setName (const std::string &name)
 Set annotation name.
 
virtual std::string name () const
 Return annotation name.
 
bool selected () const
 When a GlAnnotation is selected, it may be rendered differently to distinguish it from non-selected annotations.
 
void copyStyle (const GlAnnotation &other)
 Copies the settable parameters from another GlAnnotation.
 
- Public Member Functions inherited from GlObject
virtual Geometry::AlignedBox boundsSpherical () const
 Get the spherical bounds of this GlObject in world space.
 
virtual const mat4 & matrix () const
 Return the modelview matrix.
 
virtual bool visible () const
 Return object visibility.
 
virtual bool alwaysVisible () const
 Return if object is always visible.
 
RenderingOrderGroup renderingOrder () const
 Return current rendering order value for this GlObject.
 
void setRenderingOrder (RenderingOrderGroup group)
 Set rendering order value for this GlObject.
 
void setDraw3DIn2DView (bool draw3DIn2DView)
 
- Public Member Functions inherited from Configurable
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
 
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
 
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 
 Configurable (const Configurable &rhs)
 
 Configurable (Configurable &&rhs) noexcept
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 

Additional Inherited Members

- Public Types inherited from GlObject
enum  RenderingOrderGroup { RenderingGroupRest , RenderingGroupMesh , RenderingGroupManipulator }
 Enumeration to determine rendering order of GlObjects in GlSliceView and GlVolumeView. More...
 
- Public Attributes inherited from GlPointBasedAnnotation
Signal< const GlPointBasedAnnotation * > signalPointsChanged
 
- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 
- Protected Member Functions inherited from GlPointBasedAnnotation
void renderLabel (const GlView &view) const
 
void renderPoints (const GlView &view) const
 Render points.
 
void renderPoint (const GlView &view, int index) const
 Render point with the given index. Use -1 to render all points.
 
bool viewIsMetric () const
 
void renderLabel (const GlView &view, const vec3 &positionWorld) const
 Render the label of the annotation at the given position.
 
- Protected Member Functions inherited from GlAnnotation
void renderLabel (const GlView &view, const vec3 &positionWorld) const
 Render the label of the annotation at the given position.
 
vec2i labelSize () const
 
- Protected Attributes inherited from GlImplicitlyPlanarPointBasedAnnotation
vec3 m_xAxis = vec3(1.0, 0.0, 0.0)
 
vec3 m_yAxis = vec3(0.0, 1.0, 0.0)
 
- Protected Attributes inherited from GlPointBasedAnnotation
std::unique_ptr< GL::VertexBufferm_vbo
 Vertex buffer that can be used for rendering.
 
std::vector< vec3 > m_points
 Control points which define the form of the annotation.
 
std::vector< vec3 > m_worldPoints
 Points in world coordinates if object matrix differs from identity.
 
bool m_wpDirty = false
 True if the world point vector has to be updated.
 
bool m_showPointsAsCrosses = false
 
int m_maxPoints = -1
 
int m_minPoints = -1
 
float m_pointSize = 5.f
 
vec2 m_labelPixelOffset = vec2(6.0, 0.0)
 
vec4 m_pointColor = vec4(1, 1, 0, 1)
 
vec3 m_rotationPoint = vec3::Zero()
 
double m_hitTest2DMinSize = 4.0
 
double m_hitTest3DMinSize = 6.0
 
- Protected Attributes inherited from GlAnnotation
bool m_editable = true
 
vec4 m_color {1, 1, 0, 1}
 
float m_lineWidth = 1
 
bool m_labelVisible = true
 
bool m_labelBackgroundVisible = false
 
vec4 m_labelBackgroundColor {0.3, 0.3, 0.3, 0.7}
 
int m_labelBackgroundMargin = 3
 
bool m_labelDepthTest = true
 
bool m_selected = false
 
vec3 m_labelColor {0, 1, 1}
 
std::string m_labelText
 
std::string m_labelTextPrefix
 
std::string m_labelTextSuffix
 
const GlViewm_view = nullptr
 
std::string m_name
 
- Protected Attributes inherited from GlObject
mat4 m_matrix = mat4::Identity()
 Modelview transformation matrix of this object.
 
bool m_visible = true
 Object visibility.
 
bool m_alwaysVisible = false
 Object always visible.
 
bool m_draw3DIn2DView
 Draw 3D objects in 2D views. This is to render 3D objects in projective 2D views. Property is not serialized.
 
RenderingOrderGroup m_renderingOrder = RenderingGroupRest
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Member Function Documentation

◆ hitTestHandles2D()

int hitTestHandles2D ( int x,
int y,
const GlView & view ) const
overridevirtual

Returns the index of the handle being hit, or -1 when missing.

Reimplemented from GlPointBasedAnnotation.

◆ hitTestHandles3D()

int hitTestHandles3D ( int x,
int y,
const GlView & view ) const
overridevirtual

Reimplemented from GlPointBasedAnnotation.

◆ hitTestLine2D()

bool hitTestLine2D ( int x,
int y,
const GlView & view ) const
overridevirtual

Checks whether the line between handles gets hit (if not a straight line, override this in the annotation)

Reimplemented from GlPointBasedAnnotation.

◆ hitTest()

bool hitTest ( int ,
int ,
const GlView &  ) const
overridevirtual

Perform hit test with points of underlying object. Return true if object is hit, false otherwise.

Reimplemented from GlAnnotation.

◆ addPoint()

bool addPoint ( const vec3 & p)
overridevirtual

Adds a new point at world coords p and sets it as active point.

Reimplemented from GlPointBasedAnnotation.

◆ setPoints()

void setPoints ( const std::vector< vec3 > & points)
overridevirtual

Create annotation from scratch using the given points.

Reimplemented from GlPointBasedAnnotation.

◆ setPointColor()

void setPointColor ( const vec3 & color)
overridevirtual

Set point color.

Reimplemented from GlPointBasedAnnotation.

◆ rotate()

void rotate ( float angle)
overridevirtual

Change the GlObject matrix to reflect a rotation around the current m_rotationPoint Since this matrix is ignored by most renderers at the moment, this does not currently rotate anything.

Reimplemented from GlPointBasedAnnotation.

◆ rotateNoMatrix()

void rotateNoMatrix ( float angle)
overridevirtual

Rotate the annotation by changing the handle positions instead of the matrix.

Reimplemented from GlPointBasedAnnotation.

◆ setRotationPoint()

void setRotationPoint ( vec3 & point)
overridevirtual

Set the axis for rotation.

Reimplemented from GlPointBasedAnnotation.

◆ setPointSize()

void setPointSize ( float s)
overridevirtual

Set the point size.

Reimplemented from GlPointBasedAnnotation.

◆ setShowPointsAsCrosses()

void setShowPointsAsCrosses ( bool flag)
overridevirtual

Set the rendering of points.

Reimplemented from GlPointBasedAnnotation.

◆ setMatrix()

void setMatrix ( const mat4 & m)
overridevirtual

Overwritten method to update points in world coordinates if the matrix has changed.

Reimplemented from GlPointBasedAnnotation.

◆ setMatrixWithoutMoving()

void setMatrixWithoutMoving ( const mat4 & m)
overridevirtual

Change the matrix witout moving the annotation, e.g. for linking it with an image transformation.

Reimplemented from GlPointBasedAnnotation.

◆ sampleRenderPath()

bool sampleRenderPath ( int samples,
std::vector< vec3 > & out ) const
overridevirtual

For annotations where the rendered shape differs from the stored points, this method returns true and a set of points on the rendered curve.

Otherwise it returns false and the control points.

Reimplemented from GlPointBasedAnnotation.

◆ setLineWidth()

void setLineWidth ( float value)
overridevirtual

Set annotation line width.

Parameters
lineWidthline width

Reimplemented from GlPointBasedAnnotation.

◆ setColor()

void setColor ( const vec3 & color)
overridevirtual

Set annotation color.

Parameters
colorcolor

Reimplemented from GlAnnotation.

◆ setAlpha()

void setAlpha ( double v)
overridevirtual

Set alpha channel.

Reimplemented from GlAnnotation.

◆ setLabelVisible()

void setLabelVisible ( bool visible)
overridevirtual

Set annotation label visibility.

Parameters
visiblevisibility

Reimplemented from GlAnnotation.

◆ setLabelDepthTest()

void setLabelDepthTest ( bool depthTest)
overridevirtual

Set annotation label depth test flag.

Parameters
Flagwhether apply depth test during label rendering in 3D views.

Reimplemented from GlAnnotation.

◆ setLabelColor()

void setLabelColor ( const vec3 & color)
overridevirtual

Set annotation label color.

Parameters
colorcolor

Reimplemented from GlAnnotation.

◆ setLabelText()

void setLabelText ( const std::string & label)
overridevirtual

Set annotation label text.

Parameters
labellabel text

Reimplemented from GlAnnotation.

◆ setLabelTextPrefix()

void setLabelTextPrefix ( const std::string & labelPrefix)
overridevirtual

Set annotation label text prefix.

Parameters
labellabel text prefix

Reimplemented from GlAnnotation.

◆ setLabelTextSuffix()

void setLabelTextSuffix ( const std::string & labelSuffix)
overridevirtual

Set annotation label text suffix.

Parameters
labellabel text suffix

Reimplemented from GlAnnotation.

◆ setVisible()

void setVisible ( bool visible)
overridevirtual

Set object visibility.

Reimplemented from GlObject.

◆ setAlwaysVisible()

void setAlwaysVisible ( bool alwaysVisible)
overridevirtual

Set if object is always visible.

Reimplemented from GlObject.

◆ configure()

void configure ( const Properties * p)
overridevirtual

Set one or multiple properties.

Reimplemented from GlAnnotation.

◆ configuration()

void configuration ( Properties * p) const
overridevirtual

Retrieve the properties of this object.

Reimplemented from GlAnnotation.

◆ setSelected()

void setSelected ( bool m)
overridevirtual

When a GlAnnotation is selected, it may be rendered differently to distinguish it from non-selected annotations.

Reimplemented from GlPointBasedAnnotation.

◆ draw()

void draw ( const GlView & view)
overridevirtual

Draw the object in 3D space.

Implements GlObject.

◆ bounds()

Geometry::AlignedBox bounds ( ) const
overridevirtual

Get the axis-aligned bounding box of this GlObject in world space.

Return an empty (default-constructed) AlignedBox object if the GlObject does not reside in world space.

Implements GlObject.

◆ typeName()

std::string typeName ( ) const
overridevirtual

Return unique identifier for this object class used for serialization.

Implements GlObject.

◆ setEditable()

void setEditable ( bool editable)
overridevirtual

When a GlAnnotation is editable it may alter its visualization and render UI elements for its manipulation.

Reimplemented from GlAnnotation.

◆ updatePoints()

void updatePoints ( )
overridevirtual

Update the internal point structure.

Should be implemented by subtypes which have custom data depending on the point data. Derived implementation needs to call base class implementation.

Reimplemented from GlPointBasedAnnotation.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close