cherish
|
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>
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 > ¢ers) |
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::SceneState * | getSceneState (int row) const |
entity::SceneState * | getSceneState (int row) |
bool | replaceSceneState (int row, entity::SceneState *state) |
entity::SceneState * | getLastSceneState () |
void | addBookmark (BookmarkWidget *widget, const osg::Vec3d &eye, const osg::Vec3d ¢er, 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 ¢er, const osg::Vec3f &up, double fov) |
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.
entity::Bookmarks::Bookmarks | ( | ) |
Default constructor. Creates an empty bookmark group.
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.
parent | is the copy-from object |
copyop | is the copy method, e.g., deep copy vs. shallow copy |
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.
widget | is the BookmarkWidget to which a name is added |
eye | is the camera eye vector |
center | is the camera center vector |
up | is the camera up vector |
fov | is the camera FOV value |
void entity::Bookmarks::clearModel | ( | ) |
The method to manually clear all the vector data as well as remove all SceneState children.
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).
widget | is the widget from where the item is removed |
index | is the item's index |
std::string entity::Bookmarks::getBookmarkName | ( | int | row | ) | const |
row | is the index of which name we want to obtain |
const std::vector< osg::Vec3d > & entity::Bookmarks::getCenters | ( | ) | const |
A getter method to be used within OSG serialization procedures.
const std::vector< double > & entity::Bookmarks::getFovs | ( | ) | const |
A getter method to be used within OSG serialization procedures.
entity::SceneState * entity::Bookmarks::getLastSceneState | ( | ) |
A method to obtain lastly added child of a scene state.
const std::vector< std::string > & entity::Bookmarks::getNames | ( | ) | const |
A getter method to be used within OSG serialization procedures.
int entity::Bookmarks::getNumBookmarks | ( | ) | const |
const entity::SceneState * entity::Bookmarks::getSceneState | ( | int | row | ) | const |
row | is the index of SceneState |
entity::SceneState * entity::Bookmarks::getSceneState | ( | int | row | ) |
A method to extract scene state given a row index of the BookmarkWidget.
const std::vector< osg::Vec3d > & entity::Bookmarks::getUps | ( | ) | const |
A getter method to be used within OSG serialization procedures.
|
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.
index | is the row index of the clicked bookmark on BookmarkWidget. |
|
slot |
A slot is called when user does editing of the bookmark's name from GUI. It edits the corresponding name of the bookrmark.
item | is the pointer on the BookmarkWidget item from which the row index is derived to get the indexation for internal vectors of Bookmarks. |
|
slot |
A slot is called whenever user performs a change of order of the bookmarks from GUI.
|
slot |
A slot is called whenever the rows are removed, e.g. by user from GUI or when closing current file.
first | is the index of the first bookmark to remove |
last | is the index of the last bookmark to remove. The removal is done from the first till the last item inclusive. |
bool entity::Bookmarks::replaceSceneState | ( | int | row, |
entity::SceneState * | state | ||
) |
A method to replace the scene state with a given row onto a new one.
|
signal |
A signal to request GLWidget to be set with correspondance of the passed bookmark
row | is the bookmark index |
|
signal |
A singal to request bookmarks scene state to be updated.
state | is the pointer on SceneState to be updated |
|
signal |
A signal is sent whenever it is requested to change current state with the requested state associated with certain bookmark.
state | is the requested state that will be applied to the scene. |
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.
widget | is the widget to update |
void entity::Bookmarks::setCenters | ( | const std::vector< osg::Vec3d > & | centers | ) |
A setter method to be used within OSG serialization procedures.
void entity::Bookmarks::setFovs | ( | const std::vector< double > & | fovs | ) |
A setter method to be used within OSG serialization procedures.
void entity::Bookmarks::setNames | ( | const std::vector< std::string > & | names | ) |
A setter method to be used within OSG serialization procedures.
void entity::Bookmarks::setUps | ( | const std::vector< osg::Vec3d > & | ups | ) |
A setter method to be used within OSG serialization procedures.
void entity::Bookmarks::updateBookmark | ( | BookmarkWidget * | widget, |
int | row | ||
) |
This method might be obsolete in the future