OpenCMISS-Zinc C++ API Documentation
Public Types | Public Member Functions | Protected Attributes | List of all members
OpenCMISS::Zinc::Graphics Class Reference

Base graphics type: produces 3-D graphics visualising domains and fields. More...

#include <graphics.hpp>

Inheritance diagram for OpenCMISS::Zinc::Graphics:
OpenCMISS::Zinc::GraphicsContours OpenCMISS::Zinc::GraphicsLines OpenCMISS::Zinc::GraphicsPoints OpenCMISS::Zinc::GraphicsStreamlines OpenCMISS::Zinc::GraphicsSurfaces

Public Types

enum  RenderPolygonMode { RENDER_POLYGON_MODE_INVALID = CMZN_GRAPHICS_RENDER_POLYGON_MODE_INVALID, RENDER_POLYGON_MODE_SHADED = CMZN_GRAPHICS_RENDER_POLYGON_MODE_SHADED, RENDER_POLYGON_MODE_WIREFRAME = CMZN_GRAPHICS_RENDER_POLYGON_MODE_WIREFRAME }
 
enum  SelectMode {
  SELECT_MODE_INVALID = CMZN_GRAPHICS_SELECT_MODE_INVALID, SELECT_MODE_ON = CMZN_GRAPHICS_SELECT_MODE_ON, SELECT_MODE_OFF = CMZN_GRAPHICS_SELECT_MODE_OFF, SELECT_MODE_DRAW_SELECTED = CMZN_GRAPHICS_SELECT_MODE_DRAW_SELECTED,
  SELECT_MODE_DRAW_UNSELECTED = CMZN_GRAPHICS_SELECT_MODE_DRAW_UNSELECTED
}
 
enum  Type {
  TYPE_INVALID = CMZN_GRAPHICS_TYPE_INVALID, TYPE_POINTS = CMZN_GRAPHICS_TYPE_POINTS, TYPE_LINES = CMZN_GRAPHICS_TYPE_LINES, TYPE_SURFACES = CMZN_GRAPHICS_TYPE_SURFACES,
  TYPE_CONTOURS = CMZN_GRAPHICS_TYPE_CONTOURS, TYPE_STREAMLINES = CMZN_GRAPHICS_TYPE_STREAMLINES
}
 

Public Member Functions

 Graphics (cmzn_graphics_id graphics_id)
 
 Graphics (const Graphics &graphics)
 
Graphicsoperator= (const Graphics &graphics)
 
bool isValid () const
 
cmzn_graphics_id getId () const
 
Field getCoordinateField ()
 
int setCoordinateField (const Field &coordinateField)
 
Field getDataField ()
 
int setDataField (const Field &dataField)
 
double getRenderLineWidth ()
 
int setRenderLineWidth (double width)
 
double getRenderPointSize ()
 
int setRenderPointSize (double size)
 
enum RenderPolygonMode getRenderPolygonMode ()
 
int setRenderPolygonMode (RenderPolygonMode renderPolygonMode)
 
Scene getScene ()
 
enum SelectMode getSelectMode ()
 
int setSelectMode (SelectMode selectMode)
 
Field getSubgroupField ()
 
int setSubgroupField (const Field &subgroupField)
 
Field getTextureCoordinateField ()
 
int setTextureCoordinateField (const Field &textureCoordinateField)
 
Material getMaterial ()
 
int setMaterial (const Material &material)
 
Graphicslineattributes getGraphicslineattributes ()
 
Graphicspointattributes getGraphicspointattributes ()
 
Graphicssamplingattributes getGraphicssamplingattributes ()
 
Material getSelectedMaterial ()
 
int setSelectedMaterial (const Material &material)
 
Spectrum getSpectrum ()
 
int setSpectrum (const Spectrum &spectrum)
 
enum Type getType ()
 
Tessellation getTessellation ()
 
int setTessellation (const Tessellation &tessellation)
 
Field getTessellationField ()
 
int setTessellationField (const Field &tessellationField)
 
bool getVisibilityFlag ()
 
