Changeset 118
- Timestamp:
- Aug 23, 2010, 11:43:12 PM (14 years ago)
- Location:
- osgVisual
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/include/dataIO/visual_dataIO.h
r116 r118 127 127 * List of SLOT variables dataIO provides. 128 128 */ 129 std::vector<dataIO_slot > dataSlots;129 std::vector<dataIO_slot*> dataSlots; 130 130 131 131 friend class dataIO_eventCallback; -
osgVisual/include/extLink/dataIO_extLink.h
r88 r118 41 41 * 42 42 */ 43 dataIO_extLink(std::vector<osgVisual::dataIO_slot >& dataSlots_) : dataSlots(dataSlots_){}43 dataIO_extLink(std::vector<osgVisual::dataIO_slot *>& dataSlots_) : dataSlots(dataSlots_){} 44 44 45 45 /** … … 87 87 * This central dataSlot array is filled with available slots by this extLink class. 88 88 */ 89 std::vector<dataIO_slot >& dataSlots;89 std::vector<dataIO_slot *>& dataSlots; 90 90 91 91 }; -
osgVisual/include/extLink/dataIO_extLinkVCL.h
r116 r118 76 76 #include <leakDetection.h> 77 77 public: 78 dataIO_extLinkVCL(std::vector<dataIO_slot >& dataSlots_);78 dataIO_extLinkVCL(std::vector<dataIO_slot *>& dataSlots_); 79 79 virtual ~dataIO_extLinkVCL(void); 80 80 … … 116 116 CVCLVariable<double> SAENGER_ROT_Y; 117 117 CVCLVariable<double> SAENGER_ROT_Z; 118 119 118 }; 120 119 -
osgVisual/src/dataIO/visual_dataIO.cpp
r116 r118 191 191 { 192 192 // Check if this variable name&-type already exists 193 if( dataSlots[i] .variableName == variableName_ && dataSlots[i].direction == direction_ && dataSlots[i].variableType == variableTyp_)193 if( dataSlots[i]->variableName == variableName_ && dataSlots[i]->direction == direction_ && dataSlots[i]->variableType == variableTyp_) 194 194 { 195 195 //OSG_NOTIFY( osg::INFO ) << "visual_dataIO::getSlotPointer() - Slot found at position " << i << std::endl; 196 196 // Return pointer to the value 197 if (variableTyp_ == osgVisual::dataIO_slot::STRING ) 198 return &(dataSlots[i].sValue); 199 else 200 return &(dataSlots[i].value); 197 return dataSlots[i]; 201 198 } 202 199 } … … 204 201 // Slot does not exist -> add it to slot list 205 202 //OSG_NOTIFY( osg::INFO ) << "visual_dataIO::getSlotPointer() - Slot not found, will add as new slot " << std::endl; 206 dataIO_slot newSlot;207 newSlot .variableName = variableName_;208 newSlot .variableType = variableTyp_;209 newSlot .value = 0;210 newSlot .sValue = "";203 dataIO_slot* newSlot = new dataIO_slot(); 204 newSlot->variableName = variableName_; 205 newSlot->variableType = variableTyp_; 206 newSlot->value = 0; 207 newSlot->sValue = ""; 211 208 dataSlots.push_back( newSlot ); 212 if (variableTyp_ == osgVisual::dataIO_slot::STRING ) 213 return &(dataSlots.back().sValue); 214 else 215 { 216 return &(dataSlots.back().value); 217 } 209 return dataSlots.back(); 218 210 } 219 211 … … 224 216 { 225 217 // Check if this variable name&-type already exists 226 if( dataSlots[i] .variableName == variableName_ && dataSlots[i].direction == direction_ && dataSlots[i].variableType == osgVisual::dataIO_slot::DOUBLE )218 if( dataSlots[i]->variableName == variableName_ && dataSlots[i]->direction == direction_ && dataSlots[i]->variableType == osgVisual::dataIO_slot::DOUBLE ) 227 219 { 228 220 //OSG_NOTIFY( osg::INFO ) << "visual_dataIO::getSlotDataAsDouble() - Slot found at position " << i << std::endl; 229 return dataSlots[i] .value;221 return dataSlots[i]->value; 230 222 } 231 223 } … … 239 231 { 240 232 // Check if this variable name&-type already exists 241 if( dataSlots[i] .variableName == variableName_ && dataSlots[i].direction == direction_ && dataSlots[i].variableType == osgVisual::dataIO_slot::STRING )233 if( dataSlots[i]->variableName == variableName_ && dataSlots[i]->direction == direction_ && dataSlots[i]->variableType == osgVisual::dataIO_slot::STRING ) 242 234 { 243 235 //OSG_NOTIFY( osg::INFO ) << "visual_dataIO::getSlotDataAsDouble() - Slot found at position " << i << std::endl; 244 return dataSlots[i] .sValue;236 return dataSlots[i]->sValue; 245 237 } 246 238 } … … 255 247 { 256 248 // Check if this variable name&-type already exists 257 if( dataSlots[i] .variableName == variableName_ && dataSlots[i].direction == direction_ && dataSlots[i].variableType == osgVisual::dataIO_slot::STRING)249 if( dataSlots[i]->variableName == variableName_ && dataSlots[i]->direction == direction_ && dataSlots[i]->variableType == osgVisual::dataIO_slot::STRING) 258 250 { 259 251 // Update value 260 dataSlots[i] .sValue = sValue_;252 dataSlots[i]->sValue = sValue_; 261 253 slotFound = true; 262 return &(dataSlots[i]);254 return dataSlots[i]; 263 255 } 264 256 … … 268 260 { 269 261 // Slot does not exist -> add it to slot list 270 dataIO_slot newSlot;271 newSlot .variableName = variableName_;272 newSlot .direction = direction_;273 newSlot .variableType = osgVisual::dataIO_slot::STRING;274 newSlot .value = 0;275 newSlot .sValue = sValue_;262 dataIO_slot* newSlot = new dataIO_slot(); 263 newSlot->variableName = variableName_; 264 newSlot->direction = direction_; 265 newSlot->variableType = osgVisual::dataIO_slot::STRING; 266 newSlot->value = 0; 267 newSlot->sValue = sValue_; 276 268 dataSlots.push_back( newSlot ); 269 return dataSlots.back(); 277 270 } 278 271 … … 287 280 { 288 281 // Check if this variableName & -type already exists 289 if( dataSlots[i] .variableName == variableName_ && dataSlots[i].direction == direction_ && dataSlots[i].variableType == osgVisual::dataIO_slot::DOUBLE)282 if( dataSlots[i]->variableName == variableName_ && dataSlots[i]->direction == direction_ && dataSlots[i]->variableType == osgVisual::dataIO_slot::DOUBLE) 290 283 { 291 284 // Update value 292 285 //OSG_NOTIFY( osg::ALWAYS ) << "setSlotData: " << variableName_ << " - value: " << value_ << std::endl; 293 dataSlots[i] .value = value_;286 dataSlots[i]->value = value_; 294 287 slotFound = true; 295 return &(dataSlots[i]);288 return dataSlots[i]; 296 289 } 297 290 } … … 300 293 { 301 294 // Slot does not exist -> add it to slot list 302 dataIO_slot newSlot;303 newSlot .variableName = variableName_;304 newSlot .direction = direction_;305 newSlot .variableType = osgVisual::dataIO_slot::DOUBLE;306 newSlot .value = value_;307 newSlot .sValue = "";295 dataIO_slot* newSlot = new dataIO_slot(); 296 newSlot->variableName = variableName_; 297 newSlot->direction = direction_; 298 newSlot->variableType = osgVisual::dataIO_slot::DOUBLE; 299 newSlot->value = value_; 300 newSlot->sValue = ""; 308 301 dataSlots.push_back( newSlot ); 302 return dataSlots.back(); 309 303 } 310 304 -
osgVisual/src/extLink/dataIO_extLinkVCL.cpp
r117 r118 21 21 using namespace osgVisual; 22 22 23 dataIO_extLinkVCL::dataIO_extLinkVCL(std::vector<dataIO_slot >& dataSlots_) : dataIO_extLink(dataSlots_)23 dataIO_extLinkVCL::dataIO_extLinkVCL(std::vector<dataIO_slot *>& dataSlots_) : dataIO_extLink(dataSlots_) 24 24 { 25 25 OSG_NOTIFY( osg::ALWAYS ) << "extLinkVCL constructed" << std::endl; … … 42 42 43 43 parseVCLConfig(); 44 bool error = false; 45 46 if( !SAENGER1_POS_LAT.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER1_POS_LAT") ) 47 error = true; 48 if( !SAENGER1_POS_LON.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER1_POS_LON") ) 49 error = true; 50 if( !SAENGER1_POS_ALT.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER1_POS_ALT") ) 51 error = true; 52 if( !SAENGER1_ROT_X.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER1_ROT_X") ) 53 error = true; 54 if( !SAENGER1_ROT_Y.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER1_ROT_Y") ) 55 error = true; 56 if( !SAENGER1_ROT_Z.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER1_ROT_Z") ) 57 error = true; 58 59 if( !SAENGER2_POS_LAT.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER2_POS_LAT") ) 60 error = true; 61 if( !SAENGER2_POS_LON.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER2_POS_LON") ) 62 error = true; 63 if( !SAENGER2_POS_ALT.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER2_POS_ALT") ) 64 error = true; 65 if( !SAENGER2_ROT_X.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER2_ROT_X") ) 66 error = true; 67 if( !SAENGER2_ROT_Y.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER2_ROT_Y") ) 68 error = true; 69 if( !SAENGER2_ROT_Z.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER2_ROT_Z") ) 70 error = true; 71 72 if( !SAENGER_POS_LAT.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER_POS_LAT") ) 73 error = true; 74 if( !SAENGER_POS_LON.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER_POS_LON") ) 75 error = true; 76 if( !SAENGER_POS_ALT.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER_POS_ALT") ) 77 error = true; 78 if( !SAENGER_ROT_X.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER_ROT_X") ) 79 error = true; 80 if( !SAENGER_ROT_Y.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER_ROT_Y") ) 81 error = true; 82 if( !SAENGER_ROT_Z.Attach("VISENGINE_CAMERA_CHANNEL", "SAENGER_ROT_Z") ) 83 error = true; 84 85 if (error) 86 OSG_NOTIFY( osg::FATAL ) << "ERROR: An error occured while attaching VCL." << std::endl; 44 87 45 initialized = true; 88 46 } … … 100 58 } 101 59 102 103 60 bool dataIO_extLinkVCL::readTO_OBJvalues() 104 61 { … … 108 65 CVCLIO::GetInstance().DoDataExchange(); 109 66 110 // Copy data from VCL variables to slot variables: 111 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER1_POS_LAT", osgVisual::dataIO_slot::TO_OBJ, SAENGER1_POS_LAT.GetValue() ); 112 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER1_POS_LON", osgVisual::dataIO_slot::TO_OBJ, SAENGER1_POS_LON.GetValue() ); 113 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER1_POS_ALT", osgVisual::dataIO_slot::TO_OBJ, -SAENGER1_POS_ALT.GetValue() ); // Negatives Vorzeichen da Z-Koordinaten anders herum. 114 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER1_ROT_X", osgVisual::dataIO_slot::TO_OBJ, SAENGER1_ROT_X.GetValue() ); 115 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER1_ROT_Y", osgVisual::dataIO_slot::TO_OBJ, SAENGER1_ROT_Y.GetValue() ); 116 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER1_ROT_Z", osgVisual::dataIO_slot::TO_OBJ, SAENGER1_ROT_Z.GetValue() ); 117 118 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER2_POS_LAT", osgVisual::dataIO_slot::TO_OBJ, SAENGER2_POS_LAT.GetValue() ); 119 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER2_POS_LON", osgVisual::dataIO_slot::TO_OBJ, SAENGER2_POS_LON.GetValue() ); 120 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER2_POS_ALT", osgVisual::dataIO_slot::TO_OBJ, -SAENGER2_POS_ALT.GetValue() ); // Negatives Vorzeichen da Z-Koordinaten anders herum. 121 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER2_ROT_X", osgVisual::dataIO_slot::TO_OBJ, SAENGER2_ROT_X.GetValue() ); 122 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER2_ROT_Y", osgVisual::dataIO_slot::TO_OBJ, SAENGER2_ROT_Y.GetValue() ); 123 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER2_ROT_Z", osgVisual::dataIO_slot::TO_OBJ, SAENGER2_ROT_Z.GetValue() ); 124 125 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER_POS_LAT", osgVisual::dataIO_slot::TO_OBJ, SAENGER_POS_LAT.GetValue() ); 126 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER_POS_LON", osgVisual::dataIO_slot::TO_OBJ, SAENGER_POS_LON.GetValue() ); 127 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER_POS_ALT", osgVisual::dataIO_slot::TO_OBJ, -SAENGER_POS_ALT.GetValue() ); // Negatives Vorzeichen da Z-Koordinaten anders herum. 128 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER_ROT_X", osgVisual::dataIO_slot::TO_OBJ, SAENGER_ROT_X.GetValue() ); 129 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER_ROT_Y", osgVisual::dataIO_slot::TO_OBJ, SAENGER_ROT_Y.GetValue() ); 130 osgVisual::visual_dataIO::getInstance()->setSlotData( "SAENGER_ROT_Z", osgVisual::dataIO_slot::TO_OBJ, SAENGER_ROT_Z.GetValue() ); 67 // read TO_OBJ values from VCL 68 for(unsigned int i=0;i<extLinkChannels.size();i++) 69 { 70 if(extLinkSlots[i]->getdataDirection() == osgVisual::dataIO_slot::TO_OBJ) 71 { 72 //Copy data from VCL to slot. IMPORTANT: Due to VCL's string incapability only double slots are filled. 73 osgVisual::visual_dataIO::getInstance()->setSlotData( extLinkSlots[i]->getVariableName(), osgVisual::dataIO_slot::TO_OBJ, extLinkChannels[i]->GetValue() ); 74 } // IF (TO_OBJ) END 75 } 131 76 132 77 //OSG_NOTIFY( osg::ALWAYS ) << "LAT: " << osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble("SAENGER1_POS_LAT", osgVisual::dataIO_slot::TO_OBJ ) << std::endl; … … 142 87 // Example: MY_CHANNEL.setValue( myValue ); 143 88 144 /* In VCL no writeback transaction is done, 89 // write FROM_OBJ values into VCL 90 for(unsigned int i=0;i<extLinkChannels.size();i++) 91 { 92 if(extLinkSlots[i]->getdataDirection() == osgVisual::dataIO_slot::FROM_OBJ && extLinkSlots[i]->getvarType() == osgVisual::dataIO_slot::DOUBLE) 93 { 94 //Copy data from slot to VCL. IMPORTANT: Due to VCL's string incapability only double slots are filled. 95 extLinkChannels[i]->SetValue( osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble( extLinkSlots[i]->getVariableName(), osgVisual::dataIO_slot::FROM_OBJ ) ); 96 } // IF (FROM_OBJ) END 97 } 98 99 /* In VCL no VCL dataexchange is performed, 145 100 it is postponed until the next frame beginning, 146 101 where TO_OBJ exchange calls CVCLIO::GetInstance().DoDataExchange();. … … 256 211 257 212 // Set SLOT data and store SLOT pointer 258 extLinkSlots.push_back( osgVisual::visual_dataIO::getInstance()->setSlotData( entryName, direction_, 0 ) ); 213 osgVisual::dataIO_slot* tmpSlot = osgVisual::visual_dataIO::getInstance()->setSlotData( entryName, direction_, 0 ); 214 extLinkSlots.push_back( tmpSlot ); 259 215 } // FOR each ENTRY END 260 216 }
Note: See TracChangeset
for help on using the changeset viewer.