cherish
Public Member Functions | Protected Member Functions | List of all members
entity::FrameTool Class Reference

A tool to depict canvas bounding box in both its non-editable and editable states. More...

#include <ToolGlobal.h>

Inheritance diagram for entity::FrameTool:
entity::ToolGlobal osg::ProtectedGroup

Public Member Functions

 FrameTool ()
 
void setVisibility (bool on)
 
bool getVisibility () const
 
void setVertices (const osg::Vec3f &center, float szX, float szY, float szCr, float szAx, const osg::Vec3f &centerCustom=cher::CENTER, double theta=0, bool selectionIsEmpty=true)
 
void setColor (const osg::Vec4f &color, const osg::Vec4f &colorIntersect=cher::CANVAS_CLR_PREVIOUS)
 
void setIntersection (const osg::Vec3f &P1, const osg::Vec3f &P2, const osg::Vec3f &P3, const osg::Vec3f &P4)
 
void setEditable (bool editable)
 
const osg::Geometry * getPickable () const
 
bool isSelected () const
 
virtual void moveDelta (double du, double dv)
 
virtual void scale (double scaleX, double scaleY, osg::Vec3f center)
 
virtual void scale (double scale, osg::Vec3f center)
 
virtual void rotate (double theta, osg::Vec3f center)
 
- Public Member Functions inherited from entity::ToolGlobal
 ToolGlobal (int nVerts, osg::Array::Binding colorBind, osg::PrimitiveSet *primitiveSet, float linewidth=3.f)
 
virtual void setVertices (const std::vector< osg::Vec3f > &source)
 
virtual const osg::Vec3Array * getVertices () const
 
virtual void setColor (const osg::Vec4f &color)
 
virtual const osg::Vec4f & getColor () const
 
osg::Geode * getGeodeWire () const
 
osg::Vec3f getCenterLocal () const
 
