13 #ifndef SLIDEEVENTHANDLER
14 #define SLIDEEVENTHANDLER 1
18 #include <osg/ValueObject>
19 #include <osg/ImageSequence>
21 #include <osgGA/GUIEventHandler>
22 #include <osgViewer/Viewer>
24 #include <osgPresentation/CompileSlideCallback>
25 #include <osgPresentation/PropertyManager>
31 class SlideEventHandler;
51 JumpData(
bool in_relativeJump,
int in_slideNum,
int in_layerNum):
56 JumpData(
const std::string& in_slideName,
const std::string& in_layerName):
73 if (&rhs==
this)
return *
this;
136 if (&rhs==
this)
return *
this;
161 KeyPosition(
unsigned int key=0,
float x=FLT_MAX,
float y=FLT_MAX,
bool forward_to_devices =
false):
162 _key((
osgGA::GUIEventAdapter::KeySymbol)key),
178 if (&rhs==
this)
return *
this;
186 void set(
unsigned int key=0,
float x=FLT_MAX,
float y=FLT_MAX,
bool forward_to_devices =
false)
226 typedef std::vector<KeyPosition>
Keys;
229 void setKeys(
const Keys& keys) { _keys = keys; }
234 void setRunStrings(
const RunStrings& runStrings) { _runStrings = runStrings; }
237 void addRunString(
const std::string& runString) { _runStrings.push_back(runString); }
250 void callEnterCallbacks(
osg::Node* node);
251 void callLeaveCallbacks(
osg::Node* node);
268 template<
class T,
class U>
279 virtual void*
ptr()
const = 0;
353 void compileSlide(
unsigned int slideNum);
354 void releaseSlide(
unsigned int slideNum);
356 unsigned int getNumSlides();
362 osg::Node* getLayer(
int slideNum,
int layerNum);
364 bool selectSlide(
int slideNum,
int layerNum=FIRST_POSITION);
365 bool selectLayer(
int layerNum);
367 bool nextLayerOrSlide();
368 bool previousLayerOrSlide();
371 bool previousSlide();
374 bool previousLayer();
384 double getDuration(
const osg::Node* node)
const;
386 double getCurrentTimeDelayBetweenSlides()
const;
398 void dispatchEvent(
const KeyPosition& keyPosition);
403 void setRequestReload(
bool flag);
415 void updateAlpha(
bool,
bool,
float x,
float y);
416 void updateLight(
float x,
float y);
418 void updateOperators();
std::set< osg::ref_ptr< ObjectOperator >, dereference_less > OperatorList
void setReleaseAndCompileOnEachNewSlide(bool flag)
void setRelativeJump(bool flag)
HomePosition & operator=(const HomePosition &rhs)
void setKeys(const Keys &keys)
void setLayerName(const std::string &name)
const Keys & getKeys() const
bool _firstSlideOrLayerChange
osg::Timer_t _tickAtFirstSlideOrLayerChange
void setAutoSteppingActive(bool flag=true)
void addRunString(const std::string &runString)
void setSlideNum(int num)
HomePosition(const HomePosition &rhs, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
ActiveOperators _activeOperators
int getActiveLayer() const
#define OSGPRESENTATION_EXPORT
virtual void frame(SlideEventHandler *)
void addKey(const KeyPosition &kp)
double getTimeDelayBetweenSlides() const
void setUp(const osg::Vec3d &u)
virtual void enter(SlideEventHandler *)=0
const std::string & getLayerName() const
osg::observer_ptr< osg::Switch > _showSwitch
LayerCallbacks _leaveLayerCallbacks
osg::Timer_t _tickAtLastSlideOrLayerChange
const osg::Vec3d & getEye() const
bool getAutoSteppingActive() const
void addEnterCallback(LayerCallback *lc)
LayerAttributes(double in_duration)
FilePathData(const osgDB::FilePathList &fpl)
bool getLoopPresentation() const
JumpData(const std::string &in_slideName, const std::string &in_layerName)
osgDB::FilePathList filePathList
virtual void operator()(osg::Node *node) const =0
osgGA::GUIEventAdapter::KeySymbol _key
float getTimeDelayOnNewSlideWithMovies() const
unsigned long long Timer_t
void setSlideName(const std::string &name)
Operation
Operations related to click to run/load/key events.
const RunStrings & getRunStrings() const
void addLeaveCallback(LayerCallback *lc)
osg::observer_ptr< osgViewer::Viewer > _viewer
osg::Switch * getPresentationSwitch()
const osg::Vec3d & getCenter() const
JumpData(const JumpData &rhs, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
#define META_Object(library, name)
KeyPosition(const KeyPosition &rhs, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
std::vector< KeyPosition > Keys
bool operator<(const ObjectOperator &rhs) const
void setDuration(double duration)
double _timeLastKeyPresses
void setEye(const osg::Vec3d &e)
bool _releaseAndCompileOnEachNewSlide
bool requiresJump() const
META_Object(osgPresentation, JumpData)
virtual void maintain(SlideEventHandler *)=0
double getReferenceTime() const
osg::observer_ptr< osg::Switch > _presentationSwitch
std::list< osg::ref_ptr< LayerCallback > > LayerCallbacks
LayerCallbacks _enterLayerCallbacks
std::deque< std::string > FilePathList
void setTimeDelayBetweenSlides(double dt)
double getDuration() const
osg::ref_ptr< CompileSlideCallback > _compileSlideCallback
osgViewer::Viewer * getViewer()
META_Object(osgPresentation, HomePosition)
bool _updateOpacityActive
void setTimeDelayOnNewSlideWithMovies(float t)
void setForwardToDevices(bool flag)
virtual void leave(SlideEventHandler *)=0
const std::string & getSlideName() const
JumpData & operator=(const JumpData &rhs)
float _timeDelayOnNewSlideWithMovies
virtual void * ptr() const =0
void setJump(const JumpData &jumpData)
const osg::Vec3d & getUp() const
virtual void reset(SlideEventHandler *)=0
KeyPosition(unsigned int key=0, float x=FLT_MAX, float y=FLT_MAX, bool forward_to_devices=false)
std::vector< std::string > RunStrings
bool operator()(const T &lhs, const U &rhs) const
void setLayerNum(int num)
JumpData(bool in_relativeJump, int in_slideNum, int in_layerNum)
void setRunStrings(const RunStrings &runStrings)
bool jump(SlideEventHandler *seh) const
virtual void setPause(SlideEventHandler *, bool pause)=0
bool getRelativeJump() const
KeyPosition & operator=(const KeyPosition &rhs)
void setCenter(const osg::Vec3d &c)
const JumpData & getJumpData() const
void setLoopPresentation(bool loop)
HomePosition(const osg::Vec3 &in_eye, const osg::Vec3 &in_center, const osg::Vec3 &in_up)
META_Object(osgPresentation, KeyPosition)
osg::observer_ptr< osg::Switch > _slideSwitch
double _minimumTimeBetweenKeyPresses
bool getReleaseAndCompileOnEachNewSlide() const
SlideEventHandler(const SlideEventHandler &, const osg::CopyOp &)
int getActiveSlide() const
bool getRequestReload() const
void set(unsigned int key=0, float x=FLT_MAX, float y=FLT_MAX, bool forward_to_devices=false)
virtual ~ObjectOperator()
bool getForwardToDevices() const