cherish
Public Member Functions | List of all members
RootScene Class Reference

Contains all the entities that will appear on the scene: both user scene and utility entities (i.e. global axis). More...

#include <RootScene.h>

Inheritance diagram for RootScene:
osg::ProtectedGroup

Public Member Functions

 RootScene (QUndoStack *undoStack)
 
entity::UserScenegetUserScene () const
 
QUndoStack * getUndoStack () const
 
void setFilePath (const std::string &name)
 
bool isSetFilePath () const
 
bool isSavedToFile () const
 
void setSavedToFile (bool saved)
 
bool isEmptyScene () const
 
void clearUserData ()
 
void setToolsVisibility (bool vis)
 
bool getToolsVisibility () const
 
void setAxesVisibility (bool vis)
 
bool getAxesVisibility () const
 
void setCanvasVisibilityAll (entity::Canvas *canvas, bool vis)
 
bool getCanvasVisibilityAll (entity::Canvas *canvas) const
 
bool writeScenetoFile ()
 
bool exportSceneToFile (const std::string &name)
 
bool loadSceneFromFile ()
 
int getStrokeLevel () const
 
int getCanvasLevel () const
 
int getPhotoLevel () const
 
void addCanvas (const osg::Matrix &R, const osg::Matrix &T)
 
void addCanvas (const osg::Vec3f &normal, const osg::Vec3f &center)
 
void addCanvas (const osg::Matrix &R, const osg::Matrix &T, const std::string &name)
 
void addStroke (float u, float v, cher::EVENT event)
 
void addPolygon (float u, float v, cher::EVENT event)
 
void addLineSegment (float u, float v, cher::EVENT event)
 
void selectAllEntities ()
 
void addPhoto (const std::string &fname)
 
void addBookmark (BookmarkWidget *widget, const osg::Vec3d &eye, const osg::Vec3d &center, const osg::Vec3d &up, const double &fov)
 
bool addSVMData ()
 
bool addPhotoScaleData ()
 
bool hidePhotoScaleData ()
 
bool removePhotoScaleData ()
 
const entity::SVMDatagetPhotoScaleData () const
 
bool addCamPoseData ()
 
void hideAndUpdateSVMData ()
 
void hideAndUpdateCamPoseData ()
 
entity::SVMDatagetSVMDataCurrent () const
 
entity::CamPoseDatagetCamPoseDataCurrent () const
 
void addBookmarkTool (const osg::Vec3d &eye, const osg::Vec3d &center, const osg::Vec3d &up)
 
void updateBookmark (BookmarkWidget *widget, int row)
 
void deleteBookmark (BookmarkWidget *widget, const QModelIndex &index)
 
void deleteBookmarkTool (int first, int last)
 
void resetBookmarks (BookmarkWidget *widget)
 
void setBookmarkToolVisibility (bool vis)
 
bool getBookmarkToolVisibility () const
 
void eraseStroke (entity::Stroke *stroke, int first, int last, cher::EVENT event)
 
bool setCanvasCurrent (entity::Canvas *cnv)
 
bool setCanvasPrevious (entity::Canvas *cnv)
 
void setCanvasesButCurrent (bool enable)
 
void setAllCanvases (bool enable)
 
entity::CanvasgetCanvasCurrent () const
 
entity::CanvasgetCanvasPrevious () const
 
entity::BookmarksgetBookmarksModel () const
 
void editCanvasOffset (const osg::Vec3f &translate, cher::EVENT event)
 
void editCanvasRotate (const osg::Quat &rotation, const osg::Vec3f &center3d, cher::EVENT event)
 
void editCanvasClone (const osg::Vec3f &translate, cher::EVENT event)
 
void editCanvasSeparate (const osg::Vec3f &translate, cher::EVENT event)
 
void editCanvasDelete (entity::Canvas *canvas)
 
void editPhotoDelete (entity::Photo *photo, entity::Canvas *canvas)
 
void editPhotoPush (entity::Photo *photo, entity::Canvas *source, entity::Canvas *destination)
 
void editPolygonDelete (entity::Polygon *poly, entity::Canvas *canvas)
 
void editStrokesPush (osg::Camera *camera)
 
void editStrokesMove (double u, double v, cher::EVENT event)
 
void editStrokesScale (double u, double v, cher::EVENT event)
 
void editStrokesRotate (double u, double v, cher::EVENT event)
 
void editStrokeDelete (entity::Stroke *stroke)
 
void editEntity2DDelete (entity::Entity2D *entity)
 
void copyToBuffer ()
 
void cutToBuffer ()
 
