Moved old osgPresentation source files to osgPresentation/deprecated subdirectory.
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user