int setVisibilityFlag (bool visibilityFlag)
 
enum Scenecoordinatesystem getScenecoordinatesystem ()
 
int setScenecoordinatesystem (Scenecoordinatesystem coordinateSystem)
 
Field::DomainType getFieldDomainType ()
 
int setFieldDomainType (Field::DomainType domainType)
 
char * getName ()
 
int setName (const char *name)
 
int setElementFaceType (Element::FaceType faceType)
 
Element::FaceType getElementFaceType ()
 
bool isExterior ()
 
int setExterior (bool exterior)
 
GraphicsContours castContours ()
 
GraphicsLines castLines ()
 
GraphicsPoints castPoints ()
 
GraphicsStreamlines castStreamlines ()
 
GraphicsSurfaces castSurfaces ()
 

Protected Attributes

cmzn_graphics_id id
 

Detailed Description

Base graphics type: produces 3-D graphics visualising domains and fields.

Base graphics type: produces 3-D graphics visualising domains and fields from the owning scene's region. Derived types (points, lines, surfaces, contours and streamlines) specify the algorithm used to create the graphics and may have additional type-specific attributes.

Member Enumeration Documentation

Enumeration controlling how polygons are rendered in GL.

Enumerator
RENDER_POLYGON_MODE_INVALID 

Unspecified polygon mode

RENDER_POLYGON_MODE_SHADED 

Draw filled polygons

RENDER_POLYGON_MODE_WIREFRAME 

Draw polygon wireframe edge lines

Enumeration controlling how graphics interact with selection: whether the objects can be picked, the selection highlighted or only the selected or unselected primitives are drawn.

Enumerator
SELECT_MODE_INVALID 

Unspecified select mode

SELECT_MODE_ON 

draw all objects with unselected objects drawn in standard material, selected objects in selected_material, and with picking enabled. Default mode for any new graphics.

SELECT_MODE_OFF 

object IDs are not generated so individual nodes/elements cannot be picked nor highlighted. More efficient if picking and highlighting are not required.

SELECT_MODE_DRAW_SELECTED 

draw only selected objects in selected_material, with picking enabled

SELECT_MODE_DRAW_UNSELECTED 

draw only unselected objects in standard material, with picking enabled.

Enumeration giving the algorithm used to create graphics.

Enumerator
TYPE_INVALID 

Unspecified graphics type

TYPE_POINTS 

Points graphics visualise discrete locations in the model.

TYPE_LINES 

Lines visualise 1-D elements in the model.

TYPE_SURFACES 

Surfaces visualise 2-D elements in the model.

TYPE_CONTOURS 

Visualises where a scalar field is equal to a constant.

TYPE_STREAMLINES 

Streamlines visualise the path of a fluid particle tracking along a vector field.

Member Function Documentation

GraphicsContours OpenCMISS::Zinc::Graphics::castContours ( )
inline

If the graphics is of type contours then this function returns the derived contours graphics handle.

Returns
Handle to derived contours graphics, or NULL/invalid handle if wrong type or failed.
GraphicsLines OpenCMISS::Zinc::Graphics::castLines ( )
inline

If the graphics is of type lines then this function returns the derived lines graphics handle.

Returns
Handle to derived lines graphics, or NULL/invalid handle if wrong type or failed.
GraphicsPoints OpenCMISS::Zinc::Graphics::castPoints ( )
inline

If the graphics is of type points then this function returns the derived points graphics handle.

Returns
Handle to derived points graphics, or NULL/invalid handle if wrong type or failed.
GraphicsStreamlines OpenCMISS::Zinc::Graphics::castStreamlines ( )
inline

If the graphics is of type streamlines then this function returns the derived streamlines graphics handle.

Returns
Handle to derived streamlines graphics, or NULL/invalid handle if wrong type or failed.
GraphicsSurfaces OpenCMISS::Zinc::Graphics::castSurfaces ( )
inline

If the graphics is of type surfaces then this function returns the derived surfaces graphics handle.

