cherish
Public Slots | Signals | Public Member Functions | List of all members
entity::Bookmarks Class Reference

A proxy class that helps to connect scene graph camera positions (in format eye, center, up and name) with the corresponding BookmarkWidget. More...

#include <Bookmarks.h>

Inheritance diagram for entity::Bookmarks:

Public Slots

void onClicked (const QModelIndex &index)
 
void onItemChanged (QListWidgetItem *item)
 
void onRowsMoved (const QModelIndex &, int start, int end, const QModelIndex &, int row)
 
void onRowsRemoved (const QModelIndex &, int first, int last)
 

Signals

void requestBookmarkSet (int row)
 
void requestSceneData (entity::SceneState *state)
 
void requestSceneStateSet (entity::SceneState *state)
 

Public Member Functions

 Bookmarks ()
 
 Bookmarks (const Bookmarks &parent, osg::CopyOp copyop=osg::CopyOp::SHALLOW_COPY)
 
void setCenters (const std::vector< osg::Vec3d > &centers)
 
const std::vector< osg::Vec3d > & getCenters () const
 
void setUps (const std::vector< osg::Vec3d > &ups)
 
const std::vector< osg::Vec3d > & getUps () const
 
void setNames (const std::vector< std::string > &names)
 
const std::vector< std::string > & getNames () const
 
void setFovs (const std::vector< double > &fovs)
 
const std::vector< double > & getFovs () const
 
const entity::SceneStategetSceneState (int row) const
 
entity::SceneStategetSceneState (int row)
 
bool replaceSceneState (int row, entity::SceneState *state)
 
entity::SceneStategetLastSceneState ()
 
void addBookmark (BookmarkWidget *widget, const osg::Vec3d &eye, const osg::Vec3d &center, const osg::Vec3d &up, const std::string &name, const double &fov)
 
void updateBookmark (BookmarkWidget *widget, int row)
 
void deleteBookmark (BookmarkWidget *widget, const QModelIndex &index)
 
void resetModel (BookmarkWidget *widget)
 
void clearModel ()
 
std::string getBookmarkName (int row) const
 
int getNumBookmarks () const
 
bool editBookmarkPose (int index, const osg::Vec3f &eye, const osg::Vec3f &center, const osg::Vec3f &up, double fov)
 

Detailed Description

A proxy class that helps to connect scene graph camera positions (in format eye, center, up and name) with the corresponding BookmarkWidget.

The need for the class to inherit osg::Group class is so that to include the bookmarks into saving to file procedure which is done by OpenSceneGraph.

Scene graph wise, the entity::Bookmarks is an osg::Group node that contains STL data for camera positions and names. Also osg::Group helps to maintain the entity::SceneState as its children for each corresponding bookmark without the need of direct serialization of each scene state.

The need to inherit QObject class is so that to use signals and slots functionality. The signals and slots are connected to the BookmarkWidget and thus it assures a simultaneous update whether the bookmark changed are made directly from the widget, or trigerred by scene graph functions (e.g., on reload the scene from file).

Note: there can only be one entity::Bookmarks object in a scene graph, a child of entity::UserScene. This class servers as a container for a list of entity::SceneState -s and a list of camera parameters for each scene state.

Constructor & Destructor Documentation

§ Bookmarks() [1/2]

entity::Bookmarks::Bookmarks ( )

Default constructor. Creates an empty bookmark group.

§ Bookmarks() [2/2]

entity::Bookmarks::Bookmarks ( const Bookmarks parent,
osg::CopyOp  copyop = osg::CopyOp::SHALLOW_COPY 
)

Constructor by copy. This functions is only used by OSG serializer. It is never called for within the application.

Parameters
parentis the copy-from object
copyopis the copy method, e.g., deep copy vs. shallow copy

Member Function Documentation

§ addBookmark()

void entity::Bookmarks::addBookmark ( BookmarkWidget widget,
const osg::Vec3d &  eye,
const osg::Vec3d &  center,
const osg::Vec3d &  up,
const std::string &  name,
const double &  fov 
)

A method that performs an addition of a bookmark to the data structure. It also requests a screenshot of the bookmark from GLWidget, and SceneState to add as a child to the bookmakr which strips its data from the current state of RootScene.

Parameters
widgetis the BookmarkWidget to which a name is added
eyeis the camera eye vector
centeris the camera center vector
upis the camera up vector
fovis the camera FOV value

§ clearModel()

void entity::Bookmarks::clearModel ( )

The method to manually clear all the vector data as well as remove all SceneState children.

§ deleteBookmark()

void entity::Bookmarks::deleteBookmark ( BookmarkWidget widget,
const QModelIndex &  index 
)

This method perform deletion of the indexed item from the provided widget. Note: it does not erase elements from internal vector data structures since they are handled by the corresponding slot onRowsRemoved() (same for the SceneState children).

