cherish
|
The UserScene class contains scene graph that was created by user, including the construction tools. More...
#include <UserScene.h>
Public Slots | |
void | onItemChanged (QTreeWidgetItem *item, int column) |
void | onClicked (const QModelIndex &index) |
void | onRightClicked (const QModelIndex &index) |
Signals | |
void | sendRequestUpdate () |
void | canvasAdded (const std::string &name) |
void | photoAdded (const std::string &name, int idxCanvas) |
void | canvasRemoved (int row) |
void | photoRemoved (int rowCanvas, int rowPhoto) |
void | canvasSelectedColor (int row, int color) |
void | canvasVisibilitySet (int row, bool visibility) |
void | requestSceneToolStatus (bool &visibility) |
void | requestCanvasCreate (const osg::Vec3f &eye, const osg::Vec3f ¢er, const osg::Vec3f &up) |
Public Member Functions | |
UserScene () | |
UserScene (const UserScene &scene, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY) | |
META_Node (entity, UserScene) void initializeSG() | |
void | setGroupCanvases (osg::Group *group) |
const osg::Group * | getGroupCanvases () const |
void | setBookmarks (entity::Bookmarks *group) |
const entity::Bookmarks * | getBookmarks () const |
entity::Bookmarks * | getBookmarksModel () const |
void | setIdCanvas (unsigned int id) |
unsigned int | getIdCanvas () const |
void | setIdPhoto (unsigned int id) |
unsigned int | getIdPhoto () const |
void | setIdBookmark (unsigned int id) |
unsigned int | getIdBookmark () const |
void | setFilePath (const std::string &name) |
const std::string & | getFilePath () const |
bool | isSetFilePath () const |
void | addCanvas (QUndoStack *stack, const osg::Matrix &R, const osg::Matrix &T) |
void | addCanvas (QUndoStack *stack, const osg::Vec3f &normal, const osg::Vec3f ¢er) |
void | addCanvas (QUndoStack *stack, const osg::Matrix &R, const osg::Matrix &T, const std::string &name) |
void | addStroke (QUndoStack *stack, float u, float v, cher::EVENT event) |
void | addPolygon (QUndoStack *stack, float u, float v, cher::EVENT event) |
void | addLineSegment (QUndoStack *stack, float u, float v, cher::EVENT event) |
void | addPhoto (QUndoStack *stack, const std::string &fname) |
void | addBookmark (BookmarkWidget *widget, const osg::Vec3d &eye, const osg::Vec3d ¢er, const osg::Vec3d &up, const double &fov) |
void | updateBookmark (BookmarkWidget *widget, int row) |
void | deleteBookmark (BookmarkWidget *widget, const QModelIndex &index) |
void | eraseStroke (QUndoStack *stack, entity::Stroke *stroke, int first, int last, cher::EVENT event) |
entity::Canvas * | getCanvas (unsigned int id) |
entity::Canvas * | getCanvas (const std::string &name) |
int | getStrokeLevel () const |
int | getCanvasLevel () const |
int | getPhotoLevel () const |
bool | setCanvasCurrent (entity::Canvas *cnv) |
bool | setCanvasPrevious (entity::Canvas *cnv) |
void | setCanvasesButCurrent (bool enabled) |
void | setAllCanvases (bool enabled) |
bool | getCanvasesButCurrent () const |
entity::Canvas * | getCanvasCurrent () const |
entity::Canvas * | getCanvasPrevious () const |
int | getCanvasIndex (entity::Canvas *canvas) const |
int | getPhotoIndex (entity::Photo *photo, entity::Canvas *canvas) const |
entity::Canvas * | getCanvasFromIndex (int row) |
entity::Photo * | getPhoto (entity::Canvas *canvas, int row) |
int | getNumCanvases () const |
int | getNumPhotos (entity::Canvas *canvas) const |
int | getNumPhotos () |
int | getNumPhotosTill (entity::Canvas *canvas) |
void | editCanvasOffset (QUndoStack *stack, const osg::Vec3f &translate, cher::EVENT event) |
void | editCanvasRotate (QUndoStack *stack, const osg::Quat &rotation, const osg::Vec3f ¢er3d, cher::EVENT event) |
void | editCanvasClone (QUndoStack *stack, const osg::Vec3f &translate, cher::EVENT event) |
void | editCanvasSeparate (QUndoStack *stack, const osg::Vec3f &translate, cher::EVENT event) |
void | editCanvasDelete (QUndoStack *stack, entity::Canvas *canvas) |
void | editPhotoDelete (QUndoStack *stack, entity::Photo *photo, entity::Canvas *canvas) |
void | editPhotoPush (QUndoStack *stack, entity::Photo *photo, entity::Canvas *source, entity::Canvas *destination) |
void | editPhotoTransparency (entity::Photo *photo, entity::Canvas *canvas, float t) |
void | editPolygonDelete (QUndoStack *stack, entity::Polygon *poly, entity::Canvas *canvas) |
void | editStrokesPush (QUndoStack *stack, osg::Camera *camera) |
void | editStrokesMove (QUndoStack *stack, double u, double v, cher::EVENT event) |
void | editStrokesScale (QUndoStack *stack, double u, double v, cher::EVENT event) |
void | editStrokesRotate (QUndoStack *stack, double u, double v, cher::EVENT event) |
void | editStrokeDelete (QUndoStack *stack, entity::Stroke *stroke) |
void | editEntity2DDelete (QUndoStack *stack, entity::Entity2D *entity) |
void | editSelectedEntitiesDelete (QUndoStack *stack) |
bool | isEntityCurrent () const |
bool | isEmptyScene () const |
bool | clearUserData () |
void | updateWidgets () |
void | resetModel (CanvasPhotoWidget *widget) |
![]() | |
ProtectedGroup (const ProtectedGroup &group, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY) | |
Protected Member Functions | |
std::string | getCanvasName () |
std::string | getPhotoName () |
std::string | getBookmarkName () |
std::string | getEntityName (const std::string &name, unsigned int id) const |
void | strokeStart () |
void | strokeAppend (float u, float v) |
void | strokeFinish (QUndoStack *stack) |
bool | strokeValid () const |
void | polygonStart () |
void | polygonAppend (float u, float v, QUndoStack *stack) |
void | polygonEdit (float u, float v) |
void | polygonFinish (QUndoStack *stack) |
bool | polygonValid () const |
void | linesegmentStart () |
void | linesegmentAppend (float u, float v, QUndoStack *stack) |
void | linesegmentEdit (float u, float v) |
void | linesegmentFinish (QUndoStack *stack) |
bool | linesegmentValid () const |
void | entitiesMoveStart (double u, double v) |
void | entitiesMoveAppend (double u, double v) |
void | entitiesMoveFinish (QUndoStack *stack) |
bool | entitiesSelectedValid () const |
void | entitiesScaleStart (double u, double v) |
void | entitiesScaleAppend (double u, double v) |
void | entitiesScaleFinish (QUndoStack *stack) |
void | entitiesRotateStart (double u, double v) |
void | entitiesRotateAppend (double u, double v) |
void | entitiesRotateFinish (QUndoStack *stack) |
void | eraseStart (entity::Stroke *stroke, osg::Vec3d &hit) |
void | eraseAppend (entity::Stroke *stroke, osg::Vec3d &hit) |
void | eraseFinish (QUndoStack *stack, entity::Stroke *stroke) |
bool | eraseValid (entity::Stroke *stroke) const |
void | canvasOffsetStart () |
void | canvasOffsetAppend (const osg::Vec3f &t) |
void | canvasOffsetFinish (QUndoStack *stack) |
bool | canvasEditValid () const |
void | canvasCloneStart () |
void | canvasCloneAppend (const osg::Vec3f &t) |
void | canvasCloneFinish (QUndoStack *stack) |
bool | canvasCloneValid () const |
void | canvasSeparateStart () |
void | canvasSeparateAppend (const osg::Vec3f &t) |
void | canvasSeparateFinish (QUndoStack *stack) |
void | canvasRotateStart () |
void | canvasRotateAppend (const osg::Quat &r, const osg::Vec3f ¢er3d) |
void | canvasRotateFinish (QUndoStack *stack) |
bool | addCanvas (entity::Canvas *canvas) |
bool | removeCanvas (entity::Canvas *canvas) |
bool | addEntity (entity::Canvas *canvas, entity::Entity2D *entity) |
bool | removeEntity (entity::Canvas *canvas, entity::Entity2D *entity) |
The UserScene class contains scene graph that was created by user, including the construction tools.
The children of the UserScene are the canvases. One of the children is the Bookmarks group. The class also contains observer pointers to the current, previous and clone canvases. Normally, the clone canvas is NULL pointer, unless the user is in the process of creating a canvas by clonning or separation procedures.
The Bookmarks child can be put at any position as a child, but it's the only child. It is inserted when the user creates the first bookmark of the scene. Here is an example of possible user scene structure:
UserScene -> groupCanvas -> Canvas0 [previous] | |-> Canvas1 | |-> Canvas2 [current] | |-> ... (other canvases) |-> groupBookmarks -> SceneState0 [ bookmark0 ] -> SVMData |-> SceneState1 [ bookmark1 ]
The UserScene inherits osg::Group and QObject. The osg::Group is necessary for a scene graph representation, while QObject allows for signal and slots functionality. Most of the signal and slots are connected with MainWindow. The inheritance sequence is important: multiple inheritance requires QObject to be first. For more details on this, see: http://www.setnode.com/blog/qt-staticmetaobject-is-not-a-member-of/
entity::UserScene::UserScene | ( | ) |
Default constructor. This is the constructor to use within the application.
entity::UserScene::UserScene | ( | const UserScene & | scene, |
const osg::CopyOp & | copyop = osg::CopyOp::SHALLOW_COPY |
||
) |
Copy constructor which is required for OSG serialiazation functionality. It should never be used as-is within the application.
scene | is the scene to copy |
copyop | is the copy method, i.e. shallow vs. deep copy |
void entity::UserScene::addBookmark | ( | BookmarkWidget * | widget, |
const osg::Vec3d & | eye, | ||
const osg::Vec3d & | center, | ||
const osg::Vec3d & | up, | ||
const double & | fov | ||
) |
Creates and adds a bookmark to the Bookmarks group and the corresponding BookmarkWidget by asigning to it an automatic name.
widget | is the BookmarkWidget which is connected to the Bookmarks data structure |
eye | is the vector of camera eye to add as a bookmark |
center | is the vector of camera center to add as a bookmark |
up | is the vector of camera up to add as a bookmark |
fov | is the camera's projection matrix FOV |
void entity::UserScene::addCanvas | ( | QUndoStack * | stack, |
const osg::Matrix & | R, | ||
const osg::Matrix & | T | ||
) |
Creates and adds a Canvas as a child to the UserScene through undo/redo framework by assigning it an automatic name.
stack | is the undo/redo stack where the fur::AddCanvasCommand will be pushed to |
R | is the rotation matrix of the new canvas |
T | is the transtaltion matrix of the new canvas |
void entity::UserScene::addCanvas | ( | QUndoStack * | stack, |
const osg::Vec3f & | normal, | ||
const osg::Vec3f & | center | ||
) |
Creates and adds a Canvas as a child to the UserScene through undo/redo framework by asigning it an automatic name.
stack | is the undo/redo stack where the fur::AddCanvasCommand will be pushed to |
normal | is the normal of the new canvas |
center | is the center location of the new canvas |
void entity::UserScene::addCanvas | ( | QUndoStack * | stack, |
const osg::Matrix & | R, | ||
const osg::Matrix & | T, | ||
const std::string & | name | ||
) |
Creates and adds a Canvas as a child to the UserScene through undo/redo framework. This method is normally called by UserScene::addCanvas(QUndoStack*, const osg::Matrix&, const osg::Matrix&).
stack | is the undo/redo stack where the fur::AddCanvasCommand will be pushed to |
R | is the rotation matrix of the new canvas |
T | is the transtaltion matrix of the new canvas |
name | is the canvas name |
void entity::UserScene::addLineSegment | ( | QUndoStack * | stack, |
float | u, | ||
float | v, | ||
cher::EVENT | event | ||
) |
Add a point to a current line segment of the current canvas through undo/redo framework.
stack | is the undo/redo stack where the commend will be pushed to, |
u | is the local canvas U-coordinate of the segment, |
v | is the local canvas V-coordinate of the segment, |
event | is the current mouse state: click, move or release. |
void entity::UserScene::addPhoto | ( | QUndoStack * | stack, |
const std::string & | fname | ||
) |
Creates and adds a photo to a current canvas through undo/redo framework by asigning to it an automatic name.
stack | is the undo/redo stack where the fur::AddPhotoCommand will be pushed to |
fname | is the photo file path from where it is loaded |
void entity::UserScene::addPolygon | ( | QUndoStack * | stack, |
float | u, | ||
float | v, | ||
cher::EVENT | event | ||
) |
Adds a point to a current polygon of the current canvas through undo/redo framework.
stack | is the undo/redo stack where the fur::AddStrokeCommand will be pushed to |
u | is the local canvas U-coordinate of the stroke point [u, v] to append to Canvas::m_strokeCurrent |
v | is the local canvas V-coordinate of the stroke point [u, v] to append to Canvas::m_strokeCurrent |
event | is the current mouse state: click, drag or release |
void entity::UserScene::addStroke | ( | QUndoStack * | stack, |
float | u, | ||
float | v, | ||
cher::EVENT | event | ||
) |
Adds a point to a current stroke of the current canvas through undo/redo framework. If there is no current stroke exists, it creates it.
stack | is the undo/redo stack where the fur::AddStrokeCommand will be pushed to |
u | is the local canvas U-coordinate of the stroke point [u, v] to append to Canvas::m_strokeCurrent |
v | is the local canvas V-coordinate of the stroke point [u, v] to append to Canvas::m_strokeCurrent |
event | is the current mouse state: click, drag or release |
|
signal |
A signal which is connected with CanvasPhotoWidget::onCanvasAdded() to request to add a canvas item to the widget
|
signal |
A signal which is connected with CanvasPhotoWidget::onCanvasRemoved() to request to remove a canvas item from the widget
|
signal |
A signal which is connected with CanvasPhotoWidget::onCanvasSelectedColor() to request to update color indications for a certain canvas, e.g., when switching the canvas status from normal to current, or from current to previous.
|
signal |
A signal which is connected with CanvasPhotoWidget and is called from RootScene when the scene is loaded from file. It is to provide a back feedback from scene to the widget and it triggers the setting of the visibility icon ("open" or "closed" eye) which is related to the corresponding canvas.
row | is the sequential canvas index as it is in the canvas-photo widget |
visibility | is the boolean variable indicating whether the canvas is visible on the scene (true) or not (false). This value also corresponds to Canvas::getVisibilityData(). |
bool entity::UserScene::clearUserData | ( | ) |
A method to clear all the user data from scene graph: canvases, bookmarks and their contents.
void entity::UserScene::deleteBookmark | ( | BookmarkWidget * | widget, |
const QModelIndex & | index | ||
) |
Deletes the bookmark from Bookmarks data strucure as well as BookmarkWidget.
widget | is the BookmarkWidget which is connected to the Bookmarks data structure |
index | is the bookmark id number |
void entity::UserScene::editCanvasClone | ( | QUndoStack * | stack, |
const osg::Vec3f & | translate, | ||
cher::EVENT | event | ||
) |
The method is to create a new canvas by clonning a current canvas and then translating the newly created canvas along its normal. While in the clonning mode, three mouse modes make different states of creation:
stack | is the command stack for undo/redo framework |
translate | is the 3D difference vector which indicates translation along the canvas normal from previous canvas position |
event | is to indicate a mouse state: clicked, dragged or released |
void entity::UserScene::editCanvasDelete | ( | QUndoStack * | stack, |
entity::Canvas * | canvas | ||
) |
stack | is the command stack for undo/redo framework |
canvas | is the canvas to delete from UserScene |
void entity::UserScene::editCanvasOffset | ( | QUndoStack * | stack, |
const osg::Vec3f & | translate, | ||
cher::EVENT | event | ||
) |
The method is to edit the canvas 3D position, offset in particular. The offset is defined as a non-zero distance along the canvas normal in either positive or negative direction.
stack | is the command stack for undo/redo framework |
translate | is the 3D difference vector which indicates translation along the canvas normal from previous canvas position |
event | is to indicate a mouse state: clicked, dragged or released |
void entity::UserScene::editCanvasRotate | ( | QUndoStack * | stack, |
const osg::Quat & | rotation, | ||
const osg::Vec3f & | center3d, | ||
cher::EVENT | event | ||
) |
The method is to edit the canvas 3D position, by means of rotation. The rotation is defined as a quat which was performed along either local U or local V Canvas axis.
stack | is the command stack for undo/redo framework |
rotation | is the quat which indicates rotation from the previous canvas position |
center3d | is a 3D global point along which the rotation is performed (as of v0.4.0 this value is represented by a Canvas::m_center and is fixed) |
event | is to indicate a mouse state: clicked, dragged or released |
void entity::UserScene::editCanvasSeparate | ( | QUndoStack * | stack, |
const osg::Vec3f & | translate, | ||
cher::EVENT | event | ||
) |
Similar to editCanvasClone(), the method creates a new canvas by performing separation (not clonning). By separation it is meant a cut and paste of selected strokes into the new Canvas. While in the separation mode, three mouse modes make different states of separation:
stack | is the command stack for undo/redo framework |
translate | is the 3D difference vector which indicates translation along the canvas normal |
event | is to indicate a mouse state: clicked, dragged or released |
void entity::UserScene::editPhotoDelete | ( | QUndoStack * | stack, |
entity::Photo * | photo, | ||
entity::Canvas * | canvas | ||
) |
stack | is the command stack for undo/redo framework |
photo | is the photo to delete |
canvas | is the canvas from which the photo will be deleted |
void entity::UserScene::editPhotoPush | ( | QUndoStack * | stack, |
entity::Photo * | photo, | ||
entity::Canvas * | source, | ||
entity::Canvas * | destination | ||
) |
The method is to transfer a photo from one canvas to another. As of v0.4.0 it is in development and advised not to be used for time being; have to fix the syncronization with CanvasPhotoWidget
stack | is the command stack for undo/redo framework |
photo | is the photo to move |
source | is the canvas from where the photo will be removed |
destination | is the canvas to where to photo will be moved |
void entity::UserScene::editPhotoTransparency | ( | entity::Photo * | photo, |
entity::Canvas * | canvas, | ||
float | t | ||
) |
This method changes transparency level within scene graph and across bookmarks' scene states.
photo | is the photo to edit |
canvas | is the canvas to which the photo belongs to |
t | is the new transparency level, in range from 0 to 1. |
void entity::UserScene::editPolygonDelete | ( | QUndoStack * | stack, |
entity::Polygon * | poly, | ||
entity::Canvas * | canvas | ||
) |
A method to remove polygon from the canvas and write this operarion onto undo/redo framework.
void entity::UserScene::editSelectedEntitiesDelete | ( | QUndoStack * | stack | ) |
A method to delete all the entities of the current canvas that are being selected.
void entity::UserScene::editStrokeDelete | ( | QUndoStack * | stack, |
entity::Stroke * | stroke | ||
) |
The method is to delete a specified stroke.
stack | is the command stack for undo/redo framework |
stroke | is a stroke to delete from scene |
void entity::UserScene::editStrokesMove | ( | QUndoStack * | stack, |
double | u, | ||
double | v, | ||
cher::EVENT | event | ||
) |
The method is to perform a movement of a set of strokes within a canvas. That is, it can be considered as a 2D local move.
stack | is the command stack for undo/redo framework |
u | is the local U coordinate where the center of strokes [u, v] will be moved to |
v | is the local V coordinate where the center of strokes [u, v] will be moved to |
event | is to indicate a mouse state: clicked, dragged or released |
void entity::UserScene::editStrokesPush | ( | QUndoStack * | stack, |
osg::Camera * | camera | ||
) |
The method is to transfer a set of strokes from current canvas to previous. The transfer is projective, i.e. under given camera view the whole sketching image does not change, although the set of strokes now belongs to the previous canvas.
stack | is the command stack for undo/redo framework |
camera | is the camera pointer that contains current camera parameters (eye, center, up) |
void entity::UserScene::editStrokesRotate | ( | QUndoStack * | stack, |
double | u, | ||
double | v, | ||
cher::EVENT | event | ||
) |
The method is to perform a rotation of a set of strokes within a canvas. That is, it can be considered as a 2D local rotation.
stack | is the command stack for undo/redo framework |
u | is the local U coordinate where the local axis [u, v] will be rotated to |
v | is the local V coordinate where local axis [u, v] will be rotated to |
event | is to indicate a mouse state: clicked, dragged or released |
void entity::UserScene::editStrokesScale | ( | QUndoStack * | stack, |
double | u, | ||
double | v, | ||
cher::EVENT | event | ||
) |
The method is to perform a uniform scaling of a set of strokes within a canvas.
stack | is the command stack for undo/redo framework |
u | is the local U coordinate where the bounding box point [u, v] will be moved to |
v | is the local V coordinate where the bounding box point [u, v] will be moved to |
event | is to indicate a mouse state: clicked, dragged or released |
void entity::UserScene::eraseStroke | ( | QUndoStack * | stack, |
entity::Stroke * | stroke, | ||
int | first, | ||
int | last, | ||
cher::EVENT | event | ||
) |
This method is in development and must not be used as it is now (v0.4.0). The main idea is to erase some points from a stroke (eraser functionality)
stack | |
stroke | is the stroke from which to erase |
first | is the first index of interval of points to remove |
last | is the last index of interval of points to remove |
event | is event for pressed, dragged or released |
entity::Canvas * entity::UserScene::getCanvas | ( | unsigned int | id | ) |
Gets a pointer to a Canvas based on UserScene child index. This method is useful when, for example, we need to iterate through all the canvases of UserScene.
id | is the UserScene child index_sequence |
entity::Canvas * entity::UserScene::getCanvas | ( | const std::string & | name | ) |
Gets a pointer to a Canvas based on name match. Use with caution: in case if there are two or more canvases with the same name, it will return the first found child which name matches the given string.
name | is the name to match |
entity::Canvas * entity::UserScene::getCanvasCurrent | ( | ) | const |
bool entity::UserScene::getCanvasesButCurrent | ( | ) | const |
entity::Canvas * entity::UserScene::getCanvasFromIndex | ( | int | row | ) |
A method to return a Canvas pointer given sequential index within CanvasPhotoWidget. Returns a child of UserScene as a Canvas with given sequential index, taking Bookmarks group into consideration.
row | is the sequential index as is in CanvasPhotoWidget |
int entity::UserScene::getCanvasIndex | ( | entity::Canvas * | canvas | ) | const |
A method to return a sequential index of Canvas pointer. Normally, the index is aligned with child index of UserScene, however, it is not always the case since one of the children is Bookmarks group. The method is frequently used when we need to obtain the index number to deal with CanvasPhotoWidget entries. Example of methods that use it are: setting canvas as current / previous; model resetting, adding new canvas and photo addition and removal.
canvas | is the pointer on Canvas |
int entity::UserScene::getCanvasLevel | ( | ) | const |
Returns a level of Canvas within the whole scene graph, starting from the RootScene. It is used from EventHandler when using intersectors. The return value is defined manually, therefore it is important to keep them updated in case if scene graph is dramatically re-designed. The level for the Canvas is defined:
RootScene -> UserScene -> UserScene::m_groupCanvases -> Canvas [1] [2] [3] [4]
entity::Canvas * entity::UserScene::getCanvasPrevious | ( | ) | const |
int entity::UserScene::getNumCanvases | ( | ) | const |
int entity::UserScene::getNumPhotos | ( | entity::Canvas * | canvas | ) | const |
int entity::UserScene::getNumPhotos | ( | ) |
int entity::UserScene::getNumPhotosTill | ( | entity::Canvas * | canvas | ) |
entity::Photo * entity::UserScene::getPhoto | ( | entity::Canvas * | canvas, |
int | row | ||
) |
A method to return a Photo pointer given sequential index within a Canvas. Returns a child of Canvas with given sequential index.
canvas | is the Canvas which is a parent of requested Photo |
row | is the sequential index as is in CanvasPhotoWidget |
int entity::UserScene::getPhotoIndex | ( | entity::Photo * | photo, |
entity::Canvas * | canvas | ||
) | const |
Similar to getCanvasIndex(), the method is to return a sequential index of a photo as it is in CanvasPhotoWidget. It iterates through all the children of Canvas and compares them to the Photo pointer. Whenever the child is of type Photo, the index value increases. When the pointers match, the result index is returned.
photo | is a Photo of which index we want to obtain |
canvas | is a Canvas that contains the photo |
int entity::UserScene::getPhotoLevel | ( | ) | const |
Returns a level of Photo within the whole scene graph, starting from the RootScene. It is used from EventHandler when using intersectors. The return value is defined manually, therefore it is important to keep them updated in case if scene graph is dramatically re-designed. The level for the Photo is defined:
RootScene -> UserScene ->UserScene::m_groupCanvases -> Canvas -> Canvas::m_transform -> Canvas::m_switch -> Canvas::m_geodeData -> Photo [1] [2] [3] [4] [5] [6] [7] [8]
To simplify, a relative deepness is used, i.e.,
.
int entity::UserScene::getStrokeLevel | ( | ) | const |
Returns a level of Stroke within the whole scene graph, starting from the RootScene. It is used from EventHandler when using intersectors. The return value is defined manually, therefore it is important to keep them updated in case if scene graph is dramatically re-designed. The level for the Stroke is defined:
RootScene -> UserScene -> UserScene::m_groupCanvases -> Canvas -> Canvas::m_transform -> Canvas::m_switch -> Canvas::m_geodeData -> Stroke [1] [2] [3] [4] [5] [6] [7] [8]
To simplify, a relative deepness is used, i.e.,
.
bool entity::UserScene::isEmptyScene | ( | ) | const |
bool entity::UserScene::isEntityCurrent | ( | ) | const |
entity::UserScene::isSetFilePath | ( | ) | const |
entity::UserScene::META_Node | ( | entity | , |
UserScene | |||
) |
|
slot |
A slot which is called when the user performed a canvas left-click selection from a tree widget. Based on what item was selected, the slots changes the corresponding canvas status to current. This slot is connected with CanvasPhotoWidget::clicked().
|
slot |
A slot which is called when the canvas name was edited from CanvasPhotoWidget. Based on the edited item, the slot edits the name of the corresponding canvas. This slot is connected to CanvasPhotoWidget::itemChanged()
|
slot |
A slot which is called when the user performed a canvas right-click selection from a tree widget. Based on what item was selected, the slots changes the corresponding canvas status to previous. This slot is connected with CanvasPhotoWidget::rightClicked().
|
signal |
A signal which is connected with CanvasPhotoWidget::onPhotoAdded() to request to add a photo item to the widget
|
signal |
A signal which is connected with CanvasPhotoWidget::onPhotoRemoved() to request to remove a photo item from the widget
|
signal |
A signal to be emitter whenever user finishes editing camera position.
|
signal |
A signal to be emitted on addition of new canvas to the scene. It requests tool's status of MainWindow, and turns the internal frame on or off depending on the result.
visibility | is a boolean flag which indicated whether the tools are on (true) of off (false). |
void entity::UserScene::resetModel | ( | CanvasPhotoWidget * | widget | ) |
A method to reset Canvas and Photo data within the corresponding widget, as well as its model. It updates the widget with the new UserScene. This method is called when a file was open. The main principle is that it traverses the scene graph and adds the found Canvas entities to the CanvasPhotoWidget.
widget | is the CanvasPhotoWidget to update |
|
signal |
A signal which is connected with MainWindow::onRequestUpdate() to request for GLWidget update.
void entity::UserScene::setAllCanvases | ( | bool | enabled | ) |
A method to set the traversal masks for all the canvases.
enabled | is a flag to indicate whether all the canvases will be available for selection (intersectors) or not. |
bool entity::UserScene::setCanvasCurrent | ( | entity::Canvas * | cnv | ) |
Sets given Canvas as a current. This sets the variable UserScene::m_canvasCurrent to pointer of given Canvas. The current status also means change of Canvas frame color. When the frame color changes, the function emits a signal which is connected to CanvasPhotoWidget to mark the corresponding Canvas as selected in widget UI. Most of the time this method is called by either CanvasPhotoWidget, EventHandler methods or undo/redo framework classes (e.g. Add*Command and Edit*Command).
cnv | is the Canvas to set as current |
void entity::UserScene::setCanvasesButCurrent | ( | bool | enabled | ) |
Sets the traversal mask so that all the canvases (except current) are either traversible or not, depending on the input parameter. This function would be called from EventHandler when we want to exclude all the canvases but current from ray casting and intersection search (or enable the traversal mask back).
An example for turning the traversal off: selection of 2D entities within the current canvas (in this case we do not want the contents of other canvases to mix in with the intersection results). An example for turning the traversal masks on: 3D selection of Canvas by clicking on its pickable.
enabled | is a boolean variable which indicates whether we want to set the traversal to on (true) or off (false). |
bool entity::UserScene::setCanvasPrevious | ( | entity::Canvas * | cnv | ) |
Sets given Canvas as previous. This sets the variable UserScene::m_canvasPrevious to pointer of given Canvas. The previous status also means change of Canvas frame color. When the frame color changes, the function emits a signal which is connected to CanvasPhotoWidget to mark the corresponding Canvas as selected in widget UI. Most of the time this method will be called automatically by UserScene::setCanvasCurrent(), although there are few cases when it is called by other means, e.g., from CanvasPhotoWidget when user sets previous status by right mouse click.
cnv | is the Canvas to set as previous |
void entity::UserScene::updateBookmark | ( | BookmarkWidget * | widget, |
int | row | ||
) |
Updates the screenshot of the bookmark within the BookmarkWidget.
widget | is the BookmarkWidget which is connected to the Bookmarks data structure |
row | is the id number of the bookmark in a bookmark widget and Bookmarks data structure |
void entity::UserScene::updateWidgets | ( | ) |
A method which connects UserScene with MainWindow (and/or GLWidget). Its main purpose is to request for GLWidget::update() method to renew the viewport.