cherish
|
#include <Canvas.h>
Public Member Functions | |
Canvas (const Canvas &cnv, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY) | |
virtual void | initializeTools () |
virtual void | initializeSG () |
virtual void | initializeStateMachine () |
virtual void | initializeMasks () |
osg::Matrix | getMatrixInverse () const |
osg::Matrix | getMatrix () const |
osg::Vec3f | getCenter3D () const |
ProgramStroke * | getProgramStroke () const |
ProgramPolygon * | getProgramPolygon () const |
ProgramLineSegment * | getProgramLineSegment () const |
void | setMatrixTranslation (const osg::Matrix &T) |
const osg::Matrix & | getMatrixTranslation () const |
void | setTransform (osg::MatrixTransform *t) |
const osg::MatrixTransform * | getTransform () const |
osg::MatrixTransform * | getTransform () |
void | setSwitch (osg::Switch *sw) |
const osg::Switch * | getSwitch () const |
void | setGroupData (osg::Group *group) |
const osg::Group * | getGroupData () const |
void | setGeodeStrokes (osg::Geode *geode) |
const osg::Geode * | getGeodeStrokes () const |
void | setGeodePhotos (osg::Geode *geode) |
const osg::Geode * | getGeodePhotos () const |
void | setGeodePolygons (osg::Geode *geode) |
const osg::Geode * | getGeodePolygons () const |
void | setGeodeLineSegments (osg::Geode *geode) |
const osg::Geode * | getGeodeLineSegments () const |
void | setCenter (const osg::Vec3f ¢er) |
const osg::Vec3f & | getCenter () const |
void | setNormal (const osg::Vec3f &normal) |
const osg::Vec3f & | getNormal () const |
void | setColor (const osg::Vec4f &color, const osg::Vec4f &colorIntersection=cher::CANVAS_CLR_PREVIOUS) |
const osg::Vec4f & | getColor () const |
void | setVisibilityFrameInternal (bool vis) |
bool | getVisibilityFrameInternal () const |
bool | getVisibilityAll () const |
void | setVisibilityAll (bool vis) |
osg::Vec3f | getGlobalAxisU () const |
osg::Vec3f | getGlobalAxisV () const |
const osg::Geometry * | getGeometryPickable () const |
void | translate (const osg::Matrix &mt) |
void | rotate (const osg::Matrix &mr, const osg::Vec3f &c3d_new) |
void | unselectAll () |
void | unselectEntities () |
void | selectAllEntities () |
void | setStrokeCurrent (entity::Stroke *stroke) |
void | setStrokeCurrent (bool current) |
entity::Stroke * | getStrokeCurrent () const |
void | setPolygonCurrent (entity::Polygon *poly) |
void | setPolygonCurrent (bool current) |
entity::Polygon * | getPolygonCurrent () const |
void | setEntityCurrent (entity::ShaderedEntity2D *entity) |
void | setEntityCurrent (bool current) |
template<typename EntityType > | |
EntityType * | getEntityCurrent () const |
void | addEntitySelected (entity::Entity2D *entity) |
void | removeEntitySelected (entity::Entity2D *entity) |
const std::vector< Entity2D * > & | getEntitiesSelected () const |
int | getEntitiesSelectedSize () const |
bool | isEntitiesSelected () const |
osg::Vec3f | getEntitiesSelectedCenter3D () const |
osg::Vec3f | getEntitiesSelectedCenter2D () const |
osg::Vec3f | getCenter2D () const |
osg::Vec3f | getBoundingBoxCenter3D () const |
osg::Vec3f | getBoundingBoxCenter2D () const |
osg::BoundingBox | getBoundingBox () const |
void | moveEntities (std::vector< Entity2D *> &entities, double du, double dv) |
void | moveEntitiesSelected (double du, double dv) |
void | scaleEntities (std::vector< Entity2D *> &entities, double sx, double sy, osg::Vec3f center) |
void | scaleEntitiesSelected (double sx, double sy) |
void | rotateEntities (std::vector< entity::Entity2D *> entities, double theta, osg::Vec3f center) |
void | rotateEntitiesSelected (double theta) |
void | updateFrame (entity::Canvas *against=0) |
const osg::Vec3Array * | getFrameVertices () const |
bool | detachFrame () |
bool | attachFrame () |
osg::Group * | attachMeshGroup () |
bool | disattachMeshGroup (osg::Group *group) |
bool | addToMeshGroup (osg::Group *group, osg::Node *mesh) |
void | setModeEdit (bool on) |
void | setFrameEditable (bool on) |
bool | getModeEdit () const |
osg::Plane | getPlane () const |
entity::Canvas * | clone () const |
entity::Canvas * | separate () |
const entity::FrameTool * | getToolFrame () const |
unsigned int | getNumEntities () const |
unsigned int | getNumPhotos () const |
unsigned int | getNumStrokes () const |
unsigned int | getNumPolygons () const |
unsigned int | getNumLineSegments () const |
entity::Photo * | getPhoto (int row) const |
entity::Stroke * | getStroke (int i) const |
entity::Polygon * | getPolygon (int i) const |
entity::LineSegment * | getLineSegment (int i) const |
entity::Entity2D * | getEntity (unsigned int i) const |
bool | addEntity (entity::Entity2D *entity) |
bool | removeEntity (entity::Entity2D *entity) |
bool | containsEntity (entity::Entity2D *entity) const |
void | initializeProgramStroke () |
void | initializeProgramPolygon () |
void | initializeProgramLineSegment () |
![]() | |
ProtectedGroup (const ProtectedGroup &group, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY) | |
Protected Member Functions | |
void | setVisibilityFrame (bool vis) |
bool | getVisibilityFrame () const |
bool | getVisibilityData () const |
void | setVisibilityData (bool vis) |
void | updateTransforms () |
void | resetTransforms () |
void | setVertices (const osg::Vec3f ¢er, float szX, float szY, float szCr, float szAx) |
void | setVerticesDefault (const osg::Vec3f ¢er) |
void | setIntersection (entity::Canvas *against=0) |
Class description
bool entity::Canvas::addEntity | ( | entity::Entity2D * | entity | ) |
Method to add an entity to the canvas.
entity | is a pointer on the entity, |
void entity::Canvas::addEntitySelected | ( | entity::Entity2D * | entity | ) |
entity | is entity to add to entity::SelectedGroup. |
bool entity::Canvas::addToMeshGroup | ( | osg::Group * | group, |
osg::Node * | mesh | ||
) |
A method to add a stroke mesh to the selected mesh group as a child. Only to be used to prepare the user scene for exporting.
group | is the mesh group which is already a child of a group data, |
mesh | is the stroke mesh which will be added as a child to the group. |
bool entity::Canvas::attachFrame | ( | ) |
A method which is called when performing RootScene::writeScenetoFile to attach the frame tools back. The memory for tools is not freed since it is managed by a smart pointer (osg::ref_ptr).
osg::Group * entity::Canvas::attachMeshGroup | ( | ) |
A method to be used only before calling on scene export function. It adds to the group data a new child - mesh group where all the stroke's meshes will be kept for export purposes.
entity::Canvas * entity::Canvas::clone | ( | ) | const |
Methor to perform a clone operation of canvas. It creates a new canvas that does not belong to the scene graph.
bool entity::Canvas::containsEntity | ( | entity::Entity2D * | entity | ) | const |
entity | is the pointer on entity, |
bool entity::Canvas::detachFrame | ( | ) |
A method which is called when performing RootScene::writeScenetoFile to temporarly detach the frame tools. The memory for tools is not freed since it is managed by a smart pointer (osg::ref_ptr).
bool entity::Canvas::disattachMeshGroup | ( | osg::Group * | group | ) |
A methog to be used only after calling on scene export function. It removed the mesh group as a child of group data, thus deleting the whole structure.
osg::BoundingBox entity::Canvas::getBoundingBox | ( | ) | const |
osg::Vec3f entity::Canvas::getBoundingBoxCenter2D | ( | ) | const |
osg::Vec3f entity::Canvas::getBoundingBoxCenter3D | ( | ) | const |
const osg::Vec3f & entity::Canvas::getCenter | ( | ) | const |
osg::Vec3f entity::Canvas::getCenter2D | ( | ) | const |
osg::Vec3f entity::Canvas::getCenter3D | ( | ) | const |
const osg::Vec4f & entity::Canvas::getColor | ( | ) | const |
const std::vector< entity::Entity2D *> & entity::Canvas::getEntitiesSelected | ( | ) | const |
osg::Vec3f entity::Canvas::getEntitiesSelectedCenter2D | ( | ) | const |
osg::Vec3f entity::Canvas::getEntitiesSelectedCenter3D | ( | ) | const |
int entity::Canvas::getEntitiesSelectedSize | ( | ) | const |
entity::Entity2D * entity::Canvas::getEntity | ( | unsigned int | i | ) | const |
Method to iterate throught all the entities: both strokes and photos
i | is the index of desired entity |
const osg::Vec3Array * entity::Canvas::getFrameVertices | ( | ) | const |
const osg::Geometry * entity::Canvas::getGeometryPickable | ( | ) | const |
osg::Vec3f entity::Canvas::getGlobalAxisU | ( | ) | const |
osg::Vec3f entity::Canvas::getGlobalAxisV | ( | ) | const |
osg::Matrix entity::Canvas::getMatrix | ( | ) | const |
osg::Matrix entity::Canvas::getMatrixInverse | ( | ) | const |
bool entity::Canvas::getModeEdit | ( | ) | const |
unsigned int entity::Canvas::getNumEntities | ( | ) | const |
unsigned int entity::Canvas::getNumPhotos | ( | ) | const |
unsigned int entity::Canvas::getNumPolygons | ( | ) | const |
unsigned int entity::Canvas::getNumStrokes | ( | ) | const |
entity::Photo * entity::Canvas::getPhoto | ( | int | row | ) | const |
osg::Plane entity::Canvas::getPlane | ( | ) | const |
entity::Polygon * entity::Canvas::getPolygon | ( | int | i | ) | const |
entity::Polygon * entity::Canvas::getPolygonCurrent | ( | ) | const |
entity::Stroke * entity::Canvas::getStroke | ( | int | i | ) | const |
entity::Stroke * entity::Canvas::getStrokeCurrent | ( | ) | const |
const entity::FrameTool * entity::Canvas::getToolFrame | ( | ) | const |
bool entity::Canvas::getVisibilityAll | ( | ) | const |
bool entity::Canvas::getVisibilityFrameInternal | ( | ) | const |
|
virtual |
Method is called automatically from initializeSG(), or must be called when reading scene from file.
|
virtual |
Method to initialize canvases' geometrical properties. Must be called each time a canvas is allocated.
|
virtual |
Method is called automatically from initializeSG() to initialize OpenGL state machine or when reading scene from file.
|
virtual |
Method is either called automatically when running initializeSG or when reading scene from file.
bool entity::Canvas::isEntitiesSelected | ( | ) | const |
void entity::Canvas::moveEntities | ( | std::vector< Entity2D *> & | entities, |
double | du, | ||
double | dv | ||
) |
entities | is the vector of entities to move, |
du | is delta-u local 2D coordinate, |
dv | is delta-V local 2D coordinate. |
void entity::Canvas::moveEntitiesSelected | ( | double | du, |
double | dv | ||
) |
du | is delta-u local 2D coordinate, |
dv | is delta-V local 2D coordinate. |
bool entity::Canvas::removeEntity | ( | entity::Entity2D * | entity | ) |
Method to remove an entity from the canvas.
entity | is a pointer on the entity, |
void entity::Canvas::removeEntitySelected | ( | entity::Entity2D * | entity | ) |
entity | is entity to substract from entity::SelectedGroup. |
void entity::Canvas::rotate | ( | const osg::Matrix & | mr, |
const osg::Vec3f & | c3d_new | ||
) |
A method to rotate canvas parameters.
mr | is the rotation matrix, |
c3d_new | is the point in 3D global space aroung which the rotation is performed. |
void entity::Canvas::rotateEntities | ( | std::vector< entity::Entity2D *> | entities, |
double | theta, | ||
osg::Vec3f | center | ||
) |
entities | is the vector of entities to rotate, |
theta | is angle of rotation, |
center | the rotation local 2D center |
void entity::Canvas::rotateEntitiesSelected | ( | double | theta | ) |
theta | is angle of rotation. |
void entity::Canvas::scaleEntities | ( | std::vector< Entity2D *> & | entities, |
double | sx, | ||
double | sy, | ||
osg::Vec3f | center | ||
) |
entities | is the vector of entities to scale, |
sx | is scale along X axis, |
sy | is scale along Y axis, |
center | is 2D center along which the scaling is performed. |
void entity::Canvas::scaleEntitiesSelected | ( | double | sx, |
double | sy | ||
) |
sx | is scale along X axis, |
sy | is scale along Y axis, |
void entity::Canvas::selectAllEntities | ( | ) |
Method that adds all the entities of current canvas to entity::SelectedGroup.
entity::Canvas * entity::Canvas::separate | ( | ) |
Method to clone the canvas with inclusion of selected entities into the new canvas. A created canvas does not belong the scene graph.
void entity::Canvas::setColor | ( | const osg::Vec4f & | color, |
const osg::Vec4f & | colorIntersection = cher::CANVAS_CLR_PREVIOUS |
||
) |
A method to set up canvas frame color.
void entity::Canvas::setFrameEditable | ( | bool | on | ) |
Method to change canvas frame appereance to the editable frame.
on | is true when the canvas is about to be edited, false otherwise. |
void entity::Canvas::setModeEdit | ( | bool | on | ) |
Method to switch the normal canvas mode to edit mode, used for editing canvas position and rotation.
on | is true when the canvas is in the process of editing, and false otherwise. |
void entity::Canvas::setPolygonCurrent | ( | entity::Polygon * | poly | ) |
poly | is the polygon to mark as current, i.e., for a continious editing and point addition. |
void entity::Canvas::setPolygonCurrent | ( | bool | current | ) |
current | is a boolean variable; if false then an observer point on current polygon turns NULL. |
void entity::Canvas::setStrokeCurrent | ( | entity::Stroke * | stroke | ) |
stroke | is the stroke to mark as current, i.e., for a continious editing and point addition. |
void entity::Canvas::setStrokeCurrent | ( | bool | current | ) |
current | is a boolean variable; if false then an observer point on current stroke turns NULL. |
void entity::Canvas::setVisibilityAll | ( | bool | vis | ) |
A method to set up canvas content visibility (groupData and frameTool).
vis | is true for visible and false for invisible. |
void entity::Canvas::setVisibilityFrameInternal | ( | bool | vis | ) |
A method to set up tool frame visibility.
vis | is true for visible and false for invisible |
void entity::Canvas::translate | ( | const osg::Matrix & | mt | ) |
A method to translate canvas parameters.
mt | is the translation matrix. |
void entity::Canvas::unselectAll | ( | ) |
Convinience method that is normally used before changing a canvas status, e.g. from current to previous. It deselects SelectedGroup, as well as current stroke.
void entity::Canvas::unselectEntities | ( | ) |
Method that removes all entities from entity::SelectedGroup.
void entity::Canvas::updateFrame | ( | entity::Canvas * | against = 0 | ) |
Method to re-calculate frame's geometry and plane center transform based on canvas content location.
against | is a Canvas against which an intersection is calculated. Normally it is UserScene::m_canvasPrevious. |