- Public Member Functions inherited from osg::ProtectedGroup
 ProtectedGroup (const ProtectedGroup &group, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
 

Protected Member Functions

void initializeSG ()
 
void setColorIntersection (const osg::Vec4f &colorIntersect)
 
void initQuadGeometry (osg::Geometry *geom, const std::string &name="")
 
void initLineGeometry (osg::Geometry *geom, float lineWidth, const std::string &name="")
 
void setQuadGeometry (osg::Geometry *geom, const osg::Vec3f &P, float szX, float szY, float theta=0, const osg::Vec3f &center=cher::CENTER)
 
void setScaleGeometry (osg::Geometry *geom, const osg::Vec3f &P0, const osg::Vec3f &P1, const osg::Vec3f &P2, const osg::Vec3f &P3)
 
void setLineGeometry (osg::Geometry *geom, const osg::Vec3f &P1, const osg::Vec3f &P2)
 
void setColorGeometry (osg::Geometry *geom, const osg::Vec4f &color)
 
void moveDeltaWireGeometry (osg::Geometry *geometry, double du, double dv)
 
void scaleWireGeometry (osg::Geometry *geometry, double scaleX, double scaleY, osg::Vec3f center)
 
void scaleWireGeometry (osg::Geometry *geometry, double scale, osg::Vec3f center)
 
void rotateWireGeometry (osg::Geometry *geometry, double theta, osg::Vec3f center)
 
- Protected Member Functions inherited from entity::ToolGlobal
void updateGeometry ()
 
void updateGeometry (osg::Geometry *geom)
 

Additional Inherited Members

- Protected Attributes inherited from entity::ToolGlobal
osg::Switch * m_switch
 
osg::Geode * m_geodeWire
 
osg::Geometry * m_geomWire
 

Detailed Description

A tool to depict canvas bounding box in both its non-editable and editable states.

The canvas tool has three main modes:

  1. Non-editable
  2. 2D selection editable
  3. 3D position editable

Only certain scene graph elements are used within each of the canvas modes. The canvas frame tool has the following scene graph structure:

 FrameTool -> Switch -> GeodeWire
                     |-> GeodeIntersect
                     |-> AT_Pickable
                     |-> AT_Center (scales, axis)
                     |-> GeodeNormal
                     |-> GeodeRotation

Each geode represents a single functionality / element within the canvas frame:

Constructor & Destructor Documentation

§ FrameTool()

entity::FrameTool::FrameTool ( )

Default constructor that does scene graph initialization and pulls all the default values from cherish Settings file.

Member Function Documentation

§ getPickable()

const osg::Geometry * entity::FrameTool::getPickable ( ) const

A getter method to obtain a pointer on pickable geometry. Used from EventHandler when user is trying to pick current canvas by its pickable.

§ getVisibility()

bool entity::FrameTool::getVisibility ( ) const
virtual

A method to obtain a canvas frame visibility.

Implements entity::ToolGlobal.

§ initializeSG()

void entity::FrameTool::initializeSG ( )
protectedvirtual

Scene graph initialization is performed as shown in the class description.

Implements entity::ToolGlobal.

§ isSelected()

bool entity::FrameTool::isSelected ( ) const
Returns
true if there are any selected 2D entities within the canvas (whether the canvas is in 2D-editable mode).

§ moveDelta()

void entity::FrameTool::moveDelta ( double  du,
double  dv 
)
virtual

A method to perform delta movement when the canvas is in 2D-editable mode.

§ rotate()

void entity::FrameTool::rotate ( double  theta,
osg::Vec3f  center 
)
virtual

A methog to perform a rotation of selected 2D entities within a canvas when the canvas is in 2D-editable mode.

§ scale() [1/2]

void entity::FrameTool::scale ( double  scaleX,
double  scaleY,
osg::Vec3f  center 
)
virtual

A method to preform non-uniform scale of selected entities when the canvas is in 2D-editable mode.

§ scale() [2/2]

void entity::FrameTool::scale ( double  scale,
osg::Vec3f  center 
)
virtual

A method to perform uniform scale around fixed center when the canvas is in 2D-editable mode.

§ setColor()

void entity::FrameTool::setColor ( const osg::Vec4f &  color,
const osg::Vec4f &  colorIntersect = cher::CANVAS_CLR_PREVIOUS 
)

A method to set color frame and canvas intersection color.

§ setColorIntersection()

void entity::FrameTool::setColorIntersection ( const osg::Vec4f &  colorIntersect)
protected

A separate method to set intersection color

§ setEditable()

void entity::FrameTool::setEditable ( bool  editable)

A method to set if the canvas frame is 3D-editable or not.

§ setIntersection()

void entity::FrameTool::setIntersection ( const osg::Vec3f &  P1,
const osg::Vec3f &  P2,
const osg::Vec3f &  P3,
const osg::Vec3f &  P4 
)

A mthod to set intersection geometry

§ setScaleGeometry()

void entity::FrameTool::setScaleGeometry ( osg::Geometry *  geom,
const osg::Vec3f &  P0,
const osg::Vec3f &  P1,
const osg::Vec3f &  P2,
const osg::Vec3f &  P3 
)
protected

A method to set up m_AT_scale geometries.

§ setVertices()

void entity::FrameTool::setVertices ( const osg::Vec3f &  center,
float  szX,
float  szY,
float  szCr,
float  szAx,
const osg::Vec3f &  centerCustom = cher::CENTER,
double  theta = 0,
bool  selectionIsEmpty = true 
)

A method that was re-defined from the abstract one. It is due to the fact that canvas geometry is not defined as straightforward as in other tools. That is, the canvas bounding box has different look depending on the canvas mode: non-editable, 2D-editable or 3D-editable. This method is also used when canvas bounding box dimensions are updated (called from entity::Canvas::updateFrame()).

Parameters
centeris the updated canvas center
szXis the updated canvas half width
szYis the updated canvas half height
szCris the pickable size, normally it would stay constant
szAxis the length value of the canvas local axis (when canvas is in 2D-editable mode)
centerCustomis used when the canvas is in 2D editable mode to locate GeodeAxis position
therais used when the canvas is in 2D-editable mode to locate GeodeAxis rotation
selectionIsEmptyis to denote what type of frame (non-editable/3D-editable vs. 2D-editable) will be used

§ setVisibility()

void entity::FrameTool::setVisibility ( bool  on)
virtual

A method to set canvas frame visibility. When visibility is set to off, the visibility values are saved. When the visibility is turned back on, the values are poped back to their original states.

Parameters
onis true when canvas frame is visible, false - otherwise.

Implements entity::ToolGlobal.


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