void pasteFromBuffer ()
 
const std::vector< osg::ref_ptr< entity::Entity2D > > & getBuffer () const
 
entity::SceneStatecreateSceneState () const
 
bool setSceneState (const entity::SceneState *state)
 
entity::BookmarkToolgetBookmarkTool (int index)
 
- Public Member Functions inherited from osg::ProtectedGroup
 ProtectedGroup (const ProtectedGroup &group, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
 

Detailed Description

Contains all the entities that will appear on the scene: both user scene and utility entities (i.e. global axis).

This class also represents an intersface for entity::UserScene.

Constructor & Destructor Documentation

§ RootScene()

RootScene::RootScene ( QUndoStack *  undoStack)

Constructor: initializes structure of entity::UserScene, initializes global tools.

Member Function Documentation

§ addBookmark()

void RootScene::addBookmark ( BookmarkWidget widget,
const osg::Vec3d &  eye,
const osg::Vec3d &  center,
const osg::Vec3d &  up,
const double &  fov 
)

A method to add a new camera position as a bookmark to the BookmarkWidget, and also to the scene graph as entity::SceneState.

§ addCanvas() [1/3]

void RootScene::addCanvas ( const osg::Matrix &  R,
const osg::Matrix &  T 
)

A method to add new canvas to scene with provided rotation and translation matrices.

§ addCanvas() [2/3]

void RootScene::addCanvas ( const osg::Vec3f &  normal,
const osg::Vec3f &  center 
)

A method to add new canvas to scene with provided normal and center point.

§ addCanvas() [3/3]

void RootScene::addCanvas ( const osg::Matrix &  R,
const osg::Matrix &  T,
const std::string &  name 
)

A method to add canvas to scene with provided rotation and translation matrices, as well as a name.

§ addLineSegment()

void RootScene::addLineSegment ( float  u,
float  v,
cher::EVENT  event 
)

Add line segment point given local coordinates.

§ addPhoto()

void RootScene::addPhoto ( const std::string &  fname)

A method to add specified photo to the current canvas.

§ addPhotoScaleData()

bool RootScene::addPhotoScaleData ( )

A method to add SVMData as a child to RootScene when using photo re-scaling.

§ addPolygon()

void RootScene::addPolygon ( float  u,
float  v,
cher::EVENT  event 
)

A method to add/contribute to a polygon given local coordinates.

§ addStroke()

void RootScene::addStroke ( float  u,
float  v,
cher::EVENT  event 
)

A method to add/contribute to a stroke given local coordinates.

§ addSVMData()

bool RootScene::addSVMData ( )

A method to suplement a last added entity::SceneState with entity::SVMData as a child. Used to create a new bookmark using correspondence between four points in two different planes This method requires presense of at least two canvases on the screen.

§ clearUserData()

void RootScene::clearUserData ( )

A method to make the scene empty.

See also
isEmptyScene().

§ createSceneState()

entity::SceneState * RootScene::createSceneState ( ) const
Returns
A pointer on SceneState allocated instance. Note: this pointer is not managed by smart pointers and must be deleted manually.
See also
entity::SceneState::stripDataFrom()

§ editPolygonDelete()

void RootScene::editPolygonDelete ( entity::Polygon poly,
entity::Canvas canvas 
)

A method to remove a given polygon from the canvas; called from EventHandler.

§ exportSceneToFile()

bool RootScene::exportSceneToFile ( const std::string &  name)

A method to export the user scene to OBJ or 3DS format. It uses Parallel Transport Frame algorithm in order to convert shadered strokes into triangular meshes.

§ getAxesVisibility()

bool RootScene::getAxesVisibility ( ) const
Returns
true if the global axis are visible.

§ getBookmarkTool()

entity::BookmarkTool * RootScene::getBookmarkTool ( int  index)

A method to obtain a bookmark tool associated with the entity::Bookmarks.

Parameters
indexis the tool index associated with the bookmark data.

§ getBookmarkToolVisibility()

bool RootScene::getBookmarkToolVisibility ( ) const
Returns
A visibility flag for the set of all the bookmark tools. Since the visibility cannot be set for individual bookmarks, the returned value represents the visibility of the whole group: true for visibile and false for being invisible.

§ getCamPoseDataCurrent()

entity::CamPoseData * RootScene::getCamPoseDataCurrent ( ) const

A method to obtain a pointer on campose data that is in the state of editing by user. If no such data available, return 0.

§ getCanvasLevel()

int RootScene::getCanvasLevel ( ) const
Returns
the depth of where entity::Canvas geomtries are located.

§ getCanvasVisibilityAll()

bool RootScene::getCanvasVisibilityAll ( entity::Canvas canvas) const
Returns
true if canvas visible.

§ getPhotoLevel()

int RootScene::getPhotoLevel ( ) const
Returns
the depth of where entity::Photo geometries are located.

§ getPhotoScaleData()

const entity::SVMData * RootScene::getPhotoScaleData ( ) const
Returns
a pointer on SVMData which is a direct child of RootScene.

§ getStrokeLevel()

int RootScene::getStrokeLevel ( ) const
Returns
the depth of where entity::Stroke geometries are located.

§ getSVMDataCurrent()

entity::SVMData * RootScene::getSVMDataCurrent ( ) const

A method to obtain a pointer on SVMData that is in the state of editing by user. If no such data available, return NULL.

§ getToolsVisibility()

bool RootScene::getToolsVisibility ( ) const
Returns
true if the tools are visible.

§ getUndoStack()

QUndoStack * RootScene::getUndoStack ( ) const
Returns
pointer on undo/redo stack.

§ getUserScene()

entity::UserScene * RootScene::getUserScene ( ) const
Returns
pointer on user scene.

§ hideAndUpdateCamPoseData()

void RootScene::hideAndUpdateCamPoseData ( )

A method to hide all the visible CamPoseData from scene.

§ hideAndUpdateSVMData()

void RootScene::hideAndUpdateSVMData ( )

A method to hide all the visible SVMData from scene.

§ hidePhotoScaleData()

bool RootScene::hidePhotoScaleData ( )

A method to hide SVMData which is a child of RootScene. Used when doing photo re-scaling.

§ isEmptyScene()

bool RootScene::isEmptyScene ( ) const
Returns
true if there are no elements introduced by used on the scene.
See also
clearUserData().

§ isSavedToFile()

bool RootScene::isSavedToFile ( ) const
Returns
true if there is no difference between what was saved on disk and current scene graph.

§ isSetFilePath()

bool RootScene::isSetFilePath ( ) const
Returns
true if the scene is already attached to a file name.

§ loadSceneFromFile()

bool RootScene::loadSceneFromFile ( )
Returns
true if scene was loaded successfully from file.

§ removePhotoScaleData()

bool RootScene::removePhotoScaleData ( )

A method to remove any SVMData as a child of RootScene when done using photo re-scaling.

§ resetBookmarks()

void RootScene::resetBookmarks ( BookmarkWidget widget)

A method which is called when a file is opened. It resets the screenshot bookmarks.

Parameters
widgetis a pointer on bookmark widget (member of MainWindow).

§ selectAllEntities()

void RootScene::selectAllEntities ( )

A method to select all strokes of the current canvas.

§ setAllCanvases()

void RootScene::setAllCanvases ( bool  enable)

A method to set up traversal masks for all the canvases.

See also
entity::UserScene::setAllCanvases(), entity::UserScene::setCanvasesButCurrent().

§ setAxesVisibility()

void RootScene::setAxesVisibility ( bool  vis)

A method to make the global axis tool to hide or appear.

§ setBookmarkToolVisibility()

void RootScene::setBookmarkToolVisibility ( bool  vis)

A method to set visibility of all the bookmarks tools. The visibility cannot be set for individual bookmarks tool, only for the whole group.

Parameters
visis the visibility flag: true for visibile and false for invisible state.

§ setCanvasesButCurrent()

void RootScene::setCanvasesButCurrent ( bool  enable)

A method to set up traversal masks for all the canvases but current.

See also
entity::UserScene::setCanvasesButCurrent(), RootScene::setAllCanvases().

§ setCanvasVisibilityAll()

void RootScene::setCanvasVisibilityAll ( entity::Canvas canvas,
bool  vis 
)

A method to set up canvas visibility for both scene graph and GUI.

§ setFilePath()

void RootScene::setFilePath ( const std::string &  name)

A method to attach current scene graph to a specified file name where the scene will be kept on disk.

§ setSavedToFile()

void RootScene::setSavedToFile ( bool  saved)

Method is only used by testers. Not to be used otherwise.

§ setSceneState()

bool RootScene::setSceneState ( const entity::SceneState state)
Parameters
Apointer on SceneState instance which is served as a source for RootScene settings.
Returns
Whether the operation was performed successfully (no size discrepancies found) or not.

§ setToolsVisibility()

void RootScene::setToolsVisibility ( bool  vis)

A method to make all the tools hide or appear.

§ writeScenetoFile()

bool RootScene::writeScenetoFile ( )

A method to write the user scene to file.


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