Skip to content
This repository
Browse code

Moved old osgPresentation source files to osgPresentation/deprecated …

…subdirectory.
  • Loading branch information...
commit 8d9a74b948ea0cdc1751717f9b0aa7d5f85be3b8 1 parent 118fc81
Robert OSFIELD authored

Showing 24 changed files with 250 additions and 250 deletions. Show diff stats Hide diff stats

  1. +5 5 applications/present3D/deprecated/ExportHTML.h
  2. +21 21 applications/present3D/deprecated/ReadShowFile.cpp
  3. +1 1  applications/present3D/deprecated/present3D.cpp
  4. 0  include/osgPresentation/{ → deprecated}/AnimationMaterial
  5. 0  include/osgPresentation/{ → deprecated}/CompileSlideCallback
  6. +3 3 include/osgPresentation/{ → deprecated}/KeyEventHandler
  7. +2 2 include/osgPresentation/{ → deprecated}/PickEventHandler
  8. 0  include/osgPresentation/{ → deprecated}/PropertyManager
  9. +5 5 include/osgPresentation/{ → deprecated}/SlideEventHandler
  10. +11 11 include/osgPresentation/{ → deprecated}/SlideShowConstructor
  11. +5 5 include/osgPresentation/{ → deprecated}/Timeout
  12. +101 101 src/osgPlugins/osc/OscReceivingDevice.cpp
  13. +32 32 src/osgPlugins/osc/ReaderWriterOscDevice.cpp
  14. +14 14 src/osgPlugins/p3d/ReaderWriterP3D.cpp
  15. +2 2 src/osgPlugins/p3d/ReaderWriterPaths.cpp
  16. +16 16 src/osgPresentation/CMakeLists.txt
  17. +1 1  src/osgPresentation/{ → deprecated}/AnimationMaterial.cpp
  18. +1 1  src/osgPresentation/{ → deprecated}/CompileSlideCallback.cpp
  19. +2 2 src/osgPresentation/{ → deprecated}/KeyEventHandler.cpp
  20. +8 8 src/osgPresentation/{ → deprecated}/PickEventHandler.cpp
  21. +1 1  src/osgPresentation/{ → deprecated}/PropertyManager.cpp
  22. +3 3 src/osgPresentation/{ → deprecated}/SlideEventHandler.cpp
  23. +5 5 src/osgPresentation/{ → deprecated}/SlideShowConstructor.cpp
  24. +11 11 src/osgPresentation/{ → deprecated}/Timeout.cpp
10 applications/present3D/deprecated/ExportHTML.h
... ... @@ -1,19 +1,19 @@
1   -/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
  1 +/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
2 2 *
3   - * This software is open source and may be redistributed and/or modified under
  3 + * This software is open source and may be redistributed and/or modified under
4 4 * the terms of the GNU General Public License (GPL) version 2.0.
5 5 * The full license is in LICENSE.txt file included with this distribution,.
6   - *
  6 + *
7 7 * This software is distributed in the hope that it will be useful,
8 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 10 * include LICENSE.txt for more details.
11 11 */
12 12
13 13 #ifndef EXPORTHTML_H
14 14 #define EXPORTHTML_H 1
15 15
16   -#include <osgPresentation/SlideEventHandler>
  16 +#include <osgPresentation/deprecated/SlideEventHandler>
17 17 #include <osgViewer/Viewer>
18 18
19 19 class ExportHTML
42 applications/present3D/deprecated/ReadShowFile.cpp
... ... @@ -1,19 +1,19 @@
1   -/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
  1 +/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
2 2 *
3   - * This software is open source and may be redistributed and/or modified under
  3 + * This software is open source and may be redistributed and/or modified under
4 4 * the terms of the GNU General Public License (GPL) version 2.0.
5 5 * The full license is in LICENSE.txt file included with this distribution,.
6   - *
  6 + *
7 7 * This software is distributed in the hope that it will be useful,
8 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 10 * include LICENSE.txt for more details.
11 11 */
12 12
13 13 #include "ReadShowFile.h"
14 14 #include "ShowEventHandler.h"
15 15
16   -#include <osgPresentation/SlideEventHandler>
  16 +#include <osgPresentation/deprecated/SlideEventHandler>
17 17
18 18 #include <osg/ImageStream>
19 19 #include <osg/Shape>
@@ -35,7 +35,7 @@ class AddVolumeEditingCallbackVisitor : public osg::NodeVisitor
35 35 public:
36 36 AddVolumeEditingCallbackVisitor():
37 37 osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
38   -
  38 +
39 39 void apply(osg::Group& group)
40 40 {
41 41 osgVolume::VolumeTile* volumeTile = dynamic_cast<osgVolume::VolumeTile*>(&group);
@@ -51,7 +51,7 @@ class AddVolumeEditingCallbackVisitor : public osg::NodeVisitor
51 51 traverse(group);
52 52 }
53 53 }
54   -
  54 +
55 55 };
56 56
57 57 bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, FileNameList& normalFiles)
@@ -62,7 +62,7 @@ bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, F
62 62 if (!arguments.isOption(pos))
63 63 {
64 64 std::string ext = osgDB::getFileExtension(arguments[pos]);
65   - if (osgDB::equalCaseInsensitive(ext,"xml") || osgDB::equalCaseInsensitive(ext,"p3d"))
  65 + if (osgDB::equalCaseInsensitive(ext,"xml") || osgDB::equalCaseInsensitive(ext,"p3d"))
66 66 {
67 67 xmlFiles.push_back(arguments[pos]);
68 68 }
@@ -73,7 +73,7 @@ bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, F
73 73 }
74 74 }
75 75 return (!xmlFiles.empty() || !normalFiles.empty());
76   -}
  76 +}
