00001
00002
00003
00004
00005
00006
00007
00008 #ifndef Section_Header
00009 #define Section_Header
00010
00011 #include <G3DAll.h>
00012 #include <string>
00013 #include <XercesXMLUtil.H>
00014 #include "Spot.H"
00015
00016 using namespace std;
00017
00018 namespace cavewriting {
00019 class Word;
00020 class Effect;
00021
00022 class Section {
00023
00024 public:
00025 Section(xercesc::DOMNode* node, int id);
00026 virtual ~Section();
00027
00028 void start();
00029
00030 const string& getName() {return _name;}
00031 Array<Word*>& getWords() { return _words; }
00032
00035 int addWordAtEnd(Word* word);
00036
00038 int getEmptySpot(double widthNeeded);
00039 Vector3 getEmptySpotPosition(int spotIndex);
00040
00042 void fillSpot(int spotIndex, Word* word);
00043
00045 void emptySpot(int index);
00047 void emptySpot(Word* word);
00048
00049 bool isSpotEmpty(int spot);
00050
00052 void show();
00053
00055 void hide();
00056
00058 double getYRotationAngle();
00059 int findSpotIndex(Word* word);
00060
00061 protected:
00062 void addEffect(xercesc::DOMElement* node);
00063
00064 bool checkAllSpotInvariants();
00065
00066 void positionWords();
00067 void updateSpotPosition(int index, CoordinateFrame frame);
00068
00069
00070 private:
00071 bool _paused;
00072 bool _visible;
00073 int _id;
00074 Array<xercesc::DOMNode*> _fragments;
00075 Array<Word*> _words;
00076 Array<int> _lineBreaks;
00077 Array<Effect*> _effects;
00078 Array<Spot> _spots;
00079
00080 string _name;
00081 CoordinateFrame _cframe;
00082 double _rotationAngle;
00083 Vector3 _rotationAxis;
00084
00086 void debugPrint();
00087 void addFragment(xercesc::DOMElement* node);
00088 void addFragmentIgnoreWords(xercesc::DOMElement* node);
00089 void addLineBreak();
00090 void setNameFromNode(xercesc::DOMNode* nameNode);
00091 void setTranslationFromNode(xercesc::DOMNode* translationNode);
00092 void setRotationAxisFromNode(xercesc::DOMNode* rotationAxisNode);
00093 void setRotationAngleFromNode(xercesc::DOMNode* rotationAngleNode);
00094
00097 void addWord(Word * word);
00098
00099
00100 void removeWord(Word* word);
00101 };
00102 }
00103
00104 #endif