Changeset 118 for osgVisual/src/extLink
- Timestamp:
- Aug 23, 2010, 11:43:12 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.