77 77
78 78 bool p3d::readEnvVars(osg::ArgumentParser& arguments)
79 79 {
@@ -94,23 +94,23 @@ bool p3d::readEnvVars(osg::ArgumentParser& arguments)
94 94 {
95 95 osgDB::getDataFilePathList().push_front(path);
96 96 }
97   -
  97 +
98 98 if (p3d::readEnvVars(file)) readVars = true;
99 99 }
100 100 }
101 101 }
102 102 }
103   -
  103 +
104 104 return readVars;
105 105 }
106 106
107 107 bool p3d::readEnvVars(const std::string& fileName)
108 108 {
109 109 std::string ext = osgDB::getFileExtension(fileName);
110   - if (!osgDB::equalCaseInsensitive(ext,"xml") &&
  110 + if (!osgDB::equalCaseInsensitive(ext,"xml") &&
111 111 !osgDB::equalCaseInsensitive(ext,"p3d")) return false;
112   -
113   -
  112 +
  113 +
114 114 osg::ref_ptr<osgDB::XmlNode> doc = new osgDB::XmlNode;
115 115 osgDB::XmlNode* root = 0;
116 116
@@ -146,7 +146,7 @@ bool p3d::readEnvVars(const std::string& fileName)
146 146 }
147 147
148 148 bool readVars = false;
149   -
  149 +
150 150 for(osgDB::XmlNode::Children::iterator itr = root->children.begin();
151 151 itr != root->children.end();
152 152 ++itr)
@@ -182,7 +182,7 @@ osgDB::Options* createOptions(const osgDB::ReaderWriter::Options* options)
182 182 osg::ref_ptr<osg::Node> p3d::readHoldingSlide(const std::string& filename)
183 183 {
184 184 std::string ext = osgDB::getFileExtension(filename);
185   - if (!osgDB::equalCaseInsensitive(ext,"xml") &&
  185 + if (!osgDB::equalCaseInsensitive(ext,"xml") &&
186 186 !osgDB::equalCaseInsensitive(ext,"p3d")) return 0;
187 187
188 188 osg::ref_ptr<osgDB::ReaderWriter::Options> options = createOptions(0);
@@ -260,12 +260,12 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
260 260 }
261 261 }
262 262 }
263   -
  263 +
264 264 if (nodeList.empty())
265 265 {
266 266 return NULL;
267 267 }
268   -
  268 +
