Changeset 116 for osgVisual/src
- Timestamp:
- Aug 19, 2010, 8:58:29 PM (14 years ago)
- Location:
- osgVisual/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
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.