Parameters
widgetis the widget from where the item is removed
indexis the item's index

§ getBookmarkName()

std::string entity::Bookmarks::getBookmarkName ( int  row) const
Parameters
rowis the index of which name we want to obtain
Returns
The name of specified row.

§ getCenters()

const std::vector< osg::Vec3d > & entity::Bookmarks::getCenters ( ) const

A getter method to be used within OSG serialization procedures.

§ getFovs()

const std::vector< double > & entity::Bookmarks::getFovs ( ) const

A getter method to be used within OSG serialization procedures.

§ getLastSceneState()

entity::SceneState * entity::Bookmarks::getLastSceneState ( )

A method to obtain lastly added child of a scene state.

§ getNames()

const std::vector< std::string > & entity::Bookmarks::getNames ( ) const

A getter method to be used within OSG serialization procedures.

§ getNumBookmarks()

int entity::Bookmarks::getNumBookmarks ( ) const
Returns
The number of bookmarks.

§ getSceneState() [1/2]

const entity::SceneState * entity::Bookmarks::getSceneState ( int  row) const
Parameters
rowis the index of SceneState
Returns
Pointer on the corresponding SceneState.

§ getSceneState() [2/2]

entity::SceneState * entity::Bookmarks::getSceneState ( int  row)

A method to extract scene state given a row index of the BookmarkWidget.

§ getUps()

const std::vector< osg::Vec3d > & entity::Bookmarks::getUps ( ) const

A getter method to be used within OSG serialization procedures.

§ onClicked

void entity::Bookmarks::onClicked ( const QModelIndex &  index)
slot

A slot is called whenever user performs a click on a bookmark from GUI. The slot sets up the requested bookmark and its corresponding scene state.

Parameters
indexis the row index of the clicked bookmark on BookmarkWidget.

§ onItemChanged

void entity::Bookmarks::onItemChanged ( QListWidgetItem *  item)
slot

A slot is called when user does editing of the bookmark's name from GUI. It edits the corresponding name of the bookrmark.

Parameters
itemis the pointer on the BookmarkWidget item from which the row index is derived to get the indexation for internal vectors of Bookmarks.

§ onRowsMoved

void entity::Bookmarks::onRowsMoved ( const QModelIndex &  ,
int  start,
int  end,
const QModelIndex &  ,
int  row 
)
slot

A slot is called whenever user performs a change of order of the bookmarks from GUI.

§ onRowsRemoved

void entity::Bookmarks::onRowsRemoved ( const QModelIndex &  ,
int  first,
int  last 
)
slot

A slot is called whenever the rows are removed, e.g. by user from GUI or when closing current file.

Parameters
firstis the index of the first bookmark to remove
lastis the index of the last bookmark to remove. The removal is done from the first till the last item inclusive.

§ replaceSceneState()

bool entity::Bookmarks::replaceSceneState ( int  row,
entity::SceneState state 
)

A method to replace the scene state with a given row onto a new one.

§ requestBookmarkSet

void entity::Bookmarks::requestBookmarkSet ( int  row)
signal

A signal to request GLWidget to be set with correspondance of the passed bookmark

Parameters
rowis the bookmark index

§ requestSceneData

void entity::Bookmarks::requestSceneData ( entity::SceneState state)
signal

A singal to request bookmarks scene state to be updated.

Parameters
stateis the pointer on SceneState to be updated

§ requestSceneStateSet

void entity::Bookmarks::requestSceneStateSet ( entity::SceneState state)
signal

A signal is sent whenever it is requested to change current state with the requested state associated with certain bookmark.

Parameters
stateis the requested state that will be applied to the scene.

§ resetModel()

void entity::Bookmarks::resetModel ( BookmarkWidget widget)

This method is called only when a scene is loaded from file. It resets the widget's content, updates the screenshots. The addition of the bookmark data to the widget also triggers creation of the bookmark tool and addition it to the scene graph through the signals-slots.

Parameters
widgetis the widget to update
See also
MainWindows::onBookmarkAddedToWidget().

§ setCenters()

void entity::Bookmarks::setCenters ( const std::vector< osg::Vec3d > &  centers)

A setter method to be used within OSG serialization procedures.

§ setFovs()

void entity::Bookmarks::setFovs ( const std::vector< double > &  fovs)

A setter method to be used within OSG serialization procedures.

§ setNames()

void entity::Bookmarks::setNames ( const std::vector< std::string > &  names)

A setter method to be used within OSG serialization procedures.

§ setUps()

void entity::Bookmarks::setUps ( const std::vector< osg::Vec3d > &  ups)

A setter method to be used within OSG serialization procedures.

§ updateBookmark()

void entity::Bookmarks::updateBookmark ( BookmarkWidget widget,
int  row 
)

This method might be obsolete in the future


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