269 269 osg::ref_ptr<osg::Node> root;
270 270
271 271 if (nodeList.size()==1)
@@ -274,7 +274,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
274 274 }
275 275 else // size >1
276 276 {
277   -
  277 +
278 278 osg::Switch* sw = new osg::Switch;
279 279 for(NodeList::iterator itr=nodeList.begin();
280 280 itr!=nodeList.end();
@@ -283,7 +283,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
283 283 sw->addChild((*itr).get());
284 284 }
285 285 sw->setSingleChildOn(0);
286   -
  286 +
287 287 sw->setEventCallback(new p3d::ShowEventHandler());
288 288
289 289 root = sw;
@@ -292,7 +292,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
292 292 if (root.valid())
293 293 {
294 294 osg::notify(osg::INFO)<<"Got node now adding callback"<<std::endl;
295   -
  295 +
296 296 AddVolumeEditingCallbackVisitor avecv;
297 297 root->accept(avecv);
298 298 }
2  applications/present3D/deprecated/present3D.cpp
@@ -37,7 +37,7 @@
37 37 #include <osgGA/AnimationPathManipulator>
38 38 #include <osgGA/StateSetManipulator>
39 39
40   -#include <osgPresentation/SlideEventHandler>
  40 +#include <osgPresentation/deprecated/SlideEventHandler>
41 41 #include <osgPresentation/Cursor>
42 42
43 43 #include "ReadShowFile.h"
0  include/osgPresentation/AnimationMaterial → include/osgPresentation/deprecated/AnimationMaterial
File renamed without changes
0  include/osgPresentation/CompileSlideCallback → ...e/osgPresentation/deprecated/CompileSlideCallback
File renamed without changes
6 include/osgPresentation/KeyEventHandler → include/osgPresentation/deprecated/KeyEventHandler
@@ -18,7 +18,7 @@
18 18
19 19 #include <osgGA/GUIEventHandler>
20 20
21   -#include <osgPresentation/SlideEventHandler>
  21 +#include <osgPresentation/deprecated/SlideEventHandler>
22 22
23 23 namespace osgPresentation
24 24 {
@@ -33,7 +33,7 @@ class OSGPRESENTATION_EXPORT KeyEventHandler : public osgGA::GUIEventHandler
33 33
34 34 void setKey(int key) { _key = key; }
35 35 int getKey() const { return _key; }
36   -
  36 +
37 37 void setOperation(osgPresentation::Operation operation) { _operation = operation; }
38 38 osgPresentation::Operation getOperation() const { return _operation; }
39 39
@@ -55,7 +55,7 @@ class OSGPRESENTATION_EXPORT KeyEventHandler : public osgGA::GUIEventHandler
55 55 void doOperation();
56 56
57 57 int _key;
58   -
  58 +
59 59 std::string _command;
60 60 osgPresentation::KeyPosition _keyPos;
61 61 osgPresentation::Operation _operation;
4 include/osgPresentation/PickEventHandler → include/osgPresentation/deprecated/PickEventHandler
@@ -18,7 +18,7 @@
18 18
19 19 #include <osgGA/GUIEventHandler>
20 20
21   -#include <osgPresentation/SlideEventHandler>
  21 +#include <osgPresentation/deprecated/SlideEventHandler>
22 22
23 23 namespace osgPresentation
24 24 {
@@ -42,7 +42,7 @@ class OSGPRESENTATION_EXPORT PickEventHandler : public osgGA::GUIEventHandler
42 42
43 43 void setJumpData(const JumpData& jumpData) { _jumpData = jumpData; }
44 44 const JumpData& getJumpData() const { return _jumpData; }
45   -
  45 +
46 46 virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv);
47 47
48 48 virtual void accept(osgGA::GUIEventHandlerVisitor& v);
0  include/osgPresentation/PropertyManager → include/osgPresentation/deprecated/PropertyManager
File renamed without changes
10 include/osgPresentation/SlideEventHandler → include/osgPresentation/deprecated/SlideEventHandler
@@ -21,15 +21,15 @@
21 21 #include <osgGA/GUIEventHandler>
22 22 #include <osgViewer/Viewer>
23 23
24   -#include <osgPresentation/CompileSlideCallback>
25   -#include <osgPresentation/PropertyManager>
  24 +#include <osgPresentation/deprecated/CompileSlideCallback>
  25 +#include <osgPresentation/deprecated/PropertyManager>
26 26
27 27 namespace osgPresentation
28 28 {
29 29
30 30 // forward declare
31 31 class SlideEventHandler;
32   -
  32 +
33 33 /// Operations related to click to run/load/key events.
34 34 enum Operation
35 35 {
@@ -46,7 +46,7 @@ struct JumpData
46 46 relativeJump(true),
47 47 slideNum(0),
48 48 layerNum(0) {}
49   -
  49 +
50 50 JumpData(bool in_relativeJump, int in_slideNum, int in_layerNum):
51 51 relativeJump(in_relativeJump),
52 52 slideNum(in_slideNum),
@@ -230,7 +230,7 @@ protected:
230 230 void processOutgoing(SlideEventHandler* seh);
231 231 void processIncomming(SlideEventHandler* seh);
232 232 void processMaintained(SlideEventHandler* seh);
233   -
  233 +
234 234 bool _pause;
235 235
236 236 OperatorList _previous;
22 include/osgPresentation/SlideShowConstructor → ...e/osgPresentation/deprecated/SlideShowConstructor
@@ -31,10 +31,10 @@
31 31 #include <osgVolume/VolumeTile>
32 32 #include <osgVolume/Property>
33 33
34   -#include <osgPresentation/AnimationMaterial>
35   -#include <osgPresentation/SlideEventHandler>
36   -#include <osgPresentation/PropertyManager>
37   -#include <osgPresentation/Timeout>
  34 +#include <osgPresentation/deprecated/AnimationMaterial>
  35 +#include <osgPresentation/deprecated/SlideEventHandler>
  36 +#include <osgPresentation/deprecated/PropertyManager>
  37 +#include <osgPresentation/deprecated/Timeout>
38 38
39 39 namespace osgPresentation
40 40 {
@@ -67,7 +67,7 @@ public:
67 67 enum CoordinateFrame { SLIDE, MODEL };
68 68
69 69
70   -
  70 +
71 71 LayerAttributes* getOrCreateLayerAttributes(osg::Node* node);
72 72
73 73 void setDuration(osg::Node* node,double duration)
@@ -253,7 +253,7 @@ public:
253 253 osg::Vec4 backgroundColor;
254 254 double fps;
255 255 double duration;
256   -
  256 +
257 257 bool imageSequence;
258 258 osg::ImageSequence::Mode imageSequencePagingMode;
259 259
@@ -271,7 +271,7 @@ public:
271 271 OFF,
272 272 ON
273 273 };
274   -
  274 +
275 275 BlendingHint blendingHint;
276 276
277 277 double delayTime;
@@ -420,7 +420,7 @@ public:
420 420 CURRENT_SLIDE,
421 421 CURRENT_LAYER
422 422 };
423   -
  423 +
424 424 void addEventHandler(PresentationContext presentationContext, osg::ref_ptr<osgGA::GUIEventHandler> handler);
425 425
426 426 void keyToDoOperation(PresentationContext presentationContext, int key, Operation operation, const JumpData& jumpData=JumpData());
@@ -456,7 +456,7 @@ public:
456 456 void addModel(const std::string& filename, const PositionData& positionData, const ModelData& modelData);
457 457
458 458 void setUpVolumeScalarProperty(osgVolume::VolumeTile* tile, osgVolume::ScalarProperty* property, const std::string& source);
459   -
  459 +
460 460 void addVolume(const std::string& filename, const PositionData& positionData, const VolumeData& volumeData);
461 461
462 462 osg::Group* takePresentation() { return _root.release(); }
@@ -469,7 +469,7 @@ public:
469 469
470 470 void pushCurrentLayer();
471 471 void popCurrentLayer();
472   -
  472 +
473 473 osg::Group* getCurrentLayer() { return _currentLayer.get(); }
474 474
475 475 void setLoopPresentation(bool loop) { _loopPresentation = loop; }
@@ -555,7 +555,7 @@ protected:
555 555
556 556 osg::ref_ptr<osgPresentation::PropertyManager> _propertyManager;
557 557 osg::ref_ptr<osgPresentation::PropertyEventCallback> _propertyEventCallback;
558   -
  558 +
559 559 osg::ref_ptr<osg::Group> _root;
560 560 osg::ref_ptr<osg::Switch> _presentationSwitch;
561 561
10 include/osgPresentation/Timeout → include/osgPresentation/deprecated/Timeout
@@ -16,7 +16,7 @@
16 16
17 17 #include <osg/Transform>
18 18
19   -#include <osgPresentation/SlideEventHandler>
  19 +#include <osgPresentation/deprecated/SlideEventHandler>
20 20
21 21 namespace osgPresentation {
22 22
@@ -38,7 +38,7 @@ protected:
38 38
39 39 virtual ~HUDSettings();
40 40 };
41   -
  41 +
42 42 class OSGPRESENTATION_EXPORT Timeout : public osg::Transform
43 43 {
44 44 public:
@@ -50,14 +50,14 @@ class OSGPRESENTATION_EXPORT Timeout : public osg::Transform
50 50
51 51 META_Node(osgPresentation, Timeout);
52 52
53   -
  53 +
54 54 void setIdleDurationBeforeTimeoutDisplay(double t) { _idleDurationBeforeTimeoutDisplay = t; }
55 55 double getIdleDurationBeforeTimeoutDisplay() const { return _idleDurationBeforeTimeoutDisplay; }
56 56
57 57 void setIdleDurationBeforeTimeoutAction(double t) { _idleDurationBeforeTimeoutAction = t; }
58 58 double getIdleDurationBeforeTimeoutAction() const { return _idleDurationBeforeTimeoutAction; }
59 59
60   -
  60 +
61 61 void setKeyStartsTimoutDisplay(int key) { _keyStartsTimoutDisplay = key; }
62 62 int getKeyStartsTimoutDisplay() const { return _keyStartsTimoutDisplay; }
63 63
@@ -67,7 +67,7 @@ class OSGPRESENTATION_EXPORT Timeout : public osg::Transform
67 67 void setKeyRunTimoutAction(int key) { _keyRunTimeoutAction = key; }
68 68 int getKeyRunTimoutAction() const { return _keyRunTimeoutAction; }
69 69
70   -
  70 +
71 71 void setDisplayBroadcastKeyPosition(const osgPresentation::KeyPosition& keyPos) { _displayBroadcastKeyPos = keyPos; }
72 72 const osgPresentation::KeyPosition& getDisplayBroadcastKeyPosition() const { return _displayBroadcastKeyPos; }
73 73
202 src/osgPlugins/osc/OscReceivingDevice.cpp
@@ -17,7 +17,7 @@
17 17 #include <osg/ValueObject>
18 18 #include <osgDB/FileUtils>
19 19 #include <osgDB/FileNameUtils>
20   -#include <osgPresentation/PropertyManager>
  20 +#include <osgPresentation/deprecated/PropertyManager>
21 21 #include "osc/OscPrintReceivedElements.h"
22 22 #include "osc/OscHostEndianness.h"
23 23
@@ -93,7 +93,7 @@ class StandardRequestHandler : public OscReceivingDevice::RequestHandler {
93 93 {
94 94 }
95 95 virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m);
96   -
  96 +
97 97 virtual void describeTo(std::ostream& out) const
98 98 {
99 99 out << getRequestPath() << ": add all transmitted arguments as ValueObjects to an USER-event";
@@ -102,7 +102,7 @@ class StandardRequestHandler : public OscReceivingDevice::RequestHandler {
102 102 }
103 103 private:
104 104 void addArgumentToUdc(osg::UserDataContainer* udc, const std::string& key, const osc::ReceivedMessageArgumentIterator& itr);
105   -
  105 +
106 106 template <class T>
107 107 bool addNativeTypeFromVector(osg::UserDataContainer* udc, const std::string& key, const std::vector<T>& arr)
108 108 {
@@ -128,9 +128,9 @@ class StandardRequestHandler : public OscReceivingDevice::RequestHandler {
128 128 }
129 129 return false;
130 130 }
131   -
  131 +
132 132 bool _treatFirstArgumentAsValueName;
133   -
  133 +
134 134 };
135 135
136 136
@@ -141,18 +141,18 @@ bool StandardRequestHandler::operator()(const std::string& request_path, const s
141 141 {
142 142 std::string path = osgDB::getFilePath(full_request_path);
143 143 std::string last_elem = osgDB::getSimpleFileName(full_request_path);
144   -
  144 +
145 145 osg::ref_ptr<osgGA::GUIEventAdapter> ea = getDevice()->getOrCreateUserDataEvent();
146 146 osg::UserDataContainer* udc = ea->getOrCreateUserDataContainer();
147   -
148   -
  147 +
  148 +
149 149 ea->setName(_treatFirstArgumentAsValueName ? full_request_path : path);
150 150 udc->setName(ea->getName());
151   -
  151 +
152 152 if (m.ArgumentCount() == 0) {
153 153 return true;
154 154 }
155   -
  155 +
156 156 // if we have only one argument, get it and save it to the udc
157 157 else if (m.ArgumentCount() == 1)
158 158 {
@@ -210,7 +210,7 @@ bool StandardRequestHandler::operator()(const std::string& request_path, const s
210 210 return true;
211 211 }
212 212 }
213   -
  213 +
214 214 for(osc::ReceivedMessageArgumentIterator itr = start; itr != m.ArgumentsEnd(); ++itr, ++i)
215 215 {
216 216 std::ostringstream ss;
@@ -219,7 +219,7 @@ bool StandardRequestHandler::operator()(const std::string& request_path, const s
219 219 }
220 220 }
221 221 return true;
222   -
  222 +
223 223 }
224 224 catch(osc::Exception& e)
225 225 {
@@ -237,46 +237,46 @@ void StandardRequestHandler::addArgumentToUdc(osg::UserDataContainer* udc, const
237 237 case osc::TRUE_TYPE_TAG:
238 238 udc->setUserValue(key, true);
239 239 break;
240   -
  240 +
241 241 case osc::FALSE_TYPE_TAG:
242 242 udc->setUserValue(key, false);
243 243 break;
244   -
  244 +
245 245 case osc::INT32_TYPE_TAG:
246 246 udc->setUserValue(key, (int)((*itr).AsInt32Unchecked()));
247 247 break;
248   -
  248 +
249 249 case osc::FLOAT_TYPE_TAG:
250 250 udc->setUserValue(key, (*itr).AsFloatUnchecked());
251 251 break;
252   -
  252 +
253 253 case osc::CHAR_TYPE_TAG:
254 254 udc->setUserValue(key, (*itr).AsCharUnchecked());
255 255 break;
256   -
  256 +
257 257 case osc::RGBA_COLOR_TYPE_TAG:
258 258 // TODO: should we convert the color to an osg::Vec4?
259 259 udc->setUserValue(key, static_cast<unsigned int>((*itr).AsRgbaColorUnchecked()));
260 260 break;
261   -
  261 +
262 262 case osc::INT64_TYPE_TAG:
263 263 // TODO 64bit ints not supported by ValueObject
264 264 udc->setUserValue(key, static_cast<double>((*itr).AsInt64Unchecked()));
265 265 break;
266   -
  266 +
267 267 case osc::TIME_TAG_TYPE_TAG:
268 268 // TODO 64bit ints not supported by ValueObject
269 269 udc->setUserValue(key, static_cast<double>((*itr).AsTimeTagUnchecked()));
270 270 break;
271   -
  271 +
272 272 case osc::DOUBLE_TYPE_TAG:
273 273 udc->setUserValue(key, (*itr).AsDoubleUnchecked());
274 274 break;
275   -
  275 +
276 276 case osc::STRING_TYPE_TAG:
277 277 udc->setUserValue(key, std::string((*itr).AsStringUnchecked()));
278 278 break;
279   -
  279 +
280 280 case osc::SYMBOL_TYPE_TAG:
281 281 udc->setUserValue(key, std::string((*itr).AsSymbol()));
282 282 break;
@@ -297,25 +297,25 @@ class SetMouseInputRangeRequestHandler : public OscReceivingDevice::RequestHandl
297 297 : OscReceivingDevice::RequestHandler("/osgga/mouse/set_input_range")
298 298 {
299 299 }
300   -
  300 +
301 301 virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
302 302 {
303 303 try {
304 304 float x_min(-1.0f), y_min(-1.0f), x_max(1.0f), y_max(1.0f);
305 305 osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
306 306 args >> x_min >> y_min >> x_max >> y_max >> osc::EndMessage;
307   -
  307 +
308 308 getDevice()->getEventQueue()->setMouseInputRange(x_min, y_min, x_max, y_max);
309   -
  309 +
310 310 return true;
311 311 }
312 312 catch(osc::Exception e) {
313 313 handleException(e);
314 314 }
315   -
  315 +
316 316 return false;
317 317 }
318   -
  318 +
319 319 virtual void describeTo(std::ostream& out) const
320 320 {
321 321 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 @@ class SetMouseOrientationRequestHandler : public OscReceivingDevice::RequestHand
329 329 : OscReceivingDevice::RequestHandler("/osgga/mouse/y_orientation_increasing_upwards")
330 330 {
331 331 }
332   -
  332 +
333 333 virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
334 334 {
335 335 try {
336 336 bool increasing_upwards(false);
337 337 osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
338 338 args >>increasing_upwards >> osc::EndMessage;
339   -
  339 +
340 340 getDevice()->getEventQueue()->getCurrentEventState()->setMouseYOrientation(
341 341 increasing_upwards ? osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS : osgGA::GUIEventAdapter::Y_INCREASING_DOWNWARDS);
342   -
  342 +
343 343 return true;
344 344 }
345 345 catch(osc::Exception e) {
346 346 handleException(e);
347 347 }
348   -
  348 +
349 349 return false;
350 350 }
351   -
  351 +
352 352 virtual void describeTo(std::ostream& out) const
353 353 {
354 354 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 @@ class KeyCodeRequestHandler : public OscReceivingDevice::RequestHandler {
363 363 , _handleKeyPress(handle_key_press)
364 364 {
365 365 }
366   -
  366 +
367 367 virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
368 368 {
369 369 try {
370 370 osc::int32 keycode(0);
371 371 osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
372 372 args >> keycode >> osc::EndMessage;
373   -
  373 +
374 374 if (_handleKeyPress)
375 375 getDevice()->getEventQueue()->keyPress(keycode, getLocalTime());
376 376 else
377 377 getDevice()->getEventQueue()->keyRelease(keycode, getLocalTime());
378   -
  378 +
379 379 return true;
380 380 }
381 381 catch(osc::Exception e) {
382 382 handleException(e);
383 383 }
384   -
  384 +
385 385 return false;
386 386 }
387   -
  387 +
388 388 virtual void describeTo(std::ostream& out) const
389 389 {
390 390 out << getRequestPath() << "(int keycode): send KEY_" << (_handleKeyPress ? "DOWN" : "UP");
@@ -400,26 +400,26 @@ class KeyPressAndReleaseRequestHandler : public OscReceivingDevice::RequestHandl
400 400 : OscReceivingDevice::RequestHandler("/osgga/key/press_and_release")
401 401 {
402 402 }
403   -
  403 +
404 404 virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
405 405 {
406 406 try {
407 407 osc::int32 keycode(0);
408 408 osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
409 409 args >> keycode >> osc::EndMessage;
410   -
  410 +
411 411 getDevice()->getEventQueue()->keyPress(keycode, getLocalTime());
412 412 getDevice()->getEventQueue()->keyRelease(keycode, getLocalTime());
413   -
  413 +
414 414 return true;
415 415 }
416 416 catch(osc::Exception e) {
417 417 handleException(e);
418 418 }
419   -
  419 +
420 420 return false;
421 421 }
422   -
  422 +
423 423 virtual void describeTo(std::ostream& out) const
424 424 {
425 425 out << getRequestPath() << "(int keycode): send KEY_DOWN and KEY_UP";
@@ -439,16 +439,16 @@ class MouseMotionRequestHandler : public OscReceivingDevice::RequestHandler {
439 439 , _lastY(0.0f)
440 440 {
441 441 }
442   -
  442 +
443 443 virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
444 444 {
445   -
  445 +
446 446 try {
447 447 osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
448 448 args >> _lastX >> _lastY >> osc::EndMessage;
449   -
  449 +
450 450 getDevice()->getEventQueue()->mouseMotion(_lastX, _lastY, getLocalTime());
451   -
  451 +
452 452 return true;
453 453 }
454 454 catch (osc::Exception e) {
@@ -456,7 +456,7 @@ class MouseMotionRequestHandler : public OscReceivingDevice::RequestHandler {
456 456 }
457 457 return false;
458 458 }
459   -
  459 +
460 460 virtual void describeTo(std::ostream& out) const
461 461 {
462 462 out << getRequestPath() << "(float x, float y): send mouse motion";
@@ -474,23 +474,23 @@ class MouseScrollRequestHandler : public OscReceivingDevice::RequestHandler {
474 474 : OscReceivingDevice::RequestHandler("/osgga/mouse/scroll")
475 475 {
476 476 }
477   -
  477 +
478 478 virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
479 479 {
480   -
  480 +
481 481 try {
482 482 osc::int32 sm(osgGA::GUIEventAdapter::SCROLL_NONE);
483 483 float delta_x(0.0f), delta_y(0.0f);
484   -
  484 +
485 485 osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
486 486 args >> sm >> delta_x >> delta_y >> osc::EndMessage;
487   -
  487 +
488 488 if (sm != osgGA::GUIEventAdapter::SCROLL_NONE)
489 489 getDevice()->getEventQueue()->mouseScroll((osgGA::GUIEventAdapter::ScrollingMotion)sm, getLocalTime());
490   -
  490 +
491 491 if ((delta_x != 0.0f) || (delta_y != 0.0f))
492 492 getDevice()->getEventQueue()->mouseScroll2D(delta_x, delta_y, getLocalTime());
493   -
  493 +
494 494 return true;
495 495 }
496 496 catch (osc::Exception e) {
@@ -498,7 +498,7 @@ class MouseScrollRequestHandler : public OscReceivingDevice::RequestHandler {
498 498 }
499 499 return false;
500 500 }
501   -
  501 +
502 502 virtual void describeTo(std::ostream& out) const
503 503 {
504 504 out << getRequestPath() << "(int scroll_motion, float x, float y): send mouse scroll-motion";
@@ -515,20 +515,20 @@ class MouseButtonToggleRequestHandler : public OscReceivingDevice::RequestHandle
515 515 , _btnNum(atoi(btn_name.c_str()))
516 516 {
517 517 }
518   -
  518 +
519 519 virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
520 520 {
521 521 float down(0.0f);
522   -
  522 +
523 523 try {
524 524 osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
525 525 args >> down >> osc::EndMessage;
526   -
  526 +
527 527 if (down > 0)
528 528 getDevice()->getEventQueue()->mouseButtonPress(_mmHandler->getLastX(), _mmHandler->getLastY(), _btnNum, getLocalTime());
529 529 else
530 530 getDevice()->getEventQueue()->mouseButtonRelease(_mmHandler->getLastX(), _mmHandler->getLastY(), _btnNum, getLocalTime());
531   -
  531 +
532 532 return true;
533 533 }
534 534 catch (osc::Exception e) {
@@ -536,7 +536,7 @@ class MouseButtonToggleRequestHandler : public OscReceivingDevice::RequestHandle
536 536 }
537 537 return false;
538 538 }
539   -
  539 +
540 540 virtual void describeTo(std::ostream& out) const
541 541 {
542 542 out << getRequestPath() << "(float down): toggle mouse button";
@@ -550,7 +550,7 @@ class MouseButtonToggleRequestHandler : public OscReceivingDevice::RequestHandle
550 550 class MouseButtonRequestHandler : public OscReceivingDevice::RequestHandler {
551 551 public:
552 552 enum Mode { PRESS, RELEASE, DOUBLE_PRESS};
553   -
  553 +
554 554 MouseButtonRequestHandler(Mode mode)
555 555 : OscReceivingDevice::RequestHandler("")
556 556 , _mode(mode)
@@ -567,12 +567,12 @@ class MouseButtonRequestHandler : public OscReceivingDevice::RequestHandler {
567 567 break;
568 568 }
569 569 }
570   -
  570 +
571 571 virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
572 572 {
573 573 float x(0.0f), y(0.0f);
574 574 osc::int32 btn(0);
575   -
  575 +
576 576 try {
577 577 osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
578 578 args >> x >> y >> btn >> osc::EndMessage;
@@ -587,7 +587,7 @@ class MouseButtonRequestHandler : public OscReceivingDevice::RequestHandler {
587 587 getDevice()->getEventQueue()->mouseDoubleButtonPress(x,y, btn, getLocalTime());
588 588 break;
589 589 }
590   -
  590 +
591 591 return true;
592 592 }
593 593 catch (osc::Exception e) {
@@ -595,7 +595,7 @@ class MouseButtonRequestHandler : public OscReceivingDevice::RequestHandler {
595 595 }
596 596 return false;
597 597 }
598   -
  598 +
599 599 virtual void describeTo(std::ostream& out) const
600 600 {
601 601 out << getRequestPath() << "(float x, float y, int btn): send mouse ";
@@ -608,7 +608,7 @@ class MouseButtonRequestHandler : public OscReceivingDevice::RequestHandler {
608 608 out << "double press"; break;
609 609 }
610 610 }
611   -
  611 +
612 612 private:
613 613 Mode _mode;
614 614 };
@@ -620,16 +620,16 @@ class PenPressureRequestHandler : public OscReceivingDevice::RequestHandler {
620 620 : OscReceivingDevice::RequestHandler("/osgga/pen/pressure")
621 621 {
622 622 }
623   -
  623 +
624 624 virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
625 625 {
626 626 try {
627 627 float pressure(0.0f);
628 628 osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
629 629 args >> pressure >> osc::EndMessage;
630   -
  630 +
631 631 getDevice()->getEventQueue()->penPressure(pressure, getLocalTime());
632   -
  632 +
633 633 return true;
634 634 }
635 635 catch (osc::Exception e) {
@@ -637,7 +637,7 @@ class PenPressureRequestHandler : public OscReceivingDevice::RequestHandler {
637 637 }
638 638 return false;
639 639 }
640   -
  640 +
641 641 virtual void describeTo(std::ostream& out) const
642 642 {
643 643 out << getRequestPath() << "(float pressure): send pen pressure";
@@ -651,17 +651,17 @@ class PenProximityRequestHandler : public OscReceivingDevice::RequestHandler {
651 651 , _handleEnter(handle_enter)
652 652 {
653 653 }
654   -
  654 +
655 655 virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
656 656 {
657 657 try {
658 658 osc::int32 pt(osgGA::GUIEventAdapter::UNKNOWN);
659   -
  659 +
660 660 osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
661 661 args >> pt >> osc::EndMessage;
662   -
  662 +
663 663 getDevice()->getEventQueue()->penProximity((osgGA::GUIEventAdapter::TabletPointerType)pt, _handleEnter, getLocalTime());
664   -
  664 +
665 665 return true;
666 666 }
667 667 catch (osc::Exception e) {
@@ -669,7 +669,7 @@ class PenProximityRequestHandler : public OscReceivingDevice::RequestHandler {
669 669 }
670 670 return false;
671 671 }
672   -
  672 +
673 673 virtual void describeTo(std::ostream& out) const
674 674 {
675 675 out << getRequestPath() << "(int table_pointer_type): send pen proximity " << (_handleEnter ? "enter":"leave");
@@ -685,16 +685,16 @@ class PenOrientationRequestHandler : public OscReceivingDevice::RequestHandler {
685 685 : OscReceivingDevice::RequestHandler("/osgga/pen/orientation")
686 686 {
687 687 }
688   -
  688 +
689 689 virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const osc::ReceivedMessage& m)
690 690 {
691 691 try {
692 692 float rotation(0.0f), tilt_x(0.0f), tilt_y(0.0f);
693 693 osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
694 694 args >> rotation >> tilt_x >> tilt_y >> osc::EndMessage;
695   -
  695 +
696 696 getDevice()->getEventQueue()->penOrientation(tilt_x, tilt_y, rotation, getLocalTime());
697   -
  697 +
698 698 return true;
699 699 }
700 700 catch (osc::Exception e) {
@@ -702,7 +702,7 @@ class PenOrientationRequestHandler : public OscReceivingDevice::RequestHandler {
702 702 }
703 703 return false;
704 704 }
705   -
  705 +
706 706 virtual void describeTo(std::ostream& out) const
707 707 {
708 708 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
732 732 OSG_NOTICE << "(big endian)";
733 733 #endif
734 734 OSG_NOTICE << std::endl;
735   -
  735 +
736 736 _socket = new UdpListeningReceiveSocket(IpEndpointName( server_address.c_str(), listening_port ), this);
737   -
  737 +
738 738 addRequestHandler(new OscDevice::KeyCodeRequestHandler(false));
739 739 addRequestHandler(new OscDevice::KeyCodeRequestHandler(true));
740 740 addRequestHandler(new OscDevice::KeyPressAndReleaseRequestHandler());
741   -
  741 +
742 742 addRequestHandler(new OscDevice::SetMouseInputRangeRequestHandler());
743 743 addRequestHandler(new OscDevice::SetMouseOrientationRequestHandler());
744   -
  744 +
745 745 OscDevice::MouseMotionRequestHandler* mm_handler = new OscDevice::MouseMotionRequestHandler();
746 746 addRequestHandler(mm_handler);
747 747 addRequestHandler(new OscDevice::MouseButtonRequestHandler(OscDevice::MouseButtonRequestHandler::PRESS));
748 748 addRequestHandler(new OscDevice::MouseButtonRequestHandler(OscDevice::MouseButtonRequestHandler::RELEASE));
749 749 addRequestHandler(new OscDevice::MouseButtonRequestHandler(OscDevice::MouseButtonRequestHandler::DOUBLE_PRESS));
750 750 addRequestHandler(new OscDevice::MouseScrollRequestHandler());
751   -
  751 +
752 752 addRequestHandler(new OscDevice::MouseButtonToggleRequestHandler("1", mm_handler));
753 753 addRequestHandler(new OscDevice::MouseButtonToggleRequestHandler("2", mm_handler));
754 754 addRequestHandler(new OscDevice::MouseButtonToggleRequestHandler("3", mm_handler));
755   -
  755 +
756 756 addRequestHandler(new OscDevice::PenPressureRequestHandler());
757 757 addRequestHandler(new OscDevice::PenOrientationRequestHandler());
758 758 addRequestHandler(new OscDevice::PenProximityRequestHandler(true));
759 759 addRequestHandler(new OscDevice::PenProximityRequestHandler(false));
760   -
  760 +
761 761 addRequestHandler(new OscDevice::StandardRequestHandler("/osg/set_user_value", true));
762   -
  762 +
763 763 addRequestHandler(new OscDevice::StandardRequestHandler("", false));
764 764 setSchedulePriority(OpenThreads::Thread::THREAD_PRIORITY_LOW);
765 765 start();
@@ -783,10 +783,10 @@ void OscReceivingDevice::run()
783 783 void OscReceivingDevice::ProcessMessage( const osc::ReceivedMessage& m, const IpEndpointName& remoteEndpoint )
784 784 {
785 785 std::string in_request_path(m.AddressPattern());
786   -
  786 +
787 787 if (in_request_path == "/osc/msg_id")
788 788 return;
789   -
  789 +
790 790 std::string request_path = in_request_path + "/";
791 791
792 792 std::size_t pos(std::string::npos);
@@ -796,17 +796,17 @@ void OscReceivingDevice::ProcessMessage( const osc::ReceivedMessage& m, const Ip
796 796 if (pos != std::string::npos)
797 797 {
798 798 std::string mangled_path = request_path.substr(0, pos);
799   -
  799 +
800 800 std::pair<RequestHandlerMap::iterator,RequestHandlerMap::iterator> range = _map.equal_range(mangled_path);
801   -
  801 +
802 802 for(RequestHandlerMap::iterator i = range.first; i != range.second; ++i)
803 803 {
804 804 // OSG_INFO << "OscDevice :: handling " << mangled_path << " with " << i->second << std::endl;
805   -
  805 +
806 806 if (i->second->operator()(mangled_path, in_request_path, m) && !handled)
807 807 handled = true;
808 808 }
809   -
  809 +
810 810 }
811 811 } while ((pos != std::string::npos) && (pos > 0) && !handled);
812 812
@@ -817,7 +817,7 @@ void OscReceivingDevice::ProcessBundle( const osc::ReceivedBundle& b,
817 817 {
818 818 // find msg-id
819 819 MsgIdType msg_id(0);
820   -
  820 +
821 821 for( osc::ReceivedBundle::const_iterator i = b.ElementsBegin(); i != b.ElementsEnd(); ++i ){
822 822 const osc::ReceivedMessage& m = osc::ReceivedMessage(*i);
823 823 std::string address_pattern(m.AddressPattern());
@@ -836,7 +836,7 @@ void OscReceivingDevice::ProcessBundle( const osc::ReceivedBundle& b,
836 836 _lastMsgId = 0;
837 837 }
838 838 _lastMsgTimeStamp = now;
839   -
  839 +
840 840 if (msg_id <= _lastMsgId) {
841 841 // already handled
842 842 // OSG_WARN << "OscReceiver :: message with lower id received: " << msg_id << std::endl;
@@ -849,8 +849,8 @@ void OscReceivingDevice::ProcessBundle( const osc::ReceivedBundle& b,
849 849 _lastMsgId = msg_id;
850 850 }
851 851 }
852   -
853   -
  852 +
  853 +
854 854 for( osc::ReceivedBundle::const_iterator i = b.ElementsBegin(); i != b.ElementsEnd(); ++i ){
855 855 if( i->IsBundle() )
856 856 ProcessBundle( osc::ReceivedBundle(*i), remoteEndpoint );
@@ -873,16 +873,16 @@ void OscReceivingDevice::ProcessPacket( const char *data, int size, const IpEndp
873 873 catch(...) {
874 874 OSG_WARN << "OscDevice :: could not process UDP-packet because of an exception!" << std::endl;
875 875 }
876   -
  876 +
877 877 if (_userDataEvent.valid())
878 878 {
879 879 char address[IpEndpointName::ADDRESS_AND_PORT_STRING_LENGTH];
880 880
881   -
  881 +
882 882 remoteEndpoint.AddressAndPortAsString(address);
883   -
  883 +
884 884 _userDataEvent->setUserValue("osc/remote_end_point", std::string(address));
885   -
  885 +
886 886 getEventQueue()->addEvent(_userDataEvent.get());
887 887 _userDataEvent = NULL;
888 888 }
@@ -901,7 +901,7 @@ void OscReceivingDevice::describeTo(std::ostream& out) const
901 901 {
902 902 out << "OscDevice :: listening on " << _listeningAddress << ":" << _listeningPort << std::endl;
903 903 out << std::endl;
904   -
  904 +
905 905 for(RequestHandlerMap::const_iterator i = _map.begin(); i != _map.end(); ++i)
906 906 {
907 907 const RequestHandler* handler(i->second.get());
64 src/osgPlugins/osc/ReaderWriterOscDevice.cpp
</
@@ -14,8 +14,8 @@
14 14
15 15 /*
16 16 * ReadMe
17   - *
18   - * the osc-plugin can return an osgGA::Device which handles various osc-messages
  17 + *
  18 + * the osc-plugin can return an osgGA::Device which handles various osc-messages
19 19 * and puts them into the event-queue of the app
20 20 * you can set arbitrary values via /osg/set_user_value, these values
21 21 * are set on the attached UserDataConntainer (see below)
@@ -26,21 +26,21 @@
26 26 * osgGA::Device* device = dynamic_cast<osgGA::Device*>(osgDB::readObjectFile(filename));
27 27 *
28 28 * and add that device to your viewer
29   - * The plugin supports the following option: documentRegisteredHandlers, which will
  29 + * The plugin supports the following option: documentRegisteredHandlers, which will
30 30 * dump all registered handlers to the console. The device registers some convenient
31 31 * handlers to remote control a p3d-presentation.
32   - *