Ignore:
Timestamp:
02/12/07 08:37:26 (17 years ago)
Author:
mattausch
Message:

warning: debug version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp

    r2097 r2113  
    55#include <stdlib.h> 
    66#include <iostream> 
     7//#include <ext/algorithm> 
     8 
    79using namespace std; 
    810#include <xercesc/util/PlatformUtils.hpp> 
     
    7678//  StdInParseHandlers: Constructors and Destructor 
    7779// --------------------------------------------------------------------------- 
    78 ViewCellsParseHandlers::ViewCellsParseHandlers(ObjectContainer *objects,  
    79                                                                                            BoundingBoxConverter *bconverter): 
     80ViewCellsParseHandlers::ViewCellsParseHandlers(ObjectContainer &pvsObjects,  
     81                                                                                           ObjectContainer &preprocessorObjects, 
     82                                                                                           BoundingBoxConverter *bconverter 
     83                                                                                           ): 
    8084  mElementCount(0) 
    8185  , mAttrCount(0) 
     
    9296  , mCurrentOspNode(NULL) 
    9397  , mCurrentBvhNode(NULL) 
    94   , mObjects(objects) 
     98  , mPvsObjects(pvsObjects) 
     99  , mPreprocessorObjects(preprocessorObjects) 
    95100  , mBoundingBoxConverter(bconverter) 
    96101  , mHierarchyManager(NULL) 
     
    98103  , nObjects(0) 
    99104{ 
    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); 
    101113} 
    102114 
     
    165177                // the objects with the leaves, they can be classified geometrically 
    166178                mHierarchyManager->mOspTree-> 
    167                         InsertObjects(mHierarchyManager->mOspTree->mRoot, *mObjects); 
     179                        InsertObjects(mHierarchyManager->mOspTree->mRoot, mPvsObjects); 
    168180        } 
    169181} 
     
    278290        // associate object ids with bounding boxes 
    279291        const long startTime = GetTime(); 
    280         Debug<<"here32232"<<endl; 
     292         
    281293        if (mBoundingBoxConverter) 
    282         {Debug<<"here3772"<<endl; 
    283                 mBoundingBoxConverter->IdentifyObjects(mIBoundingBoxes, *mObjects); 
     294        { 
     295                mBoundingBoxConverter->IdentifyObjects(mIBoundingBoxes, mPvsObjects); 
    284296        } 
    285297 
     
    394406 
    395407 
    396 void ViewCellsParseHandlers::ExchangePvs(ViewCell *vc) 
     408void ViewCellsParseHandlers::ReplaceBvhPvs(ViewCell *vc) 
    397409{ 
    398410        //cout << "exchanging pvs" << endl; 
     
    404416 
    405417        ObjectContainer oldIntersectables; 
     418 
    406419        // output PVS of view cell 
    407420        while (pit.HasMoreEntries()) 
     
    454467        for (vit = mViewCells.begin(); vit != vit_end; ++ vit) 
    455468        { 
    456                 ExchangePvs(*vit); 
     469                ReplaceBvhPvs(*vit); 
    457470        } 
    458471} 
     
    486499        { 
    487500                cout << "\nparsing view cells" << endl; 
     501                Debug << "\nparsing view cells" << endl; 
    488502                 
    489503                mCurrentState = PARSE_VIEWCELLS; 
     
    496510        if (element == "ViewSpaceHierarchy") 
    497511        {                
     512                Debug << "\nparsing view space hierarchy" << endl; 
    498513                cout << "\nparsing view space hierarchy" << endl; 
    499514                mCurrentState = PARSE_VIEWSPACE_HIERARCHY; 
     
    505520        { 
    506521                cout << "\nparsing object space hierarchy" << endl; 
     522                Debug << "\nparsing object space hierarchy" << endl; 
     523 
    507524                mCurrentState = PARSE_OBJECTSPACE_HIERARCHY; 
    508525                StartObjectSpaceHierarchy(attributes); 
     
    574591 
    575592                ObjectContainer::iterator oit =  
    576                                                                 lower_bound(mObjects->begin(),  
    577                                                                                         mObjects->end(),  
     593                                                                lower_bound(mPvsObjects.begin(),  
     594                                                                                        mPvsObjects.end(),  
    578595                                                                                        (Intersectable *)&dummyInst, ilt);       
    579596 
    580                 if ((oit != mObjects->end()) && ((*oit)->GetId() == objId)) 
     597                if ((oit != mPvsObjects.end()) && ((*oit)->GetId() == objId)) 
    581598                { 
    582599                        // $$JB we should store a float a per object which corresponds 
     
    669686                                //std::stable_sort(objects.begin(), objects.end(), ilt); 
    670687                                mHierarchyManager->mOspTree->mBoundingBox.Initialize(); 
    671                                 ObjectContainer::const_iterator oit, oit_end = mObjects->end(); 
     688                                ObjectContainer::const_iterator oit, oit_end = mPvsObjects.end(); 
    672689                                 
    673690                                //-- compute bounding box 
    674                                 for (oit = mObjects->begin(); oit != oit_end; ++ oit) 
     691                                for (oit = mPvsObjects.begin(); oit != oit_end; ++ oit) 
    675692                                { 
    676693                                        Intersectable *obj = *oit; 
     
    13241341 
    13251342                ObjectContainer::iterator oit = 
    1326                         lower_bound(mObjects->begin(),  
    1327                                                 mObjects->end(),  
     1343                        lower_bound(mPvsObjects.begin(),  
     1344                                                mPvsObjects.end(),  
    13281345                                                (Intersectable *)&dummyInst,  
    13291346                                                ilt);    
    13301347                                                         
    1331                 if ((oit != mObjects->end()) && ((*oit)->GetId() == objId)) 
     1348                if ((oit != mPvsObjects.end()) && ((*oit)->GetId() == objId)) 
    13321349                { 
    13331350                        objects.push_back(*oit); 
     1351                        Debug << "x"; 
    13341352                } 
    13351353                else 
    13361354                { 
    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; 
    13381357                } 
    13391358        } 
     
    14121431 
    14131432 
    1414 bool ViewCellsParser::ParseViewCellsFile(const string filename,  
     1433bool ViewCellsParser::ParseViewCellsFile(const string &filename,  
    14151434                                                                                 ViewCellsManager **viewCells, 
    1416                                                                                  ObjectContainer *objects, 
     1435                                                                                 ObjectContainer &pvsObjects, 
     1436                                                                                 ObjectContainer &preprocessorObjects, 
    14171437                                                                                 BoundingBoxConverter *bconverter) 
    14181438{ 
     
    14481468  //  to do. 
    14491469  // 
    1450   ViewCellsParseHandlers handler(objects, bconverter); 
     1470  ViewCellsParseHandlers handler(pvsObjects, preprocessorObjects, bconverter); 
    14511471  parser->setDocumentHandler(&handler); 
    14521472  parser->setErrorHandler(&handler); 
Note: See TracChangeset for help on using the changeset viewer.