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

changed pvs loading: loading objects in a first pass

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/ObjectsParserXerces.h

    r2114 r2115  
    1 #ifndef _X3D_PARSER_XERCES__H 
    2 #define _X3D_PARSER_XERCES__H 
     1#ifndef _OBJECTS_PARSER_XERCES__H 
     2#define _OBJECTS_PARSER_XERCES__H 
    33 
    44// --------------------------------------------------------------------------- 
     
    1717XERCES_CPP_NAMESPACE_END 
    1818 
    19 class VspBspTree; 
    20 class BspTree; 
    21 class ViewCellsManager; 
    22 class ViewCellsTree; 
    23 class VspTree; 
    24 class OspTree; 
    25 class VspNode; 
     19 
    2620class BvhNode; 
    2721class BvHierarchy; 
    28 class HierarchyManager; 
    2922 
    3023 
     
    3225{ 
    3326public: 
    34   // ----------------------------------------------------------------------- 
    35   //  Constructors and Destructor 
    36   // ----------------------------------------------------------------------- 
    37   ObjectsParseHandlers(ObjectContainer &pvsObjects,  
    38                                                  ObjectContainer &preprocessorObjects,  
    39                                                  BoundingBoxConverter *bconverter); 
    40   ~ObjectsParseHandlers(); 
    41    
    42    
    43   // ----------------------------------------------------------------------- 
    44   //  Getter methods 
    45   // ----------------------------------------------------------------------- 
    46   unsigned int GetElementCount() 
    47   { 
    48     return mElementCount; 
    49   } 
    50    
    51   unsigned int GetAttrCount() 
    52   { 
    53     return mAttrCount; 
    54   } 
    55    
    56   unsigned int GetCharacterCount() 
    57   { 
    58     return mCharacterCount; 
    59   } 
    60    
    61   unsigned int GetSpaceCount() 
    62   { 
    63     return mSpaceCount; 
    64   } 
     27 
     28        // ----------------------------------------------------------------------- 
     29        //  Constructors and Destructor 
     30        // ----------------------------------------------------------------------- 
     31 
     32        ObjectsParseHandlers(ObjectContainer &pvsObjects,  
     33                                                 const ObjectContainer &preprocessorObjects); 
     34 
     35        ~ObjectsParseHandlers(); 
    6536 
    6637 
    67   // ----------------------------------------------------------------------- 
    68   //  Handlers for the SAX DocumentHandler interface 
    69   // ----------------------------------------------------------------------- 
    70   void endElement(const XMLCh* const name); 
    71   void startElement(const XMLCh* const name, AttributeList& attributes); 
    72   void characters(const XMLCh* const chars, const unsigned int length); 
    73   void ignorableWhitespace(const XMLCh* const chars, const unsigned int length); 
    74   void resetDocument(); 
     38        // ----------------------------------------------------------------------- 
     39        //  Getter methods 
     40        // ----------------------------------------------------------------------- 
    7541 
    76   ///////////////////////// 
     42        unsigned int GetElementCount() 
     43        { 
     44                return mElementCount; 
     45        } 
    7746 
    78   int mUniqueObjectId; 
    79   vector<BvhLeaf *> mBvhLeaves; 
    80   ObjectContainer &mPreprocessorObjects; 
     47        unsigned int GetAttrCount() 
     48        { 
     49                return mAttrCount; 
     50        } 
    8151 
    82   /// current state of the parser 
    83   int mCurrentState; 
    84    
    85   enum {, BVH}; 
     52        unsigned int GetCharacterCount() 
     53        { 
     54                return mCharacterCount; 
     55        } 
    8656 
    87   int mViewSpaceHierarchyType; 
    88   int mObjectSpaceHierarchyType; 
    89   int nViewCells; 
    90   int nObjects; 
    91    
    92    
    93   //////////////////////////////// 
     57        unsigned int GetSpaceCount() 
     58        { 
     59                return mSpaceCount; 
     60        } 
    9461 
    9562 
    96   // Handlers for X3D 
    97    
    98   void StartObjectSpaceHierarchy(AttributeList& attributes); 
     63        // ----------------------------------------------------------------------- 
     64        //  Handlers for the SAX DocumentHandler interface 
     65        // ----------------------------------------------------------------------- 
    9966 
    100   void StartObjectSpaceHierarchyElement(const std::string &element, AttributeList& attributes); 
     67        void endElement(const XMLCh* const name); 
     68        void startElement(const XMLCh* const name, AttributeList& attributes); 
     69        void characters(const XMLCh* const chars, const unsigned int length); 
     70        void ignorableWhitespace(const XMLCh* const chars, const unsigned int length); 
     71        void resetDocument(); 
    10172 
    102   void StartBvhLeaf(AttributeList& attributes); 
    103   void StartBvhInterior(AttributeList& attributes); 
    104   void StartBvhElement(string element, AttributeList& attributes); 
     73        void StartObjectSpaceHierarchyElement(const std::string &element,  
     74                                                                                  AttributeList& attributes); 
    10575 
    106   void EndObjectSpaceHierarchyInterior(); 
     76        ///////////////////////// 
    10777 
    108   void EndBvhInterior(); 
    109   void EndOspInterior(); 
     78        int mUniqueObjectId; 
    11079 
    111   void EndObjectSpaceHierarchy(); 
     80        vector<BvhLeaf *> mBvhLeaves; 
    11281 
    113   void StartBvhLeafObjects(ObjectContainer &objects, const char *ptr); 
     82        const ObjectContainer &mPreprocessorObjects; 
     83        ObjectContainer &mPvsObjects; 
    11484 
    115   // ----------------------------------------------------------------------- 
    116   //  Handlers for the SAX ErrorHandler interface 
    117   // ----------------------------------------------------------------------- 
     85        /// current state of the parser 
     86        bool mIsObjectSpaceHierarchy; 
    11887 
    119   void warning(const SAXParseException& exc); 
    120   void error(const SAXParseException& exc); 
    121   void fatalError(const SAXParseException& exc); 
    122    
    123    
     88        enum {BVH}; 
     89 
     90        //////////// 
     91        //-- Handlers for X3D 
     92 
     93        void StartBvhLeaf(AttributeList& attributes); 
     94        void StartBvhElement(string element, AttributeList& attributes); 
     95 
     96        void EndObjectSpaceHierarchy(); 
     97 
     98        void StartBvhLeafObjects(ObjectContainer &objects, const char *ptr); 
     99 
     100        // ----------------------------------------------------------------------- 
     101        //  Handlers for the SAX ErrorHandler interface 
     102        // ----------------------------------------------------------------------- 
     103 
     104        void warning(const SAXParseException& exc); 
     105        void error(const SAXParseException& exc); 
     106        void fatalError(const SAXParseException& exc); 
     107 
     108 
    124109private: 
    125   // ----------------------------------------------------------------------- 
    126   //  Private data members 
    127   // 
    128   //  fAttrCount 
    129   //  fCharacterCount 
    130   //  fElementCount 
    131   //  fSpaceCount 
    132   //      These are just counters that are run upwards based on the input 
    133   //      from the document handlers. 
    134   // ----------------------------------------------------------------------- 
    135   unsigned int    mAttrCount; 
    136   unsigned int    mCharacterCount; 
    137   unsigned int    mElementCount; 
    138   unsigned int    mSpaceCount; 
     110        // ----------------------------------------------------------------------- 
     111        //  Private data members 
     112        // 
     113        //  fAttrCount 
     114        //  fCharacterCount 
     115        //  fElementCount 
     116        //  fSpaceCount 
     117        //      These are just counters that are run upwards based on the input 
     118        //      from the document handlers. 
     119        // ----------------------------------------------------------------------- 
     120        unsigned int    mAttrCount; 
     121        unsigned int    mCharacterCount; 
     122        unsigned int    mElementCount; 
     123        unsigned int    mSpaceCount; 
    139124}; 
    140125 
     
    146131{ 
    147132public : 
    148   // ----------------------------------------------------------------------- 
    149   //  Constructors and Destructor 
    150   // ----------------------------------------------------------------------- 
    151   StrX(const XMLCh* const toTranscode) 
    152   { 
    153           // Call the private transcoding method 
    154           mLocalForm = XMLString::transcode(toTranscode); 
    155   } 
    156    
    157   ~StrX() 
    158   { 
    159           XMLString::release(&mLocalForm); 
    160   } 
    161    
    162   // ----------------------------------------------------------------------- 
    163   //  Getter methods 
    164   // ----------------------------------------------------------------------- 
    165   const char* LocalForm() const 
    166   { 
    167     return mLocalForm; 
    168   } 
    169    
     133        // ----------------------------------------------------------------------- 
     134        //  Constructors and Destructor 
     135        // ----------------------------------------------------------------------- 
     136        StrX(const XMLCh* const toTranscode) 
     137        { 
     138                // Call the private transcoding method 
     139                mLocalForm = XMLString::transcode(toTranscode); 
     140        } 
     141 
     142        ~StrX() 
     143        { 
     144                XMLString::release(&mLocalForm); 
     145        } 
     146 
     147        // ----------------------------------------------------------------------- 
     148        //  Getter methods 
     149        // ----------------------------------------------------------------------- 
     150        const char* LocalForm() const 
     151        { 
     152                return mLocalForm; 
     153        } 
     154 
    170155private : 
    171   // ----------------------------------------------------------------------- 
    172   //  Private data members 
    173   // 
    174   //  fLocalForm 
    175   //      This is the local code page form of the string. 
    176   // ----------------------------------------------------------------------- 
    177   char*   mLocalForm; 
     156        // ----------------------------------------------------------------------- 
     157        //  Private data members 
     158        // 
     159        //  fLocalForm 
     160        //      This is the local code page form of the string. 
     161        // ----------------------------------------------------------------------- 
     162        char*   mLocalForm; 
    178163}; 
    179164 
     
    181166operator<<(XERCES_STD_QUALIFIER ostream& target, const StrX& toDump) 
    182167{ 
    183   target << toDump.LocalForm(); 
    184   return target; 
     168        target << toDump.LocalForm(); 
     169        return target; 
    185170} 
    186171} 
Note: See TracChangeset for help on using the changeset viewer.