VR CAD Viewer 1.0
Qt and VTK application for loading and visualising CAD models with VR support
Loading...
Searching...
No Matches
ModelPart Class Reference

Represents one CAD model part in the application. More...

#include <ModelPart.h>

Public Member Functions

 ModelPart (const QList< QVariant > &data, ModelPart *parent=nullptr)
 Creates a new model part.
 
 ~ModelPart ()
 Deletes the model part and its child items.
 
void appendChild (ModelPart *item)
 Adds a child item to this model part.
 
ModelPartchild (int row)
 Gets the child item at a given row.
 
int childCount () const
 Gets the number of child items.
 
int columnCount () const
 Gets the number of data columns.
 
QVariant data (int column) const
 Gets the data stored in a given column.
 
void set (int column, const QVariant &value)
 Sets the data stored in a given column.
 
ModelPartparentItem ()
 Gets the parent item.
 
int row () const
 Gets this item's row number relative to its parent.
 
void setColour (const unsigned char R, const unsigned char G, const unsigned char B)
 Sets the RGB colour of the model part.
 
unsigned char getColourR ()
 Gets the red colour value.
 
unsigned char getColourG ()
 Gets the green colour value.
 
unsigned char getColourB ()
 Gets the green colour value.
 
void setVisible (bool isVisible)
 Sets whether the model part is visible.
 
bool visible ()
 Gets whether the model part is visible.
 
void loadSTL (QString fileName)
 Loads an STL file for this model part.
 
vtkSmartPointer< vtkActorgetActor ()
 Gets the actor used for normal GUI rendering.
 
vtkSmartPointer< vtkActorgetNewActor ()
 Creates a separate actor for VR rendering.
 
bool removeChild (int row)
 Removes a child item at a given row.
 
void setShrinkFilter (bool enabled, double factor)
 Sets the shrink filter used for rendering.
 
bool shrinkFilterEnabled () const
 Checks whether the shrink filter is enabled.
 
double shrinkFactor () const
 Gets the shrink filter factor.
 
void updatePipeline ()
 Updates the main VTK rendering pipeline after filter/property changes.
 
void updateVRPipeline ()
 Updates the VR rendering pipeline after filter/property changes.
 
void setClipFilter (bool enabled, int axis, double value, bool invert)
 Sets the clip filter used for rendering.
 
bool clipFilterEnabled () const
 Checks whether the clip filter is enabled.
 
int clipAxis () const
 Gets the axis used by the clip filter.
 
double clipValue () const
 Gets the clip filter value.
 
bool clipInvert () const
 Checks whether the clip filter is inverted.
 

Detailed Description

Represents one CAD model part in the application.

Stores tree hierarchy information, display properties such as colour and visibility, and the VTK objects needed to render an STL model.

Constructor & Destructor Documentation

◆ ModelPart()

ModelPart::ModelPart ( const QList< QVariant > &  data,
ModelPart parent = nullptr 
)

Creates a new model part.

Parameters
dataItem data such as name and visibility.
parentParent item in the tree, or nullptr for the root item.

Member Function Documentation

◆ appendChild()

void ModelPart::appendChild ( ModelPart item)

Adds a child item to this model part.

Parameters
itemPointer to the child item to add.
Here is the caller graph for this function:

◆ child()

ModelPart * ModelPart::child ( int  row)

Gets the child item at a given row.

Parameters
rowRow index of the child item.
Returns
Pointer to the child item.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ childCount()

int ModelPart::childCount ( ) const

Gets the number of child items.

Returns
Number of children below this item.
Here is the caller graph for this function:

◆ clipAxis()

int ModelPart::clipAxis ( ) const

Gets the axis used by the clip filter.

Returns
Clip axis index.
Here is the caller graph for this function:

◆ clipFilterEnabled()

bool ModelPart::clipFilterEnabled ( ) const

Checks whether the clip filter is enabled.

Returns
True if the clip filter is enabled.
Here is the caller graph for this function:

◆ clipInvert()