Returns
Handle to derived surfaces graphics, or NULL/invalid handle if wrong type or failed.
Field OpenCMISS::Zinc::Graphics::getCoordinateField ( )
inline

Gets the field supplying coordinates for the graphics.

Returns
Handle to coordinate field, or NULL/invalid handle if none or failed.
Field OpenCMISS::Zinc::Graphics::getDataField ( )
inline

Gets the data field used with the spectrum to colour the graphics.

Returns
Handle to data field, or NULL/invalid handle if none or failed.
Element::FaceType OpenCMISS::Zinc::Graphics::getElementFaceType ( )
inline

Gets the element face type the graphics is limited to generating graphics for.

Returns
The face type of the graphics, or FACE_TYPE_INVALID if invalid graphics supplied.
Field::DomainType OpenCMISS::Zinc::Graphics::getFieldDomainType ( )
inline

Get the field domain type graphics are created from with the graphics.

Returns
The domain type of the graphics or CMZN_FIELD_DOMAIN_TYPE_INVALID on error.
Graphicslineattributes OpenCMISS::Zinc::Graphics::getGraphicslineattributes ( )
inline

If the graphics produces lines or extrusions then returns a handle to the line attribute object for specifying section profile and scaling.

Returns
Handle to graphics line attributes, or NULL/invalid handle if not supported by graphics type or failed.
Graphicspointattributes OpenCMISS::Zinc::Graphics::getGraphicspointattributes ( )
inline

If the graphics produces points then returns a handle to point attribute object for specifying glyph, scaling fields, scale factors and labels.

Returns
Handle to graphics point attributes, or NULL/invalid handle if not supported by graphics type or failed.
Graphicssamplingattributes OpenCMISS::Zinc::Graphics::getGraphicssamplingattributes ( )
inline

If the graphics samples points from elements then returns a handle to sampling attribute object for specifying sampling mode, density field etc.

Returns
Handle to graphics sampling attributes, or NULL/invalid handle if not supported by graphics type or failed.
cmzn_graphics_id OpenCMISS::Zinc::Graphics::getId ( ) const
inline

Return the C handle of the Graphics object.

Returns
C handle of Graphics if this objects is valid, 0 otherwise.
Material OpenCMISS::Zinc::Graphics::getMaterial ( )
inline

Gets the material giving the colour/shading of the graphics when unselected.

Returns
Handle to material, or NULL/invalid handle on failure.
char* OpenCMISS::Zinc::Graphics::getName ( )
inline

Return the name of the graphics. The graphics has no name until user sets it.

Returns
On success: allocated string containing name, or NULL if none. Up to caller to free using cmzn_deallocate().
double OpenCMISS::Zinc::Graphics::getRenderLineWidth ( )
inline

Get the width used for rendering line primitives in GL in renderer 'point units', typically pixels for on-screen display.

Returns
The line render width in pixels, or 0.0 if bad argument.
double OpenCMISS::Zinc::Graphics::getRenderPointSize ( )
inline

Get the size used for rendering point primitives in GL in renderer 'point units', typically pixels for on-screen display.

Returns
The point render size in pixels, or 0.0 if bad argument.
enum RenderPolygonMode OpenCMISS::Zinc::Graphics::getRenderPolygonMode ( )
inline

Get mode controlling how polygons in the graphics are rendered in GL.

Returns
The render polygon mode, or CMZN_GRAPHICS_RENDER_POLYGON_MODE_INVALID if bad arguments.
Scene OpenCMISS::Zinc::Graphics::getScene ( )
inline

Get the scene owning this graphics.

Returns
Handle to scene owning graphics, or NULL/invalid handle on failure.
enum Scenecoordinatesystem OpenCMISS::Zinc::Graphics::getScenecoordinatesystem ( )
inline

Get the scene coordinate system in which to render the coordinates of graphics.

Returns
coordinate system used in graphics.
Material OpenCMISS::Zinc::Graphics::getSelectedMaterial ( )
inline

Gets the material giving the colour/shading of the graphics when selected.

