Moved old osgPresentation source files to osgPresentation/deprecated subdirectory.

This commit is contained in:
Robert Osfield 2013-08-18 18:10:39 +00:00
parent 28ce02915a
commit 4e3715d4bb
24 changed files with 250 additions and 250 deletions

View File

@ -1,19 +1,19 @@
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield /* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
* *
* This software is open source and may be redistributed and/or modified under * This software is open source and may be redistributed and/or modified under
* the terms of the GNU General Public License (GPL) version 2.0. * the terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,. * The full license is in LICENSE.txt file included with this distribution,.
* *
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* include LICENSE.txt for more details. * include LICENSE.txt for more details.
*/ */
#ifndef EXPORTHTML_H #ifndef EXPORTHTML_H
#define EXPORTHTML_H 1 #define EXPORTHTML_H 1
#include <osgPresentation/SlideEventHandler> #include <osgPresentation/deprecated/SlideEventHandler>
#include <osgViewer/Viewer> #include <osgViewer/Viewer>
class ExportHTML class ExportHTML

View File

@ -1,19 +1,19 @@
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield /* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
* *
* This software is open source and may be redistributed and/or modified under * This software is open source and may be redistributed and/or modified under
* the terms of the GNU General Public License (GPL) version 2.0. * the terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,. * The full license is in LICENSE.txt file included with this distribution,.
* *
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* include LICENSE.txt for more details. * include LICENSE.txt for more details.
*/ */
#include "ReadShowFile.h" #include "ReadShowFile.h"
#include "ShowEventHandler.h" #include "ShowEventHandler.h"
#include <osgPresentation/SlideEventHandler> #include <osgPresentation/deprecated/SlideEventHandler>
#include <osg/ImageStream> #include <osg/ImageStream>
#include <osg/Shape> #include <osg/Shape>
@ -35,7 +35,7 @@ class AddVolumeEditingCallbackVisitor : public osg::NodeVisitor
public: public:
AddVolumeEditingCallbackVisitor(): AddVolumeEditingCallbackVisitor():
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {} osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
void apply(osg::Group& group) void apply(osg::Group& group)
{ {
osgVolume::VolumeTile* volumeTile = dynamic_cast<osgVolume::VolumeTile*>(&group); osgVolume::VolumeTile* volumeTile = dynamic_cast<osgVolume::VolumeTile*>(&group);
@ -51,7 +51,7 @@ public:
traverse(group); traverse(group);
} }
} }
}; };
bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, FileNameList& normalFiles) bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, FileNameList& normalFiles)
@ -62,7 +62,7 @@ bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, F
if (!arguments.isOption(pos)) if (!arguments.isOption(pos))
{ {
std::string ext = osgDB::getFileExtension(arguments[pos]); std::string ext = osgDB::getFileExtension(arguments[pos]);
if (osgDB::equalCaseInsensitive(ext,"xml") || osgDB::equalCaseInsensitive(ext,"p3d")) if (osgDB::equalCaseInsensitive(ext,"xml") || osgDB::equalCaseInsensitive(ext,"p3d"))
{ {
xmlFiles.push_back(arguments[pos]); xmlFiles.push_back(arguments[pos]);
} }
@ -73,7 +73,7 @@ bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, F
} }
} }
return (!xmlFiles.empty() || !normalFiles.empty()); return (!xmlFiles.empty() || !normalFiles.empty());
} }
bool p3d::readEnvVars(osg::ArgumentParser& arguments) bool p3d::readEnvVars(osg::ArgumentParser& arguments)
{ {
@ -94,23 +94,23 @@ bool p3d::readEnvVars(osg::ArgumentParser& arguments)
{ {
osgDB::getDataFilePathList().push_front(path); osgDB::getDataFilePathList().push_front(path);
} }
if (p3d::readEnvVars(file)) readVars = true; if (p3d::readEnvVars(file)) readVars = true;
} }
} }
} }
} }
return readVars; return readVars;
} }
bool p3d::readEnvVars(const std::string& fileName) bool p3d::readEnvVars(const std::string& fileName)
{ {
std::string ext = osgDB::getFileExtension(fileName); std::string ext = osgDB::getFileExtension(fileName);
if (!osgDB::equalCaseInsensitive(ext,"xml") && if (!osgDB::equalCaseInsensitive(ext,"xml") &&
!osgDB::equalCaseInsensitive(ext,"p3d")) return false; !osgDB::equalCaseInsensitive(ext,"p3d")) return false;
osg::ref_ptr<osgDB::XmlNode> doc = new osgDB::XmlNode; osg::ref_ptr<osgDB::XmlNode> doc = new osgDB::XmlNode;
osgDB::XmlNode* root = 0; osgDB::XmlNode* root = 0;
@ -146,7 +146,7 @@ bool p3d::readEnvVars(const std::string& fileName)
} }
bool readVars = false; bool readVars = false;
for(osgDB::XmlNode::Children::iterator itr = root->children.begin(); for(osgDB::XmlNode::Children::iterator itr = root->children.begin();
itr != root->children.end(); itr != root->children.end();
++itr) ++itr)
@ -182,7 +182,7 @@ osgDB::Options* createOptions(const osgDB::ReaderWriter::Options* options)
osg::ref_ptr<osg::Node> p3d::readHoldingSlide(const std::string& filename) osg::ref_ptr<osg::Node> p3d::readHoldingSlide(const std::string& filename)
{ {
std::string ext = osgDB::getFileExtension(filename); std::string ext = osgDB::getFileExtension(filename);
if (!osgDB::equalCaseInsensitive(ext,"xml") && if (!osgDB::equalCaseInsensitive(ext,"xml") &&
!osgDB::equalCaseInsensitive(ext,"p3d")) return 0; !osgDB::equalCaseInsensitive(ext,"p3d")) return 0;
osg::ref_ptr<osgDB::ReaderWriter::Options> options = createOptions(0); osg::ref_ptr<osgDB::ReaderWriter::Options> options = createOptions(0);
@ -260,12 +260,12 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
} }
} }
} }
if (nodeList.empty()) if (nodeList.empty())
{ {
return NULL; return NULL;
} }
osg::ref_ptr<osg::Node> root; osg::ref_ptr<osg::Node> root;
if (nodeList.size()==1) if (nodeList.size()==1)
@ -274,7 +274,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
} }
else // size >1 else // size >1
{ {
osg::Switch* sw = new osg::Switch; osg::Switch* sw = new osg::Switch;
for(NodeList::iterator itr=nodeList.begin(); for(NodeList::iterator itr=nodeList.begin();
itr!=nodeList.end(); itr!=nodeList.end();
@ -283,7 +283,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
sw->addChild((*itr).get()); sw->addChild((*itr).get());
} }
sw->setSingleChildOn(0); sw->setSingleChildOn(0);
sw->setEventCallback(new p3d::ShowEventHandler()); sw->setEventCallback(new p3d::ShowEventHandler());
root = sw; root = sw;
@ -292,7 +292,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
if (root.valid()) if (root.valid())
{ {
osg::notify(osg::INFO)<<"Got node now adding callback"<<std::endl; osg::notify(osg::INFO)<<"Got node now adding callback"<<std::endl;
AddVolumeEditingCallbackVisitor avecv; AddVolumeEditingCallbackVisitor avecv;
root->accept(avecv); root->accept(avecv);
} }

View File

@ -37,7 +37,7 @@
#include <osgGA/AnimationPathManipulator> #include <osgGA/AnimationPathManipulator>
#include <osgGA/StateSetManipulator> #include <osgGA/StateSetManipulator>
#include <osgPresentation/SlideEventHandler> #include <osgPresentation/deprecated/SlideEventHandler>
#include <osgPresentation/Cursor> #include <osgPresentation/Cursor>
#include "ReadShowFile.h" #include "ReadShowFile.h"

View File

@ -18,7 +18,7 @@
#include <osgGA/GUIEventHandler> #include <osgGA/GUIEventHandler>
#include <osgPresentation/SlideEventHandler> #include <osgPresentation/deprecated/SlideEventHandler>
namespace osgPresentation namespace osgPresentation
{ {
@ -33,7 +33,7 @@ class OSGPRESENTATION_EXPORT KeyEventHandler : public osgGA::GUIEventHandler
void setKey(int key) { _key = key; } void setKey(int key) { _key = key; }
int getKey() const { return _key; } int getKey() const { return _key; }
void setOperation(osgPresentation::Operation operation) { _operation = operation; } void setOperation(osgPresentation::Operation operation) { _operation = operation; }
osgPresentation::Operation getOperation() const { return _operation; } osgPresentation::Operation getOperation() const { return _operation; }
@ -55,7 +55,7 @@ class OSGPRESENTATION_EXPORT KeyEventHandler : public osgGA::GUIEventHandler
void doOperation(); void doOperation();
int _key; int _key;
std::string _command; std::string _command;
osgPresentation::KeyPosition _keyPos; osgPresentation::KeyPosition _keyPos;
osgPresentation::Operation _operation; osgPresentation::Operation _operation;

View File

@ -18,7 +18,7 @@
#include <osgGA/GUIEventHandler> #include <osgGA/GUIEventHandler>
#include <osgPresentation/SlideEventHandler> #include <osgPresentation/deprecated/SlideEventHandler>
namespace osgPresentation namespace osgPresentation
{ {
@ -42,7 +42,7 @@ class OSGPRESENTATION_EXPORT PickEventHandler : public osgGA::GUIEventHandler
void setJumpData(const JumpData& jumpData) { _jumpData = jumpData; } void setJumpData(const JumpData& jumpData) { _jumpData = jumpData; }
const JumpData& getJumpData() const { return _jumpData; } const JumpData& getJumpData() const { return _jumpData; }
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv); virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv);
virtual void accept(osgGA::GUIEventHandlerVisitor& v); virtual void accept(osgGA::GUIEventHandlerVisitor& v);

View File

@ -21,15 +21,15 @@
#include <osgGA/GUIEventHandler> #include <osgGA/GUIEventHandler>
#include <osgViewer/Viewer> #include <osgViewer/Viewer>
#include <osgPresentation/CompileSlideCallback> #include <osgPresentation/deprecated/CompileSlideCallback>
#include <osgPresentation/PropertyManager> #include <osgPresentation/deprecated/PropertyManager>
namespace osgPresentation namespace osgPresentation
{ {
// forward declare // forward declare
class SlideEventHandler; class SlideEventHandler;
/// Operations related to click to run/load/key events. /// Operations related to click to run/load/key events.
enum Operation enum Operation
{ {
@ -46,7 +46,7 @@ struct JumpData
relativeJump(true), relativeJump(true),
slideNum(0), slideNum(0),
layerNum(0) {} layerNum(0) {}
JumpData(bool in_relativeJump, int in_slideNum, int in_layerNum): JumpData(bool in_relativeJump, int in_slideNum, int in_layerNum):
relativeJump(in_relativeJump), relativeJump(in_relativeJump),
slideNum(in_slideNum), slideNum(in_slideNum),
@ -230,7 +230,7 @@ protected:
void processOutgoing(SlideEventHandler* seh); void processOutgoing(SlideEventHandler* seh);
void processIncomming(SlideEventHandler* seh); void processIncomming(SlideEventHandler* seh);
void processMaintained(SlideEventHandler* seh); void processMaintained(SlideEventHandler* seh);
bool _pause; bool _pause;
OperatorList _previous; OperatorList _previous;

View File

@ -31,10 +31,10 @@
#include <osgVolume/VolumeTile> #include <osgVolume/VolumeTile>
#include <osgVolume/Property> #include <osgVolume/Property>
#include <osgPresentation/AnimationMaterial> #include <osgPresentation/deprecated/AnimationMaterial>
#include <osgPresentation/SlideEventHandler> #include <osgPresentation/deprecated/SlideEventHandler>
#include <osgPresentation/PropertyManager> #include <osgPresentation/deprecated/PropertyManager>
#include <osgPresentation/Timeout> #include <osgPresentation/deprecated/Timeout>
namespace osgPresentation namespace osgPresentation
{ {
@ -67,7 +67,7 @@ public:
enum CoordinateFrame { SLIDE, MODEL }; enum CoordinateFrame { SLIDE, MODEL };
LayerAttributes* getOrCreateLayerAttributes(osg::Node* node); LayerAttributes* getOrCreateLayerAttributes(osg::Node* node);
void setDuration(osg::Node* node,double duration) void setDuration(osg::Node* node,double duration)
@ -253,7 +253,7 @@ public:
osg::Vec4 backgroundColor; osg::Vec4 backgroundColor;
double fps; double fps;
double duration; double duration;
bool imageSequence; bool imageSequence;
osg::ImageSequence::Mode imageSequencePagingMode; osg::ImageSequence::Mode imageSequencePagingMode;
@ -271,7 +271,7 @@ public:
OFF, OFF,
ON ON
}; };
BlendingHint blendingHint; BlendingHint blendingHint;
double delayTime; double delayTime;
@ -420,7 +420,7 @@ public:
CURRENT_SLIDE, CURRENT_SLIDE,
CURRENT_LAYER CURRENT_LAYER
}; };
void addEventHandler(PresentationContext presentationContext, osg::ref_ptr<osgGA::GUIEventHandler> handler); void addEventHandler(PresentationContext presentationContext, osg::ref_ptr<osgGA::GUIEventHandler> handler);
void keyToDoOperation(PresentationContext presentationContext, int key, Operation operation, const JumpData& jumpData=JumpData()); void keyToDoOperation(PresentationContext presentationContext, int key, Operation operation, const JumpData& jumpData=JumpData());
@ -456,7 +456,7 @@ public:
void addModel(const std::string& filename, const PositionData& positionData, const ModelData& modelData); void addModel(const std::string& filename, const PositionData& positionData, const ModelData& modelData);
void setUpVolumeScalarProperty(osgVolume::VolumeTile* tile, osgVolume::ScalarProperty* property, const std::string& source); void setUpVolumeScalarProperty(osgVolume::VolumeTile* tile, osgVolume::ScalarProperty* property, const std::string& source);
void addVolume(const std::string& filename, const PositionData& positionData, const VolumeData& volumeData); void addVolume(const std::string& filename, const PositionData& positionData, const VolumeData& volumeData);
osg::Group* takePresentation() { return _root.release(); } osg::Group* takePresentation() { return _root.release(); }
@ -469,7 +469,7 @@ public:
void pushCurrentLayer(); void pushCurrentLayer();
void popCurrentLayer(); void popCurrentLayer();
osg::Group* getCurrentLayer() { return _currentLayer.get(); } osg::Group* getCurrentLayer() { return _currentLayer.get(); }
void setLoopPresentation(bool loop) { _loopPresentation = loop; } void setLoopPresentation(bool loop) { _loopPresentation = loop; }
@ -555,7 +555,7 @@ protected:
osg::ref_ptr<osgPresentation::PropertyManager> _propertyManager; osg::ref_ptr<osgPresentation::PropertyManager> _propertyManager;
osg::ref_ptr<osgPresentation::PropertyEventCallback> _propertyEventCallback; osg::ref_ptr<osgPresentation::PropertyEventCallback> _propertyEventCallback;
osg::ref_ptr<osg::Group> _root; osg::ref_ptr<osg::Group> _root;
osg::ref_ptr<osg::Switch> _presentationSwitch; osg::ref_ptr<osg::Switch> _presentationSwitch;

View File

@ -16,7 +16,7 @@
#include <osg/Transform> #include <osg/Transform>
#include <osgPresentation/SlideEventHandler> #include <osgPresentation/deprecated/SlideEventHandler>
namespace osgPresentation { namespace osgPresentation {
@ -38,7 +38,7 @@ protected:
virtual ~HUDSettings(); virtual ~HUDSettings();
}; };
class OSGPRESENTATION_EXPORT Timeout : public osg::Transform class OSGPRESENTATION_EXPORT Timeout : public osg::Transform
{ {
public: public:
@ -50,14 +50,14 @@ class OSGPRESENTATION_EXPORT Timeout : public osg::Transform
META_Node(osgPresentation, Timeout); META_Node(osgPresentation, Timeout);
void setIdleDurationBeforeTimeoutDisplay(double t) { _idleDurationBeforeTimeoutDisplay = t; } void setIdleDurationBeforeTimeoutDisplay(double t) { _idleDurationBeforeTimeoutDisplay = t; }
double getIdleDurationBeforeTimeoutDisplay() const { return _idleDurationBeforeTimeoutDisplay; } double getIdleDurationBeforeTimeoutDisplay() const { return _idleDurationBeforeTimeoutDisplay; }
void setIdleDurationBeforeTimeoutAction(double t) { _idleDurationBeforeTimeoutAction = t; } void setIdleDurationBeforeTimeoutAction(double t) { _idleDurationBeforeTimeoutAction = t; }
double getIdleDurationBeforeTimeoutAction() const { return _idleDurationBeforeTimeoutAction; } double getIdleDurationBeforeTimeoutAction() const { return _idleDurationBeforeTimeoutAction; }
void setKeyStartsTimoutDisplay(int key) { _keyStartsTimoutDisplay = key; } void setKeyStartsTimoutDisplay(int key) { _keyStartsTimoutDisplay = key; }
int getKeyStartsTimoutDisplay() const { return _keyStartsTimoutDisplay; } int getKeyStartsTimoutDisplay() const { return _keyStartsTimoutDisplay; }
@ -67,7 +67,7 @@ class OSGPRESENTATION_EXPORT Timeout : public osg::Transform
void setKeyRunTimoutAction(int key) { _keyRunTimeoutAction = key; } void setKeyRunTimoutAction(int key) { _keyRunTimeoutAction = key; }
int getKeyRunTimoutAction() const { return _keyRunTimeoutAction; } int getKeyRunTimoutAction() const { return _keyRunTimeoutAction; }
void setDisplayBroadcastKeyPosition(const osgPresentation::KeyPosition& keyPos) { _displayBroadcastKeyPos = keyPos; } void setDisplayBroadcastKeyPosition(const osgPresentation::KeyPosition& keyPos) { _displayBroadcastKeyPos = keyPos; }
const osgPresentation::KeyPosition& getDisplayBroadcastKeyPosition() const { return _displayBroadcastKeyPos; } const osgPresentation::KeyPosition& getDisplayBroadcastKeyPosition() const { return _displayBroadcastKeyPos; }

View File

@ -17,7 +17,7 @@
#include <osg/ValueObject> #include <osg/ValueObject>
#include <osgDB/FileUtils> #include <osgDB/FileUtils>
#include <osgDB/FileNameUtils> #include <osgDB/FileNameUtils>
#include <osgPresentation/PropertyManager> #include <osgPresentation/deprecated/PropertyManager>
#include "osc/OscPrintReceivedElements.h" #include "osc/OscPrintReceivedElements.h"
#include "osc/OscHostEndianness.h" #include "osc/OscHostEndianness.h"
@ -93,7 +93,7 @@ public:
{ {
} }
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m); virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m);
virtual void describeTo(std::ostream& out) const virtual void describeTo(std::ostream& out) const
{ {
out << getRequestPath() << ": add all transmitted arguments as ValueObjects to an USER-event"; out << getRequestPath() << ": add all transmitted arguments as ValueObjects to an USER-event";
@ -102,7 +102,7 @@ public:
} }
private: private:
void addArgumentToUdc(osg::UserDataContainer* udc, const std::string& key, const osc::ReceivedMessageArgumentIterator& itr); void addArgumentToUdc(osg::UserDataContainer* udc, const std::string& key, const osc::ReceivedMessageArgumentIterator& itr);
template <class T> template <class T>
bool addNativeTypeFromVector(osg::UserDataContainer* udc, const std::string& key, const std::vector<T>& arr) bool addNativeTypeFromVector(osg::UserDataContainer* udc, const std::string& key, const std::vector<T>& arr)
{ {
@ -128,9 +128,9 @@ private:
} }
return false; return false;
} }
bool _treatFirstArgumentAsValueName; bool _treatFirstArgumentAsValueName;
}; };
@ -141,18 +141,18 @@ bool StandardRequestHandler::operator()(const std::string& request_path, const s
{ {
std::string path = osgDB::getFilePath(full_request_path); std::string path = osgDB::getFilePath(full_request_path);
std::string last_elem = osgDB::getSimpleFileName(full_request_path); std::string last_elem = osgDB::getSimpleFileName(full_request_path);
osg::ref_ptr<osgGA::GUIEventAdapter> ea = getDevice()->getOrCreateUserDataEvent(); osg::ref_ptr<osgGA::GUIEventAdapter> ea = getDevice()->getOrCreateUserDataEvent();
osg::UserDataContainer* udc = ea->getOrCreateUserDataContainer(); osg::UserDataContainer* udc = ea->getOrCreateUserDataContainer();
ea->setName(_treatFirstArgumentAsValueName ? full_request_path : path); ea->setName(_treatFirstArgumentAsValueName ? full_request_path : path);
udc->setName(ea->getName()); udc->setName(ea->getName());
if (m.ArgumentCount() == 0) { if (m.ArgumentCount() == 0) {
return true; return true;
} }
// if we have only one argument, get it and save it to the udc // if we have only one argument, get it and save it to the udc
else if (m.ArgumentCount() == 1) else if (m.ArgumentCount() == 1)
{ {
@ -210,7 +210,7 @@ bool StandardRequestHandler::operator()(const std::string& request_path, const s
return true; return true;
} }
} }
for(osc::ReceivedMessageArgumentIterator itr = start; itr != m.ArgumentsEnd(); ++itr, ++i) for(osc::ReceivedMessageArgumentIterator itr = start; itr != m.ArgumentsEnd(); ++itr, ++i)
{ {
std::ostringstream ss; std::ostringstream ss;
@ -219,7 +219,7 @@ bool StandardRequestHandler::operator()(const std::string& request_path, const s
} }
} }
return true; return true;
} }
catch(osc::Exception& e) catch(osc::Exception& e)
{ {
@ -237,46 +237,46 @@ void StandardRequestHandler::addArgumentToUdc(osg::UserDataContainer* udc, const
case osc::TRUE_TYPE_TAG: case osc::TRUE_TYPE_TAG:
udc->setUserValue(key, true); udc->setUserValue(key, true);
break; break;
case osc::FALSE_TYPE_TAG: case osc::FALSE_TYPE_TAG:
udc->setUserValue(key, false); udc->setUserValue(key, false);
break; break;
case osc::INT32_TYPE_TAG: case osc::INT32_TYPE_TAG:
udc->setUserValue(key, (int)((*itr).AsInt32Unchecked())); udc->setUserValue(key, (int)((*itr).AsInt32Unchecked()));
break; break;
case osc::FLOAT_TYPE_TAG: case osc::FLOAT_TYPE_TAG:
udc->setUserValue(key, (*itr).AsFloatUnchecked()); udc->setUserValue(key, (*itr).AsFloatUnchecked());
break; break;
case osc::CHAR_TYPE_TAG: case osc::CHAR_TYPE_TAG:
udc->setUserValue(key, (*itr).AsCharUnchecked()); udc->setUserValue(key, (*itr).AsCharUnchecked());
break; break;
case osc::RGBA_COLOR_TYPE_TAG: case osc::RGBA_COLOR_TYPE_TAG:
// TODO: should we convert the color to an osg::Vec4? // TODO: should we convert the color to an osg::Vec4?
udc->setUserValue(key, static_cast<unsigned int>((*itr).AsRgbaColorUnchecked())); udc->setUserValue(key, static_cast<unsigned int>((*itr).AsRgbaColorUnchecked()));
break; break;
case osc::INT64_TYPE_TAG: case osc::INT64_TYPE_TAG:
// TODO 64bit ints not supported by ValueObject // TODO 64bit ints not supported by ValueObject
udc->setUserValue(key, static_cast<double>((*itr).AsInt64Unchecked())); udc->setUserValue(key, static_cast<double>((*itr).AsInt64Unchecked()));
break; break;
case osc::TIME_TAG_TYPE_TAG: case osc::TIME_TAG_TYPE_TAG:
// TODO 64bit ints not supported by ValueObject // TODO 64bit ints not supported by ValueObject
udc->setUserValue(key, static_cast<double>((*itr).AsTimeTagUnchecked())); udc->setUserValue(key, static_cast<double>((*itr).AsTimeTagUnchecked()));
break; break;
case osc::DOUBLE_TYPE_TAG: case osc::DOUBLE_TYPE_TAG:
udc->setUserValue(key, (*itr).AsDoubleUnchecked()); udc->setUserValue(key, (*itr).AsDoubleUnchecked());
break; break;
case osc::STRING_TYPE_TAG: case osc::STRING_TYPE_TAG:
udc->setUserValue(key, std::string((*itr).AsStringUnchecked())); udc->setUserValue(key, std::string((*itr).AsStringUnchecked()));
break; break;
case osc::SYMBOL_TYPE_TAG: case osc::SYMBOL_TYPE_TAG:
udc->setUserValue(key, std::string((*itr).AsSymbol())); udc->setUserValue(key, std::string((*itr).AsSymbol()));
break; break;
@ -297,25 +297,25 @@ public:
: OscReceivingDevice::RequestHandler("/osgga/mouse/set_input_range") : OscReceivingDevice::RequestHandler("/osgga/mouse/set_input_range")
{ {
} }
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m) virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
{ {
try { try {
float x_min(-1.0f), y_min(-1.0f), x_max(1.0f), y_max(1.0f); float x_min(-1.0f), y_min(-1.0f), x_max(1.0f), y_max(1.0f);
osc::ReceivedMessageArgumentStream args = m.ArgumentStream(); osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
args >> x_min >> y_min >> x_max >> y_max >> osc::EndMessage; args >> x_min >> y_min >> x_max >> y_max >> osc::EndMessage;
getDevice()->getEventQueue()->setMouseInputRange(x_min, y_min, x_max, y_max); getDevice()->getEventQueue()->setMouseInputRange(x_min, y_min, x_max, y_max);
return true; return true;
} }
catch(osc::Exception e) { catch(osc::Exception e) {
handleException(e); handleException(e);
} }
return false; return false;
} }
virtual void describeTo(std::ostream& out) const virtual void describeTo(std::ostream& out) const
{ {
out << getRequestPath() << "(float x_min, float y_min, float x_max, float y_max): sets the mouse-input-range" << std::dec; out << getRequestPath() << "(float x_min, float y_min, float x_max, float y_max): sets the mouse-input-range" << std::dec;
@ -329,26 +329,26 @@ public:
: OscReceivingDevice::RequestHandler("/osgga/mouse/y_orientation_increasing_upwards") : OscReceivingDevice::RequestHandler("/osgga/mouse/y_orientation_increasing_upwards")
{ {
} }
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m) virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
{ {
try { try {
bool increasing_upwards(false); bool increasing_upwards(false);
osc::ReceivedMessageArgumentStream args = m.ArgumentStream(); osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
args >>increasing_upwards >> osc::EndMessage; args >>increasing_upwards >> osc::EndMessage;
getDevice()->getEventQueue()->getCurrentEventState()->setMouseYOrientation( getDevice()->getEventQueue()->getCurrentEventState()->setMouseYOrientation(
increasing_upwards ? osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS : osgGA::GUIEventAdapter::Y_INCREASING_DOWNWARDS); increasing_upwards ? osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS : osgGA::GUIEventAdapter::Y_INCREASING_DOWNWARDS);
return true; return true;
} }
catch(osc::Exception e) { catch(osc::Exception e) {
handleException(e); handleException(e);
} }
return false; return false;
} }
virtual void describeTo(std::ostream& out) const virtual void describeTo(std::ostream& out) const
{ {
out << getRequestPath() << "(float x_min, float y_min, float x_max, float y_max): sets the mouse-input-range" << std::dec; out << getRequestPath() << "(float x_min, float y_min, float x_max, float y_max): sets the mouse-input-range" << std::dec;
@ -363,28 +363,28 @@ public:
, _handleKeyPress(handle_key_press) , _handleKeyPress(handle_key_press)
{ {
} }
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m) virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
{ {
try { try {
osc::int32 keycode(0); osc::int32 keycode(0);
osc::ReceivedMessageArgumentStream args = m.ArgumentStream(); osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
args >> keycode >> osc::EndMessage; args >> keycode >> osc::EndMessage;
if (_handleKeyPress) if (_handleKeyPress)
getDevice()->getEventQueue()->keyPress(keycode, getLocalTime()); getDevice()->getEventQueue()->keyPress(keycode, getLocalTime());
else else
getDevice()->getEventQueue()->keyRelease(keycode, getLocalTime()); getDevice()->getEventQueue()->keyRelease(keycode, getLocalTime());
return true; return true;
} }
catch(osc::Exception e) { catch(osc::Exception e) {
handleException(e); handleException(e);
} }
return false; return false;
} }
virtual void describeTo(std::ostream& out) const virtual void describeTo(std::ostream& out) const
{ {
out << getRequestPath() << "(int keycode): send KEY_" << (_handleKeyPress ? "DOWN" : "UP"); out << getRequestPath() << "(int keycode): send KEY_" << (_handleKeyPress ? "DOWN" : "UP");
@ -400,26 +400,26 @@ public:
: OscReceivingDevice::RequestHandler("/osgga/key/press_and_release") : OscReceivingDevice::RequestHandler("/osgga/key/press_and_release")
{ {
} }
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m) virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
{ {
try { try {
osc::int32 keycode(0); osc::int32 keycode(0);
osc::ReceivedMessageArgumentStream args = m.ArgumentStream(); osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
args >> keycode >> osc::EndMessage; args >> keycode >> osc::EndMessage;
getDevice()->getEventQueue()->keyPress(keycode, getLocalTime()); getDevice()->getEventQueue()->keyPress(keycode, getLocalTime());
getDevice()->getEventQueue()->keyRelease(keycode, getLocalTime()); getDevice()->getEventQueue()->keyRelease(keycode, getLocalTime());
return true; return true;
} }
catch(osc::Exception e) { catch(osc::Exception e) {
handleException(e); handleException(e);
} }
return false; return false;
} }
virtual void describeTo(std::ostream& out) const virtual void describeTo(std::ostream& out) const
{ {
out << getRequestPath() << "(int keycode): send KEY_DOWN and KEY_UP"; out << getRequestPath() << "(int keycode): send KEY_DOWN and KEY_UP";
@ -439,16 +439,16 @@ public:
, _lastY(0.0f) , _lastY(0.0f)
{ {
} }
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m) virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
{ {
try { try {
osc::ReceivedMessageArgumentStream args = m.ArgumentStream(); osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
args >> _lastX >> _lastY >> osc::EndMessage; args >> _lastX >> _lastY >> osc::EndMessage;
getDevice()->getEventQueue()->mouseMotion(_lastX, _lastY, getLocalTime()); getDevice()->getEventQueue()->mouseMotion(_lastX, _lastY, getLocalTime());
return true; return true;
} }
catch (osc::Exception e) { catch (osc::Exception e) {
@ -456,7 +456,7 @@ public:
} }
return false; return false;
} }
virtual void describeTo(std::ostream& out) const virtual void describeTo(std::ostream& out) const
{ {
out << getRequestPath() << "(float x, float y): send mouse motion"; out << getRequestPath() << "(float x, float y): send mouse motion";
@ -474,23 +474,23 @@ public:
: OscReceivingDevice::RequestHandler("/osgga/mouse/scroll") : OscReceivingDevice::RequestHandler("/osgga/mouse/scroll")
{ {
} }
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m) virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
{ {
try { try {
osc::int32 sm(osgGA::GUIEventAdapter::SCROLL_NONE); osc::int32 sm(osgGA::GUIEventAdapter::SCROLL_NONE);
float delta_x(0.0f), delta_y(0.0f); float delta_x(0.0f), delta_y(0.0f);
osc::ReceivedMessageArgumentStream args = m.ArgumentStream(); osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
args >> sm >> delta_x >> delta_y >> osc::EndMessage; args >> sm >> delta_x >> delta_y >> osc::EndMessage;
if (sm != osgGA::GUIEventAdapter::SCROLL_NONE) if (sm != osgGA::GUIEventAdapter::SCROLL_NONE)
getDevice()->getEventQueue()->mouseScroll((osgGA::GUIEventAdapter::ScrollingMotion)sm, getLocalTime()); getDevice()->getEventQueue()->mouseScroll((osgGA::GUIEventAdapter::ScrollingMotion)sm, getLocalTime());
if ((delta_x != 0.0f) || (delta_y != 0.0f)) if ((delta_x != 0.0f) || (delta_y != 0.0f))
getDevice()->getEventQueue()->mouseScroll2D(delta_x, delta_y, getLocalTime()); getDevice()->getEventQueue()->mouseScroll2D(delta_x, delta_y, getLocalTime());
return true; return true;
} }
catch (osc::Exception e) { catch (osc::Exception e) {
@ -498,7 +498,7 @@ public:
} }
return false; return false;
} }
virtual void describeTo(std::ostream& out) const virtual void describeTo(std::ostream& out) const
{ {
out << getRequestPath() << "(int scroll_motion, float x, float y): send mouse scroll-motion"; out << getRequestPath() << "(int scroll_motion, float x, float y): send mouse scroll-motion";
@ -515,20 +515,20 @@ public:
, _btnNum(atoi(btn_name.c_str())) , _btnNum(atoi(btn_name.c_str()))
{ {
} }
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m) virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
{ {
float down(0.0f); float down(0.0f);
try { try {
osc::ReceivedMessageArgumentStream args = m.ArgumentStream(); osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
args >> down >> osc::EndMessage; args >> down >> osc::EndMessage;
if (down > 0) if (down > 0)
getDevice()->getEventQueue()->mouseButtonPress(_mmHandler->getLastX(), _mmHandler->getLastY(), _btnNum, getLocalTime()); getDevice()->getEventQueue()->mouseButtonPress(_mmHandler->getLastX(), _mmHandler->getLastY(), _btnNum, getLocalTime());
else else
getDevice()->getEventQueue()->mouseButtonRelease(_mmHandler->getLastX(), _mmHandler->getLastY(), _btnNum, getLocalTime()); getDevice()->getEventQueue()->mouseButtonRelease(_mmHandler->getLastX(), _mmHandler->getLastY(), _btnNum, getLocalTime());
return true; return true;
} }
catch (osc::Exception e) { catch (osc::Exception e) {
@ -536,7 +536,7 @@ public:
} }
return false; return false;
} }
virtual void describeTo(std::ostream& out) const virtual void describeTo(std::ostream& out) const
{ {
out << getRequestPath() << "(float down): toggle mouse button"; out << getRequestPath() << "(float down): toggle mouse button";
@ -550,7 +550,7 @@ private:
class MouseButtonRequestHandler : public OscReceivingDevice::RequestHandler { class MouseButtonRequestHandler : public OscReceivingDevice::RequestHandler {
public: public:
enum Mode { PRESS, RELEASE, DOUBLE_PRESS}; enum Mode { PRESS, RELEASE, DOUBLE_PRESS};
MouseButtonRequestHandler(Mode mode) MouseButtonRequestHandler(Mode mode)
: OscReceivingDevice::RequestHandler("") : OscReceivingDevice::RequestHandler("")
, _mode(mode) , _mode(mode)
@ -567,12 +567,12 @@ public:
break; break;
} }
} }
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m) virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
{ {
float x(0.0f), y(0.0f); float x(0.0f), y(0.0f);
osc::int32 btn(0); osc::int32 btn(0);
try { try {
osc::ReceivedMessageArgumentStream args = m.ArgumentStream(); osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
args >> x >> y >> btn >> osc::EndMessage; args >> x >> y >> btn >> osc::EndMessage;
@ -587,7 +587,7 @@ public:
getDevice()->getEventQueue()->mouseDoubleButtonPress(x,y, btn, getLocalTime()); getDevice()->getEventQueue()->mouseDoubleButtonPress(x,y, btn, getLocalTime());
break; break;
} }
return true; return true;
} }
catch (osc::Exception e) { catch (osc::Exception e) {
@ -595,7 +595,7 @@ public:
} }
return false; return false;
} }
virtual void describeTo(std::ostream& out) const virtual void describeTo(std::ostream& out) const
{ {
out << getRequestPath() << "(float x, float y, int btn): send mouse "; out << getRequestPath() << "(float x, float y, int btn): send mouse ";
@ -608,7 +608,7 @@ public:
out << "double press"; break; out << "double press"; break;
} }
} }
private: private:
Mode _mode; Mode _mode;
}; };
@ -620,16 +620,16 @@ public:
: OscReceivingDevice::RequestHandler("/osgga/pen/pressure") : OscReceivingDevice::RequestHandler("/osgga/pen/pressure")
{ {
} }
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m) virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
{ {
try { try {
float pressure(0.0f); float pressure(0.0f);
osc::ReceivedMessageArgumentStream args = m.ArgumentStream(); osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
args >> pressure >> osc::EndMessage; args >> pressure >> osc::EndMessage;
getDevice()->getEventQueue()->penPressure(pressure, getLocalTime()); getDevice()->getEventQueue()->penPressure(pressure, getLocalTime());
return true; return true;
} }
catch (osc::Exception e) { catch (osc::Exception e) {
@ -637,7 +637,7 @@ public:
} }
return false; return false;
} }
virtual void describeTo(std::ostream& out) const virtual void describeTo(std::ostream& out) const
{ {
out << getRequestPath() << "(float pressure): send pen pressure"; out << getRequestPath() << "(float pressure): send pen pressure";
@ -651,17 +651,17 @@ public:
, _handleEnter(handle_enter) , _handleEnter(handle_enter)
{ {
} }
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m) virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
{ {
try { try {
osc::int32 pt(osgGA::GUIEventAdapter::UNKNOWN); osc::int32 pt(osgGA::GUIEventAdapter::UNKNOWN);
osc::ReceivedMessageArgumentStream args = m.ArgumentStream(); osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
args >> pt >> osc::EndMessage; args >> pt >> osc::EndMessage;
getDevice()->getEventQueue()->penProximity((osgGA::GUIEventAdapter::TabletPointerType)pt, _handleEnter, getLocalTime()); getDevice()->getEventQueue()->penProximity((osgGA::GUIEventAdapter::TabletPointerType)pt, _handleEnter, getLocalTime());
return true; return true;
} }
catch (osc::Exception e) { catch (osc::Exception e) {
@ -669,7 +669,7 @@ public:
} }
return false; return false;
} }
virtual void describeTo(std::ostream& out) const virtual void describeTo(std::ostream& out) const
{ {
out << getRequestPath() << "(int table_pointer_type): send pen proximity " << (_handleEnter ? "enter":"leave"); out << getRequestPath() << "(int table_pointer_type): send pen proximity " << (_handleEnter ? "enter":"leave");
@ -685,16 +685,16 @@ public:
: OscReceivingDevice::RequestHandler("/osgga/pen/orientation") : OscReceivingDevice::RequestHandler("/osgga/pen/orientation")
{ {
} }
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m) virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
{ {
try { try {
float rotation(0.0f), tilt_x(0.0f), tilt_y(0.0f); float rotation(0.0f), tilt_x(0.0f), tilt_y(0.0f);
osc::ReceivedMessageArgumentStream args = m.ArgumentStream(); osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
args >> rotation >> tilt_x >> tilt_y >> osc::EndMessage; args >> rotation >> tilt_x >> tilt_y >> osc::EndMessage;
getDevice()->getEventQueue()->penOrientation(tilt_x, tilt_y, rotation, getLocalTime()); getDevice()->getEventQueue()->penOrientation(tilt_x, tilt_y, rotation, getLocalTime());
return true; return true;
} }
catch (osc::Exception e) { catch (osc::Exception e) {
@ -702,7 +702,7 @@ public:
} }
return false; return false;
} }
virtual void describeTo(std::ostream& out) const virtual void describeTo(std::ostream& out) const
{ {
out << getRequestPath() << "(float rotation, float tilt_x, float tilt_y): send pen orientation"; out << getRequestPath() << "(float rotation, float tilt_x, float tilt_y): send pen orientation";
@ -732,34 +732,34 @@ OscReceivingDevice::OscReceivingDevice(const std::string& server_address, int li
OSG_NOTICE << "(big endian)"; OSG_NOTICE << "(big endian)";
#endif #endif
OSG_NOTICE << std::endl; OSG_NOTICE << std::endl;
_socket = new UdpListeningReceiveSocket(IpEndpointName( server_address.c_str(), listening_port ), this); _socket = new UdpListeningReceiveSocket(IpEndpointName( server_address.c_str(), listening_port ), this);
addRequestHandler(new OscDevice::KeyCodeRequestHandler(false)); addRequestHandler(new OscDevice::KeyCodeRequestHandler(false));
addRequestHandler(new OscDevice::KeyCodeRequestHandler(true)); addRequestHandler(new OscDevice::KeyCodeRequestHandler(true));
addRequestHandler(new OscDevice::KeyPressAndReleaseRequestHandler()); addRequestHandler(new OscDevice::KeyPressAndReleaseRequestHandler());
addRequestHandler(new OscDevice::SetMouseInputRangeRequestHandler()); addRequestHandler(new OscDevice::SetMouseInputRangeRequestHandler());
addRequestHandler(new OscDevice::SetMouseOrientationRequestHandler()); addRequestHandler(new OscDevice::SetMouseOrientationRequestHandler());
OscDevice::MouseMotionRequestHandler* mm_handler = new OscDevice::MouseMotionRequestHandler(); OscDevice::MouseMotionRequestHandler* mm_handler = new OscDevice::MouseMotionRequestHandler();
addRequestHandler(mm_handler); addRequestHandler(mm_handler);
addRequestHandler(new OscDevice::MouseButtonRequestHandler(OscDevice::MouseButtonRequestHandler::PRESS)); addRequestHandler(new OscDevice::MouseButtonRequestHandler(OscDevice::MouseButtonRequestHandler::PRESS));
addRequestHandler(new OscDevice::MouseButtonRequestHandler(OscDevice::MouseButtonRequestHandler::RELEASE)); addRequestHandler(new OscDevice::MouseButtonRequestHandler(OscDevice::MouseButtonRequestHandler::RELEASE));
addRequestHandler(new OscDevice::MouseButtonRequestHandler(OscDevice::MouseButtonRequestHandler::DOUBLE_PRESS)); addRequestHandler(new OscDevice::MouseButtonRequestHandler(OscDevice::MouseButtonRequestHandler::DOUBLE_PRESS));
addRequestHandler(new OscDevice::MouseScrollRequestHandler()); addRequestHandler(new OscDevice::MouseScrollRequestHandler());
addRequestHandler(new OscDevice::MouseButtonToggleRequestHandler("1", mm_handler)); addRequestHandler(new OscDevice::MouseButtonToggleRequestHandler("1", mm_handler));
addRequestHandler(new OscDevice::MouseButtonToggleRequestHandler("2", mm_handler)); addRequestHandler(new OscDevice::MouseButtonToggleRequestHandler("2", mm_handler));
addRequestHandler(new OscDevice::MouseButtonToggleRequestHandler("3", mm_handler)); addRequestHandler(new OscDevice::MouseButtonToggleRequestHandler("3", mm_handler));
addRequestHandler(new OscDevice::PenPressureRequestHandler()); addRequestHandler(new OscDevice::PenPressureRequestHandler());
addRequestHandler(new OscDevice::PenOrientationRequestHandler()); addRequestHandler(new OscDevice::PenOrientationRequestHandler());
addRequestHandler(new OscDevice::PenProximityRequestHandler(true)); addRequestHandler(new OscDevice::PenProximityRequestHandler(true));
addRequestHandler(new OscDevice::PenProximityRequestHandler(false)); addRequestHandler(new OscDevice::PenProximityRequestHandler(false));
addRequestHandler(new OscDevice::StandardRequestHandler("/osg/set_user_value", true)); addRequestHandler(new OscDevice::StandardRequestHandler("/osg/set_user_value", true));
addRequestHandler(new OscDevice::StandardRequestHandler("", false)); addRequestHandler(new OscDevice::StandardRequestHandler("", false));
setSchedulePriority(OpenThreads::Thread::THREAD_PRIORITY_LOW); setSchedulePriority(OpenThreads::Thread::THREAD_PRIORITY_LOW);
start(); start();
@ -783,10 +783,10 @@ void OscReceivingDevice::run()
void OscReceivingDevice::ProcessMessage( const osc::ReceivedMessage& m, const IpEndpointName& remoteEndpoint ) void OscReceivingDevice::ProcessMessage( const osc::ReceivedMessage& m, const IpEndpointName& remoteEndpoint )
{ {
std::string in_request_path(m.AddressPattern()); std::string in_request_path(m.AddressPattern());
if (in_request_path == "/osc/msg_id") if (in_request_path == "/osc/msg_id")
return; return;
std::string request_path = in_request_path + "/"; std::string request_path = in_request_path + "/";
std::size_t pos(std::string::npos); std::size_t pos(std::string::npos);
@ -796,17 +796,17 @@ void OscReceivingDevice::ProcessMessage( const osc::ReceivedMessage& m, const Ip
if (pos != std::string::npos) if (pos != std::string::npos)
{ {
std::string mangled_path = request_path.substr(0, pos); std::string mangled_path = request_path.substr(0, pos);
std::pair<RequestHandlerMap::iterator,RequestHandlerMap::iterator> range = _map.equal_range(mangled_path); std::pair<RequestHandlerMap::iterator,RequestHandlerMap::iterator> range = _map.equal_range(mangled_path);
for(RequestHandlerMap::iterator i = range.first; i != range.second; ++i) for(RequestHandlerMap::iterator i = range.first; i != range.second; ++i)
{ {
// OSG_INFO << "OscDevice :: handling " << mangled_path << " with " << i->second << std::endl; // OSG_INFO << "OscDevice :: handling " << mangled_path << " with " << i->second << std::endl;
if (i->second->operator()(mangled_path, in_request_path, m) && !handled) if (i->second->operator()(mangled_path, in_request_path, m) && !handled)
handled = true; handled = true;
} }
} }
} while ((pos != std::string::npos) && (pos > 0) && !handled); } while ((pos != std::string::npos) && (pos > 0) && !handled);
@ -817,7 +817,7 @@ void OscReceivingDevice::ProcessBundle( const osc::ReceivedBundle& b,
{ {
// find msg-id // find msg-id
MsgIdType msg_id(0); MsgIdType msg_id(0);
for( osc::ReceivedBundle::const_iterator i = b.ElementsBegin(); i != b.ElementsEnd(); ++i ){ for( osc::ReceivedBundle::const_iterator i = b.ElementsBegin(); i != b.ElementsEnd(); ++i ){
const osc::ReceivedMessage& m = osc::ReceivedMessage(*i); const osc::ReceivedMessage& m = osc::ReceivedMessage(*i);
std::string address_pattern(m.AddressPattern()); std::string address_pattern(m.AddressPattern());
@ -836,7 +836,7 @@ void OscReceivingDevice::ProcessBundle( const osc::ReceivedBundle& b,
_lastMsgId = 0; _lastMsgId = 0;
} }
_lastMsgTimeStamp = now; _lastMsgTimeStamp = now;
if (msg_id <= _lastMsgId) { if (msg_id <= _lastMsgId) {
// already handled // already handled
// OSG_WARN << "OscReceiver :: message with lower id received: " << msg_id << std::endl; // OSG_WARN << "OscReceiver :: message with lower id received: " << msg_id << std::endl;
@ -849,8 +849,8 @@ void OscReceivingDevice::ProcessBundle( const osc::ReceivedBundle& b,
_lastMsgId = msg_id; _lastMsgId = msg_id;
} }
} }
for( osc::ReceivedBundle::const_iterator i = b.ElementsBegin(); i != b.ElementsEnd(); ++i ){ for( osc::ReceivedBundle::const_iterator i = b.ElementsBegin(); i != b.ElementsEnd(); ++i ){
if( i->IsBundle() ) if( i->IsBundle() )
ProcessBundle( osc::ReceivedBundle(*i), remoteEndpoint ); ProcessBundle( osc::ReceivedBundle(*i), remoteEndpoint );
@ -873,16 +873,16 @@ void OscReceivingDevice::ProcessPacket( const char *data, int size, const IpEndp
catch(...) { catch(...) {
OSG_WARN << "OscDevice :: could not process UDP-packet because of an exception!" << std::endl; OSG_WARN << "OscDevice :: could not process UDP-packet because of an exception!" << std::endl;
} }
if (_userDataEvent.valid()) if (_userDataEvent.valid())
{ {
char address[IpEndpointName::ADDRESS_AND_PORT_STRING_LENGTH]; char address[IpEndpointName::ADDRESS_AND_PORT_STRING_LENGTH];
remoteEndpoint.AddressAndPortAsString(address); remoteEndpoint.AddressAndPortAsString(address);
_userDataEvent->setUserValue("osc/remote_end_point", std::string(address)); _userDataEvent->setUserValue("osc/remote_end_point", std::string(address));
getEventQueue()->addEvent(_userDataEvent.get()); getEventQueue()->addEvent(_userDataEvent.get());
_userDataEvent = NULL; _userDataEvent = NULL;
} }
@ -901,7 +901,7 @@ void OscReceivingDevice::describeTo(std::ostream& out) const
{ {
out << "OscDevice :: listening on " << _listeningAddress << ":" << _listeningPort << std::endl; out << "OscDevice :: listening on " << _listeningAddress << ":" << _listeningPort << std::endl;
out << std::endl; out << std::endl;
for(RequestHandlerMap::const_iterator i = _map.begin(); i != _map.end(); ++i) for(RequestHandlerMap::const_iterator i = _map.begin(); i != _map.end(); ++i)
{ {
const RequestHandler* handler(i->second.get()); const RequestHandler* handler(i->second.get());

View File

@ -14,8 +14,8 @@
/* /*
* ReadMe * ReadMe
* *
* the osc-plugin can return an osgGA::Device which handles various osc-messages * the osc-plugin can return an osgGA::Device which handles various osc-messages
* and puts them into the event-queue of the app * and puts them into the event-queue of the app
* you can set arbitrary values via /osg/set_user_value, these values * you can set arbitrary values via /osg/set_user_value, these values
* are set on the attached UserDataConntainer (see below) * are set on the attached UserDataConntainer (see below)
@ -26,21 +26,21 @@
* osgGA::Device* device = dynamic_cast<osgGA::Device*>(osgDB::readObjectFile(filename)); * osgGA::Device* device = dynamic_cast<osgGA::Device*>(osgDB::readObjectFile(filename));
* *
* and add that device to your viewer * and add that device to your viewer
* The plugin supports the following option: documentRegisteredHandlers, which will * The plugin supports the following option: documentRegisteredHandlers, which will
* dump all registered handlers to the console. The device registers some convenient * dump all registered handlers to the console. The device registers some convenient
* handlers to remote control a p3d-presentation. * handlers to remote control a p3d-presentation.
* *
* you can feed a osgPresentation::PropertyManager into the plugin and set values on it via * you can feed a osgPresentation::PropertyManager into the plugin and set values on it via
* "/p3d/set_value key value" or "/p3d/set_value/key value" * "/p3d/set_value key value" or "/p3d/set_value/key value"
* Additionally the plugin listens for * Additionally the plugin listens for
* "/osg/set_user_value key value" or "/osg/set_user_value/key value" and set the transmitted value on the * "/osg/set_user_value key value" or "/osg/set_user_value/key value" and set the transmitted value on the
* UserDataContainer of the device. * UserDataContainer of the device.
* *
* *
* The plugin supports forwarding most of the events per osc to another host. * The plugin supports forwarding most of the events per osc to another host.
* It uses a special event-handler, which forwards the events. To get this * It uses a special event-handler, which forwards the events. To get this
* event-handler, do something like this: * event-handler, do something like this:
* *
* std::string filename = "<target-address>:<target-port>.sender.osc"; * std::string filename = "<target-address>:<target-port>.sender.osc";
* osgGA::GUIEventHandler* event_handler = dynamic_cast<osgGA::GUIEventHandler*>(osgDB::readObjectFile(filename)); * osgGA::GUIEventHandler* event_handler = dynamic_cast<osgGA::GUIEventHandler*>(osgDB::readObjectFile(filename));
* *
@ -59,7 +59,7 @@
#include <osgDB/FileUtils> #include <osgDB/FileUtils>
#include "OscSendingDevice.hpp" #include "OscSendingDevice.hpp"
#include "OscReceivingDevice.hpp" #include "OscReceivingDevice.hpp"
#include <osgPresentation/PropertyManager> #include <osgPresentation/deprecated/PropertyManager>
@ -74,8 +74,8 @@ class ReaderWriterOsc : public osgDB::ReaderWriter
supportsOption("documentRegisteredHandlers", "dump a documentation of all registered REST-handler to the console"); supportsOption("documentRegisteredHandlers", "dump a documentation of all registered REST-handler to the console");
supportsOption("numMessagesPerEvent", "set the number of osc-messages to send for one event (sender-only)"); supportsOption("numMessagesPerEvent", "set the number of osc-messages to send for one event (sender-only)");
supportsOption("delayBetweenSendsInMillisecs", "when sending multiple msgs per event you can specify an optional delay between the sends (sender-only)"); supportsOption("delayBetweenSendsInMillisecs", "when sending multiple msgs per event you can specify an optional delay between the sends (sender-only)");
} }
virtual const char* className() const { return "OSC Virtual Device Integration plugin"; } virtual const char* className() const { return "OSC Virtual Device Integration plugin"; }
@ -85,26 +85,26 @@ class ReaderWriterOsc : public osgDB::ReaderWriter
if (osgDB::getFileExtension(file) == "osc") if (osgDB::getFileExtension(file) == "osc")
{ {
std::string file_name = osgDB::getNameLessExtension(file); std::string file_name = osgDB::getNameLessExtension(file);
if (osgDB::getFileExtension(file_name) == "sender") if (osgDB::getFileExtension(file_name) == "sender")
{ {
file_name = osgDB::getNameLessExtension(file_name); file_name = osgDB::getNameLessExtension(file_name);
std::string server_address = file_name.substr(0,file_name.find(':')); std::string server_address = file_name.substr(0,file_name.find(':'));
std::string server_port = file_name.substr(file_name.find(':') + 1); std::string server_port = file_name.substr(file_name.find(':') + 1);
unsigned int num_messages_per_event = 1; unsigned int num_messages_per_event = 1;
if (options && !options->getPluginStringData("numMessagesPerEvent").empty()) { if (options && !options->getPluginStringData("numMessagesPerEvent").empty()) {
std::string num_messages_per_event_str = options->getPluginStringData("numMessagesPerEvent"); std::string num_messages_per_event_str = options->getPluginStringData("numMessagesPerEvent");
num_messages_per_event = osg::maximum(1, atoi(num_messages_per_event_str.c_str())); num_messages_per_event = osg::maximum(1, atoi(num_messages_per_event_str.c_str()));
} }
unsigned int delay_between_sends_in_millisecs = 0; unsigned int delay_between_sends_in_millisecs = 0;
if (options && !options->getPluginStringData("delayBetweenSendsInMillisecs").empty()) { if (options && !options->getPluginStringData("delayBetweenSendsInMillisecs").empty()) {
std::string delay_between_sends_in_millisecs_str = options->getPluginStringData("delayBetweenSendsInMillisecs"); std::string delay_between_sends_in_millisecs_str = options->getPluginStringData("delayBetweenSendsInMillisecs");
delay_between_sends_in_millisecs = atoi(delay_between_sends_in_millisecs_str.c_str()); delay_between_sends_in_millisecs = atoi(delay_between_sends_in_millisecs_str.c_str());
} }
return new OscSendingDevice(server_address, atoi(server_port.c_str()), num_messages_per_event, delay_between_sends_in_millisecs); return new OscSendingDevice(server_address, atoi(server_port.c_str()), num_messages_per_event, delay_between_sends_in_millisecs);
} }
else else
@ -123,37 +123,37 @@ class ReaderWriterOsc : public osgDB::ReaderWriter
port = 8000; port = 8000;
} }
try { try {
osg::ref_ptr<OscReceivingDevice> device = new OscReceivingDevice(server_address, port); osg::ref_ptr<OscReceivingDevice> device = new OscReceivingDevice(server_address, port);
device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/slide/first", osgGA::GUIEventAdapter::KEY_Home)); device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/slide/first", osgGA::GUIEventAdapter::KEY_Home));
device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/slide/last", osgGA::GUIEventAdapter::KEY_End)); device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/slide/last", osgGA::GUIEventAdapter::KEY_End));
device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/slide/next", osgGA::GUIEventAdapter::KEY_Right)); device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/slide/next", osgGA::GUIEventAdapter::KEY_Right));
device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/slide/previous", osgGA::GUIEventAdapter::KEY_Left)); device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/slide/previous", osgGA::GUIEventAdapter::KEY_Left));
device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/layer/next", osgGA::GUIEventAdapter::KEY_Down)); device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/layer/next", osgGA::GUIEventAdapter::KEY_Down));
device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/layer/previous", osgGA::GUIEventAdapter::KEY_Up)); device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/layer/previous", osgGA::GUIEventAdapter::KEY_Up));
device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/slideorlayer/next", osgGA::GUIEventAdapter::KEY_Page_Down)); device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/slideorlayer/next", osgGA::GUIEventAdapter::KEY_Page_Down));
device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/slideorlayer/previous", osgGA::GUIEventAdapter::KEY_Page_Up)); device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/slideorlayer/previous", osgGA::GUIEventAdapter::KEY_Page_Up));
device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/unpause", 'o')); device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/unpause", 'o'));
device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/pause", 'p')); device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/pause", 'p'));
device->addRequestHandler(new SendKeystrokeRequestHandler("/osgviewer/home", ' ')); device->addRequestHandler(new SendKeystrokeRequestHandler("/osgviewer/home", ' '));
device->addRequestHandler(new SendKeystrokeRequestHandler("/osgviewer/stats", 's')); device->addRequestHandler(new SendKeystrokeRequestHandler("/osgviewer/stats", 's'));
if ((options && (options->getPluginStringData("documentRegisteredHandlers") == "true"))) if ((options && (options->getPluginStringData("documentRegisteredHandlers") == "true")))
{ {
std::cout << *device << std::endl; std::cout << *device << std::endl;
} }
return device.release(); return device.release();
} }
catch(const osc::Exception& e) catch(const osc::Exception& e)
@ -173,9 +173,9 @@ class ReaderWriterOsc : public osgDB::ReaderWriter
} }
} }
} }
return ReadResult::FILE_NOT_HANDLED; return ReadResult::FILE_NOT_HANDLED;
} }

View File

@ -21,7 +21,7 @@
#include <osgWidget/PdfReader> #include <osgWidget/PdfReader>
#include <osgPresentation/SlideShowConstructor> #include <osgPresentation/deprecated/SlideShowConstructor>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -401,7 +401,7 @@ bool ReaderWriterP3DXML::getKeyProperty(osgDB::XmlNode*cur, const char* token, i
OSG_NOTICE<<" empty()"<<std::endl; OSG_NOTICE<<" empty()"<<std::endl;
return false; return false;
} }
if (itr->second.find("0x",0,2)!=std::string::npos) if (itr->second.find("0x",0,2)!=std::string::npos)
{ {
std::istringstream iss(itr->second); std::istringstream iss(itr->second);
@ -1031,7 +1031,7 @@ bool ReaderWriterP3DXML::parseProperties(osgDB::XmlNode* root, osg::UserDataCont
float value; float value;
std::stringstream str(cur->contents); std::stringstream str(cur->contents);
str>>value; str>>value;
udc.setUserValue(name, value); udc.setUserValue(name, value);
readProperties = true; readProperties = true;
@ -1256,8 +1256,8 @@ void ReaderWriterP3DXML::parseVolume(osgPresentation::SlideShowConstructor& cons
else if (operation=="REPLACE_ALPHA_WITH_LUMINANCE") volumeData.colorSpaceOperation = osg::REPLACE_ALPHA_WITH_LUMINANCE; else if (operation=="REPLACE_ALPHA_WITH_LUMINANCE") volumeData.colorSpaceOperation = osg::REPLACE_ALPHA_WITH_LUMINANCE;
else if (operation=="REPLACE_RGB_WITH_LUMINANCE") volumeData.colorSpaceOperation = osg::REPLACE_RGB_WITH_LUMINANCE; else if (operation=="REPLACE_RGB_WITH_LUMINANCE") volumeData.colorSpaceOperation = osg::REPLACE_RGB_WITH_LUMINANCE;
} }
// check for any transfer function required // check for any transfer function required
std::string transferFunctionFile; std::string transferFunctionFile;
@ -1561,10 +1561,10 @@ void ReaderWriterP3DXML::parseTimeout(osgPresentation::SlideShowConstructor& con
timeout->setKeyRunTimoutAction(keyPosition._key); timeout->setKeyRunTimoutAction(keyPosition._key);
} }
} }
} }
constructor.popCurrentLayer(); // return the constructor.popCurrentLayer(); // return the
} }
@ -1796,7 +1796,7 @@ void ReaderWriterP3DXML::parseLayer(osgPresentation::SlideShowConstructor& const
else if (cur->name == "forward_mouse_event_to_device") else if (cur->name == "forward_mouse_event_to_device")
{ {
osgPresentation::JumpData jumpData; osgPresentation::JumpData jumpData;
OSG_ALWAYS<<"forward_mouse_event_to_device ["<<cur->contents<<"]"<<std::endl; OSG_ALWAYS<<"forward_mouse_event_to_device ["<<cur->contents<<"]"<<std::endl;
constructor.layerClickToDoOperation(cur->contents,osgPresentation::FORWARD_EVENT, jumpData); constructor.layerClickToDoOperation(cur->contents,osgPresentation::FORWARD_EVENT, jumpData);
} }
@ -1889,7 +1889,7 @@ void ReaderWriterP3DXML::parseLayer(osgPresentation::SlideShowConstructor& const
OSG_NOTICE<<"key_to_jump failed."<<std::endl; OSG_NOTICE<<"key_to_jump failed."<<std::endl;
} }
} }
else else
{ {
osgPresentation::KeyPosition keyPosition; osgPresentation::KeyPosition keyPosition;
if (getKeyPosition(cur, keyPosition)) if (getKeyPosition(cur, keyPosition))
@ -2140,7 +2140,7 @@ void ReaderWriterP3DXML::parseSlide (osgPresentation::SlideShowConstructor& cons
{ {
parseLayer(constructor, _templateMap[inherit].get()); parseLayer(constructor, _templateMap[inherit].get());
} }
parseLayer (constructor, cur); parseLayer (constructor, cur);
} }
else if (cur->name == "clean_layer") else if (cur->name == "clean_layer")
@ -2215,7 +2215,7 @@ void ReaderWriterP3DXML::parseSlide (osgPresentation::SlideShowConstructor& cons
OSG_NOTICE<<"getCurrentSlide() returns NULL, unable to set name "<<std::endl; OSG_NOTICE<<"getCurrentSlide() returns NULL, unable to set name "<<std::endl;
} }
} }
constructor.setBackgroundColor(previous_bgcolor,false); constructor.setBackgroundColor(previous_bgcolor,false);
constructor.setTextColor(previous_textcolor); constructor.setTextColor(previous_textcolor);
@ -2353,12 +2353,12 @@ class MyReadFileCallback : public virtual osgDB::ReadFileCallback
OSG_INFO<<"Trying server file "<<filename<<std::endl; OSG_INFO<<"Trying server file "<<filename<<std::endl;
osgDB::ReaderWriter::ReadResult result; osgDB::ReaderWriter::ReadResult result;
// get a specific readerwriter capable of handling the protocol and extension, will return a registered fallback readerwriter for extension '*' // get a specific readerwriter capable of handling the protocol and extension, will return a registered fallback readerwriter for extension '*'
osgDB::ReaderWriter* rw = osgDB::Registry::instance()->getReaderWriterForProtocolAndExtension( osgDB::ReaderWriter* rw = osgDB::Registry::instance()->getReaderWriterForProtocolAndExtension(
osgDB::getServerProtocol(filename), osgDB::getServerProtocol(filename),
osgDB::getFileExtension(filename)); osgDB::getFileExtension(filename));
if (!rw) return osgDB::ReaderWriter::ReadResult::FILE_NOT_HANDLED; if (!rw) return osgDB::ReaderWriter::ReadResult::FILE_NOT_HANDLED;
switch(type) switch(type)
@ -2587,7 +2587,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterP3DXML::readNode(std::istream& fin,
osg::ref_ptr<osgDB::ReaderWriter::Options> local_opt = options ? static_cast<osgDB::ReaderWriter::Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; osg::ref_ptr<osgDB::ReaderWriter::Options> local_opt = options ? static_cast<osgDB::ReaderWriter::Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options;
local_opt->setReadFileCallback(new MyReadFileCallback); local_opt->setReadFileCallback(new MyReadFileCallback);
local_opt->setFindFileCallback(new MyFindFileCallback); local_opt->setFindFileCallback(new MyFindFileCallback);
return readNode(input, local_opt.get()); return readNode(input, local_opt.get());
} }

View File

@ -20,8 +20,8 @@
#include <osgWidget/PdfReader> #include <osgWidget/PdfReader>
#include <osgPresentation/SlideShowConstructor> #include <osgPresentation/deprecated/SlideShowConstructor>
#include <osgPresentation/AnimationMaterial> #include <osgPresentation/deprecated/AnimationMaterial>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View File

@ -9,28 +9,28 @@ SET(LIB_NAME osgPresentation)
SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME})
SET(TARGET_H SET(TARGET_H
${HEADER_PATH}/Export ${HEADER_PATH}/Export
${HEADER_PATH}/AnimationMaterial
${HEADER_PATH}/CompileSlideCallback
${HEADER_PATH}/Cursor ${HEADER_PATH}/Cursor
${HEADER_PATH}/PickEventHandler ${HEADER_PATH}/deprecated/AnimationMaterial
${HEADER_PATH}/PropertyManager ${HEADER_PATH}/deprecated/CompileSlideCallback
${HEADER_PATH}/KeyEventHandler ${HEADER_PATH}/deprecated/PickEventHandler
${HEADER_PATH}/SlideEventHandler ${HEADER_PATH}/deprecated/PropertyManager
${HEADER_PATH}/SlideShowConstructor ${HEADER_PATH}/deprecated/KeyEventHandler
${HEADER_PATH}/Timeout ${HEADER_PATH}/deprecated/SlideEventHandler
${HEADER_PATH}/deprecated/SlideShowConstructor
${HEADER_PATH}/deprecated/Timeout
) )
# FIXME: For OS X, need flag for Framework or dylib # FIXME: For OS X, need flag for Framework or dylib
SET(TARGET_SRC SET(TARGET_SRC
AnimationMaterial.cpp
CompileSlideCallback.cpp
Cursor.cpp Cursor.cpp
PickEventHandler.cpp deprecated/AnimationMaterial.cpp
PropertyManager.cpp deprecated/CompileSlideCallback.cpp
KeyEventHandler.cpp deprecated/PickEventHandler.cpp
SlideEventHandler.cpp deprecated/PropertyManager.cpp
SlideShowConstructor.cpp deprecated/KeyEventHandler.cpp
Timeout.cpp deprecated/SlideEventHandler.cpp
deprecated/SlideShowConstructor.cpp
deprecated/Timeout.cpp
${OPENSCENEGRAPH_VERSIONINFO_RC} ${OPENSCENEGRAPH_VERSIONINFO_RC}
) )

View File

@ -10,7 +10,7 @@
* include LICENSE.txt for more details. * include LICENSE.txt for more details.
*/ */
#include <osgPresentation/AnimationMaterial> #include <osgPresentation/deprecated/AnimationMaterial>
#include <osg/MatrixTransform> #include <osg/MatrixTransform>
#include <osg/PositionAttitudeTransform> #include <osg/PositionAttitudeTransform>

View File

@ -10,7 +10,7 @@
* include LICENSE.txt for more details. * include LICENSE.txt for more details.
*/ */
#include <osgPresentation/CompileSlideCallback> #include <osgPresentation/deprecated/CompileSlideCallback>
#include <osgUtil/GLObjectsVisitor> #include <osgUtil/GLObjectsVisitor>

View File

@ -10,8 +10,8 @@
* include LICENSE.txt for more details. * include LICENSE.txt for more details.
*/ */
#include <osgPresentation/KeyEventHandler> #include <osgPresentation/deprecated/KeyEventHandler>
#include <osgPresentation/SlideEventHandler> #include <osgPresentation/deprecated/SlideEventHandler>
#include <osgViewer/Viewer> #include <osgViewer/Viewer>
#include <osg/Notify> #include <osg/Notify>

View File

@ -10,8 +10,8 @@
* include LICENSE.txt for more details. * include LICENSE.txt for more details.
*/ */
#include <osgPresentation/PickEventHandler> #include <osgPresentation/deprecated/PickEventHandler>
#include <osgPresentation/SlideEventHandler> #include <osgPresentation/deprecated/SlideEventHandler>
#include <osgViewer/Viewer> #include <osgViewer/Viewer>
#include <osg/Notify> #include <osg/Notify>
@ -77,17 +77,17 @@ bool PickEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
osg::ref_ptr<osgGA::GUIEventAdapter> cloned_ea = osg::clone(&ea); osg::ref_ptr<osgGA::GUIEventAdapter> cloned_ea = osg::clone(&ea);
const osg::BoundingBox bb(hitr->drawable->getBound()); const osg::BoundingBox bb(hitr->drawable->getBound());
const osg::Vec3& p(hitr->localIntersectionPoint); const osg::Vec3& p(hitr->localIntersectionPoint);
float transformed_x = (p.x() - bb.xMin()) / (bb.xMax() - bb.xMin()); float transformed_x = (p.x() - bb.xMin()) / (bb.xMax() - bb.xMin());
float transformed_y = (p.z() - bb.zMin()) / (bb.zMax() - bb.zMin()); float transformed_y = (p.z() - bb.zMin()) / (bb.zMax() - bb.zMin());
cloned_ea->setX(ea.getXmin() + transformed_x * (ea.getXmax() - ea.getXmin())); cloned_ea->setX(ea.getXmin() + transformed_x * (ea.getXmax() - ea.getXmin()));
cloned_ea->setY(ea.getYmin() + transformed_y * (ea.getYmax() - ea.getYmin())); cloned_ea->setY(ea.getYmin() + transformed_y * (ea.getYmax() - ea.getYmin()));
cloned_ea->setMouseYOrientation(osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS); cloned_ea->setMouseYOrientation(osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS);
// std::cout << transformed_x << "/" << transformed_x << " -> " << cloned_ea->getX() << "/" <<cloned_ea->getY() << std::endl; // std::cout << transformed_x << "/" << transformed_x << " -> " << cloned_ea->getX() << "/" <<cloned_ea->getY() << std::endl;
// dispatch cloned event to devices // dispatch cloned event to devices
osgViewer::View::Devices& devices = viewer->getDevices(); osgViewer::View::Devices& devices = viewer->getDevices();
for(osgViewer::View::Devices::iterator i = devices.begin(); i != devices.end(); ++i) for(osgViewer::View::Devices::iterator i = devices.begin(); i != devices.end(); ++i)
@ -98,7 +98,7 @@ bool PickEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
} }
} }
} }
else else
{ {
if (ea.getEventType()==osgGA::GUIEventAdapter::PUSH) if (ea.getEventType()==osgGA::GUIEventAdapter::PUSH)
{ {

View File

@ -10,7 +10,7 @@
* include LICENSE.txt for more details. * include LICENSE.txt for more details.
*/ */
#include <osgPresentation/PropertyManager> #include <osgPresentation/deprecated/PropertyManager>
#include <osg/io_utils> #include <osg/io_utils>
using namespace osgPresentation; using namespace osgPresentation;

View File

@ -10,8 +10,9 @@
* include LICENSE.txt for more details. * include LICENSE.txt for more details.
*/ */
#include <osgPresentation/SlideEventHandler> #include <osgPresentation/deprecated/SlideEventHandler>
#include <osgPresentation/SlideShowConstructor> #include <osgPresentation/deprecated/SlideShowConstructor>
#include <osgPresentation/deprecated/AnimationMaterial>
#include <osg/AnimationPath> #include <osg/AnimationPath>
#include <osg/Transform> #include <osg/Transform>
@ -27,7 +28,6 @@
#include <osgGA/AnimationPathManipulator> #include <osgGA/AnimationPathManipulator>
#include <osgPresentation/AnimationMaterial>
#include <iostream> #include <iostream>

View File

@ -10,7 +10,11 @@
* include LICENSE.txt for more details. * include LICENSE.txt for more details.
*/ */
#include <osgPresentation/SlideShowConstructor> #include <osgPresentation/deprecated/SlideShowConstructor>
#include <osgPresentation/deprecated/AnimationMaterial>
#include <osgPresentation/deprecated/PickEventHandler>
#include <osgPresentation/deprecated/KeyEventHandler>
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/PolygonOffset> #include <osg/PolygonOffset>
@ -51,10 +55,6 @@
#include <sstream> #include <sstream>
#include <algorithm> #include <algorithm>
#include <osgPresentation/AnimationMaterial>
#include <osgPresentation/PickEventHandler>
#include <osgPresentation/KeyEventHandler>
#include <osgManipulator/TabBoxDragger> #include <osgManipulator/TabBoxDragger>
#include <osgManipulator/TabBoxTrackballDragger> #include <osgManipulator/TabBoxTrackballDragger>
#include <osgManipulator/TrackballDragger> #include <osgManipulator/TrackballDragger>

View File

@ -11,7 +11,7 @@
* OpenSceneGraph Public License for more details. * OpenSceneGraph Public License for more details.
*/ */
#include <osgPresentation/Timeout> #include <osgPresentation/deprecated/Timeout>
#include <osgUtil/CullVisitor> #include <osgUtil/CullVisitor>
#include <osgGA/EventVisitor> #include <osgGA/EventVisitor>
@ -28,7 +28,7 @@ public:
LEAVE, LEAVE,
RESET RESET
}; };
OperationVisitor(Operation op) : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _operation(op), _sleepTime(0.0) {} OperationVisitor(Operation op) : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _operation(op), _sleepTime(0.0) {}
void apply(osg::Node& node) void apply(osg::Node& node)
@ -83,7 +83,7 @@ public:
double sleepTime() const { return _sleepTime; } double sleepTime() const { return _sleepTime; }
Operation _operation; Operation _operation;
double _sleepTime; double _sleepTime;
}; };
@ -104,7 +104,7 @@ bool HUDSettings::getModelViewMatrix(osg::Matrix& matrix, osg::NodeVisitor* nv)
matrix.makeLookAt(osg::Vec3d(0.0,0.0,0.0),osg::Vec3d(0.0,_slideDistance,0.0),osg::Vec3d(0.0,0.0,1.0)); matrix.makeLookAt(osg::Vec3d(0.0,0.0,0.0),osg::Vec3d(0.0,_slideDistance,0.0),osg::Vec3d(0.0,0.0,1.0));
if (nv) if (nv)
{ {
if (nv->getTraversalMask()==_leftMask) if (nv->getTraversalMask()==_leftMask)
{ {
matrix.postMultTranslate(osg::Vec3(_eyeOffset,0.0,0.0)); matrix.postMultTranslate(osg::Vec3(_eyeOffset,0.0,0.0));
@ -114,7 +114,7 @@ bool HUDSettings::getModelViewMatrix(osg::Matrix& matrix, osg::NodeVisitor* nv)
matrix.postMultTranslate(osg::Vec3(-_eyeOffset,0.0,0.0)); matrix.postMultTranslate(osg::Vec3(-_eyeOffset,0.0,0.0));
} }
} }
return true; return true;
} }
@ -288,13 +288,13 @@ void Timeout::traverse(osg::NodeVisitor& nv)
} }
} }
} }
if (needToRecordEventTime) if (needToRecordEventTime)
{ {
_timeOfLastEvent = nv.getFrameStamp()->getReferenceTime(); _timeOfLastEvent = nv.getFrameStamp()->getReferenceTime();
} }
double timeSinceLastEvent = nv.getFrameStamp() ? nv.getFrameStamp()->getReferenceTime()-_timeOfLastEvent : 0.0; double timeSinceLastEvent = nv.getFrameStamp() ? nv.getFrameStamp()->getReferenceTime()-_timeOfLastEvent : 0.0;
if (timeSinceLastEvent>_idleDurationBeforeTimeoutDisplay) if (timeSinceLastEvent>_idleDurationBeforeTimeoutDisplay)
@ -369,9 +369,9 @@ void Timeout::traverse(osg::NodeVisitor& nv)
OSG_NOTICE<<"Doing timeout broadcast key event"<<_actionBroadcastKeyPos._key<<std::endl; OSG_NOTICE<<"Doing timeout broadcast key event"<<_actionBroadcastKeyPos._key<<std::endl;
broadcastEvent(viewer, _actionBroadcastKeyPos); broadcastEvent(viewer, _actionBroadcastKeyPos);
} }
} }
} }
else if (nv.getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR) else if (nv.getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR)
{ {
@ -381,7 +381,7 @@ void Timeout::traverse(osg::NodeVisitor& nv)
{ {
if (strcmp(nv.className(),"FindOperatorsVisitor")==0) if (strcmp(nv.className(),"FindOperatorsVisitor")==0)
{ {
OSG_NOTICE<<"Timout::traverse() "<<nv.className()<<", ignoring traversal"<<std::endl; OSG_NOTICE<<"Timout::traverse() "<<nv.className()<<", ignoring traversal"<<std::endl;
} }
else else
{ {
@ -390,5 +390,5 @@ void Timeout::traverse(osg::NodeVisitor& nv)
} }
} }