Changeset 116
- Timestamp:
- Aug 19, 2010, 8:58:29 PM (14 years ago)
- Location:
- osgVisual
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/include/dataIO/visual_dataIO.h
r96 r116 155 155 double getSlotDataAsDouble(std::string variableName_, osgVisual::dataIO_slot::dataDirection direction_ ); 156 156 std::string getSlotDataAsString(std::string variableName_, osgVisual::dataIO_slot::dataDirection direction_ ); 157 voidsetSlotData(std::string variableName_, osgVisual::dataIO_slot::dataDirection direction_, std::string sValue_ );158 voidsetSlotData(std::string variableName_, osgVisual::dataIO_slot::dataDirection direction_, double value_ );157 osgVisual::dataIO_slot* setSlotData(std::string variableName_, osgVisual::dataIO_slot::dataDirection direction_, std::string sValue_ ); 158 osgVisual::dataIO_slot* setSlotData(std::string variableName_, osgVisual::dataIO_slot::dataDirection direction_, double value_ ); 159 159 160 160 int getSlotNum() {return dataSlots.size();} -
osgVisual/include/extLink/dataIO_extLinkVCL.h
r97 r116 16 16 */ 17 17 18 #include <dataIO_extLink.h> 18 #include <dataIO_extLink.h> // Base class 19 19 #include <osg/Notify> 20 20 #include <osgDB/FileUtils> 21 22 // VCL 21 23 #include <winsock2.h> 24 25 // XML Parser 26 #include <stdio.h> 27 #include <libxml/parser.h> 28 #include <libxml/tree.h> 29 22 30 23 31 // VCL … … 77 85 bool writebackFROM_OBJvalues(); 78 86 87 79 88 private: 89 bool parseVCLConfig(); 90 void checkXMLNode(xmlNode * a_node); 91 void addChannels(xmlNode * a_node, std::string channelName_, dataIO_slot::dataDirection direction_ ); 92 93 std::string VCLConfigFilename; 94 std::vector< CVCLVariable<double>* > extLinkChannels; 95 std::vector< osgVisual::dataIO_slot* > extLinkSlots; 96 bool configFileValid; 97 80 98 CVCLVariable<double> SAENGER1_POS_LAT; 81 99 CVCLVariable<double> SAENGER1_POS_LON; -
osgVisual/src/core/visual_core.cpp
r115 r116 48 48 49 49 // Test memory leak (todo) 50 //double* test = new double[1000];50 double* test = new double[1000]; 51 51 52 52 #ifdef USE_SPACENAVIGATOR -
osgVisual/src/dataIO/visual_dataIO.cpp
r88 r116 248 248 } 249 249 250 voidvisual_dataIO::setSlotData(std::string variableName_, osgVisual::dataIO_slot::dataDirection direction_, std::string sValue_ )250 osgVisual::dataIO_slot* visual_dataIO::setSlotData(std::string variableName_, osgVisual::dataIO_slot::dataDirection direction_, std::string sValue_ ) 251 251 { 252 252 bool slotFound = false; … … 260 260 dataSlots[i].sValue = sValue_; 261 261 slotFound = true; 262 return &(dataSlots[i]); 262 263 } 263 264 … … 275 276 dataSlots.push_back( newSlot ); 276 277 } 277 } 278 279 void visual_dataIO::setSlotData(std::string variableName_, osgVisual::dataIO_slot::dataDirection direction_, double value_ ) 278 279 return NULL; 280 } 281 282 osgVisual::dataIO_slot* visual_dataIO::setSlotData(std::string variableName_, osgVisual::dataIO_slot::dataDirection direction_, double value_ ) 280 283 { 281 284 // iterate through slotlist. If found, return pointer, else add slot to list … … 290 293 dataSlots[i].value = value_; 291 294 slotFound = true; 295 return &(dataSlots[i]); 292 296 } 293 297 } … … 304 308 dataSlots.push_back( newSlot ); 305 309 } 310 311 return NULL; 306 312 } 307 313 -
osgVisual/src/extLink/dataIO_extLinkVCL.cpp
r88 r116 35 35 OSG_NOTIFY( osg::ALWAYS ) << "extLinkVCL init()" << std::endl; 36 36 37 std::string VCLConfigFilename = "osgVisual.xml"; 37 VCLConfigFilename = "osgVisual.xml"; 38 38 39 if ( osgDB::fileExists( VCLConfigFilename ) ) 39 40 { 40 41 CVCLIO::GetInstance().LoadProject(VCLConfigFilename.c_str()); 42 43 parseVCLConfig(); 41 44 bool error = false; 42 45 … … 145 148 return true; 146 149 } 150 151 bool dataIO_extLinkVCL::parseVCLConfig() 152 { 153 configFileValid = false; 154 xmlDoc *doc = NULL; 155 xmlNode *root_element = NULL; 156 157 doc = xmlReadFile(VCLConfigFilename.c_str(), NULL, 0); 158 if (doc == NULL) 159 { 160 configFileValid = false; 161 std::cout << "error: could not parse file" << VCLConfigFilename; 162 } 163 else 164 { 165 // Get the root element node 166 root_element = xmlDocGetRootElement(doc); 167 168 checkXMLNode(root_element); 169 170 // free the document 171 xmlFreeDoc(doc);; 172 } 173 // Free the global variables that may have been allocated by the parser. 174 xmlCleanupParser(); 175 176 if(!configFileValid) 177 OSG_ALWAYS << "ERROR: XML file seems not to be a valid VCL configuration file!" << std::endl; 178 179 return true; 180 } 181 182 void dataIO_extLinkVCL::checkXMLNode(xmlNode * a_node) 183 { 184 for (xmlNode *cur_node = a_node; cur_node; cur_node = cur_node->next) 185 { 186 std::string node_name=reinterpret_cast<const char*>(cur_node->name); 187 if(cur_node->type == XML_ELEMENT_NODE && node_name == "CONFIGURATION") 188 { 189 std::cout << "XML node CONFIGURATION found" << std::endl; 190 configFileValid = true; 191 } 192 193 if (cur_node->type == XML_ELEMENT_NODE && node_name == "CHANNEL") 194 { 195 std::cout << "XML node CHANNEL found" << std::endl; 196 197 // Extract channel infos like name, direction and extract channels 198 std::string name; 199 dataIO_slot::dataDirection direction; 200 xmlAttr *attr = cur_node->properties; 201 while ( attr ) 202 { 203 std::string attr_name=reinterpret_cast<const char*>(attr->name); 204 if( attr_name == "name" ) 205 name = reinterpret_cast<const char*>(attr->children->content); 206 if( attr_name == "multicast_in_group" ) 207 direction = dataIO_slot::TO_OBJ; 208 if( attr_name == "multicast_out_group" ) 209 direction = dataIO_slot::FROM_OBJ; 210 //std::cout << "Attribute name: " << attr->name << " value: " << attr->children->content << std::endl; 211 attr = attr->next; 212 } 213 addChannels(cur_node->children, name, direction ); 214 215 //printf("node type: Element, name: %s\n", cur_node->name); 216 std::cout << "Processing children at " << cur_node->children << std::endl; 217 } // IF(CHANNEL) END 218 219 // Iterate to the next nodes to find channels. 220 checkXMLNode(cur_node->children); 221 } // FOR END 222 } 223 224 void dataIO_extLinkVCL::addChannels(xmlNode * a_node, std::string channelName_, dataIO_slot::dataDirection direction_ ) 225 { 226 if(!a_node) 227 return; 228 229 OSG_ALWAYS << "Processing channels for channel " << channelName_ << " with the direction " << direction_ << std::endl; 230 231 for (xmlNode *cur_node = a_node; cur_node; cur_node = cur_node->next) 232 { 233 OSG_ALWAYS << "Found entry!" << std::endl; 234 235 // Extract ENTRY - name 236 std::string entryName; 237 xmlAttr *attr = cur_node->properties; 238 while ( attr ) 239 { 240 std::string attr_name=reinterpret_cast<const char*>(attr->name); 241 if( attr_name == "name" ) 242 entryName = reinterpret_cast<const char*>(attr->children->content); 243 //std::cout << "Attribute name: " << attr->name << " value: " << attr->children->content << std::endl; 244 attr = attr->next; 245 } 246 247 // Store VCL variable 248 CVCLVariable<double>* tmp = new CVCLVariable<double>; 249 extLinkChannels.push_back(tmp); 250 251 // Attach VCL variable to channel: 252 if( !tmp->Attach(channelName_.c_str(), entryName.c_str() ) ) 253 OSG_ALWAYS << "ERROR - dataIO_extLinkVCL::addChannels(): unable to attach VCL variable entryName: " << entryName << " to channel: " << channelName_ << std::endl; 254 255 // Set SLOT data and store SLOT pointer 256 extLinkSlots.push_back( osgVisual::visual_dataIO::getInstance()->setSlotData( entryName, direction_, 0 ) ); 257 } // FOR each ENTRY END 258 } -
osgVisual/src/sky_Silverlining/visual_skySilverLining.cpp
r113 r116 227 227 this->addDrawable(skyDrawable); 228 228 this->addDrawable(cloudsDrawable); 229 230 //SilverLining::Atmosphere::EnableHDR( true ); 229 231 } 230 232
Note: See TracChangeset
for help on using the changeset viewer.