Returns
Handle to material, or NULL/invalid handle if none or failed.
enum SelectMode OpenCMISS::Zinc::Graphics::getSelectMode ( )
inline

Gets the mode controlling how graphics are drawn depending on whether the underlying object is selected, and also whether picking is enabled.

Returns
The select mode, or MODE_INVALID if bad argument.
Spectrum OpenCMISS::Zinc::Graphics::getSpectrum ( )
inline

Gets the spectrum used with the data field to colour the graphics.

Returns
Handle to spectrum, or NULL/invalid handle if none or failed.
Field OpenCMISS::Zinc::Graphics::getSubgroupField ( )
inline

Gets the field which returns true/non-zero for primitive to be created.

Returns
Handle to subgroup field, or NULL/invalid handle if none or failed.
Tessellation OpenCMISS::Zinc::Graphics::getTessellation ( )
inline

Returns the tessellation object of the graphics. Caller must destroy returned handle.

Returns
Handle to tessellation, or NULL/invalid handle if none or failed.
Field OpenCMISS::Zinc::Graphics::getTessellationField ( )
inline

Gets the field controlling tessellation quality.

Returns
Handle to tessellation field, or NULL/invalid handle if none or failed.
Field OpenCMISS::Zinc::Graphics::getTextureCoordinateField ( )
inline

Get the texture coordinate field of the graphics. Caller must destroy handle.

Returns
Handle to texture coordinate field, or NULL/invalid handle if none or failed.
enum Type OpenCMISS::Zinc::Graphics::getType ( )
inline

Get the graphics type: POINTS, LINES, SURFACES, CONTOURS, STREAMLINES

Returns
The enumerated graphics type, or TYPE_INVALID on error.
bool OpenCMISS::Zinc::Graphics::getVisibilityFlag ( )
inline

Return status of graphics visibility flag attribute.

Returns
Boolean value true if visibility flag is set, false if not.
bool OpenCMISS::Zinc::Graphics::isExterior ( )
inline

Gets flag to generate graphics for exterior faces or lines only.

Returns
Boolean true if the exterior flag is set, otherwise false.
bool OpenCMISS::Zinc::Graphics::isValid ( ) const
inline

Check if this is a valid Graphics object.

Returns
Status True if object is valid, false otherwise.
int OpenCMISS::Zinc::Graphics::setCoordinateField ( const Field coordinateField)
inline

Sets the field supplying coordinates for the graphics. Non rectangular- Cartesian coordinates are automatically converted to RC for the graphics.

Parameters
coordinateFieldThe field to use as the coordinate field. May have from 1 to 3 components.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Graphics::setDataField ( const Field dataField)
inline

Sets the data field used with the spectrum to colour the graphics.

Parameters
dataFieldThe field to use as the data field.
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
int OpenCMISS::Zinc::Graphics::setElementFaceType ( Element::FaceType  faceType)
inline

Sets the element face type the graphics is limited to generating graphics for. e.g. FACE_TYPE_XI1_0 generates graphics only on faces and lines where the top-level element 'xi1' coordinate equals 0. Value FACE_TYPE_ALL disables the face check so all elements of dimension - face or non-face - are accepted.

Parameters
faceTypeA valid element face type.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Graphics::setExterior ( bool  exterior)
inline

Sets flag to generate graphics for exterior faces or lines only.

Parameters
exteriorNew boolean value: true to set, false to clear.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Graphics::setFieldDomainType ( Field::DomainType  domainType)
inline

Set the field domain type to create graphics from with the graphics. Note that all domain types are applicable to all graphics types, for example this attribute cannot be changed for LINES and SURFACES, which always use 1D and 2D elements domains, respectively.

Parameters
domainTypeEnumerated value of the field domain type to use.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Graphics::setMaterial ( const Material material)
inline

Sets the material giving the colour/shading of the graphics when unselected.

Parameters
materialThe standard/unselected material.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Graphics::setName ( const char *  name)
inline

Sets the name of the graphics. Unlike other containers, scene can contain multiple graphics with the same name. New graphics default to having no name. A common use of the name is to mark the graphics for filtering, like metadata.

