00001 #ifndef __VECTORDATA_H 00002 #define __VECTORDATA_H 00003 00004 #include <qobject.h> 00005 #include <qprogressbar.h> 00006 #include <qdialog.h> 00007 #include <qlayout.h> 00008 00009 #include <vector> 00010 #include <stack> 00011 #include <iostream> 00012 #include "shape.h" 00013 #include "selectionset.h" 00014 #include "image.h" 00015 00021 class VectorData : public QObject, public XMLSerializeable { 00022 Q_OBJECT 00023 public: 00024 typedef enum { 00025 POINT, 00026 LINE, 00027 POLY 00028 } ShapeType; 00029 00030 protected: 00031 std::vector<Shape*> mLLSet; 00032 std::vector<Shape*> mXYSet; 00033 SelectionSet mSelSet; 00034 00035 std::stack<std::vector<Shape*> > mUndoLL; // storage for previous states 00036 // of the lat-lon shape data 00037 // for undo facility 00038 std::stack<std::vector<Shape*> > mUndoXY; // storage for previous states 00039 // of the X-Y shape data 00040 // for undo facility 00041 std::stack<SelectionSet> mUndoSel; // storage for previous states 00042 // of selected vector data 00043 // for undo facility 00044 00045 std::stack<std::vector<Shape*> > mRedoLL; // storage for previous states 00046 // of the lat-lon shape data 00047 // for undo facility 00048 std::stack<std::vector<Shape*> > mRedoXY; // storage for previous states 00049 // of the X-Y shape data 00050 // for undo facility 00051 std::stack<SelectionSet> mRedoSel; // storage for "undone" states 00052 // of selected vector data 00053 // for redo facility 00054 00055 ShapeType mType; // type of shape 00056 Image *mImg; 00057 00058 public: 00059 VectorData( ShapeType type, Image *img=NULL ); 00060 virtual ~VectorData( ) { 00061 } 00062 00063 virtual bool toXML( QDomDocument &doc, 00064 QDomElement &elem, 00065 std::string id ) =0; 00066 00067 virtual bool fromXML( QDomElement &elem ) =0; 00068 00069 virtual void addNode( Node &node, int inode =-1 ) =0; 00070 virtual void insertNode( Node &node, int inode ) =0; 00071 virtual void delNode( int inode ) =0; 00072 virtual void moveNode( Node &node, int inode = -1 ) =0; 00073 virtual void addLine( Node &node ) =0; 00074 virtual void delLine( int iline ) =0; 00075 virtual void breakLine( int iline, int inode ) =0; 00076 virtual void joinLine( int il1, int il2, int in1, int in2 ) =0; 00077 virtual void addLineNode( Node &node, int iline, int inode = -1 ) =0; 00078 virtual void insertLineNode( Node &node, int iline, int inode = -1 ) =0; 00079 virtual void delLineNode( int iline, int inode ) =0; 00080 virtual void moveLineNode( int iline, int inode, Node &node ) =0; 00081 virtual void push( ) =0; 00082 virtual void pop( ) =0; 00083 virtual void redo( ) =0; 00084 virtual void pushSelection( ) =0; 00085 00086 00087 void setImage( Image *img ) { 00088 mImg = img; 00089 } 00090 ShapeType getType( ) { 00091 return mType; 00092 } 00093 std::vector<Shape*>& getXYSet( ) { 00094 return mXYSet; 00095 } 00096 std::vector<Shape*>& getLLSet( ) { 00097 return mLLSet; 00098 } 00099 unsigned int size( ) { 00100 return mLLSet.size(); 00101 } 00102 SelectionSet& getSelSet() { 00103 return mSelSet; 00104 } 00105 00106 public slots: 00107 void transformDataset( ); 00108 00109 signals: 00110 void datasetChanged( ); 00111 00112 }; 00113 00114 #endif 00115 00116 00117
Home |
Search |
Disclaimers & Privacy |
Contact Us GLIMSView Maintainer: dsoltesz@usgs.gov |