Changeset 2113 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp
- Timestamp:
- 02/12/07 08:37:26 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp
r2097 r2113 5 5 #include <stdlib.h> 6 6 #include <iostream> 7 //#include <ext/algorithm> 8 7 9 using namespace std; 8 10 #include <xercesc/util/PlatformUtils.hpp> … … 76 78 // StdInParseHandlers: Constructors and Destructor 77 79 // --------------------------------------------------------------------------- 78 ViewCellsParseHandlers::ViewCellsParseHandlers(ObjectContainer *objects, 79 BoundingBoxConverter *bconverter): 80 ViewCellsParseHandlers::ViewCellsParseHandlers(ObjectContainer &pvsObjects, 81 ObjectContainer &preprocessorObjects, 82 BoundingBoxConverter *bconverter 83 ): 80 84 mElementCount(0) 81 85 , mAttrCount(0) … … 92 96 , mCurrentOspNode(NULL) 93 97 , mCurrentBvhNode(NULL) 94 , mObjects(objects) 98 , mPvsObjects(pvsObjects) 99 , mPreprocessorObjects(preprocessorObjects) 95 100 , mBoundingBoxConverter(bconverter) 96 101 , mHierarchyManager(NULL) … … 98 103 , nObjects(0) 99 104 { 100 std::stable_sort(mObjects->begin(), mObjects->end(), ilt); 105 mCreatePvsObjects = mPvsObjects.empty(); 106 107 // sort objects so we can search in them 108 //if (!is_sorted(mPvsObjects.begin(), mPvsObjects.end(), ilt)) 109 sort(mPvsObjects.begin(), mPvsObjects.end(), ilt); 110 111 //if (!is_sorted(mPreprocessorObjects.begin(), mPreprocessorObjects.end(), ilt)) 112 sort(mPreprocessorObjects.begin(), mPreprocessorObjects.end(), ilt); 101 113 } 102 114 … … 165 177 // the objects with the leaves, they can be classified geometrically 166 178 mHierarchyManager->mOspTree-> 167 InsertObjects(mHierarchyManager->mOspTree->mRoot, *mObjects);179 InsertObjects(mHierarchyManager->mOspTree->mRoot, mPvsObjects); 168 180 } 169 181 } … … 278 290 // associate object ids with bounding boxes 279 291 const long startTime = GetTime(); 280 Debug<<"here32232"<<endl;292 281 293 if (mBoundingBoxConverter) 282 { Debug<<"here3772"<<endl;283 mBoundingBoxConverter->IdentifyObjects(mIBoundingBoxes, *mObjects);294 { 295 mBoundingBoxConverter->IdentifyObjects(mIBoundingBoxes, mPvsObjects); 284 296 } 285 297 … … 394 406 395 407 396 void ViewCellsParseHandlers:: ExchangePvs(ViewCell *vc)408 void ViewCellsParseHandlers::ReplaceBvhPvs(ViewCell *vc) 397 409 { 398 410 //cout << "exchanging pvs" << endl; … … 404 416 405 417 ObjectContainer oldIntersectables; 418 406 419 // output PVS of view cell 407 420 while (pit.HasMoreEntries()) … … 454 467 for (vit = mViewCells.begin(); vit != vit_end; ++ vit) 455 468 { 456 ExchangePvs(*vit);469 ReplaceBvhPvs(*vit); 457 470 } 458 471 } … … 486 499 { 487 500 cout << "\nparsing view cells" << endl; 501 Debug << "\nparsing view cells" << endl; 488 502 489 503 mCurrentState = PARSE_VIEWCELLS; … … 496 510 if (element == "ViewSpaceHierarchy") 497 511 { 512 Debug << "\nparsing view space hierarchy" << endl; 498 513 cout << "\nparsing view space hierarchy" << endl; 499 514 mCurrentState = PARSE_VIEWSPACE_HIERARCHY; … … 505 520 { 506 521 cout << "\nparsing object space hierarchy" << endl; 522 Debug << "\nparsing object space hierarchy" << endl; 523 507 524 mCurrentState = PARSE_OBJECTSPACE_HIERARCHY; 508 525 StartObjectSpaceHierarchy(attributes); … … 574 591 575 592 ObjectContainer::iterator oit = 576 lower_bound(m Objects->begin(),577 m Objects->end(),593 lower_bound(mPvsObjects.begin(), 594 mPvsObjects.end(), 578 595 (Intersectable *)&dummyInst, ilt); 579 596 580 if ((oit != m Objects->end()) && ((*oit)->GetId() == objId))597 if ((oit != mPvsObjects.end()) && ((*oit)->GetId() == objId)) 581 598 { 582 599 // $$JB we should store a float a per object which corresponds … … 669 686 //std::stable_sort(objects.begin(), objects.end(), ilt); 670 687 mHierarchyManager->mOspTree->mBoundingBox.Initialize(); 671 ObjectContainer::const_iterator oit, oit_end = m Objects->end();688 ObjectContainer::const_iterator oit, oit_end = mPvsObjects.end(); 672 689 673 690 //-- compute bounding box 674 for (oit = m Objects->begin(); oit != oit_end; ++ oit)691 for (oit = mPvsObjects.begin(); oit != oit_end; ++ oit) 675 692 { 676 693 Intersectable *obj = *oit; … … 1324 1341 1325 1342 ObjectContainer::iterator oit = 1326 lower_bound(m Objects->begin(),1327 m Objects->end(),1343 lower_bound(mPvsObjects.begin(), 1344 mPvsObjects.end(), 1328 1345 (Intersectable *)&dummyInst, 1329 1346 ilt); 1330 1347 1331 if ((oit != m Objects->end()) && ((*oit)->GetId() == objId))1348 if ((oit != mPvsObjects.end()) && ((*oit)->GetId() == objId)) 1332 1349 { 1333 1350 objects.push_back(*oit); 1351 Debug << "x"; 1334 1352 } 1335 1353 else 1336 1354 { 1337 cerr << "StartBvhLeafObjects error: object with id " << objId << " does not exist" << endl; 1355 Debug << "y"; 1356 //cerr << "StartBvhLeafObjects error: object with id " << objId << " does not exist" << endl; 1338 1357 } 1339 1358 } … … 1412 1431 1413 1432 1414 bool ViewCellsParser::ParseViewCellsFile(const string filename,1433 bool ViewCellsParser::ParseViewCellsFile(const string &filename, 1415 1434 ViewCellsManager **viewCells, 1416 ObjectContainer *objects, 1435 ObjectContainer &pvsObjects, 1436 ObjectContainer &preprocessorObjects, 1417 1437 BoundingBoxConverter *bconverter) 1418 1438 { … … 1448 1468 // to do. 1449 1469 // 1450 ViewCellsParseHandlers handler( objects, bconverter);1470 ViewCellsParseHandlers handler(pvsObjects, preprocessorObjects, bconverter); 1451 1471 parser->setDocumentHandler(&handler); 1452 1472 parser->setErrorHandler(&handler);
Note: See TracChangeset
for help on using the changeset viewer.