See also
Scenefiltermodule::createScenefilterGraphicsName
Parameters
nameThe new name for the graphics, OR NULL to clear.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Graphics::setRenderLineWidth ( double  width)
inline

Set the width used for rendering line primitives in GL in renderer 'point units', typically pixels for on-screen display but scalable to ensure lines are of appropriate thickness on high resolution output. Note there may be arbitrary limits on values depending on the GL implementation, and for non-antialised rendering the nearest integer is used. The default value is 1.0.

Parameters
widthThe line render width in pixels. Value > 0.0.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Graphics::setRenderPointSize ( double  size)
inline

Set the size used for rendering point primitives in GL in renderer 'point units', typically pixels for on-screen display but scalable to ensure points are of appropriate size on high resolution output. Note there may be arbitrary limits on values depending on the GL implementation, and may be rounded to the nearest integer in use. The default value is 1.0.

Parameters
sizeThe point render size in pixels. Value > 0.0.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Graphics::setRenderPolygonMode ( RenderPolygonMode  renderPolygonMode)
inline

Set mode controlling how polygons in the graphics are rendered in GL: shaded/filled, wireframe etc.

See also
Graphics::RenderPolygonMode
Parameters
renderPolygonModeMode of polygon rendering: shaded, wireframe.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Graphics::setScenecoordinatesystem ( Scenecoordinatesystem  coordinateSystem)
inline

Set the scene coordinate system in which to render the coordinates of graphics.

Parameters
coordinateSystemenumerator describing coordinate system to be set for graphics.
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
int OpenCMISS::Zinc::Graphics::setSelectedMaterial ( const Material material)
inline

Set the material giving the colour/shading of the graphics when selected.

Parameters
materialThe selected/highlight material.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Graphics::setSelectMode ( SelectMode  selectMode)
inline

Sets the mode controlling how graphics are drawn depending on whether the underlying object is selected, and also whether picking is enabled. An object is selected if it is in the current selection_group for the scene which owns the graphics. The default select mode for new graphics is CMZN_GRAPHICS_SELECT_MODE_ON.

Parameters
selectModeA valid select mode for the graphics.
Returns
On success OpenCMISS::Zinc::OK, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Graphics::setSpectrum ( const Spectrum spectrum)
inline

Sets the spectrum used with the data field to colour the graphics.

Parameters
spectrumThe spectrum to use to map colours.
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
int OpenCMISS::Zinc::Graphics::setSubgroupField ( const Field subgroupField)
inline

Sets optional field which causes graphics to be generated only for parts of the domain where its value is true/non-zero. Commonly a group, node_group or element_group field which is efficiently iterated over. Note general fields are evaluated at an arbitrary location in elements.

Parameters
subgroupFieldScalar subgroup field.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Graphics::setTessellation ( const Tessellation tessellation)
inline

Sets the tessellation object of the graphics.

Parameters
tessellationThe tessellation object to be set for graphics.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Graphics::setTessellationField ( const Field tessellationField)
inline

Sets a field which sets tessellation quality to match its native refinement in any element (if any) and also apply refinement factors if the field function is non-linear at its native refinement. If no tessellation field is supplied, the coordinate field is checked for non-linearity of function OR coordinate system, but not native refinement.

Parameters
tessellationFieldThe field which sets tessellation quality.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Graphics::setTextureCoordinateField ( const Field textureCoordinateField)
inline

Set the texture coordinate field of the graphics. Values of this field specify mapping of the material's image field to coordinates in the graphics. The texture coordinate field is currently unused by POINTS and STREAMLINES.

Parameters
textureCoordinateFieldThe field to be set as the texture coordinate field, or 0 for none. Field must have from 1 to 3 components.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Graphics::setVisibilityFlag ( bool  visibilityFlag)
inline

Sets status of graphics visibility flag attribute. Note this only affects visibility of graphics when a scene filter is acting on it.

Parameters
visibilityFlagBoolean true to set, false to clear.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.

The documentation for this class was generated from the following files: