CAD Viewer
|
CAD viewer class. More...
#include "mainwindow.h"
Public Slots | |
void | handleButton () |
This function is used to handle a button being pressed. More... | |
void | handleButton2 () |
This function is used to handle a button being pressed. More... | |
void | handleTreeClicked () |
This function is used to handle a the tree being clicked. More... | |
void | on_actionOpen_File_triggered () |
This function is used to handle the open file button being pressed. More... | |
void | on_actionItem_Options_triggered () |
This function is used to handle item options. More... | |
void | ResetCamera () |
This function is used to Reset the camera. More... | |
void | updateRenderFromTree (const QModelIndex &index) |
This function is used to Update the render from the tree. More... | |
void | updateRender () |
This function is used to Update the render. More... | |
void | on_actionStart_VR_triggered () |
start the VR session More... | |
void | on_actionStop_VR_triggered () |
stop the VR session More... | |
void | on_actionAdd_New_Item_triggered () |
this function is used to add a new child to the tree More... | |
void | on_actionHelp_triggered () |
this function opens the help dialog More... | |
void | on_actionReset_triggered () |
this function is used to reset the viewer More... | |
void | rotateModelX () |
this function is used to rotate the model in the vtk viewer in the x axis More... | |
void | rotateModelY () |
this function is used to rotate the model in the vtk viewer in the y axis More... | |
void | rotateModelZ () |
this function is used to rotate the model in the vtk viewer in the z axis More... | |
void | resetSliders () |
this function is used to reset Sliders More... | |
void | ShrinkFilter () |
this function is used to apply the shrink filter. More... | |
void | ClipFilter () |
this function is used to apply the clip filter. More... | |
void | on_actionResetPosition_triggered () |
this function is used to reset the objects position More... | |
void | on_actionResetColours_triggered () |
this function is used to reset the objects colours More... | |
void | on_action180Rotate_triggered () |
this function is used to flip the objects by 180 degrees More... | |
void | on_actionSaveRender_triggered () |
Save image of the render. More... | |
void | on_actionPrint_triggered () |
print image More... | |
void | ModifyLighting () |
change lighting of the render More... | |
void | on_actionBackground_triggered () |
change background colour of the render More... | |
void | handleRotation_x1 () |
handles clockwise rotation buttons in the x axis for VR More... | |
void | handleRotation_x2 () |
handles stop rotation buttons in the x axis for VR More... | |
void | handleRotation_x3 () |
handles anti clockwise rotation buttons in the x axis for VR More... | |
void | handleRotation_y1 () |
handles clockwise rotation buttons in the y axis for VR More... | |
void | handleRotation_y2 () |
handles stop rotation buttons in the y axis for VR More... | |
void | handleRotation_y3 () |
handles anti clockwise rotation buttons in the y axis for VR More... | |
void | handleRotation_z1 () |
handles clockwise rotation buttons in the z axis for VR More... | |
void | handleRotation_z2 () |
handles stop rotation buttons in the z axis for VR More... | |
void | handleRotation_z3 () |
handles anti clockwise rotation buttons in the z axis for VR More... | |
void | changeRotationSpeed () |
handles the rotation speed slider More... | |
void | ColourPicker () |
handles the colour picker More... | |
void | clipFilterSlider () |
handles clip filter More... | |
Signals | |
void | statusUpdateMessage (const QString &message, int timeout) |
This function is used to send a message to the status bar. More... | |
Public Member Functions | |
MainWindow (QWidget *parent=nullptr) | |
Constructor for the CAD viewer. More... | |
~MainWindow () | |
Deconstructor for the CAD viewer. More... | |
void | FullRotation () |
This function is used to set the model part list. More... | |
Private Attributes | |
Ui::MainWindow * | ui |
ui is the user interface More... | |
ModelPartList * | partList |
partList is the list of parts More... | |
vtkSmartPointer< vtkRenderer > | renderer |
renderer is the vtk renderer More... | |
vtkSmartPointer< vtkGenericOpenGLRenderWindow > | renderWindow |
renderWindow is the vtk render window More... | |
vtkSmartPointer< vtkLight > | light |
light is the vtk light More... | |
VRRenderThread * | VR_Render |
VR_Render is the VR render thread. More... | |
QString | StoredFileName |
StoredFileName is the name of the file. More... | |
bool | VR_Running = false |
VR_Running is a bool to check if VR is running. More... | |
int | k = 0 |
k is a counter for the VR rotation More... | |
int | previous_value |
previous_value is the previous value of the slider More... | |
double | red |
double | green |
double | blue |
red, green, blue are the rgb values for the colour picker More... | |
double | RotationSpeedValue = 1.0 |
RotationSpeedValue is the rotation speed value. More... | |
int | VR_RotationX = 0 |
VR_RotationX is the VR rotation in the x axis. More... | |
int | VR_RotationY = 0 |
VR_RotationY is the VR rotation in the y axis. More... | |
int | VR_RotationZ = 0 |
VR_RotationZ is the VR rotation in the z axis. More... | |
CAD viewer class.
This class is the main window for the CAD viewer that the use interfaces with.
MainWindow::MainWindow | ( | QWidget * | parent = nullptr | ) |
Constructor for the CAD viewer.
parent | is the parent widget |
This is the constructor for the mainWindow class. first the treeview is linked to add an options section. next the slots are connected to respective handlers. A inital render is created and added to the treeview.
MainWindow::~MainWindow | ( | ) |
Deconstructor for the CAD viewer.
This is the destructor for the mainWindow class.
|
slot |
handles the rotation speed slider
[in] | void |
This function is used to change the rotation speed of the model. First the VR_running flag is checked to see if VR is running. if it is, rotation speed is interpreted by the slider. the VR renderer then issues command to update the rotation speed.
|
slot |
this function is used to apply the clip filter.
[in] | void |
This function is used to apply a clip filter. First the index is retrieved from the treeview and the selected part is retrieved from the index. Next the status bar is updated with a message. the clip filter is applied to the selected part and the renderer is rendered. the render window is rendered.
|
slot |
handles clip filter
[in] | void |
|
slot |
handles the colour picker
[in] | void |
This function is used to generate a colour picker dialog box. First the status bar is updated with a message. the current index is retrieved form the tree view. the selected part is retrieved from the index. a new colour dialog box is created. the options of the colour dialog box are set. if the dialog box is accepted, the colour is retrieved and set to the selected part. the colour is set to the selected part.
void MainWindow::FullRotation | ( | ) |
This function is used to set the model part list.
This function is used to rotate the model 180 degrees. First the status bar is updated with a message. Next the current index of the treeview is retrieved and the selected part is retrieved from the index. that information is then forgotten about. the render is updated and the camera moved 180 degrees.
|
slot |
This function is used to handle a button being pressed.
New Item Button Pushed. This function shows a message at the bottom left corner of the application indicating that the New Item button was pushed. Once pushed, the New Item function is called.
[in] | void |
This functions is used to add a new item to the tree view. it is called by a button on the GUI. An update message is produced. The function on_actionAdd_New_Item_triggered() is called.
|
slot |
This function is used to handle a button being pressed.
[in] | void |
This functions opens the dialog box for part options. first the status bar is updated with a message. next a dialog box is created. information about the part is loaded to the dialog. after the user has finished with the dialog the information is retrieved and the part is updated. the status bar is updated with the file name. the colour of the model is set. the render window is rendered and the camera is reset.
|
slot |
handles clockwise rotation buttons in the x axis for VR
[in] | void |
This function is used to rotate the VR model in the x axis clockwise. First the VR_running flag is checked to see if VR is running. if it is, the VR render is issued a command to rotate the model.
|
slot |
handles stop rotation buttons in the x axis for VR
[in] | void |
This function is used to stop the VR model from rotating in the x axis. First the VR_running flag is checked to see if VR is running. if it is, the VR render is issued a command to stop rotating the model.
|
slot |
handles anti clockwise rotation buttons in the x axis for VR
[in] | void |
This function is used to rotate the VR model in the x axis anticlockwise. First the VR_running flag is checked to see if VR is running. if it is, the VR render is issued a command to rotate the model.
|
slot |
handles clockwise rotation buttons in the y axis for VR
[in] | void |
This function is used to rotate the VR model in the y axis clockwise. First the VR_running flag is checked to see if VR is running. if it is, the VR render is issued a command to rotate the model.
|
slot |
handles stop rotation buttons in the y axis for VR
[in] | void |
This function is used to stop the VR model from rotating in the y axis. First the VR_running flag is checked to see if VR is running. if it is, the VR render is issued a command to stop rotating the model.
|
slot |
handles anti clockwise rotation buttons in the y axis for VR
[in] | void |
This function is used to rotate the VR model in the y axis anticlockwise. First the VR_running flag is checked to see if VR is running. if it is, the VR render is issued a command to rotate the model.
|
slot |
handles clockwise rotation buttons in the z axis for VR
[in] | void |
This function is used to rotate the VR model in the z axis clockwise. First the VR_running flag is checked to see if VR is running. if it is, the VR render is issued a command to rotate the model.
|
slot |
handles stop rotation buttons in the z axis for VR
[in] | void |
This function is used to stop the VR model from rotating in the z axis. First the VR_running flag is checked to see if VR is running. if it is, the VR render is issued a command to stop rotating the model.
|
slot |
handles anti clockwise rotation buttons in the z axis for VR
[in] | void |
This function is used to rotate the VR model in the z axis anticlockwise. First the VR_running flag is checked to see if VR is running. if it is, the VR render is issued a command to rotate the model.
|
slot |
This function is used to handle a the tree being clicked.
[in] | void |
This function is used to handle the tree being clicked. the current index of the tree is retrieved and the selected part is retrieved from the index.
|
slot |
change lighting of the render
[in] | void |
This function is used to modify the lighting of the scene. first the value of the status bar is retrieved and converted to a string. This is displayed in a message. a new light is created and the intensity is set. the current index of the treeview is retrieved and the selected part is retrieved from the index. the actor and light are added to the renderer. the render window is rendered. the previous value is set to the slider value.
|
slot |
this function is used to flip the objects by 180 degrees
[in] | void |
This function is used to rotate the model 180 degrees. This is now obsolete.
|
slot |
this function is used to add a new child to the tree
[in] | void |
This function is used to add a new item to the tree view. when called the current index of the treeview is retrieved and the selected part is retrieved from the index. a new child is created and added to the selected part.
|
slot |
change background colour of the render
[in] | void |
This function is used to add a background image. first the status bar is updated with a message. next a file dialog box is opened to select a file. a file is selected by the user. the image is read and added to the renderer. the render window is rendered. the camera is reset. the render is updated.
|
slot |
this function opens the help dialog
[in] | void |
This function is used to show a help dialog box. a new dialog box is created, and its status is displayed in the status bar
|
slot |
This function is used to handle item options.
[in] | void |
This function is used to handle the save file action.
|
slot |
This function is used to handle the open file button being pressed.
[in] | void |
This function is used to handle the open file action. First current index of the treeview is retrieved and the selected part is retrieved from the index. Next a file dialog box is opened to select a file. a file is selected by the user. all files selected are itterated through and added to the treeview. the render is updated and the camera is reset.
|
slot |
print image
[in] | void |
This function is used to print a render of the model. First a new printer is created and a new print dialog box is created. if the dialog is accepted, a new painter is created and the pixmap is retrieved and drawn. the painter is ended.
|
slot |
this function is used to reset the viewer
[in] | void |
This function is used to reset the model. first the status bar is updated with a message. next the current index of the treeview is retrieved and the selected part is retrieved from the index. the colour of the selected part is set. the visibility of the selected part is set to true. the colours of the model are reset. the actor is rotated. the render is updated. the camera is reset. the render window is rendered. the sliders are reset. if the selected part has children, the function is recursively called for each child. the render is updated. the camera is reset. the render window is rendered. the sliders are reset.
|
slot |
this function is used to reset the objects colours
[in] | void |
This function is used to reset the colour of the model. first a message is displayed in the status bar. next the index of the part is retrieved from the treeview and the selected part is retrieved from the index. the number of children is retrieved. if the part has no children, the colour of the selected part is set and the render is updated. the camera is reset and the render window is rendered. if the part has children, the colour of the selected part is set for each child and the render is updated. the camera is reset and the render window is rendered.
|
slot |
this function is used to reset the objects position
[in] | void |
This function is used to reset the position of the model. first the index of the part is retrieved from the treeview. the selected part is retrieved from the index. the number of children is retrieved. if the part has no children, the actor is rotated and the render is updated. the camera is reset and the render window is rendered. if the part has children, the actor is rotated for each child and the render is updated. the camera is reset and the render window is rendered.
|
slot |
Save image of the render.
[in] | void |
This function is used to save a render of the model. First a file dialog box is opened to select a file to save to. Next the pixmap is retrieved and saved to the file.
|
slot |
start the VR session
[in] | void |
This function is used to start the VR viewer. first the status bar is updated with a message. next the VR viewer is started. The actors are made off line to run in the thread and are added to the VR render. the VR render is started.
|
slot |
stop the VR session
[in] | void |
This function is used to stop the VR viewer when the stop VR action is triggered. first the status bar is updated with a message. next the VR render is destroyed. the VR running flag is set to false.
|
slot |
This function is used to Reset the camera.
[in] | void |
This function is used to reset the camera. by setting the azimuth and elevation of the camera to 30 and resetting the camera clipping range.
|
slot |
this function is used to reset Sliders
[in] | void |
This function is used to reset the sliders. the value of each slider is set to 0.
|
slot |
this function is used to rotate the model in the vtk viewer in the x axis
[in] | void |
This function is used to rotate the model in the X axis.first the index of the part is retrieved from the treeview. the selected part is retrieved from the index. the value of the slider is retrieved and converted to a string. the number of children is retrieved. if the part has no children, the actor is rotated and the render is updated. the camera is reset and the render window is rendered. if the part has children, the actor is rotated for each child and the render is updated. the camera is reset and the render window is rendered.
|
slot |
this function is used to rotate the model in the vtk viewer in the y axis
[in] | void |
This function is used to rotate the model in the Y axis.first the index of the part is retrieved from the treeview. the selected part is retrieved from the index. the value of the slider is retrieved and converted to a string. the number of children is retrieved. if the part has no children, the actor is rotated and the render is updated. the camera is reset and the render window is rendered. if the part has children, the actor is rotated for each child and the render is updated. the camera is reset and the render window is rendered.
|
slot |
this function is used to rotate the model in the vtk viewer in the z axis
[in] | void |
This function is used to rotate the model in the Z axis. first the index of the part is retrieved from the treeview. the selected part is retrieved from the index. the value of the slider is retrieved and converted to a string. the number of children is retrieved. if the part has no children, the actor is rotated and the render is updated. the camera is reset and the render window is rendered. if the part has children, the actor is rotated for each child and the render is updated. the camera is reset and the render window is rendered.
|
slot |
this function is used to apply the shrink filter.
[in] | void |
This function is used to apply a shrink filter. First the index is retrieved from the treeview and the selected part is retrieved from the index. Next the status bar is updated with a message. the shrink filter is applied to the selected part and the renderer is rendered. the render window is rendered.
|
signal |
This function is used to send a message to the status bar.
[in] | message | is the message to be sent |
[in] | timeout | is the time the message is displayed for |
[out] | prints | message to status bar |
|
slot |
This function is used to Update the render.
[in] | void |
This function is used to update the render. first all view props are removed from the renderer and the render is updated from the tree. the renderer is rendered.
|
slot |
This function is used to Update the render from the tree.
[in] | index | is the index of the tree |
This function is used to update the render from the tree. if the index passed is valid then the selected part is retrieved from the index. the new actor is added and other camera settings are set. if the index has children, the function is recursively called for each child.
|
private |
red, green, blue are the rgb values for the colour picker
|
private |
|
private |
k is a counter for the VR rotation
|
private |
light is the vtk light
|
private |
partList is the list of parts
|
private |
previous_value is the previous value of the slider
|
private |
|
private |
renderer is the vtk renderer
|
private |
renderWindow is the vtk render window
|
private |
RotationSpeedValue is the rotation speed value.
|
private |
StoredFileName is the name of the file.
|
private |
ui is the user interface
|
private |
VR_Render is the VR render thread.
|
private |
VR_RotationX is the VR rotation in the x axis.
|
private |
VR_RotationY is the VR rotation in the y axis.
|
private |
VR_RotationZ is the VR rotation in the z axis.
|
private |
VR_Running is a bool to check if VR is running.