bool ModelPart::clipInvert ( ) const

Checks whether the clip filter is inverted.

Returns
True if the clipped region is inverted.
Here is the caller graph for this function:

◆ clipValue()

double ModelPart::clipValue ( ) const

Gets the clip filter value.

Returns
Clip position value.
Here is the caller graph for this function:

◆ columnCount()

int ModelPart::columnCount ( ) const

Gets the number of data columns.

Returns
Number of columns used by the tree model.
Here is the caller graph for this function:

◆ data()

QVariant ModelPart::data ( int  column) const

Gets the data stored in a given column.

Parameters
columnColumn index.
Returns
Data value for that column.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getActor()

vtkSmartPointer< vtkActor > ModelPart::getActor ( )

Gets the actor used for normal GUI rendering.

Returns
VTK actor for the main application renderer.

◆ getColourB()

unsigned char ModelPart::getColourB ( )

Gets the green colour value.

Returns
Green value from 0 to 255.
Here is the caller graph for this function:

◆ getColourG()

unsigned char ModelPart::getColourG ( )

Gets the green colour value.

Returns
Green value from 0 to 255.
Here is the caller graph for this function:

◆ getColourR()

unsigned char ModelPart::getColourR ( )

Gets the red colour value.

Returns
Red value from 0 to 255.
Here is the caller graph for this function:

◆ getNewActor()

vtkSmartPointer< vtkActor > ModelPart::getNewActor ( )

Creates a separate actor for VR rendering.

Returns
New VTK actor for the VR renderer.
Here is the call graph for this function:

◆ loadSTL()

void ModelPart::loadSTL ( QString  fileName)

Loads an STL file for this model part.

Parameters
fileNamePath to the STL file.
Here is the call graph for this function:

◆ parentItem()

ModelPart * ModelPart::parentItem ( )

Gets the parent item.

Returns
Pointer to the parent ModelPart.
Here is the caller graph for this function:

◆ removeChild()

bool ModelPart::removeChild ( int  row)

Removes a child item at a given row.

Parameters
rowRow index of the child to remove.
Returns
True if the child was removed successfully.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ row()

int ModelPart::row ( ) const

Gets this item's row number relative to its parent.

Returns
Row index of this item.
Here is the caller graph for this function:

◆ set()

void ModelPart::set ( int  column,
const QVariant value 
)

Sets the data stored in a given column.

Parameters
columnColumn index.
valueNew value to store.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setClipFilter()

void ModelPart::setClipFilter ( bool  enabled,
int  axis,
double  value,
bool  invert 
)

Sets the clip filter used for rendering.

Parameters
enabledTrue to enable the filter, false to disable it.
axisAxis used for clipping.
valueClip position along the selected axis.
invertTrue to invert the clipped region.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setColour()

void ModelPart::setColour ( const unsigned char  R,
const unsigned char  G,
const unsigned char  B 
)

Sets the RGB colour of the model part.

Parameters
RRed value from 0 to 255.
GGreen value from 0 to 255.
BBlue value from 0 to 255.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setShrinkFilter()

void ModelPart::setShrinkFilter ( bool  enabled,
double  factor 
)

Sets the shrink filter used for rendering.

Parameters
enabledTrue to enable the filter, false to disable it.
factorShrink factor applied to the model.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setVisible()

void ModelPart::setVisible ( bool  isVisible)

Sets whether the model part is visible.

Parameters
isVisibleTrue to show the part, false to hide it.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shrinkFactor()

double ModelPart::shrinkFactor ( ) const

Gets the shrink filter factor.

Returns
Current shrink factor.
Here is the caller graph for this function:

◆ shrinkFilterEnabled()

bool ModelPart::shrinkFilterEnabled ( ) const

Checks whether the shrink filter is enabled.

Returns
True if the shrink filter is enabled.
Here is the caller graph for this function:

◆ visible()

bool ModelPart::visible ( )

Gets whether the model part is visible.

Returns
True if visible, false otherwise.
Here is the caller graph for this function:

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