Changeset 931 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp
- Timestamp:
- 05/08/06 18:57:11 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp
r881 r931 65 65 // StdInParseHandlers: Constructors and Destructor 66 66 // --------------------------------------------------------------------------- 67 ViewCellsParseHandlers::ViewCellsParseHandlers(ObjectContainer *objects ):67 ViewCellsParseHandlers::ViewCellsParseHandlers(ObjectContainer *objects, BoundingBoxConverter *bconverter): 68 68 mElementCount(0) 69 69 , mAttrCount(0) … … 77 77 , mCurrentViewCell(NULL) 78 78 , mCurrentBspNode(NULL) 79 { 80 mObjects = objects; 79 , mObjects(objects) 80 , mBoundingBoxConverter(bconverter) 81 { 82 // mObjects = objects; 81 83 } 82 84 … … 132 134 } 133 135 136 134 137 inline static bool vlt(ViewCell *v1, ViewCell *v2) 135 138 { … … 144 147 } 145 148 149 150 void ViewCellsParseHandlers::EndBoundingBoxes() 151 { 152 // bounding boxes gathered: associate object ids with bounding boxes 153 if (mBoundingBoxConverter) 154 mBoundingBoxConverter->IdentifyObjects(mIBoundingBoxes, *mObjects); 155 } 146 156 147 157 … … 208 218 if (element == "ViewSpaceBox") 209 219 { 220 Debug << "v"; 221 StartViewSpaceBox(attributes); 222 } 223 224 // decides the used view cell hierarchy 225 if (element == "BoundingBox") 226 { 210 227 Debug << "b"; 211 StartViewSpaceBox(attributes); 212 } 213 228 StartBoundingBox(attributes); 229 } 214 230 215 231 // use different methods for the given view cell hierarchy types … … 379 395 380 396 397 void ViewCellsParseHandlers::StartBoundingBox(AttributeList& attributes) 398 { 399 int len = attributes.getLength(); 400 401 Vector3 bmin, bmax; 402 int id; 403 404 for (int i = 0; i < len; ++ i) 405 { 406 string attrName(StrX(attributes.getName(i)).LocalForm()); 407 StrX attrValue(attributes.getValue(i)); 408 const char *ptr = attrValue.LocalForm(); 409 410 411 if (attrName == "id") 412 { 413 sscanf(ptr, "%d", &id); 414 } 415 416 if (attrName == "min") 417 { 418 sscanf(ptr, "%f %f %f", 419 &bmin.x, &bmin.y, &bmin.z); 420 } 421 else if (attrName == "max") 422 { 423 sscanf(ptr, "%f %f %f", 424 &bmax.x, &bmax.y, &bmax.z); 425 } 426 } 427 428 AxisAlignedBox3 box(bmin, bmax); 429 mIBoundingBoxes.push_back(IndexedBoundingBox(id, box)); 430 431 Debug << "view space box: " << mViewSpaceBox << endl; 432 } 433 434 381 435 void ViewCellsParseHandlers::StartBspLeaf(AttributeList& attributes) 382 436 { … … 637 691 bool ViewCellsParser::ParseFile(const string filename, 638 692 ViewCellsManager **viewCells, 639 ObjectContainer *objects) 693 ObjectContainer *objects, 694 BoundingBoxConverter *bconverter) 640 695 { 641 696 // Initialize the XML4C system … … 669 724 // to do. 670 725 // 671 ViewCellsParseHandlers handler(objects );726 ViewCellsParseHandlers handler(objects, bconverter); 672 727 parser->setDocumentHandler(&handler); 673 728 parser->setErrorHandler(&handler); … … 724 779 XMLPlatformUtils::Terminate(); 725 780 726 //assign new view cells manager781 //-- assign new view cells manager 727 782 *viewCells = handler.mViewCellsManager; 728 783
Note: See TracChangeset
for help on using the changeset viewer.