SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
Representation of an SMTK Resource. More...
#include <vtkSMTKResourceRepresentation.h>
Classes | |
struct | State |
The visual state of a single component. More... | |
Public Types | |
enum | RepresentationTypes { POINTS = VTK_POINTS, WIREFRAME = VTK_WIREFRAME, SURFACE = VTK_SURFACE, SURFACE_WITH_EDGES = 3 } |
Set the representation Subtype. More... | |
enum | ColorByType { ENTITY = 0, VOLUME, FIELD } |
Set color-by mode. | |
typedef vtkPVDataRepresentation | Superclass |
using | ComponentStateMap = std::map< smtk::common::UUID, State > |
A map from component UUIDs to user-provided state. | |
using | RenderableDataMap = std::map< smtk::common::UUID, vtkDataObject * > |
A map from UUIDs to vtkDataObjects rendered by this representation (across all its actors) | |
using | StyleFromSelectionFunction = std::function< bool(smtk::view::SelectionPtr, RenderableDataMap &, vtkSMTKResourceRepresentation *)> |
The type of a function used to update display attributes based on selections. | |
Public Member Functions | |
virtual int | IsA (const char *type) |
vtkSMTKResourceRepresentation * | NewInstance () const |
void | PrintSelf (ostream &os, vtkIndent indent) override |
vtkSMTKResourceRepresentation (const vtkSMTKResourceRepresentation &)=delete | |
vtkSMTKResourceRepresentation & | operator= (const vtkSMTKResourceRepresentation &)=delete |
int | ProcessViewRequest (vtkInformationRequestKey *request_type, vtkInformation *inInfo, vtkInformation *outInfo) override |
int | RequestData (vtkInformation *info, vtkInformationVector **inVec, vtkInformationVector *outVec) override |
bool | AddToView (vtkView *view) override |
bool | RemoveFromView (vtkView *view) override |
void | SetVisibility (bool val) override |
void | SetMapScalars (int val) |
Resource rendering properties. More... | |
void | SetInterpolateScalarsBeforeMapping (int val) |
void | SetPointSize (double val) |
void | SetLineWidth (double val) |
void | SetLineColor (double r, double g, double b) |
void | SetLookupTable (vtkScalarsToColors *val) |
void | SetEdgeVisibility (int val) |
void | SetRenderLinesAsTubes (int val) |
void | SetRenderPointsAsSpheres (int val) |
void | SetVertexVisibility (int val) |
virtual void | SetDefaultEdgeColor (double r, double g, double b) |
Selection properties. More... | |
virtual void | SetDefaultEdgeColor (const double *rgb) |
virtual double * | GetDefaultEdgeColor () |
virtual void | SetDefaultFaceColor (double r, double g, double b) |
virtual void | SetDefaultFaceColor (const double *rgb) |
virtual double * | GetDefaultFaceColor () |
virtual void | SetSelectionColor (double, double, double) |
virtual void | SetSelectionColor (double[3]) |
virtual double * | GetSelectionColor () |
virtual void | GetSelectionColor (double &, double &, double &) |
virtual void | GetSelectionColor (double[3]) |
virtual void | SetHoverColor (double, double, double) |
virtual void | SetHoverColor (double[3]) |
virtual double * | GetHoverColor () |
virtual void | GetHoverColor (double &, double &, double &) |
virtual void | GetHoverColor (double[3]) |
void | SetSelectionPointSize (double val) |
void | SetSelectionLineWidth (double val) |
void | SetSelectionRenderStyle (int style) |
void | SetOpacity (double val) |
void | SetPosition (double x, double y, double z) |
void | SetScale (double x, double y, double z) |
void | SetOrientation (double x, double y, double z) |
void | SetOrigin (double x, double y, double z) |
void | SetUserTransform (const double matrix[16]) |
void | SetSpecularPower (double val) |
void | SetSpecular (double val) |
void | SetDiffuse (double val) |
void | SetAmbient (double val) |
void | SetPickable (int val) |
void | SetTexture (vtkTexture *val) |
virtual void | SetActiveAssembly (const char *) |
virtual char * | GetActiveAssembly () |
void | SetBlockVisibility (unsigned int index, bool visible) |
Block properties for tessellation entities (Block 0: Components). | |
bool | GetBlockVisibility (unsigned int index) const |
void | RemoveBlockVisibility (unsigned int index, bool=true) |
void | RemoveBlockVisibilities () |
void | SetBlockColor (unsigned int index, double r, double g, double b) |
void | SetBlockColor (unsigned int index, double *color) |
double * | GetBlockColor (unsigned int index) |
void | RemoveBlockColor (unsigned int index) |
void | RemoveBlockColors () |
void | SetBlockOpacity (unsigned int index, double opacity) |
void | SetBlockOpacity (unsigned int index, double *opacity) |
double | GetBlockOpacity (unsigned int index) |
void | RemoveBlockOpacity (unsigned int index) |
void | RemoveBlockOpacities () |
void | SetSelectedState (vtkDataObject *data, int selectionValue, bool isGlyph) |
Selection/highlighting appearance. More... | |
void | SetInstanceVisibility (unsigned int index, bool visible) |
Block properties for instance placements (Block 2: Glyph Points). | |
bool | GetInstanceVisibility (unsigned int index) const |
void | RemoveInstanceVisibility (unsigned int index, bool) |
void | RemoveInstanceVisibilities () |
void | SetInstanceColor (unsigned int index, double r, double g, double b) |
void | SetInstanceColor (unsigned int index, double *color) |
double * | GetInstanceColor (unsigned int index) |
void | RemoveInstanceColor (unsigned int index) |
void | RemoveInstanceColors () |
virtual void | SetRepresentation (int) |
virtual int | GetRepresentation () |
void | SetRepresentation (const char *type) |
Overload to set representation type using string. More... | |
virtual void | SetColorBy (int) |
virtual int | GetColorBy () |
void | SetColorBy (const char *type) |
Overload to set color mode using a string. More... | |
void | SelectionModified () |
This method is used internally to notify the representation to rebbuild display properties in response to a change in the SMTK selection. More... | |
void | SetUseInternalAttributes (bool enable) |
Internal attributes are set through color block proxy properties. | |
virtual void | SetWrapper (vtkSMTKWrapper *) |
virtual vtkSMTKWrapper * | GetWrapper () |
void | SetResource (const smtk::resource::ResourcePtr &res) |
smtk::resource::ResourcePtr | GetResource () const |
void | GetEntityVisibilities (std::map< smtk::common::UUID, int > &visdata) |
bool | SetEntityVisibility (smtk::resource::PersistentObjectPtr ent, bool visible) |
bool | ApplyStyle (smtk::view::SelectionPtr seln, RenderableDataMap &renderables, vtkSMTKResourceRepresentation *rep) |
Look for generator functions that alters a representation's appearance based on a selection. More... | |
bool | SelectComponentFootprint (smtk::resource::PersistentObject *item, int selnBits, RenderableDataMap &renderables) |
A helper used by ApplyDefaultStyle to handle a single component. | |
bool | SelectComponentFootprint (const smtk::model::EntityRefs &items, int selnBits, RenderableDataMap &renderables) |
A helper used by ApplyDefaultStyle to handle model entity components. | |
const ComponentStateMap & | GetComponentState () const |
Return the map from persistent-object UUID to user-specified state. More... | |
int | GetEntitiesActorPickId () const |
Return the prop ID assigned to the actor that renders tessellated components. | |
int | GetGlyphEntitiesActorPickId () const |
Return the prop ID assigned to the actor that renders glyph components. | |
int | GetSelectedEntitiesActorPickId () const |
Return the prop ID assigned to the actor that renders selected tessellated components. | |
int | GetSelectedGlyphEntitiesActorPickId () const |
Return the prop ID assigned to the actor that renders selected glyph components. | |
vtkCompositeDataDisplayAttributes * | GetEntityMapperDisplayAttributes () |
Accessor for clients to use with vtkSMTKRepresentationStyleSupplier. | |
vtkCompositeDataDisplayAttributes * | GetSelectedEntityMapperDisplayAttributes () |
vtkSmartPointer< vtkActor > | GetEntitiesActor () |
Fetch the representation's actors. More... | |
vtkSmartPointer< vtkActor > | GetSelectedEntitiesActor () |
vtkSmartPointer< vtkActor > | GetGlyphEntitiesActor () |
vtkSmartPointer< vtkActor > | GetSelectedGlyphEntitiesActor () |
Static Public Member Functions | |
static vtkSMTKResourceRepresentation * | New () |
static int | IsTypeOf (const char *type) |
static vtkSMTKResourceRepresentation * | SafeDownCast (vtkObjectBase *o) |
static bool | ApplyDefaultStyle (smtk::view::SelectionPtr seln, RenderableDataMap &renderables, vtkSMTKResourceRepresentation *rep) |
The default selection-style function. | |
Protected Member Functions | |
virtual vtkObjectBase * | NewInstanceInternal () const |
int | FillInputPortInformation (int port, vtkInformation *info) override |
void | SetupDefaults () |
void | SetOutputExtent (vtkAlgorithmOutput *output, vtkInformation *inInfo) |
void | ConfigureGlyphMapper (vtkGlyph3DMapper *mapper) |
void | UpdateRenderableData (vtkMultiBlockDataSet *modelData, vtkMultiBlockDataSet *instanceData) |
void | UpdateDisplayAttributesFromSelection (vtkMultiBlockDataSet *modelData, vtkMultiBlockDataSet *instanceData) |
void | UpdateSelection (vtkMultiBlockDataSet *data, vtkCompositeDataDisplayAttributes *blockAttr, vtkActor *actor) |
vtkDataObject * | FindNode (vtkMultiBlockDataSet *data, const smtk::common::UUID &uuid) |
void | ClearSelection (vtkMapper *mapper) |
Clear the current selection stored in the mapper's vtkCompositeDisplayDataAttributes. More... | |
void | UpdateColoringParameters (vtkDataObject *data) |
Update the active coloring mode (field coloring, etc.). | |
void | UpdateRepresentationSubtype () |
Update the active representation subtype. | |
void | ColorByVolume (vtkMultiBlockDataSet *data) |
Entities bounding a volume entity (if any), use the color defined by the bounded entity. More... | |
void | ColorByEntity (vtkMultiBlockDataSet *data) |
void | ColorByField () |
void | ApplyInternalBlockAttributes () |
Block attributes in a mapper are referenced to each block through DataObject pointers. More... | |
void | ApplyEntityAttributes (vtkMapper *mapper) |
void | ApplyGlyphBlockAttributes (vtkGlyph3DMapper *mapper) |
bool | GetModelBounds () |
Compute bounds of the input model taking into account instance placements (and corresponding glyph offsets) and entity tessellation bounds. | |
bool | GetEntityBounds (vtkDataObject *dataObject, double bounds[6], vtkCompositeDataDisplayAttributes *cdAttributes) |
Protected Attributes | |
vtkSMTKWrapper * | Wrapper { nullptr } |
Provides access to the SMTK selection and to resource components. More... | |
smtk::view::SelectionObservers::Key | SelectionObserver |
If Wrapper is non-null, SelectionObserver is the handle of an observer of Wrapper->GetSelection(). | |
std::weak_ptr< smtk::resource::Resource > | Resource |
Provides access to entities in the model. More... | |
ComponentStateMap | ComponentState |
Map from component ids to their state (which is currently only visibility, but may be expanded) | |
double | DataBounds [6] |
int | Representation = SURFACE |
int | ColorBy = FIELD |
bool | UpdateColorBy = false |
bool | UseInternalAttributes = false |
vtkNew< vtkApplyTransforms > | ApplyTransforms |
vtkNew< vtkMultiBlockDataSet > | CurrentData |
vtkSmartPointer< vtkCompositePolyDataMapper2 > | EntityMapper |
vtkSmartPointer< vtkCompositePolyDataMapper2 > | SelectedEntityMapper |
vtkSmartPointer< vtkGlyph3DMapper > | GlyphMapper |
vtkSmartPointer< vtkGlyph3DMapper > | SelectedGlyphMapper |
vtkSmartPointer< vtkActor > | Entities |
vtkSmartPointer< vtkActor > | SelectedEntities |
vtkSmartPointer< vtkActor > | GlyphEntities |
vtkSmartPointer< vtkActor > | SelectedGlyphEntities |
int | EntitiesActorPickId { -1 } |
int | SelectedEntitiesActorPickId { -1 } |
int | GlyphEntitiesActorPickId { -1 } |
int | SelectedGlyphEntitiesActorPickId { -1 } |
vtkSmartPointer< vtkProperty > | Property |
Rendering properties shared between Entities and GlyphEntities. | |
double | Ambient = 0. |
double | Diffuse = 1. |
double | Specular = 0. |
double | DefaultEdgeColor [3] = { 0., 0., 0. } |
double | DefaultFaceColor [3] = { 1., 1., 1. } |
double | SelectionColor [3] = { 1., 0.48235, 0.0 } |
double | HoverColor [3] = { 0.7, 0.483, 0.5873 } |
bool | BlockAttrChanged = false |
Block attributes for components. | |
vtkTimeStamp | BlockAttributeTime |
std::unordered_map< unsigned int, bool > | BlockVisibilities |
std::unordered_map< unsigned int, double > | BlockOpacities |
std::unordered_map< unsigned int, std::array< double, 3 > > | BlockColors |
bool | InstanceAttrChanged = false |
Block attributes for instance points (GlyphPoints). | |
vtkTimeStamp | InstanceAttributeTime |
std::unordered_map< unsigned int, bool > | InstanceVisibilities |
std::unordered_map< unsigned int, std::array< double, 3 > > | InstanceColors |
RenderableDataMap | RenderableData |
Hold a map of renderable objects whose style is altered by an SMTK selection. | |
vtkTimeStamp | RenderableTime |
Timestamp for when RenderableData was last updated. | |
vtkTimeStamp | SelectionTime |
Timestamp for when the SMTK application Selection was last modified. | |
vtkTimeStamp | ApplyStyleTime |
Timestamp for when highlighting styles related to the selection were last applied. | |
char * | ActiveAssembly { nullptr } |
The name of the active assembly. | |
Representation of an SMTK Resource.
Renders the outputs of vtkSMTKResourceReader.
Input data arrives as a multiblock with four blocks:
Block | Mapper | Actor |
---|---|---|
Block 0: Components | EntityMapper | Entities |
Block 1: Glyph prototypes | GlyphMapper | GlyphEntities |
Block 2: Glyph points | GlyphMapper | GlyphEntities |
| Block 3: Images | Internal slice representation |
vtkSMSMTKResourceRepresentationProxy sets certain properties used as mapper inputs (GlyphPrototypes and GlyphPoints).
Each of the mappers has a selection counterpart (SelectedEntityMapper and SelectedGlyphMapper) which renders only selected entities.
The representation supports different coloring modes (ColorBy):
And different representation subtypes:
Set the representation Subtype.
This adds VTK_SURFACE_WITH_EDGES to those defined in vtkProperty.
|
protected |
Block attributes in a mapper are referenced to each block through DataObject pointers.
Since DataObjects may change after updating the pipeline, this class maintains an additional map using the flat-index as a key. This method updates the mapper's attributes with those cached in this representation; This is done after the data has updated (multi-block nodes change after an update).
bool vtkSMTKResourceRepresentation::ApplyStyle | ( | smtk::view::SelectionPtr | seln, |
RenderableDataMap & | renderables, | ||
vtkSMTKResourceRepresentation * | rep | ||
) |
Look for generator functions that alters a representation's appearance based on a selection.
This is used to update block display attributes (per-block color, visibility, and opacity) on all of the representation's actors based on the active selection. This function is not called from within a selection's observer callback; instead it is called the next time the representation is about to be rendered. (This way, representations which are not visible do no work maintaining visual properties.)
New style function suppliers are registered with vtkSMTKRepresentationStyleSupplier. If there are none, then the default handler is used.
The default value of this function is vtkSMTKResourceRepresentation::ApplyDefaultStyle().
|
protected |
Clear the current selection stored in the mapper's vtkCompositeDisplayDataAttributes.
For vtkCompositePolyDataMapper2, setting the top node as false is enough since the state of the top node will stream down to its nodes. Glyph3DMapper does not behave as vtkCompositePolyDataMapper2, hence it is necessary to update the block visibility of each node directly.
|
protected |
Entities bounding a volume entity (if any), use the color defined by the bounded entity.
Currently uses only volume 0.
|
inline |
Return the map from persistent-object UUID to user-specified state.
This is read only. If you want to modify component state, call SetEntityVisibility().
|
inline |
Fetch the representation's actors.
These are used to configure pickers so that only geometry associated with an SMTK resource can be picked.
|
override |
TODO Add LOD Mappers
void vtkSMTKResourceRepresentation::SelectionModified | ( | ) |
This method is used internally to notify the representation to rebbuild display properties in response to a change in the SMTK selection.
You should never call it yourself.
void vtkSMTKResourceRepresentation::SetColorBy | ( | const char * | type | ) |
Overload to set color mode using a string.
Accepted strings are: "Entity", "Volume" (and soon "Group").
|
virtual |
Selection properties.
Forwarded to the relevant vtkProperty instances.
void vtkSMTKResourceRepresentation::SetMapScalars | ( | int | val | ) |
Resource rendering properties.
Forwarded to the relevant vtkProperty instances.
void vtkSMTKResourceRepresentation::SetRepresentation | ( | const char * | type | ) |
Overload to set representation type using string.
Accepted strings are: "Points", "Wireframe", "Surface" and "Surface With Edges".
void vtkSMTKResourceRepresentation::SetSelectedState | ( | vtkDataObject * | data, |
int | selectionValue, | ||
bool | isGlyph | ||
) |
Selection/highlighting appearance.
Apply the selectionValue to the given data.
A selectionValue of -1 indicates that both the unselected and selected blocks corresponding to data should be hidden. A selectionValue of 0 indicates the unselected block should be shown. A selectionValue larger than 0 indicates the selected block should be shown and colored according to selectionValue.
|
protected |
Provides access to entities in the model.
This is useful when coloring by certain modes (e.g. in order to query the color of a volume with a given UUID).
|
protected |
Provides access to the SMTK selection and to resource components.
The selection is used to change the visual style of entities. Additionally, resource and component relationships are used