Moved old osgPresentation source files to osgPresentation/deprecated subdirectory.
This commit is contained in:
parent
28ce02915a
commit
4e3715d4bb
@ -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 full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef EXPORTHTML_H
|
||||
#define EXPORTHTML_H 1
|
||||
|
||||
#include <osgPresentation/SlideEventHandler>
|
||||
#include <osgPresentation/deprecated/SlideEventHandler>
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
class ExportHTML
|
||||
|
@ -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 full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* 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 "ReadShowFile.h"
|
||||
#include "ShowEventHandler.h"
|
||||
|
||||
#include <osgPresentation/SlideEventHandler>
|
||||
#include <osgPresentation/deprecated/SlideEventHandler>
|
||||
|
||||
#include <osg/ImageStream>
|
||||
#include <osg/Shape>
|
||||
@ -35,7 +35,7 @@ class AddVolumeEditingCallbackVisitor : public osg::NodeVisitor
|
||||
public:
|
||||
AddVolumeEditingCallbackVisitor():
|
||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
||||
|
||||
|
||||
void apply(osg::Group& group)
|
||||
{
|
||||
osgVolume::VolumeTile* volumeTile = dynamic_cast<osgVolume::VolumeTile*>(&group);
|
||||
@ -51,7 +51,7 @@ public:
|
||||
traverse(group);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
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))
|
||||
{
|
||||
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]);
|
||||
}
|
||||
@ -73,7 +73,7 @@ bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, F
|
||||
}
|
||||
}
|
||||
return (!xmlFiles.empty() || !normalFiles.empty());
|
||||
}
|
||||
}
|
||||
|
||||
bool p3d::readEnvVars(osg::ArgumentParser& arguments)
|
||||
{
|
||||
@ -94,23 +94,23 @@ bool p3d::readEnvVars(osg::ArgumentParser& arguments)
|
||||
{
|
||||
osgDB::getDataFilePathList().push_front(path);
|
||||
}
|
||||
|
||||
|
||||
if (p3d::readEnvVars(file)) readVars = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return readVars;
|
||||
}
|
||||
|
||||
bool p3d::readEnvVars(const std::string& fileName)
|
||||
{
|
||||
std::string ext = osgDB::getFileExtension(fileName);
|
||||
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
|
||||
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
|
||||
!osgDB::equalCaseInsensitive(ext,"p3d")) return false;
|
||||
|
||||
|
||||
|
||||
|
||||
osg::ref_ptr<osgDB::XmlNode> doc = new osgDB::XmlNode;
|
||||
osgDB::XmlNode* root = 0;
|
||||
|
||||
@ -146,7 +146,7 @@ bool p3d::readEnvVars(const std::string& fileName)
|
||||
}
|
||||
|
||||
bool readVars = false;
|
||||
|
||||
|
||||
for(osgDB::XmlNode::Children::iterator itr = root->children.begin();
|
||||
itr != root->children.end();
|
||||
++itr)
|
||||
@ -182,7 +182,7 @@ osgDB::Options* createOptions(const osgDB::ReaderWriter::Options* options)
|
||||
osg::ref_ptr<osg::Node> p3d::readHoldingSlide(const std::string& filename)
|
||||
{
|
||||
std::string ext = osgDB::getFileExtension(filename);
|
||||
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
|
||||
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
|
||||
!osgDB::equalCaseInsensitive(ext,"p3d")) return 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())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
osg::ref_ptr<osg::Node> root;
|
||||
|
||||
if (nodeList.size()==1)
|
||||
@ -274,7 +274,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
|
||||
}
|
||||
else // size >1
|
||||
{
|
||||
|
||||
|
||||
osg::Switch* sw = new osg::Switch;
|
||||
for(NodeList::iterator itr=nodeList.begin();
|
||||
itr!=nodeList.end();
|
||||
@ -283,7 +283,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
|
||||
sw->addChild((*itr).get());
|
||||
}
|
||||
sw->setSingleChildOn(0);
|
||||
|
||||
|
||||
sw->setEventCallback(new p3d::ShowEventHandler());
|
||||
|
||||
root = sw;
|
||||
@ -292,7 +292,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
|
||||
if (root.valid())
|
||||
{
|
||||
osg::notify(osg::INFO)<<"Got node now adding callback"<<std::endl;
|
||||
|
||||
|
||||
AddVolumeEditingCallbackVisitor avecv;
|
||||
root->accept(avecv);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <osgGA/AnimationPathManipulator>
|
||||
#include <osgGA/StateSetManipulator>
|
||||
|
||||
#include <osgPresentation/SlideEventHandler>
|
||||
#include <osgPresentation/deprecated/SlideEventHandler>
|
||||
#include <osgPresentation/Cursor>
|
||||
|
||||
#include "ReadShowFile.h"
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include <osgGA/GUIEventHandler>
|
||||
|
||||
#include <osgPresentation/SlideEventHandler>
|
||||
#include <osgPresentation/deprecated/SlideEventHandler>
|
||||
|
||||
namespace osgPresentation
|
||||
{
|
||||
@ -33,7 +33,7 @@ class OSGPRESENTATION_EXPORT KeyEventHandler : public osgGA::GUIEventHandler
|
||||
|
||||
void setKey(int key) { _key = key; }
|
||||
int getKey() const { return _key; }
|
||||
|
||||
|
||||
void setOperation(osgPresentation::Operation operation) { _operation = operation; }
|
||||
osgPresentation::Operation getOperation() const { return _operation; }
|
||||
|
||||
@ -55,7 +55,7 @@ class OSGPRESENTATION_EXPORT KeyEventHandler : public osgGA::GUIEventHandler
|
||||
void doOperation();
|
||||
|
||||
int _key;
|
||||
|
||||
|
||||
std::string _command;
|
||||
osgPresentation::KeyPosition _keyPos;
|
||||
osgPresentation::Operation _operation;
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include <osgGA/GUIEventHandler>
|
||||
|
||||
#include <osgPresentation/SlideEventHandler>
|
||||
#include <osgPresentation/deprecated/SlideEventHandler>
|
||||
|
||||
namespace osgPresentation
|
||||
{
|
||||
@ -42,7 +42,7 @@ class OSGPRESENTATION_EXPORT PickEventHandler : public osgGA::GUIEventHandler
|
||||
|
||||
void setJumpData(const JumpData& jumpData) { _jumpData = jumpData; }
|
||||
const JumpData& getJumpData() const { return _jumpData; }
|
||||
|
||||
|
||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv);
|
||||
|
||||
virtual void accept(osgGA::GUIEventHandlerVisitor& v);
|
@ -21,15 +21,15 @@
|
||||
#include <osgGA/GUIEventHandler>
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
#include <osgPresentation/CompileSlideCallback>
|
||||
#include <osgPresentation/PropertyManager>
|
||||
#include <osgPresentation/deprecated/CompileSlideCallback>
|
||||
#include <osgPresentation/deprecated/PropertyManager>
|
||||
|
||||
namespace osgPresentation
|
||||
{
|
||||
|
||||
// forward declare
|
||||
class SlideEventHandler;
|
||||
|
||||
|
||||
/// Operations related to click to run/load/key events.
|
||||
enum Operation
|
||||
{
|
||||
@ -46,7 +46,7 @@ struct JumpData
|
||||
relativeJump(true),
|
||||
slideNum(0),
|
||||
layerNum(0) {}
|
||||
|
||||
|
||||
JumpData(bool in_relativeJump, int in_slideNum, int in_layerNum):
|
||||
relativeJump(in_relativeJump),
|
||||
slideNum(in_slideNum),
|
||||
@ -230,7 +230,7 @@ protected:
|
||||
void processOutgoing(SlideEventHandler* seh);
|
||||
void processIncomming(SlideEventHandler* seh);
|
||||
void processMaintained(SlideEventHandler* seh);
|
||||
|
||||
|
||||
bool _pause;
|
||||
|
||||
OperatorList _previous;
|
@ -31,10 +31,10 @@
|
||||
#include <osgVolume/VolumeTile>
|
||||
#include <osgVolume/Property>
|
||||
|
||||
#include <osgPresentation/AnimationMaterial>
|
||||
#include <osgPresentation/SlideEventHandler>
|
||||
#include <osgPresentation/PropertyManager>
|
||||
#include <osgPresentation/Timeout>
|
||||
#include <osgPresentation/deprecated/AnimationMaterial>
|
||||
#include <osgPresentation/deprecated/SlideEventHandler>
|
||||
#include <osgPresentation/deprecated/PropertyManager>
|
||||
#include <osgPresentation/deprecated/Timeout>
|
||||
|
||||
namespace osgPresentation
|
||||
{
|
||||
@ -67,7 +67,7 @@ public:
|
||||
enum CoordinateFrame { SLIDE, MODEL };
|
||||
|
||||
|
||||
|
||||
|
||||
LayerAttributes* getOrCreateLayerAttributes(osg::Node* node);
|
||||
|
||||
void setDuration(osg::Node* node,double duration)
|
||||
@ -253,7 +253,7 @@ public:
|
||||
osg::Vec4 backgroundColor;
|
||||
double fps;
|
||||
double duration;
|
||||
|
||||
|
||||
bool imageSequence;
|
||||
osg::ImageSequence::Mode imageSequencePagingMode;
|
||||
|
||||
@ -271,7 +271,7 @@ public:
|
||||
OFF,
|
||||
ON
|
||||
};
|
||||
|
||||
|
||||
BlendingHint blendingHint;
|
||||
|
||||
double delayTime;
|
||||
@ -420,7 +420,7 @@ public:
|
||||
CURRENT_SLIDE,
|
||||
CURRENT_LAYER
|
||||
};
|
||||
|
||||
|
||||
void addEventHandler(PresentationContext presentationContext, osg::ref_ptr<osgGA::GUIEventHandler> handler);
|
||||
|
||||
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 setUpVolumeScalarProperty(osgVolume::VolumeTile* tile, osgVolume::ScalarProperty* property, const std::string& source);
|
||||
|
||||
|
||||
void addVolume(const std::string& filename, const PositionData& positionData, const VolumeData& volumeData);
|
||||
|
||||
osg::Group* takePresentation() { return _root.release(); }
|
||||
@ -469,7 +469,7 @@ public:
|
||||
|
||||
void pushCurrentLayer();
|
||||
void popCurrentLayer();
|
||||
|
||||
|
||||
osg::Group* getCurrentLayer() { return _currentLayer.get(); }
|
||||
|
||||
void setLoopPresentation(bool loop) { _loopPresentation = loop; }
|
||||
@ -555,7 +555,7 @@ protected:
|
||||
|
||||
osg::ref_ptr<osgPresentation::PropertyManager> _propertyManager;
|
||||
osg::ref_ptr<osgPresentation::PropertyEventCallback> _propertyEventCallback;
|
||||
|
||||
|
||||
osg::ref_ptr<osg::Group> _root;
|
||||
osg::ref_ptr<osg::Switch> _presentationSwitch;
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <osg/Transform>
|
||||
|
||||
#include <osgPresentation/SlideEventHandler>
|
||||
#include <osgPresentation/deprecated/SlideEventHandler>
|
||||
|
||||
namespace osgPresentation {
|
||||
|
||||
@ -38,7 +38,7 @@ protected:
|
||||
|
||||
virtual ~HUDSettings();
|
||||
};
|
||||
|
||||
|
||||
class OSGPRESENTATION_EXPORT Timeout : public osg::Transform
|
||||
{
|
||||
public:
|
||||
@ -50,14 +50,14 @@ class OSGPRESENTATION_EXPORT Timeout : public osg::Transform
|
||||
|
||||
META_Node(osgPresentation, Timeout);
|
||||
|
||||
|
||||
|
||||
void setIdleDurationBeforeTimeoutDisplay(double t) { _idleDurationBeforeTimeoutDisplay = t; }
|
||||
double getIdleDurationBeforeTimeoutDisplay() const { return _idleDurationBeforeTimeoutDisplay; }
|
||||
|
||||
void setIdleDurationBeforeTimeoutAction(double t) { _idleDurationBeforeTimeoutAction = t; }
|
||||
double getIdleDurationBeforeTimeoutAction() const { return _idleDurationBeforeTimeoutAction; }
|
||||
|
||||
|
||||
|
||||
void setKeyStartsTimoutDisplay(int key) { _keyStartsTimoutDisplay = key; }
|
||||
int getKeyStartsTimoutDisplay() const { return _keyStartsTimoutDisplay; }
|
||||
|
||||
@ -67,7 +67,7 @@ class OSGPRESENTATION_EXPORT Timeout : public osg::Transform
|
||||
void setKeyRunTimoutAction(int key) { _keyRunTimeoutAction = key; }
|
||||
int getKeyRunTimoutAction() const { return _keyRunTimeoutAction; }
|
||||
|
||||
|
||||
|
||||
void setDisplayBroadcastKeyPosition(const osgPresentation::KeyPosition& keyPos) { _displayBroadcastKeyPos = keyPos; }
|
||||
const osgPresentation::KeyPosition& getDisplayBroadcastKeyPosition() const { return _displayBroadcastKeyPos; }
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <osg/ValueObject>
|
||||
#include <osgDB/FileUtils>
|
||||
#include <osgDB/FileNameUtils>
|
||||
#include <osgPresentation/PropertyManager>
|
||||
#include <osgPresentation/deprecated/PropertyManager>
|
||||
#include "osc/OscPrintReceivedElements.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 void describeTo(std::ostream& out) const
|
||||
{
|
||||
out << getRequestPath() << ": add all transmitted arguments as ValueObjects to an USER-event";
|
||||
@ -102,7 +102,7 @@ public:
|
||||
}
|
||||
private:
|
||||
void addArgumentToUdc(osg::UserDataContainer* udc, const std::string& key, const osc::ReceivedMessageArgumentIterator& itr);
|
||||
|
||||
|
||||
template <class T>
|
||||
bool addNativeTypeFromVector(osg::UserDataContainer* udc, const std::string& key, const std::vector<T>& arr)
|
||||
{
|
||||
@ -128,9 +128,9 @@ private:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
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 last_elem = osgDB::getSimpleFileName(full_request_path);
|
||||
|
||||
|
||||
osg::ref_ptr<osgGA::GUIEventAdapter> ea = getDevice()->getOrCreateUserDataEvent();
|
||||
osg::UserDataContainer* udc = ea->getOrCreateUserDataContainer();
|
||||
|
||||
|
||||
|
||||
|
||||
ea->setName(_treatFirstArgumentAsValueName ? full_request_path : path);
|
||||
udc->setName(ea->getName());
|
||||
|
||||
|
||||
if (m.ArgumentCount() == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// if we have only one argument, get it and save it to the udc
|
||||
else if (m.ArgumentCount() == 1)
|
||||
{
|
||||
@ -210,7 +210,7 @@ bool StandardRequestHandler::operator()(const std::string& request_path, const s
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(osc::ReceivedMessageArgumentIterator itr = start; itr != m.ArgumentsEnd(); ++itr, ++i)
|
||||
{
|
||||
std::ostringstream ss;
|
||||
@ -219,7 +219,7 @@ bool StandardRequestHandler::operator()(const std::string& request_path, const s
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
catch(osc::Exception& e)
|
||||
{
|
||||
@ -237,46 +237,46 @@ void StandardRequestHandler::addArgumentToUdc(osg::UserDataContainer* udc, const
|
||||
case osc::TRUE_TYPE_TAG:
|
||||
udc->setUserValue(key, true);
|
||||
break;
|
||||
|
||||
|
||||
case osc::FALSE_TYPE_TAG:
|
||||
udc->setUserValue(key, false);
|
||||
break;
|
||||
|
||||
|
||||
case osc::INT32_TYPE_TAG:
|
||||
udc->setUserValue(key, (int)((*itr).AsInt32Unchecked()));
|
||||
break;
|
||||
|
||||
|
||||
case osc::FLOAT_TYPE_TAG:
|
||||
udc->setUserValue(key, (*itr).AsFloatUnchecked());
|
||||
break;
|
||||
|
||||
|
||||
case osc::CHAR_TYPE_TAG:
|
||||
udc->setUserValue(key, (*itr).AsCharUnchecked());
|
||||
break;
|
||||
|
||||
|
||||
case osc::RGBA_COLOR_TYPE_TAG:
|
||||
// TODO: should we convert the color to an osg::Vec4?
|
||||
udc->setUserValue(key, static_cast<unsigned int>((*itr).AsRgbaColorUnchecked()));
|
||||
break;
|
||||
|
||||
|
||||
case osc::INT64_TYPE_TAG:
|
||||
// TODO 64bit ints not supported by ValueObject
|
||||
udc->setUserValue(key, static_cast<double>((*itr).AsInt64Unchecked()));
|
||||
break;
|
||||
|
||||
|
||||
case osc::TIME_TAG_TYPE_TAG:
|
||||
// TODO 64bit ints not supported by ValueObject
|
||||
udc->setUserValue(key, static_cast<double>((*itr).AsTimeTagUnchecked()));
|
||||
break;
|
||||
|
||||
|
||||
case osc::DOUBLE_TYPE_TAG:
|
||||
udc->setUserValue(key, (*itr).AsDoubleUnchecked());
|
||||
break;
|
||||
|
||||
|
||||
case osc::STRING_TYPE_TAG:
|
||||
udc->setUserValue(key, std::string((*itr).AsStringUnchecked()));
|
||||
break;
|
||||
|
||||
|
||||
case osc::SYMBOL_TYPE_TAG:
|
||||
udc->setUserValue(key, std::string((*itr).AsSymbol()));
|
||||
break;
|
||||
@ -297,25 +297,25 @@ public:
|
||||
: 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)
|
||||
{
|
||||
try {
|
||||
float x_min(-1.0f), y_min(-1.0f), x_max(1.0f), y_max(1.0f);
|
||||
osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
|
||||
args >> x_min >> y_min >> x_max >> y_max >> osc::EndMessage;
|
||||
|
||||
|
||||
getDevice()->getEventQueue()->setMouseInputRange(x_min, y_min, x_max, y_max);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(osc::Exception e) {
|
||||
handleException(e);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
@ -329,26 +329,26 @@ public:
|
||||
: 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)
|
||||
{
|
||||
try {
|
||||
bool increasing_upwards(false);
|
||||
osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
|
||||
args >>increasing_upwards >> osc::EndMessage;
|
||||
|
||||
|
||||
getDevice()->getEventQueue()->getCurrentEventState()->setMouseYOrientation(
|
||||
increasing_upwards ? osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS : osgGA::GUIEventAdapter::Y_INCREASING_DOWNWARDS);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(osc::Exception e) {
|
||||
handleException(e);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
@ -363,28 +363,28 @@ public:
|
||||
, _handleKeyPress(handle_key_press)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
|
||||
{
|
||||
try {
|
||||
osc::int32 keycode(0);
|
||||
osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
|
||||
args >> keycode >> osc::EndMessage;
|
||||
|
||||
|
||||
if (_handleKeyPress)
|
||||
getDevice()->getEventQueue()->keyPress(keycode, getLocalTime());
|
||||
else
|
||||
getDevice()->getEventQueue()->keyRelease(keycode, getLocalTime());
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(osc::Exception e) {
|
||||
handleException(e);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual void describeTo(std::ostream& out) const
|
||||
{
|
||||
out << getRequestPath() << "(int keycode): send KEY_" << (_handleKeyPress ? "DOWN" : "UP");
|
||||
@ -400,26 +400,26 @@ public:
|
||||
: 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)
|
||||
{
|
||||
try {
|
||||
osc::int32 keycode(0);
|
||||
osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
|
||||
args >> keycode >> osc::EndMessage;
|
||||
|
||||
|
||||
getDevice()->getEventQueue()->keyPress(keycode, getLocalTime());
|
||||
getDevice()->getEventQueue()->keyRelease(keycode, getLocalTime());
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(osc::Exception e) {
|
||||
handleException(e);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual void describeTo(std::ostream& out) const
|
||||
{
|
||||
out << getRequestPath() << "(int keycode): send KEY_DOWN and KEY_UP";
|
||||
@ -439,16 +439,16 @@ public:
|
||||
, _lastY(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
|
||||
{
|
||||
|
||||
|
||||
try {
|
||||
osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
|
||||
args >> _lastX >> _lastY >> osc::EndMessage;
|
||||
|
||||
|
||||
getDevice()->getEventQueue()->mouseMotion(_lastX, _lastY, getLocalTime());
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (osc::Exception e) {
|
||||
@ -456,7 +456,7 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual void describeTo(std::ostream& out) const
|
||||
{
|
||||
out << getRequestPath() << "(float x, float y): send mouse motion";
|
||||
@ -474,23 +474,23 @@ public:
|
||||
: OscReceivingDevice::RequestHandler("/osgga/mouse/scroll")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
|
||||
{
|
||||
|
||||
|
||||
try {
|
||||
osc::int32 sm(osgGA::GUIEventAdapter::SCROLL_NONE);
|
||||
float delta_x(0.0f), delta_y(0.0f);
|
||||
|
||||
|
||||
osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
|
||||
args >> sm >> delta_x >> delta_y >> osc::EndMessage;
|
||||
|
||||
|
||||
if (sm != osgGA::GUIEventAdapter::SCROLL_NONE)
|
||||
getDevice()->getEventQueue()->mouseScroll((osgGA::GUIEventAdapter::ScrollingMotion)sm, getLocalTime());
|
||||
|
||||
|
||||
if ((delta_x != 0.0f) || (delta_y != 0.0f))
|
||||
getDevice()->getEventQueue()->mouseScroll2D(delta_x, delta_y, getLocalTime());
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (osc::Exception e) {
|
||||
@ -498,7 +498,7 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual void describeTo(std::ostream& out) const
|
||||
{
|
||||
out << getRequestPath() << "(int scroll_motion, float x, float y): send mouse scroll-motion";
|
||||
@ -515,20 +515,20 @@ public:
|
||||
, _btnNum(atoi(btn_name.c_str()))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
|
||||
{
|
||||
float down(0.0f);
|
||||
|
||||
|
||||
try {
|
||||
osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
|
||||
args >> down >> osc::EndMessage;
|
||||
|
||||
|
||||
if (down > 0)
|
||||
getDevice()->getEventQueue()->mouseButtonPress(_mmHandler->getLastX(), _mmHandler->getLastY(), _btnNum, getLocalTime());
|
||||
else
|
||||
getDevice()->getEventQueue()->mouseButtonRelease(_mmHandler->getLastX(), _mmHandler->getLastY(), _btnNum, getLocalTime());
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (osc::Exception e) {
|
||||
@ -536,7 +536,7 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual void describeTo(std::ostream& out) const
|
||||
{
|
||||
out << getRequestPath() << "(float down): toggle mouse button";
|
||||
@ -550,7 +550,7 @@ private:
|
||||
class MouseButtonRequestHandler : public OscReceivingDevice::RequestHandler {
|
||||
public:
|
||||
enum Mode { PRESS, RELEASE, DOUBLE_PRESS};
|
||||
|
||||
|
||||
MouseButtonRequestHandler(Mode mode)
|
||||
: OscReceivingDevice::RequestHandler("")
|
||||
, _mode(mode)
|
||||
@ -567,12 +567,12 @@ public:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
osc::int32 btn(0);
|
||||
|
||||
|
||||
try {
|
||||
osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
|
||||
args >> x >> y >> btn >> osc::EndMessage;
|
||||
@ -587,7 +587,7 @@ public:
|
||||
getDevice()->getEventQueue()->mouseDoubleButtonPress(x,y, btn, getLocalTime());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (osc::Exception e) {
|
||||
@ -595,7 +595,7 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual void describeTo(std::ostream& out) const
|
||||
{
|
||||
out << getRequestPath() << "(float x, float y, int btn): send mouse ";
|
||||
@ -608,7 +608,7 @@ public:
|
||||
out << "double press"; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
Mode _mode;
|
||||
};
|
||||
@ -620,16 +620,16 @@ public:
|
||||
: OscReceivingDevice::RequestHandler("/osgga/pen/pressure")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
|
||||
{
|
||||
try {
|
||||
float pressure(0.0f);
|
||||
osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
|
||||
args >> pressure >> osc::EndMessage;
|
||||
|
||||
|
||||
getDevice()->getEventQueue()->penPressure(pressure, getLocalTime());
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (osc::Exception e) {
|
||||
@ -637,7 +637,7 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual void describeTo(std::ostream& out) const
|
||||
{
|
||||
out << getRequestPath() << "(float pressure): send pen pressure";
|
||||
@ -651,17 +651,17 @@ public:
|
||||
, _handleEnter(handle_enter)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
|
||||
{
|
||||
try {
|
||||
osc::int32 pt(osgGA::GUIEventAdapter::UNKNOWN);
|
||||
|
||||
|
||||
osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
|
||||
args >> pt >> osc::EndMessage;
|
||||
|
||||
|
||||
getDevice()->getEventQueue()->penProximity((osgGA::GUIEventAdapter::TabletPointerType)pt, _handleEnter, getLocalTime());
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (osc::Exception e) {
|
||||
@ -669,7 +669,7 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual void describeTo(std::ostream& out) const
|
||||
{
|
||||
out << getRequestPath() << "(int table_pointer_type): send pen proximity " << (_handleEnter ? "enter":"leave");
|
||||
@ -685,16 +685,16 @@ public:
|
||||
: OscReceivingDevice::RequestHandler("/osgga/pen/orientation")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
|
||||
{
|
||||
try {
|
||||
float rotation(0.0f), tilt_x(0.0f), tilt_y(0.0f);
|
||||
osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
|
||||
args >> rotation >> tilt_x >> tilt_y >> osc::EndMessage;
|
||||
|
||||
|
||||
getDevice()->getEventQueue()->penOrientation(tilt_x, tilt_y, rotation, getLocalTime());
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (osc::Exception e) {
|
||||
@ -702,7 +702,7 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual void describeTo(std::ostream& out) const
|
||||
{
|
||||
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)";
|
||||
#endif
|
||||
OSG_NOTICE << std::endl;
|
||||
|
||||
|
||||
_socket = new UdpListeningReceiveSocket(IpEndpointName( server_address.c_str(), listening_port ), this);
|
||||
|
||||
|
||||
addRequestHandler(new OscDevice::KeyCodeRequestHandler(false));
|
||||
addRequestHandler(new OscDevice::KeyCodeRequestHandler(true));
|
||||
addRequestHandler(new OscDevice::KeyPressAndReleaseRequestHandler());
|
||||
|
||||
|
||||
addRequestHandler(new OscDevice::SetMouseInputRangeRequestHandler());
|
||||
addRequestHandler(new OscDevice::SetMouseOrientationRequestHandler());
|
||||
|
||||
|
||||
OscDevice::MouseMotionRequestHandler* mm_handler = new OscDevice::MouseMotionRequestHandler();
|
||||
addRequestHandler(mm_handler);
|
||||
addRequestHandler(new OscDevice::MouseButtonRequestHandler(OscDevice::MouseButtonRequestHandler::PRESS));
|
||||
addRequestHandler(new OscDevice::MouseButtonRequestHandler(OscDevice::MouseButtonRequestHandler::RELEASE));
|
||||
addRequestHandler(new OscDevice::MouseButtonRequestHandler(OscDevice::MouseButtonRequestHandler::DOUBLE_PRESS));
|
||||
addRequestHandler(new OscDevice::MouseScrollRequestHandler());
|
||||
|
||||
|
||||
addRequestHandler(new OscDevice::MouseButtonToggleRequestHandler("1", mm_handler));
|
||||
addRequestHandler(new OscDevice::MouseButtonToggleRequestHandler("2", mm_handler));
|
||||
addRequestHandler(new OscDevice::MouseButtonToggleRequestHandler("3", mm_handler));
|
||||
|
||||
|
||||
addRequestHandler(new OscDevice::PenPressureRequestHandler());
|
||||
addRequestHandler(new OscDevice::PenOrientationRequestHandler());
|
||||
addRequestHandler(new OscDevice::PenProximityRequestHandler(true));
|
||||
addRequestHandler(new OscDevice::PenProximityRequestHandler(false));
|
||||
|
||||
|
||||
addRequestHandler(new OscDevice::StandardRequestHandler("/osg/set_user_value", true));
|
||||
|
||||
|
||||
addRequestHandler(new OscDevice::StandardRequestHandler("", false));
|
||||
setSchedulePriority(OpenThreads::Thread::THREAD_PRIORITY_LOW);
|
||||
start();
|
||||
@ -783,10 +783,10 @@ void OscReceivingDevice::run()
|
||||
void OscReceivingDevice::ProcessMessage( const osc::ReceivedMessage& m, const IpEndpointName& remoteEndpoint )
|
||||
{
|
||||
std::string in_request_path(m.AddressPattern());
|
||||
|
||||
|
||||
if (in_request_path == "/osc/msg_id")
|
||||
return;
|
||||
|
||||
|
||||
std::string request_path = in_request_path + "/";
|
||||
|
||||
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)
|
||||
{
|
||||
std::string mangled_path = request_path.substr(0, pos);
|
||||
|
||||
|
||||
std::pair<RequestHandlerMap::iterator,RequestHandlerMap::iterator> range = _map.equal_range(mangled_path);
|
||||
|
||||
|
||||
for(RequestHandlerMap::iterator i = range.first; i != range.second; ++i)
|
||||
{
|
||||
// OSG_INFO << "OscDevice :: handling " << mangled_path << " with " << i->second << std::endl;
|
||||
|
||||
|
||||
if (i->second->operator()(mangled_path, in_request_path, m) && !handled)
|
||||
handled = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} while ((pos != std::string::npos) && (pos > 0) && !handled);
|
||||
|
||||
@ -817,7 +817,7 @@ void OscReceivingDevice::ProcessBundle( const osc::ReceivedBundle& b,
|
||||
{
|
||||
// find msg-id
|
||||
MsgIdType msg_id(0);
|
||||
|
||||
|
||||
for( osc::ReceivedBundle::const_iterator i = b.ElementsBegin(); i != b.ElementsEnd(); ++i ){
|
||||
const osc::ReceivedMessage& m = osc::ReceivedMessage(*i);
|
||||
std::string address_pattern(m.AddressPattern());
|
||||
@ -836,7 +836,7 @@ void OscReceivingDevice::ProcessBundle( const osc::ReceivedBundle& b,
|
||||
_lastMsgId = 0;
|
||||
}
|
||||
_lastMsgTimeStamp = now;
|
||||
|
||||
|
||||
if (msg_id <= _lastMsgId) {
|
||||
// already handled
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
for( osc::ReceivedBundle::const_iterator i = b.ElementsBegin(); i != b.ElementsEnd(); ++i ){
|
||||
if( i->IsBundle() )
|
||||
ProcessBundle( osc::ReceivedBundle(*i), remoteEndpoint );
|
||||
@ -873,16 +873,16 @@ void OscReceivingDevice::ProcessPacket( const char *data, int size, const IpEndp
|
||||
catch(...) {
|
||||
OSG_WARN << "OscDevice :: could not process UDP-packet because of an exception!" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
if (_userDataEvent.valid())
|
||||
{
|
||||
char address[IpEndpointName::ADDRESS_AND_PORT_STRING_LENGTH];
|
||||
|
||||
|
||||
|
||||
remoteEndpoint.AddressAndPortAsString(address);
|
||||
|
||||
|
||||
_userDataEvent->setUserValue("osc/remote_end_point", std::string(address));
|
||||
|
||||
|
||||
getEventQueue()->addEvent(_userDataEvent.get());
|
||||
_userDataEvent = NULL;
|
||||
}
|
||||
@ -901,7 +901,7 @@ void OscReceivingDevice::describeTo(std::ostream& out) const
|
||||
{
|
||||
out << "OscDevice :: listening on " << _listeningAddress << ":" << _listeningPort << std::endl;
|
||||
out << std::endl;
|
||||
|
||||
|
||||
for(RequestHandlerMap::const_iterator i = _map.begin(); i != _map.end(); ++i)
|
||||
{
|
||||
const RequestHandler* handler(i->second.get());
|
||||
|
@ -14,8 +14,8 @@
|
||||
|
||||
/*
|
||||
* 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
|
||||
* you can set arbitrary values via /osg/set_user_value, these values
|
||||
* are set on the attached UserDataConntainer (see below)
|
||||
@ -26,21 +26,21 @@
|
||||
* osgGA::Device* device = dynamic_cast<osgGA::Device*>(osgDB::readObjectFile(filename));
|
||||
*
|
||||
* 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
|
||||
* 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"
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* 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
|
||||
* event-handler, do something like this:
|
||||
*
|
||||
*
|
||||
* std::string filename = "<target-address>:<target-port>.sender.osc";
|
||||
* osgGA::GUIEventHandler* event_handler = dynamic_cast<osgGA::GUIEventHandler*>(osgDB::readObjectFile(filename));
|
||||
*
|
||||
@ -59,7 +59,7 @@
|
||||
#include <osgDB/FileUtils>
|
||||
#include "OscSendingDevice.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("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)");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
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")
|
||||
{
|
||||
std::string file_name = osgDB::getNameLessExtension(file);
|
||||
|
||||
|
||||
if (osgDB::getFileExtension(file_name) == "sender")
|
||||
{
|
||||
file_name = osgDB::getNameLessExtension(file_name);
|
||||
|
||||
|
||||
std::string server_address = file_name.substr(0,file_name.find(':'));
|
||||
std::string server_port = file_name.substr(file_name.find(':') + 1);
|
||||
|
||||
|
||||
unsigned int num_messages_per_event = 1;
|
||||
if (options && !options->getPluginStringData("numMessagesPerEvent").empty()) {
|
||||
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()));
|
||||
}
|
||||
|
||||
|
||||
unsigned int delay_between_sends_in_millisecs = 0;
|
||||
if (options && !options->getPluginStringData("delayBetweenSendsInMillisecs").empty()) {
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
return new OscSendingDevice(server_address, atoi(server_port.c_str()), num_messages_per_event, delay_between_sends_in_millisecs);
|
||||
}
|
||||
else
|
||||
@ -123,37 +123,37 @@ class ReaderWriterOsc : public osgDB::ReaderWriter
|
||||
port = 8000;
|
||||
}
|
||||
try {
|
||||
|
||||
|
||||
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/last", osgGA::GUIEventAdapter::KEY_End));
|
||||
|
||||
|
||||
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/layer/next", osgGA::GUIEventAdapter::KEY_Down));
|
||||
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/previous", osgGA::GUIEventAdapter::KEY_Page_Up));
|
||||
|
||||
|
||||
device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/unpause", 'o'));
|
||||
device->addRequestHandler(new SendKeystrokeRequestHandler("/p3d/pause", 'p'));
|
||||
|
||||
|
||||
device->addRequestHandler(new SendKeystrokeRequestHandler("/osgviewer/home", ' '));
|
||||
device->addRequestHandler(new SendKeystrokeRequestHandler("/osgviewer/stats", 's'));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ((options && (options->getPluginStringData("documentRegisteredHandlers") == "true")))
|
||||
{
|
||||
std::cout << *device << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return device.release();
|
||||
}
|
||||
catch(const osc::Exception& e)
|
||||
@ -173,9 +173,9 @@ class ReaderWriterOsc : public osgDB::ReaderWriter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ReadResult::FILE_NOT_HANDLED;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include <osgWidget/PdfReader>
|
||||
|
||||
#include <osgPresentation/SlideShowConstructor>
|
||||
#include <osgPresentation/deprecated/SlideShowConstructor>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -401,7 +401,7 @@ bool ReaderWriterP3DXML::getKeyProperty(osgDB::XmlNode*cur, const char* token, i
|
||||
OSG_NOTICE<<" empty()"<<std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (itr->second.find("0x",0,2)!=std::string::npos)
|
||||
{
|
||||
std::istringstream iss(itr->second);
|
||||
@ -1031,7 +1031,7 @@ bool ReaderWriterP3DXML::parseProperties(osgDB::XmlNode* root, osg::UserDataCont
|
||||
float value;
|
||||
std::stringstream str(cur->contents);
|
||||
str>>value;
|
||||
|
||||
|
||||
udc.setUserValue(name, value);
|
||||
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_RGB_WITH_LUMINANCE") volumeData.colorSpaceOperation = osg::REPLACE_RGB_WITH_LUMINANCE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// check for any transfer function required
|
||||
std::string transferFunctionFile;
|
||||
@ -1561,10 +1561,10 @@ void ReaderWriterP3DXML::parseTimeout(osgPresentation::SlideShowConstructor& con
|
||||
timeout->setKeyRunTimoutAction(keyPosition._key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
constructor.popCurrentLayer(); // return the
|
||||
}
|
||||
|
||||
@ -1796,7 +1796,7 @@ void ReaderWriterP3DXML::parseLayer(osgPresentation::SlideShowConstructor& const
|
||||
else if (cur->name == "forward_mouse_event_to_device")
|
||||
{
|
||||
osgPresentation::JumpData jumpData;
|
||||
|
||||
|
||||
OSG_ALWAYS<<"forward_mouse_event_to_device ["<<cur->contents<<"]"<<std::endl;
|
||||
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;
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
osgPresentation::KeyPosition keyPosition;
|
||||
if (getKeyPosition(cur, keyPosition))
|
||||
@ -2140,7 +2140,7 @@ void ReaderWriterP3DXML::parseSlide (osgPresentation::SlideShowConstructor& cons
|
||||
{
|
||||
parseLayer(constructor, _templateMap[inherit].get());
|
||||
}
|
||||
|
||||
|
||||
parseLayer (constructor, cur);
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
constructor.setBackgroundColor(previous_bgcolor,false);
|
||||
constructor.setTextColor(previous_textcolor);
|
||||
|
||||
@ -2353,12 +2353,12 @@ class MyReadFileCallback : public virtual osgDB::ReadFileCallback
|
||||
OSG_INFO<<"Trying server file "<<filename<<std::endl;
|
||||
|
||||
osgDB::ReaderWriter::ReadResult result;
|
||||
|
||||
|
||||
// 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::getServerProtocol(filename),
|
||||
osgDB::getFileExtension(filename));
|
||||
|
||||
|
||||
if (!rw) return osgDB::ReaderWriter::ReadResult::FILE_NOT_HANDLED;
|
||||
|
||||
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;
|
||||
local_opt->setReadFileCallback(new MyReadFileCallback);
|
||||
local_opt->setFindFileCallback(new MyFindFileCallback);
|
||||
|
||||
|
||||
return readNode(input, local_opt.get());
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
|
||||
#include <osgWidget/PdfReader>
|
||||
|
||||
#include <osgPresentation/SlideShowConstructor>
|
||||
#include <osgPresentation/AnimationMaterial>
|
||||
#include <osgPresentation/deprecated/SlideShowConstructor>
|
||||
#include <osgPresentation/deprecated/AnimationMaterial>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -9,28 +9,28 @@ SET(LIB_NAME osgPresentation)
|
||||
SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME})
|
||||
SET(TARGET_H
|
||||
${HEADER_PATH}/Export
|
||||
${HEADER_PATH}/AnimationMaterial
|
||||
${HEADER_PATH}/CompileSlideCallback
|
||||
${HEADER_PATH}/Cursor
|
||||
${HEADER_PATH}/PickEventHandler
|
||||
${HEADER_PATH}/PropertyManager
|
||||
${HEADER_PATH}/KeyEventHandler
|
||||
${HEADER_PATH}/SlideEventHandler
|
||||
${HEADER_PATH}/SlideShowConstructor
|
||||
${HEADER_PATH}/Timeout
|
||||
${HEADER_PATH}/deprecated/AnimationMaterial
|
||||
${HEADER_PATH}/deprecated/CompileSlideCallback
|
||||
${HEADER_PATH}/deprecated/PickEventHandler
|
||||
${HEADER_PATH}/deprecated/PropertyManager
|
||||
${HEADER_PATH}/deprecated/KeyEventHandler
|
||||
${HEADER_PATH}/deprecated/SlideEventHandler
|
||||
${HEADER_PATH}/deprecated/SlideShowConstructor
|
||||
${HEADER_PATH}/deprecated/Timeout
|
||||
)
|
||||
|
||||
# FIXME: For OS X, need flag for Framework or dylib
|
||||
SET(TARGET_SRC
|
||||
AnimationMaterial.cpp
|
||||
CompileSlideCallback.cpp
|
||||
Cursor.cpp
|
||||
PickEventHandler.cpp
|
||||
PropertyManager.cpp
|
||||
KeyEventHandler.cpp
|
||||
SlideEventHandler.cpp
|
||||
SlideShowConstructor.cpp
|
||||
Timeout.cpp
|
||||
deprecated/AnimationMaterial.cpp
|
||||
deprecated/CompileSlideCallback.cpp
|
||||
deprecated/PickEventHandler.cpp
|
||||
deprecated/PropertyManager.cpp
|
||||
deprecated/KeyEventHandler.cpp
|
||||
deprecated/SlideEventHandler.cpp
|
||||
deprecated/SlideShowConstructor.cpp
|
||||
deprecated/Timeout.cpp
|
||||
${OPENSCENEGRAPH_VERSIONINFO_RC}
|
||||
)
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#include <osgPresentation/AnimationMaterial>
|
||||
#include <osgPresentation/deprecated/AnimationMaterial>
|
||||
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/PositionAttitudeTransform>
|
@ -10,7 +10,7 @@
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#include <osgPresentation/CompileSlideCallback>
|
||||
#include <osgPresentation/deprecated/CompileSlideCallback>
|
||||
|
||||
#include <osgUtil/GLObjectsVisitor>
|
||||
|
@ -10,8 +10,8 @@
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#include <osgPresentation/KeyEventHandler>
|
||||
#include <osgPresentation/SlideEventHandler>
|
||||
#include <osgPresentation/deprecated/KeyEventHandler>
|
||||
#include <osgPresentation/deprecated/SlideEventHandler>
|
||||
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osg/Notify>
|
@ -10,8 +10,8 @@
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#include <osgPresentation/PickEventHandler>
|
||||
#include <osgPresentation/SlideEventHandler>
|
||||
#include <osgPresentation/deprecated/PickEventHandler>
|
||||
#include <osgPresentation/deprecated/SlideEventHandler>
|
||||
|
||||
#include <osgViewer/Viewer>
|
||||
#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);
|
||||
const osg::BoundingBox bb(hitr->drawable->getBound());
|
||||
const osg::Vec3& p(hitr->localIntersectionPoint);
|
||||
|
||||
|
||||
float transformed_x = (p.x() - bb.xMin()) / (bb.xMax() - bb.xMin());
|
||||
float transformed_y = (p.z() - bb.zMin()) / (bb.zMax() - bb.zMin());
|
||||
|
||||
|
||||
cloned_ea->setX(ea.getXmin() + transformed_x * (ea.getXmax() - ea.getXmin()));
|
||||
cloned_ea->setY(ea.getYmin() + transformed_y * (ea.getYmax() - ea.getYmin()));
|
||||
cloned_ea->setMouseYOrientation(osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS);
|
||||
|
||||
|
||||
// std::cout << transformed_x << "/" << transformed_x << " -> " << cloned_ea->getX() << "/" <<cloned_ea->getY() << std::endl;
|
||||
|
||||
|
||||
|
||||
|
||||
// dispatch cloned event to devices
|
||||
osgViewer::View::Devices& devices = viewer->getDevices();
|
||||
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)
|
||||
{
|
@ -10,7 +10,7 @@
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#include <osgPresentation/PropertyManager>
|
||||
#include <osgPresentation/deprecated/PropertyManager>
|
||||
#include <osg/io_utils>
|
||||
|
||||
using namespace osgPresentation;
|
@ -10,8 +10,9 @@
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#include <osgPresentation/SlideEventHandler>
|
||||
#include <osgPresentation/SlideShowConstructor>
|
||||
#include <osgPresentation/deprecated/SlideEventHandler>
|
||||
#include <osgPresentation/deprecated/SlideShowConstructor>
|
||||
#include <osgPresentation/deprecated/AnimationMaterial>
|
||||
|
||||
#include <osg/AnimationPath>
|
||||
#include <osg/Transform>
|
||||
@ -27,7 +28,6 @@
|
||||
|
||||
#include <osgGA/AnimationPathManipulator>
|
||||
|
||||
#include <osgPresentation/AnimationMaterial>
|
||||
|
||||
#include <iostream>
|
||||
|
@ -10,7 +10,11 @@
|
||||
* 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/PolygonOffset>
|
||||
@ -51,10 +55,6 @@
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
#include <osgPresentation/AnimationMaterial>
|
||||
#include <osgPresentation/PickEventHandler>
|
||||
#include <osgPresentation/KeyEventHandler>
|
||||
|
||||
#include <osgManipulator/TabBoxDragger>
|
||||
#include <osgManipulator/TabBoxTrackballDragger>
|
||||
#include <osgManipulator/TrackballDragger>
|
@ -11,7 +11,7 @@
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#include <osgPresentation/Timeout>
|
||||
#include <osgPresentation/deprecated/Timeout>
|
||||
#include <osgUtil/CullVisitor>
|
||||
#include <osgGA/EventVisitor>
|
||||
|
||||
@ -28,7 +28,7 @@ public:
|
||||
LEAVE,
|
||||
RESET
|
||||
};
|
||||
|
||||
|
||||
OperationVisitor(Operation op) : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _operation(op), _sleepTime(0.0) {}
|
||||
|
||||
void apply(osg::Node& node)
|
||||
@ -83,7 +83,7 @@ public:
|
||||
double sleepTime() const { return _sleepTime; }
|
||||
|
||||
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));
|
||||
|
||||
if (nv)
|
||||
{
|
||||
{
|
||||
if (nv->getTraversalMask()==_leftMask)
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -288,13 +288,13 @@ void Timeout::traverse(osg::NodeVisitor& nv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (needToRecordEventTime)
|
||||
{
|
||||
_timeOfLastEvent = nv.getFrameStamp()->getReferenceTime();
|
||||
}
|
||||
|
||||
|
||||
double timeSinceLastEvent = nv.getFrameStamp() ? nv.getFrameStamp()->getReferenceTime()-_timeOfLastEvent : 0.0;
|
||||
|
||||
if (timeSinceLastEvent>_idleDurationBeforeTimeoutDisplay)
|
||||
@ -369,9 +369,9 @@ void Timeout::traverse(osg::NodeVisitor& nv)
|
||||
OSG_NOTICE<<"Doing timeout broadcast key event"<<_actionBroadcastKeyPos._key<<std::endl;
|
||||
broadcastEvent(viewer, _actionBroadcastKeyPos);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (nv.getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR)
|
||||
{
|
||||
@ -381,7 +381,7 @@ void Timeout::traverse(osg::NodeVisitor& nv)
|
||||
{
|
||||
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
|
||||
{
|
||||
@ -390,5 +390,5 @@ void Timeout::traverse(osg::NodeVisitor& nv)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user