Reorganised placement of classes associated with scene graph.
Warning clean up.
This commit is contained in:
parent
6399de2897
commit
54c3204524
@ -82,7 +82,7 @@ std::string ExportHTML::createFileName(const std::string& basename, unsigned int
|
||||
else return createString(basename,'_', page, ext);
|
||||
}
|
||||
|
||||
bool ExportHTML::write(SlideEventHandler* seh, osgViewer::Viewer& viewer, const std::string& filename)
|
||||
bool ExportHTML::write(osgPresentation::SlideEventHandler* seh, osgViewer::Viewer& viewer, const std::string& filename)
|
||||
{
|
||||
std::string image_basename;
|
||||
std::string image_ext;
|
||||
@ -179,7 +179,7 @@ bool ExportHTML::write(SlideEventHandler* seh, osgViewer::Viewer& viewer, const
|
||||
}
|
||||
// wait for all cull and draw threads to complete.
|
||||
|
||||
seh->selectSlide(i, SlideEventHandler::LAST_POSITION);
|
||||
seh->selectSlide(i, osgPresentation::SlideEventHandler::LAST_POSITION);
|
||||
|
||||
// fire off the cull and draw traversals of the scene.
|
||||
viewer.frame();
|
||||
|
@ -19,7 +19,7 @@
|
||||
class ExportHTML
|
||||
{
|
||||
public:
|
||||
static bool write(SlideEventHandler* seh, osgViewer::Viewer& viewer, const std::string& filename);
|
||||
static bool write(osgPresentation::SlideEventHandler* seh, osgViewer::Viewer& viewer, const std::string& filename);
|
||||
|
||||
static std::string createFileName(const std::string& basename, unsigned int page, const std::string& ext);
|
||||
};
|
||||
|
@ -17,7 +17,9 @@
|
||||
#include <osg/Notify>
|
||||
#include <osgDB/FileUtils>
|
||||
|
||||
PickEventHandler::PickEventHandler(SlideShowConstructor::Operation operation,bool relativeJump, int slideNum, int layerNum):
|
||||
using namespace osgPresentation;
|
||||
|
||||
PickEventHandler::PickEventHandler(osgPresentation::Operation operation,bool relativeJump, int slideNum, int layerNum):
|
||||
_operation(operation),
|
||||
_relativeJump(relativeJump),
|
||||
_slideNum(slideNum),
|
||||
@ -25,7 +27,7 @@ PickEventHandler::PickEventHandler(SlideShowConstructor::Operation operation,boo
|
||||
{
|
||||
}
|
||||
|
||||
PickEventHandler::PickEventHandler(const std::string& str, SlideShowConstructor::Operation operation,bool relativeJump, int slideNum, int layerNum):
|
||||
PickEventHandler::PickEventHandler(const std::string& str, osgPresentation::Operation operation,bool relativeJump, int slideNum, int layerNum):
|
||||
_command(str),
|
||||
_operation(operation),
|
||||
_relativeJump(relativeJump),
|
||||
@ -34,9 +36,9 @@ PickEventHandler::PickEventHandler(const std::string& str, SlideShowConstructor:
|
||||
{
|
||||
}
|
||||
|
||||
PickEventHandler::PickEventHandler(const SlideShowConstructor::KeyPosition& keyPos,bool relativeJump, int slideNum, int layerNum):
|
||||
PickEventHandler::PickEventHandler(const osgPresentation::KeyPosition& keyPos,bool relativeJump, int slideNum, int layerNum):
|
||||
_keyPos(keyPos),
|
||||
_operation(SlideShowConstructor::EVENT),
|
||||
_operation(osgPresentation::EVENT),
|
||||
_relativeJump(relativeJump),
|
||||
_slideNum(slideNum),
|
||||
_layerNum(layerNum)
|
||||
@ -114,13 +116,12 @@ void PickEventHandler::doOperation()
|
||||
{
|
||||
switch(_operation)
|
||||
{
|
||||
case(SlideShowConstructor::RUN):
|
||||
case(osgPresentation::RUN):
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Run "<<_command<<std::endl;
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
osgDB::FilePathList& paths = osgDB::getDataFilePathList();
|
||||
#if 0
|
||||
if (!paths.empty())
|
||||
{
|
||||
#ifdef _WIN32
|
||||
@ -164,17 +165,22 @@ void PickEventHandler::doOperation()
|
||||
|
||||
break;
|
||||
}
|
||||
case(SlideShowConstructor::LOAD):
|
||||
case(osgPresentation::LOAD):
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Load "<<_command<<std::endl;
|
||||
break;
|
||||
}
|
||||
case(SlideShowConstructor::EVENT):
|
||||
case(osgPresentation::EVENT):
|
||||
{
|
||||
osg::notify(osg::INFO)<<"Event "<<_keyPos._key<<" "<<_keyPos._x<<" "<<_keyPos._y<<std::endl;
|
||||
if (SlideEventHandler::instance()) SlideEventHandler::instance()->dispatchEvent(_keyPos);
|
||||
break;
|
||||
}
|
||||
case(osgPresentation::JUMP):
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Requires jump "<<std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (requiresJump())
|
||||
|
@ -18,24 +18,27 @@
|
||||
|
||||
#include <osgGA/GUIEventHandler>
|
||||
|
||||
#include "SlideShowConstructor.h"
|
||||
#include "SlideEventHandler.h"
|
||||
|
||||
namespace osgPresentation
|
||||
{
|
||||
|
||||
class PickEventHandler : public osgGA::GUIEventHandler
|
||||
{
|
||||
public:
|
||||
|
||||
PickEventHandler(SlideShowConstructor::Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0);
|
||||
PickEventHandler(const std::string& str, SlideShowConstructor::Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0);
|
||||
PickEventHandler(const SlideShowConstructor::KeyPosition& keyPos, bool relativeJump=true, int slideNum=0, int layerNum=0);
|
||||
PickEventHandler(osgPresentation::Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0);
|
||||
PickEventHandler(const std::string& str, osgPresentation::Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0);
|
||||
PickEventHandler(const osgPresentation::KeyPosition& keyPos, bool relativeJump=true, int slideNum=0, int layerNum=0);
|
||||
|
||||
void setOperation(SlideShowConstructor::Operation operation) { _operation = operation; }
|
||||
SlideShowConstructor::Operation getOperation() const { return _operation; }
|
||||
void setOperation(osgPresentation::Operation operation) { _operation = operation; }
|
||||
osgPresentation::Operation getOperation() const { return _operation; }
|
||||
|
||||
void setCommand(const std::string& str) { _command = str; }
|
||||
const std::string& getCommand() const { return _command; }
|
||||
|
||||
void setKeyPosition(const SlideShowConstructor::KeyPosition& keyPos) { _keyPos = keyPos; }
|
||||
const SlideShowConstructor::KeyPosition& getKeyPosition() const { return _keyPos; }
|
||||
void setKeyPosition(const osgPresentation::KeyPosition& keyPos) { _keyPos = keyPos; }
|
||||
const osgPresentation::KeyPosition& getKeyPosition() const { return _keyPos; }
|
||||
|
||||
void setRelativeJump(int slideDelta, int layerDelta);
|
||||
void setAbsoluteJump(int slideNum, int layerNum);
|
||||
@ -55,12 +58,14 @@ class PickEventHandler : public osgGA::GUIEventHandler
|
||||
void doOperation();
|
||||
|
||||
std::string _command;
|
||||
SlideShowConstructor::KeyPosition _keyPos;
|
||||
SlideShowConstructor::Operation _operation;
|
||||
osgPresentation::KeyPosition _keyPos;
|
||||
osgPresentation::Operation _operation;
|
||||
|
||||
bool _relativeJump;
|
||||
int _slideNum;
|
||||
int _layerNum;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -75,7 +75,7 @@ bool p3d::readEnvVars(osg::ArgumentParser& arguments)
|
||||
{
|
||||
bool readVars = false;
|
||||
|
||||
for(unsigned int i=1; i<arguments.argc(); ++i)
|
||||
for(int i=1; i<arguments.argc(); ++i)
|
||||
{
|
||||
if (!arguments.isOption(i))
|
||||
{
|
||||
|
@ -112,22 +112,22 @@ public:
|
||||
virtual ReadResult readNode(const std::string& fileName,
|
||||
const osgDB::ReaderWriter::Options* options) const;
|
||||
|
||||
void parseModel(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const;
|
||||
void parseModel(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const;
|
||||
|
||||
void parseVolume(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const;
|
||||
void parseVolume(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const;
|
||||
|
||||
void parseStereoPair(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const;
|
||||
void parseStereoPair(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const;
|
||||
|
||||
void parseLayer(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const;
|
||||
void parseLayer(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const;
|
||||
|
||||
void parseBullets(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur, bool inheritPreviousLayers, bool defineAsBaseLayer) const;
|
||||
void parseText(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur, bool inheritPreviousLayers, bool defineAsBaseLayer) const;
|
||||
void parseBullets(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur, bool inheritPreviousLayers, bool defineAsBaseLayer) const;
|
||||
void parseText(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur, bool inheritPreviousLayers, bool defineAsBaseLayer) const;
|
||||
|
||||
void parsePage (SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const;
|
||||
void parsePage (osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const;
|
||||
|
||||
void parseSlide (SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur, bool parseTitles=true, bool parseLayers=true) const;
|
||||
void parseSlide (osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur, bool parseTitles=true, bool parseLayers=true) const;
|
||||
|
||||
void parsePdfDocument (SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const;
|
||||
void parsePdfDocument (osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const;
|
||||
|
||||
osg::Vec4 mapStringToColor(const std::string& str) const
|
||||
{
|
||||
@ -175,14 +175,14 @@ public:
|
||||
bool getProperty(xmlNodePtr cur, const char* token, osgText::Text::Layout& value) const;
|
||||
bool getProperty(xmlNodePtr cur, const char* token, osgText::Text::AlignmentType& value) const;
|
||||
|
||||
bool getProperties(xmlNodePtr cur, SlideShowConstructor::PositionData& value) const;
|
||||
bool getProperties(xmlNodePtr cur, SlideShowConstructor::FontData& value) const;
|
||||
bool getProperties(xmlNodePtr cur, SlideShowConstructor::ModelData& value) const;
|
||||
bool getProperties(xmlNodePtr cur, SlideShowConstructor::ImageData& value) const;
|
||||
bool getProperties(xmlNodePtr cur, osgPresentation::SlideShowConstructor::PositionData& value) const;
|
||||
bool getProperties(xmlNodePtr cur, osgPresentation::SlideShowConstructor::FontData& value) const;
|
||||
bool getProperties(xmlNodePtr cur, osgPresentation::SlideShowConstructor::ModelData& value) const;
|
||||
bool getProperties(xmlNodePtr cur, osgPresentation::SlideShowConstructor::ImageData& value) const;
|
||||
bool getJumpProperties(xmlNodePtr cur, bool& relativeJump, int& slideNum, int& layerNum) const;
|
||||
|
||||
bool getKeyPositionInner(xmlDocPtr doc, xmlNodePtr cur, SlideShowConstructor::KeyPosition& keyPosition) const;
|
||||
bool getKeyPosition(xmlDocPtr doc, xmlNodePtr cur, SlideShowConstructor::KeyPosition& keyPosition) const;
|
||||
bool getKeyPositionInner(xmlDocPtr doc, xmlNodePtr cur, osgPresentation::KeyPosition& keyPosition) const;
|
||||
bool getKeyPosition(xmlDocPtr doc, xmlNodePtr cur, osgPresentation::KeyPosition& keyPosition) const;
|
||||
|
||||
typedef std::map<std::string,osg::Vec4> ColorMap;
|
||||
typedef std::map<std::string,osgText::Text::Layout> LayoutMap;
|
||||
@ -444,7 +444,7 @@ bool ReaderWriterP3DXML::getProperty(xmlNodePtr cur, const char* token, osgText:
|
||||
return success;
|
||||
}
|
||||
|
||||
bool ReaderWriterP3DXML::getProperties(xmlNodePtr cur, SlideShowConstructor::PositionData& value) const
|
||||
bool ReaderWriterP3DXML::getProperties(xmlNodePtr cur, osgPresentation::SlideShowConstructor::PositionData& value) const
|
||||
{
|
||||
bool propertiesRead=false;
|
||||
|
||||
@ -461,14 +461,14 @@ bool ReaderWriterP3DXML::getProperties(xmlNodePtr cur, SlideShowConstructor::Pos
|
||||
{
|
||||
propertiesRead = true;
|
||||
|
||||
if (str=="model") value.frame = SlideShowConstructor::MODEL;
|
||||
else if (str=="slide") value.frame = SlideShowConstructor::SLIDE;
|
||||
if (str=="model") value.frame = osgPresentation::SlideShowConstructor::MODEL;
|
||||
else if (str=="slide") value.frame = osgPresentation::SlideShowConstructor::SLIDE;
|
||||
else osg::notify(_notifyLevel)<<"Parser error - coordinate_frame=\""<<str<<"\" unrecongonized value"<<std::endl;
|
||||
|
||||
osg::notify(_notifyLevel)<<"read coordinate_frame "<< ((value.frame==SlideShowConstructor::MODEL) ? "SlideShowConstructor::MODEL" : "SlideShowConstructor::SLIDE")<<std::endl;
|
||||
osg::notify(_notifyLevel)<<"read coordinate_frame "<< ((value.frame==osgPresentation::SlideShowConstructor::MODEL) ? "osgPresentation::SlideShowConstructor::MODEL" : "osgPresentation::SlideShowConstructor::SLIDE")<<std::endl;
|
||||
}
|
||||
|
||||
if (value.frame==SlideShowConstructor::SLIDE)
|
||||
if (value.frame==osgPresentation::SlideShowConstructor::SLIDE)
|
||||
{
|
||||
|
||||
if (getProperty(cur, "position", str))
|
||||
@ -491,7 +491,7 @@ bool ReaderWriterP3DXML::getProperties(xmlNodePtr cur, SlideShowConstructor::Pos
|
||||
else osg::notify(_notifyLevel)<<"Read position="<<value.position<<std::endl;
|
||||
}
|
||||
}
|
||||
else // value.frame==SlideShowConstructor::MODEL
|
||||
else // value.frame==osgPresentation::SlideShowConstructor::MODEL
|
||||
{
|
||||
|
||||
if (getProperty(cur, "position", str))
|
||||
@ -686,7 +686,7 @@ bool ReaderWriterP3DXML::getProperties(xmlNodePtr cur, SlideShowConstructor::Pos
|
||||
return propertiesRead;
|
||||
}
|
||||
|
||||
bool ReaderWriterP3DXML::getProperties(xmlNodePtr cur, SlideShowConstructor::FontData& value) const
|
||||
bool ReaderWriterP3DXML::getProperties(xmlNodePtr cur, osgPresentation::SlideShowConstructor::FontData& value) const
|
||||
{
|
||||
bool propertiesRead=false;
|
||||
|
||||
@ -721,7 +721,7 @@ bool ReaderWriterP3DXML::getProperties(xmlNodePtr cur, SlideShowConstructor::Fon
|
||||
return propertiesRead;
|
||||
}
|
||||
|
||||
bool ReaderWriterP3DXML::getProperties(xmlNodePtr cur, SlideShowConstructor::ModelData& value) const
|
||||
bool ReaderWriterP3DXML::getProperties(xmlNodePtr cur, osgPresentation::SlideShowConstructor::ModelData& value) const
|
||||
{
|
||||
bool propertiesRead=false;
|
||||
|
||||
@ -736,7 +736,7 @@ bool ReaderWriterP3DXML::getProperties(xmlNodePtr cur, SlideShowConstructor::Mod
|
||||
return propertiesRead;
|
||||
}
|
||||
|
||||
bool ReaderWriterP3DXML::getProperties(xmlNodePtr cur, SlideShowConstructor::ImageData& value) const
|
||||
bool ReaderWriterP3DXML::getProperties(xmlNodePtr cur, osgPresentation::SlideShowConstructor::ImageData& value) const
|
||||
{
|
||||
bool propertiesRead=false;
|
||||
|
||||
@ -839,13 +839,13 @@ bool ReaderWriterP3DXML::getJumpProperties(xmlNodePtr cur, bool& relativeJump, i
|
||||
return propertyRead;
|
||||
}
|
||||
|
||||
void ReaderWriterP3DXML::parseModel(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const
|
||||
void ReaderWriterP3DXML::parseModel(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const
|
||||
{
|
||||
|
||||
SlideShowConstructor::PositionData positionData = constructor.getModelPositionData();
|
||||
osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getModelPositionData();
|
||||
bool positionRead = getProperties(cur,positionData);
|
||||
|
||||
SlideShowConstructor::ModelData modelData;// = constructor.getModelData();
|
||||
osgPresentation::SlideShowConstructor::ModelData modelData;// = constructor.getModelData();
|
||||
getProperties(cur,modelData);
|
||||
|
||||
std::string filename;
|
||||
@ -862,10 +862,10 @@ void ReaderWriterP3DXML::parseModel(SlideShowConstructor& constructor, xmlDocPtr
|
||||
|
||||
}
|
||||
|
||||
void ReaderWriterP3DXML::parseVolume(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const
|
||||
void ReaderWriterP3DXML::parseVolume(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const
|
||||
{
|
||||
|
||||
SlideShowConstructor::PositionData positionData = constructor.getModelPositionData();
|
||||
osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getModelPositionData();
|
||||
bool positionRead = getProperties(cur,positionData);
|
||||
|
||||
std::string filename;
|
||||
@ -880,16 +880,16 @@ void ReaderWriterP3DXML::parseVolume(SlideShowConstructor& constructor, xmlDocPt
|
||||
}
|
||||
}
|
||||
|
||||
void ReaderWriterP3DXML::parseStereoPair(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const
|
||||
void ReaderWriterP3DXML::parseStereoPair(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const
|
||||
{
|
||||
std::string filenameLeft;
|
||||
std::string filenameRight;
|
||||
|
||||
SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
|
||||
osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
|
||||
bool positionRead = getProperties(cur,positionData);
|
||||
|
||||
SlideShowConstructor::ImageData imageDataLeft;// = constructor.getImageData();
|
||||
SlideShowConstructor::ImageData imageDataRight;// = constructor.getImageData();
|
||||
osgPresentation::SlideShowConstructor::ImageData imageDataLeft;// = constructor.getImageData();
|
||||
osgPresentation::SlideShowConstructor::ImageData imageDataRight;// = constructor.getImageData();
|
||||
|
||||
xmlChar *key;
|
||||
cur = cur->xmlChildrenNode;
|
||||
@ -925,7 +925,7 @@ void ReaderWriterP3DXML::parseStereoPair(SlideShowConstructor& constructor, xmlD
|
||||
|
||||
}
|
||||
|
||||
bool ReaderWriterP3DXML::getKeyPosition(xmlDocPtr doc, xmlNodePtr cur, SlideShowConstructor::KeyPosition& keyPosition) const
|
||||
bool ReaderWriterP3DXML::getKeyPosition(xmlDocPtr doc, xmlNodePtr cur, osgPresentation::KeyPosition& keyPosition) const
|
||||
{
|
||||
if ((!xmlStrcmp(cur->name, (const xmlChar *)"key")))
|
||||
{
|
||||
@ -941,7 +941,7 @@ bool ReaderWriterP3DXML::getKeyPosition(xmlDocPtr doc, xmlNodePtr cur, SlideShow
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ReaderWriterP3DXML::getKeyPositionInner(xmlDocPtr doc, xmlNodePtr cur, SlideShowConstructor::KeyPosition& keyPosition) const
|
||||
bool ReaderWriterP3DXML::getKeyPositionInner(xmlDocPtr doc, xmlNodePtr cur, osgPresentation::KeyPosition& keyPosition) const
|
||||
{
|
||||
// x in range -1 to 1, from left to right
|
||||
float x = FLT_MAX;
|
||||
@ -995,10 +995,10 @@ bool ReaderWriterP3DXML::getKeyPositionInner(xmlDocPtr doc, xmlNodePtr cur, Slid
|
||||
|
||||
|
||||
|
||||
void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const
|
||||
void ReaderWriterP3DXML::parseLayer(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const
|
||||
{
|
||||
// create a keyPosition just in case we need it.
|
||||
SlideShowConstructor::KeyPosition keyPosition;
|
||||
osgPresentation::KeyPosition keyPosition;
|
||||
|
||||
osg::notify(osg::INFO)<<std::endl<<"parseLayer"<<std::endl;
|
||||
|
||||
@ -1043,7 +1043,7 @@ void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr
|
||||
if (key)
|
||||
{
|
||||
osg::notify(osg::INFO)<<"click_to_run ["<<(const char*)key<<"]"<<std::endl;
|
||||
constructor.layerClickToDoOperation((const char*)key,SlideShowConstructor::RUN, relativeJump, slideNum, layerNum);
|
||||
constructor.layerClickToDoOperation((const char*)key,osgPresentation::RUN, relativeJump, slideNum, layerNum);
|
||||
}
|
||||
xmlFree(key);
|
||||
}
|
||||
@ -1058,7 +1058,7 @@ void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr
|
||||
if (key)
|
||||
{
|
||||
osg::notify(osg::INFO)<<"click_to_load ["<<(const char*)key<<"]"<<std::endl;
|
||||
constructor.layerClickToDoOperation((const char*)key,SlideShowConstructor::LOAD, relativeJump, slideNum, layerNum);
|
||||
constructor.layerClickToDoOperation((const char*)key,osgPresentation::LOAD, relativeJump, slideNum, layerNum);
|
||||
}
|
||||
xmlFree(key);
|
||||
}
|
||||
@ -1084,7 +1084,7 @@ void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr
|
||||
int layerNum = 0;
|
||||
getJumpProperties(cur, relativeJump, slideNum, layerNum);
|
||||
|
||||
constructor.layerClickEventOperation(SlideShowConstructor::JUMP, relativeJump, slideNum, layerNum);
|
||||
constructor.layerClickEventOperation(osgPresentation::JUMP, relativeJump, slideNum, layerNum);
|
||||
}
|
||||
|
||||
else if ((!xmlStrcmp(cur->name, (const xmlChar *)"newline")))
|
||||
@ -1109,10 +1109,10 @@ void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr
|
||||
if (key)
|
||||
{
|
||||
osg::notify(osg::INFO)<<"bullet ["<<(const char*)key<<"]"<<std::endl;
|
||||
SlideShowConstructor::PositionData positionData = constructor.getTextPositionData();
|
||||
osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getTextPositionData();
|
||||
bool positionRead = getProperties(cur,positionData);
|
||||
|
||||
SlideShowConstructor::FontData fontData = constructor.getTextFontData();
|
||||
osgPresentation::SlideShowConstructor::FontData fontData = constructor.getTextFontData();
|
||||
bool fontRead = getProperties(cur,fontData);
|
||||
|
||||
constructor.addBullet((const char*)key,
|
||||
@ -1126,10 +1126,10 @@ void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr
|
||||
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||
if (key)
|
||||
{
|
||||
SlideShowConstructor::PositionData positionData = constructor.getTextPositionData();
|
||||
osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getTextPositionData();
|
||||
bool positionRead = getProperties(cur,positionData);
|
||||
|
||||
SlideShowConstructor::FontData fontData = constructor.getTextFontData();
|
||||
osgPresentation::SlideShowConstructor::FontData fontData = constructor.getTextFontData();
|
||||
bool fontRead = getProperties(cur,fontData);
|
||||
|
||||
constructor.addParagraph((const char*)key,
|
||||
@ -1144,10 +1144,10 @@ void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr
|
||||
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||
if (key)
|
||||
{
|
||||
SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
|
||||
osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
|
||||
bool positionRead = getProperties(cur,positionData);
|
||||
|
||||
SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
|
||||
osgPresentation::SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
|
||||
getProperties(cur,imageData);
|
||||
|
||||
constructor.addImage((const char*)key,
|
||||
@ -1161,10 +1161,10 @@ void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr
|
||||
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||
if (key)
|
||||
{
|
||||
SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
|
||||
osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
|
||||
bool positionRead = getProperties(cur,positionData);
|
||||
|
||||
SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
|
||||
osgPresentation::SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
|
||||
getProperties(cur,imageData);
|
||||
|
||||
constructor.addVNC((const char*)key,
|
||||
@ -1178,10 +1178,10 @@ void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr
|
||||
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||
if (key)
|
||||
{
|
||||
SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
|
||||
osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
|
||||
bool positionRead = getProperties(cur,positionData);
|
||||
|
||||
SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
|
||||
osgPresentation::SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
|
||||
getProperties(cur,imageData);
|
||||
|
||||
constructor.addBrowser((const char*)key,
|
||||
@ -1195,10 +1195,10 @@ void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr
|
||||
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||
if (key)
|
||||
{
|
||||
SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
|
||||
osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
|
||||
bool positionRead = getProperties(cur,positionData);
|
||||
|
||||
SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
|
||||
osgPresentation::SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
|
||||
getProperties(cur,imageData);
|
||||
|
||||
constructor.addPDF((const char*)key,
|
||||
@ -1238,7 +1238,7 @@ void ReaderWriterP3DXML::parseLayer(SlideShowConstructor& constructor, xmlDocPtr
|
||||
|
||||
}
|
||||
|
||||
void ReaderWriterP3DXML::parseBullets(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur, bool inheritPreviousLayers, bool defineAsBaseLayer) const
|
||||
void ReaderWriterP3DXML::parseBullets(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur, bool inheritPreviousLayers, bool defineAsBaseLayer) const
|
||||
{
|
||||
xmlChar *key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||
if (key)
|
||||
@ -1246,10 +1246,10 @@ void ReaderWriterP3DXML::parseBullets(SlideShowConstructor& constructor, xmlDocP
|
||||
constructor.addLayer(inheritPreviousLayers, defineAsBaseLayer);
|
||||
|
||||
osg::notify(osg::INFO)<<"bullets ["<<(const char*)key<<"]"<<std::endl;
|
||||
SlideShowConstructor::PositionData positionData = constructor.getTextPositionData();
|
||||
osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getTextPositionData();
|
||||
bool positionRead = getProperties(cur,positionData);
|
||||
|
||||
SlideShowConstructor::FontData fontData = constructor.getTextFontData();
|
||||
osgPresentation::SlideShowConstructor::FontData fontData = constructor.getTextFontData();
|
||||
bool fontRead = getProperties(cur,fontData);
|
||||
|
||||
constructor.addBullet((const char*)key,
|
||||
@ -1260,7 +1260,7 @@ void ReaderWriterP3DXML::parseBullets(SlideShowConstructor& constructor, xmlDocP
|
||||
}
|
||||
|
||||
|
||||
void ReaderWriterP3DXML::parseText(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur, bool inheritPreviousLayers, bool defineAsBaseLayer) const
|
||||
void ReaderWriterP3DXML::parseText(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur, bool inheritPreviousLayers, bool defineAsBaseLayer) const
|
||||
{
|
||||
xmlChar *key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||
if (key)
|
||||
@ -1268,10 +1268,10 @@ void ReaderWriterP3DXML::parseText(SlideShowConstructor& constructor, xmlDocPtr
|
||||
constructor.addLayer(inheritPreviousLayers, defineAsBaseLayer);
|
||||
|
||||
osg::notify(osg::INFO)<<"text ["<<(const char*)key<<"]"<<std::endl;
|
||||
SlideShowConstructor::PositionData positionData = constructor.getTextPositionData();
|
||||
osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getTextPositionData();
|
||||
bool positionRead = getProperties(cur,positionData);
|
||||
|
||||
SlideShowConstructor::FontData fontData = constructor.getTextFontData();
|
||||
osgPresentation::SlideShowConstructor::FontData fontData = constructor.getTextFontData();
|
||||
bool fontRead = getProperties(cur,fontData);
|
||||
|
||||
constructor.addParagraph((const char*)key,
|
||||
@ -1281,7 +1281,7 @@ void ReaderWriterP3DXML::parseText(SlideShowConstructor& constructor, xmlDocPtr
|
||||
xmlFree(key);
|
||||
}
|
||||
|
||||
void ReaderWriterP3DXML::parsePage(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const
|
||||
void ReaderWriterP3DXML::parsePage(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const
|
||||
{
|
||||
xmlChar *key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||
if (key)
|
||||
@ -1313,10 +1313,10 @@ void ReaderWriterP3DXML::parsePage(SlideShowConstructor& constructor, xmlDocPtr
|
||||
|
||||
constructor.addLayer(true,false);
|
||||
|
||||
SlideShowConstructor::PositionData positionData = constructor.getTextPositionData();
|
||||
osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getTextPositionData();
|
||||
bool positionRead = getProperties(cur,positionData);
|
||||
|
||||
SlideShowConstructor::FontData fontData = constructor.getTextFontData();
|
||||
osgPresentation::SlideShowConstructor::FontData fontData = constructor.getTextFontData();
|
||||
bool fontRead = getProperties(cur,fontData);
|
||||
|
||||
constructor.addParagraph((const char*)key,
|
||||
@ -1326,7 +1326,7 @@ void ReaderWriterP3DXML::parsePage(SlideShowConstructor& constructor, xmlDocPtr
|
||||
xmlFree(key);
|
||||
}
|
||||
|
||||
void ReaderWriterP3DXML::parsePdfDocument(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const
|
||||
void ReaderWriterP3DXML::parsePdfDocument(osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur) const
|
||||
{
|
||||
xmlChar *key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||
if (key)
|
||||
@ -1359,10 +1359,10 @@ void ReaderWriterP3DXML::parsePdfDocument(SlideShowConstructor& constructor, xml
|
||||
|
||||
constructor.addLayer(true,false);
|
||||
|
||||
SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
|
||||
bool positionRead = getProperties(cur,positionData);
|
||||
osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getImagePositionData();
|
||||
getProperties(cur,positionData);
|
||||
|
||||
SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
|
||||
osgPresentation::SlideShowConstructor::ImageData imageData;// = constructor.getImageData();
|
||||
imageData.page = 0;
|
||||
getProperties(cur,imageData);
|
||||
|
||||
@ -1410,14 +1410,14 @@ void ReaderWriterP3DXML::parsePdfDocument(SlideShowConstructor& constructor, xml
|
||||
xmlFree(key);
|
||||
}
|
||||
|
||||
void ReaderWriterP3DXML::parseSlide (SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur, bool parseTitles, bool parseLayers) const
|
||||
void ReaderWriterP3DXML::parseSlide (osgPresentation::SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur, bool parseTitles, bool parseLayers) const
|
||||
{
|
||||
|
||||
osg::Vec4 previous_bgcolor = constructor.getBackgroundColor();
|
||||
osg::Vec4 previous_textcolor = constructor.getTextColor();
|
||||
|
||||
// create a keyPosition just in case we need it.
|
||||
SlideShowConstructor::KeyPosition keyPosition;
|
||||
osgPresentation::KeyPosition keyPosition;
|
||||
|
||||
xmlChar *key;
|
||||
cur = cur->xmlChildrenNode;
|
||||
@ -1431,10 +1431,10 @@ void ReaderWriterP3DXML::parseSlide (SlideShowConstructor& constructor, xmlDocPt
|
||||
|
||||
if (key)
|
||||
{
|
||||
SlideShowConstructor::PositionData positionData = constructor.getTitlePositionData();
|
||||
osgPresentation::SlideShowConstructor::PositionData positionData = constructor.getTitlePositionData();
|
||||
bool positionRead = getProperties(cur,positionData);
|
||||
|
||||
SlideShowConstructor::FontData fontData = constructor.getTitleFontData();
|
||||
osgPresentation::SlideShowConstructor::FontData fontData = constructor.getTitleFontData();
|
||||
bool fontRead = getProperties(cur,fontData);
|
||||
|
||||
constructor.setSlideTitle((const char*)key,
|
||||
@ -1533,7 +1533,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterP3DXML::readNode(const std::string&
|
||||
if (fileName.empty()) return ReadResult::FILE_NOT_FOUND;
|
||||
|
||||
// create a keyPosition just in case we need it.
|
||||
SlideShowConstructor::KeyPosition keyPosition;
|
||||
osgPresentation::KeyPosition keyPosition;
|
||||
|
||||
xmlDocPtr doc;
|
||||
xmlNodePtr cur;
|
||||
@ -1559,7 +1559,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterP3DXML::readNode(const std::string&
|
||||
return ReadResult::FILE_NOT_HANDLED;
|
||||
}
|
||||
|
||||
SlideShowConstructor constructor;
|
||||
osgPresentation::SlideShowConstructor constructor;
|
||||
|
||||
osgDB::FilePathList previousPaths = osgDB::getDataFilePathList();
|
||||
|
||||
|
@ -29,11 +29,35 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace osgPresentation;
|
||||
|
||||
static osg::observer_ptr<SlideEventHandler> s_seh;
|
||||
|
||||
SlideEventHandler* SlideEventHandler::instance() { return s_seh.get(); }
|
||||
|
||||
void LayerAttributes::callEnterCallbacks(osg::Node* node)
|
||||
{
|
||||
osg::notify(osg::INFO)<<"LayerAttributes::callEnterCallbacks("<<node<<")"<<std::endl;
|
||||
for(LayerCallbacks::iterator itr = _enterLayerCallbacks.begin();
|
||||
itr != _enterLayerCallbacks.end();
|
||||
++itr)
|
||||
{
|
||||
(*(*itr))(node);
|
||||
}
|
||||
}
|
||||
|
||||
void LayerAttributes::callLeaveCallbacks(osg::Node* node)
|
||||
{
|
||||
osg::notify(osg::INFO)<<"LayerAttributes::callLeaveCallbacks("<<node<<")"<<std::endl;
|
||||
for(LayerCallbacks::iterator itr = _leaveLayerCallbacks.begin();
|
||||
itr != _leaveLayerCallbacks.end();
|
||||
++itr)
|
||||
{
|
||||
(*(*itr))(node);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct ImageStreamOperator : public ObjectOperator
|
||||
{
|
||||
ImageStreamOperator(osg::ImageStream* imageStream):
|
||||
@ -159,7 +183,7 @@ struct CallbackOperator : public ObjectOperator
|
||||
|
||||
struct LayerAttributesOperator : public ObjectOperator
|
||||
{
|
||||
LayerAttributesOperator(osg::Node* node, SlideShowConstructor::LayerAttributes* la):
|
||||
LayerAttributesOperator(osg::Node* node, LayerAttributes* la):
|
||||
_node(node),
|
||||
_layerAttribute(la)
|
||||
{
|
||||
@ -175,7 +199,7 @@ struct LayerAttributesOperator : public ObjectOperator
|
||||
{
|
||||
osg::notify(osg::INFO)<<"applyKeys {"<<std::endl;
|
||||
|
||||
for(SlideShowConstructor::LayerAttributes::Keys::iterator itr = _layerAttribute->_keys.begin();
|
||||
for(LayerAttributes::Keys::iterator itr = _layerAttribute->_keys.begin();
|
||||
itr != _layerAttribute->_keys.end();
|
||||
++itr)
|
||||
{
|
||||
@ -186,7 +210,7 @@ struct LayerAttributesOperator : public ObjectOperator
|
||||
}
|
||||
if (!_layerAttribute->_runStrings.empty())
|
||||
{
|
||||
for(SlideShowConstructor::LayerAttributes::RunStrings::iterator itr = _layerAttribute->_runStrings.begin();
|
||||
for(LayerAttributes::RunStrings::iterator itr = _layerAttribute->_runStrings.begin();
|
||||
itr != _layerAttribute->_runStrings.end();
|
||||
++itr)
|
||||
{
|
||||
@ -232,7 +256,7 @@ struct LayerAttributesOperator : public ObjectOperator
|
||||
|
||||
|
||||
osg::ref_ptr<osg::Node> _node;
|
||||
osg::ref_ptr<SlideShowConstructor::LayerAttributes> _layerAttribute;
|
||||
osg::ref_ptr<LayerAttributes> _layerAttribute;
|
||||
};
|
||||
|
||||
|
||||
@ -252,7 +276,7 @@ public:
|
||||
_operatorList.insert(new CallbackOperator(&node, node.getUpdateCallback()));
|
||||
}
|
||||
|
||||
SlideShowConstructor::LayerAttributes* la = dynamic_cast<SlideShowConstructor::LayerAttributes*>(node.getUserData());
|
||||
LayerAttributes* la = dynamic_cast<LayerAttributes*>(node.getUserData());
|
||||
if (la)
|
||||
{
|
||||
_operatorList.insert(new LayerAttributesOperator(&node, la));
|
||||
@ -409,7 +433,7 @@ public:
|
||||
|
||||
void apply(osg::Node& node)
|
||||
{
|
||||
SlideShowConstructor::HomePosition* homePosition = dynamic_cast<SlideShowConstructor::HomePosition*>(node.getUserData());
|
||||
HomePosition* homePosition = dynamic_cast<HomePosition*>(node.getUserData());
|
||||
if (homePosition)
|
||||
{
|
||||
_homePosition = homePosition;
|
||||
@ -418,7 +442,7 @@ public:
|
||||
traverse(node);
|
||||
}
|
||||
|
||||
osg::ref_ptr<SlideShowConstructor::HomePosition> _homePosition;
|
||||
osg::ref_ptr<HomePosition> _homePosition;
|
||||
|
||||
};
|
||||
|
||||
@ -457,7 +481,7 @@ public:
|
||||
|
||||
void apply(osg::Node& node)
|
||||
{
|
||||
SlideShowConstructor::FilePathData* fdd = dynamic_cast<SlideShowConstructor::FilePathData*>(node.getUserData());
|
||||
FilePathData* fdd = dynamic_cast<FilePathData*>(node.getUserData());
|
||||
if (fdd)
|
||||
{
|
||||
osg::notify(osg::INFO)<<"Recorded FilePathData"<<std::endl;
|
||||
@ -645,7 +669,7 @@ SlideEventHandler::SlideEventHandler(osgViewer::Viewer* viewer):
|
||||
|
||||
double SlideEventHandler::getDuration(const osg::Node* node) const
|
||||
{
|
||||
const SlideShowConstructor::LayerAttributes* la = dynamic_cast<const SlideShowConstructor::LayerAttributes*>(node->getUserData());
|
||||
const LayerAttributes* la = dynamic_cast<const LayerAttributes*>(node->getUserData());
|
||||
return la ? la->_duration : -1.0;
|
||||
}
|
||||
|
||||
@ -1091,7 +1115,7 @@ bool SlideEventHandler::previousLayerOrSlide()
|
||||
|
||||
bool SlideEventHandler::nextSlide()
|
||||
{
|
||||
SlideShowConstructor::LayerAttributes* la = _slideSwitch.valid() ? dynamic_cast<SlideShowConstructor::LayerAttributes*>(_slideSwitch->getUserData()) : 0;
|
||||
LayerAttributes* la = _slideSwitch.valid() ? dynamic_cast<LayerAttributes*>(_slideSwitch->getUserData()) : 0;
|
||||
if (la && la->requiresJump())
|
||||
{
|
||||
if (la->getRelativeJump())
|
||||
@ -1135,7 +1159,7 @@ bool SlideEventHandler::previousSlide()
|
||||
|
||||
bool SlideEventHandler::nextLayer()
|
||||
{
|
||||
SlideShowConstructor::LayerAttributes* la = (_slideSwitch.valid() && _activeLayer>=0) ? dynamic_cast<SlideShowConstructor::LayerAttributes*>(_slideSwitch->getChild(_activeLayer)->getUserData()) : 0;
|
||||
LayerAttributes* la = (_slideSwitch.valid() && _activeLayer>=0) ? dynamic_cast<LayerAttributes*>(_slideSwitch->getChild(_activeLayer)->getUserData()) : 0;
|
||||
if (la)
|
||||
{
|
||||
la->callLeaveCallbacks(_slideSwitch->getChild(_activeLayer));
|
||||
@ -1265,7 +1289,7 @@ void SlideEventHandler::releaseSlide(unsigned int slideNum)
|
||||
_presentationSwitch->getChild(slideNum)->accept(globjVisitor);
|
||||
}
|
||||
|
||||
void SlideEventHandler::dispatchEvent(const SlideShowConstructor::KeyPosition& keyPosition)
|
||||
void SlideEventHandler::dispatchEvent(const KeyPosition& keyPosition)
|
||||
{
|
||||
osg::notify(osg::INFO)<<" keyPosition._key "<<keyPosition._key<<" "<<keyPosition._x<<" "<<keyPosition._y<<std::endl;
|
||||
|
||||
|
@ -20,7 +20,117 @@
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
#include "CompileSlideCallback.h"
|
||||
#include "SlideShowConstructor.h"
|
||||
|
||||
namespace osgPresentation
|
||||
{
|
||||
|
||||
/// Operations related to click to run/load/key events.
|
||||
enum Operation
|
||||
{
|
||||
RUN,
|
||||
LOAD,
|
||||
EVENT,
|
||||
JUMP
|
||||
};
|
||||
|
||||
struct HomePosition : public virtual osg::Referenced
|
||||
{
|
||||
HomePosition() {}
|
||||
|
||||
HomePosition(const osg::Vec3& in_eye, const osg::Vec3& in_center, const osg::Vec3& in_up):
|
||||
eye(in_eye),
|
||||
center(in_center),
|
||||
up(in_up) {}
|
||||
|
||||
osg::Vec3 eye;
|
||||
osg::Vec3 center;
|
||||
osg::Vec3 up;
|
||||
};
|
||||
|
||||
struct KeyPosition
|
||||
{
|
||||
KeyPosition(unsigned int key=0, float x=FLT_MAX, float y=FLT_MAX):
|
||||
_key((osgGA::GUIEventAdapter::KeySymbol)key),
|
||||
_x(x),
|
||||
_y(y) {}
|
||||
|
||||
|
||||
void set(unsigned int key=0, float x=FLT_MAX, float y=FLT_MAX)
|
||||
{
|
||||
_key = (osgGA::GUIEventAdapter::KeySymbol)key;
|
||||
_x = x;
|
||||
_y = y;
|
||||
}
|
||||
|
||||
osgGA::GUIEventAdapter::KeySymbol _key;
|
||||
float _x;
|
||||
float _y;
|
||||
};
|
||||
|
||||
struct LayerCallback : public virtual osg::Referenced
|
||||
{
|
||||
virtual void operator() (osg::Node* node) const = 0;
|
||||
};
|
||||
|
||||
struct LayerAttributes : public virtual osg::Referenced
|
||||
{
|
||||
LayerAttributes():_duration(0),_relativeJump(true),_slideNum(0),_layerNum(0) {}
|
||||
LayerAttributes(double in_duration):_duration(in_duration),_relativeJump(true),_slideNum(0),_layerNum(0) {}
|
||||
|
||||
void setDuration(double duration) { _duration = duration; }
|
||||
double getDuration() const { return _duration; }
|
||||
|
||||
typedef std::vector<KeyPosition> Keys;
|
||||
typedef std::vector<std::string> RunStrings;
|
||||
|
||||
void setKeys(const Keys& keys) { _keys = keys; }
|
||||
const Keys& getKeys() const { return _keys; }
|
||||
|
||||
void addKey(const KeyPosition& kp) { _keys.push_back(kp); }
|
||||
|
||||
void setRunStrings(const RunStrings& runStrings) { _runStrings = runStrings; }
|
||||
const RunStrings& getRunStrings() const { return _runStrings; }
|
||||
|
||||
void addRunString(const std::string& runString) { _runStrings.push_back(runString); }
|
||||
|
||||
void setJump(bool relativeJump, int slideNum, int layerNum)
|
||||
{
|
||||
_relativeJump = relativeJump;
|
||||
_slideNum = slideNum;
|
||||
_layerNum = layerNum;
|
||||
}
|
||||
|
||||
bool getRelativeJump() const { return _relativeJump; }
|
||||
int getSlideNum() const { return _slideNum; }
|
||||
int getLayerNum() const { return _layerNum; }
|
||||
|
||||
bool requiresJump() const { return _relativeJump ? (_slideNum!=0 || _layerNum!=0) : true; }
|
||||
|
||||
double _duration;
|
||||
Keys _keys;
|
||||
RunStrings _runStrings;
|
||||
|
||||
bool _relativeJump;
|
||||
int _slideNum;
|
||||
int _layerNum;
|
||||
|
||||
void addEnterCallback(LayerCallback* lc) { _enterLayerCallbacks.push_back(lc); }
|
||||
void addLeaveCallback(LayerCallback* lc) { _leaveLayerCallbacks.push_back(lc); }
|
||||
|
||||
void callEnterCallbacks(osg::Node* node);
|
||||
void callLeaveCallbacks(osg::Node* node);
|
||||
|
||||
typedef std::list< osg::ref_ptr<LayerCallback> > LayerCallbacks;
|
||||
LayerCallbacks _enterLayerCallbacks;
|
||||
LayerCallbacks _leaveLayerCallbacks;
|
||||
};
|
||||
|
||||
struct FilePathData : public virtual osg::Referenced
|
||||
{
|
||||
FilePathData(const osgDB::FilePathList& fpl):filePathList(fpl) {}
|
||||
|
||||
osgDB::FilePathList filePathList;
|
||||
};
|
||||
|
||||
|
||||
struct dereference_less
|
||||
@ -104,7 +214,7 @@ public:
|
||||
enum WhichPosition
|
||||
{
|
||||
FIRST_POSITION = 0,
|
||||
LAST_POSITION = 0xffffffff,
|
||||
LAST_POSITION = 0xffffffff
|
||||
};
|
||||
|
||||
void compileSlide(unsigned int slideNum);
|
||||
@ -148,7 +258,7 @@ public:
|
||||
void setLoopPresentation(bool loop) { _loopPresentation = loop; }
|
||||
bool getLoopPresentation() const { return _loopPresentation; }
|
||||
|
||||
void dispatchEvent(const SlideShowConstructor::KeyPosition& keyPosition);
|
||||
void dispatchEvent(const KeyPosition& keyPosition);
|
||||
|
||||
enum ObjectMask
|
||||
{
|
||||
@ -212,4 +322,6 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -50,6 +50,8 @@
|
||||
#include "AnimationMaterial.h"
|
||||
#include "PickEventHandler.h"
|
||||
|
||||
using namespace osgPresentation;
|
||||
|
||||
class SetToTransparentBin : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
@ -84,28 +86,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
void SlideShowConstructor::LayerAttributes::callEnterCallbacks(osg::Node* node)
|
||||
{
|
||||
osg::notify(osg::INFO)<<"SlideShowConstructor::LayerAttributes::callEnterCallbacks("<<node<<")"<<std::endl;
|
||||
for(LayerCallbacks::iterator itr = _enterLayerCallbacks.begin();
|
||||
itr != _enterLayerCallbacks.end();
|
||||
++itr)
|
||||
{
|
||||
(*(*itr))(node);
|
||||
}
|
||||
}
|
||||
|
||||
void SlideShowConstructor::LayerAttributes::callLeaveCallbacks(osg::Node* node)
|
||||
{
|
||||
osg::notify(osg::INFO)<<"SlideShowConstructor::LayerAttributes::callLeaveCallbacks("<<node<<")"<<std::endl;
|
||||
for(LayerCallbacks::iterator itr = _leaveLayerCallbacks.begin();
|
||||
itr != _leaveLayerCallbacks.end();
|
||||
++itr)
|
||||
{
|
||||
(*(*itr))(node);
|
||||
}
|
||||
}
|
||||
|
||||
SlideShowConstructor::SlideShowConstructor()
|
||||
{
|
||||
_slideDistance = osg::DisplaySettings::instance()->getScreenDistance();
|
||||
@ -208,7 +188,7 @@ void SlideShowConstructor::createPresentation()
|
||||
if (_autoSteppingActive) _root->addDescription("auto");
|
||||
}
|
||||
|
||||
SlideShowConstructor::LayerAttributes* SlideShowConstructor::getOrCreateLayerAttributes(osg::Node* node)
|
||||
LayerAttributes* SlideShowConstructor::getOrCreateLayerAttributes(osg::Node* node)
|
||||
{
|
||||
LayerAttributes* la = dynamic_cast<LayerAttributes*>(node->getUserData());
|
||||
if (!la)
|
||||
@ -294,7 +274,7 @@ void SlideShowConstructor::selectSlide(int slideNum)
|
||||
{
|
||||
addSlide();
|
||||
}
|
||||
else if (slideNum>=_presentationSwitch->getNumChildren())
|
||||
else if (slideNum>=static_cast<int>(_presentationSwitch->getNumChildren()))
|
||||
{
|
||||
addSlide();
|
||||
}
|
||||
@ -435,7 +415,7 @@ void SlideShowConstructor::selectLayer(int layerNum)
|
||||
addSlide();
|
||||
addLayer();
|
||||
}
|
||||
else if (layerNum>=0 && layerNum<_slide->getNumChildren() && _slide->getChild(layerNum)->asGroup())
|
||||
else if (layerNum>=0 && layerNum<static_cast<int>(_slide->getNumChildren()) && _slide->getChild(layerNum)->asGroup())
|
||||
{
|
||||
_currentLayer = _slide->getChild(layerNum)->asGroup();
|
||||
_previousLayer = _currentLayer;
|
||||
@ -516,7 +496,7 @@ void SlideShowConstructor::layerClickToDoOperation(const std::string& command, O
|
||||
}
|
||||
|
||||
|
||||
void SlideShowConstructor::layerClickEventOperation(const SlideShowConstructor::KeyPosition& keyPos, bool relativeJump, int slideNum, int layerNum)
|
||||
void SlideShowConstructor::layerClickEventOperation(const KeyPosition& keyPos, bool relativeJump, int slideNum, int layerNum)
|
||||
{
|
||||
if (!_currentLayer) addLayer();
|
||||
|
||||
@ -1075,7 +1055,7 @@ void SlideShowConstructor::addPDF(const std::string& filename, const PositionDat
|
||||
addInteractiveImage(filename, positionData, imageData);
|
||||
}
|
||||
|
||||
class SetPageCallback: public SlideShowConstructor::LayerCallback
|
||||
class SetPageCallback: public LayerCallback
|
||||
{
|
||||
public:
|
||||
SetPageCallback(osgWidget::PdfImage* pdfImage, int pageNum):
|
||||
@ -1444,7 +1424,7 @@ void SlideShowConstructor::addModel(osg::Node* subgraph, const PositionData& pos
|
||||
|
||||
void SlideShowConstructor::addVolume(const std::string& filename, const PositionData& positionData)
|
||||
{
|
||||
osg::Object::DataVariance defaultMatrixDataVariance = osg::Object::DYNAMIC; // STATIC
|
||||
// osg::Object::DataVariance defaultMatrixDataVariance = osg::Object::DYNAMIC; // STATIC
|
||||
|
||||
std::string foundFile = filename;
|
||||
|
||||
|
@ -26,6 +26,10 @@
|
||||
#include <osgDB/FileUtils>
|
||||
|
||||
#include "AnimationMaterial.h"
|
||||
#include "SlideEventHandler.h"
|
||||
|
||||
namespace osgPresentation
|
||||
{
|
||||
|
||||
class SlideShowConstructor
|
||||
{
|
||||
@ -34,98 +38,6 @@ public:
|
||||
|
||||
enum CoordinateFrame { SLIDE, MODEL };
|
||||
|
||||
struct HomePosition : public virtual osg::Referenced
|
||||
{
|
||||
HomePosition() {}
|
||||
|
||||
HomePosition(const osg::Vec3& in_eye, const osg::Vec3& in_center, const osg::Vec3& in_up):
|
||||
eye(in_eye),
|
||||
center(in_center),
|
||||
up(in_up) {}
|
||||
|
||||
osg::Vec3 eye;
|
||||
osg::Vec3 center;
|
||||
osg::Vec3 up;
|
||||
};
|
||||
|
||||
struct KeyPosition
|
||||
{
|
||||
KeyPosition(unsigned int key=0, float x=FLT_MAX, float y=FLT_MAX):
|
||||
_key((osgGA::GUIEventAdapter::KeySymbol)key),
|
||||
_x(x),
|
||||
_y(y) {}
|
||||
|
||||
|
||||
void set(unsigned int key=0, float x=FLT_MAX, float y=FLT_MAX)
|
||||
{
|
||||
_key = (osgGA::GUIEventAdapter::KeySymbol)key;
|
||||
_x = x;
|
||||
_y = y;
|
||||
}
|
||||
|
||||
osgGA::GUIEventAdapter::KeySymbol _key;
|
||||
float _x;
|
||||
float _y;
|
||||
};
|
||||
|
||||
struct LayerCallback : public virtual osg::Referenced
|
||||
{
|
||||
virtual void operator() (osg::Node* node) const = 0;
|
||||
};
|
||||
|
||||
struct LayerAttributes : public virtual osg::Referenced
|
||||
{
|
||||
LayerAttributes():_duration(0),_relativeJump(true),_slideNum(0),_layerNum(0) {}
|
||||
LayerAttributes(double in_duration):_duration(in_duration),_relativeJump(true),_slideNum(0),_layerNum(0) {}
|
||||
|
||||
void setDuration(double duration) { _duration = duration; }
|
||||
double getDuration() const { return _duration; }
|
||||
|
||||
typedef std::vector<KeyPosition> Keys;
|
||||
typedef std::vector<std::string> RunStrings;
|
||||
|
||||
void setKeys(const Keys& keys) { _keys = keys; }
|
||||
const Keys& getKeys() const { return _keys; }
|
||||
|
||||
void addKey(const KeyPosition& kp) { _keys.push_back(kp); }
|
||||
|
||||
void setRunStrings(const RunStrings& runStrings) { _runStrings = runStrings; }
|
||||
const RunStrings& getRunStrings() const { return _runStrings; }
|
||||
|
||||
void addRunString(const std::string& runString) { _runStrings.push_back(runString); }
|
||||
|
||||
void setJump(bool relativeJump, int slideNum, int layerNum)
|
||||
{
|
||||
_relativeJump = relativeJump;
|
||||
_slideNum = slideNum;
|
||||
_layerNum = layerNum;
|
||||
}
|
||||
|
||||
bool getRelativeJump() const { return _relativeJump; }
|
||||
int getSlideNum() const { return _slideNum; }
|
||||
int getLayerNum() const { return _layerNum; }
|
||||
|
||||
bool requiresJump() const { return _relativeJump ? (_slideNum!=0 || _layerNum!=0) : true; }
|
||||
|
||||
double _duration;
|
||||
Keys _keys;
|
||||
RunStrings _runStrings;
|
||||
|
||||
bool _relativeJump;
|
||||
int _slideNum;
|
||||
int _layerNum;
|
||||
|
||||
void addEnterCallback(LayerCallback* lc) { _enterLayerCallbacks.push_back(lc); }
|
||||
void addLeaveCallback(LayerCallback* lc) { _leaveLayerCallbacks.push_back(lc); }
|
||||
|
||||
void callEnterCallbacks(osg::Node* node);
|
||||
void callLeaveCallbacks(osg::Node* node);
|
||||
|
||||
typedef std::list< osg::ref_ptr<LayerCallback> > LayerCallbacks;
|
||||
LayerCallbacks _enterLayerCallbacks;
|
||||
LayerCallbacks _leaveLayerCallbacks;
|
||||
};
|
||||
|
||||
|
||||
LayerAttributes* getOrCreateLayerAttributes(osg::Node* node);
|
||||
|
||||
@ -198,12 +110,6 @@ public:
|
||||
if (_currentLayer.valid()) setJump(_currentLayer.get(),relativeJump, switchNum, layerNum);
|
||||
}
|
||||
|
||||
struct FilePathData : public virtual osg::Referenced
|
||||
{
|
||||
FilePathData(const osgDB::FilePathList& fpl):filePathList(fpl) {}
|
||||
|
||||
osgDB::FilePathList filePathList;
|
||||
};
|
||||
|
||||
|
||||
struct PositionData
|
||||
@ -320,14 +226,6 @@ public:
|
||||
osg::Vec4 color;
|
||||
};
|
||||
|
||||
/// Operations related to click to run/load/key events.
|
||||
enum Operation
|
||||
{
|
||||
RUN,
|
||||
LOAD,
|
||||
EVENT,
|
||||
JUMP
|
||||
};
|
||||
|
||||
SlideShowConstructor();
|
||||
|
||||
@ -399,7 +297,7 @@ public:
|
||||
|
||||
void layerClickToDoOperation(Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0);
|
||||
void layerClickToDoOperation(const std::string& command, Operation operation, bool relativeJump=true, int slideNum=0, int layerNum=0);
|
||||
void layerClickEventOperation(const SlideShowConstructor::KeyPosition& keyPos, bool relativeJump=true, int slideNum=0, int layerNum=0);
|
||||
void layerClickEventOperation(const KeyPosition& keyPos, bool relativeJump=true, int slideNum=0, int layerNum=0);
|
||||
|
||||
void addBullet(const std::string& bullet, PositionData& positionData, FontData& fontData);
|
||||
|
||||
@ -515,4 +413,6 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -59,7 +59,7 @@ static const char* s_version = "1.3";
|
||||
void setViewer(osgViewer::Viewer& viewer, float width, float height, float distance)
|
||||
{
|
||||
double vfov = osg::RadiansToDegrees(atan2(height/2.0f,distance)*2.0);
|
||||
double hfov = osg::RadiansToDegrees(atan2(width/2.0f,distance)*2.0);
|
||||
// double hfov = osg::RadiansToDegrees(atan2(width/2.0f,distance)*2.0);
|
||||
|
||||
viewer.getCamera()->setProjectionMatrixAsPerspective( vfov, width/height, 0.1, 1000.0);
|
||||
}
|
||||
@ -160,7 +160,7 @@ enum P3DApplicationType
|
||||
{
|
||||
VIEWER,
|
||||
MASTER,
|
||||
SLAVE,
|
||||
SLAVE
|
||||
};
|
||||
|
||||
|
||||
@ -321,7 +321,7 @@ int main( int argc, char **argv )
|
||||
while (arguments.read("--loop")) loopPresentation = true;
|
||||
|
||||
// register the slide event handler - which moves the presentation from slide to slide, layer to layer.
|
||||
SlideEventHandler* seh = new SlideEventHandler(&viewer);
|
||||
osgPresentation::SlideEventHandler* seh = new osgPresentation::SlideEventHandler(&viewer);
|
||||
viewer.addEventHandler(seh);
|
||||
|
||||
seh->setAutoSteppingActive(autoSteppingActive);
|
||||
|
Loading…
Reference in New Issue
Block a user