00001 #ifndef __GLIMSGIDDATA_H 00002 #define __GLIMSGIDDATA_H 00003 00004 #include "simplepointdata.h" 00005 #include "glacieriddef.h" 00006 #include "image.h" 00007 #include <vector> 00008 #include <stack> 00009 #include "ValidationReport.h" 00010 00040 class GLIMSGIDData : public SimplePointData { 00041 protected: 00042 std::vector<GlacierIDDef> mDefSet; 00043 00044 std::stack < std::vector <GlacierIDDef> > mUndoGIDDef ; 00045 std::stack < std::vector <GlacierIDDef> > mRedoGIDDef ; 00046 00052 virtual void pushRedo ( ); 00053 00059 virtual void clear( ); 00060 00066 virtual void clearRedo( ); 00067 00068 public: 00069 GLIMSGIDData( ) { 00070 } 00071 virtual ~GLIMSGIDData( ) { 00072 } 00073 00074 virtual bool fromXML( QDomElement &elem ); 00075 virtual bool toXML( QDomDocument &doc, 00076 QDomElement &elem, 00077 std::string id="" ); 00078 00079 virtual void addNode( Node &node, int inode ); 00080 virtual void delNode( int inode ); 00081 virtual void moveNode( Node &node, int inode = -1 ); 00082 virtual void insertNode( Node &node, int inode ); 00083 00087 virtual void push( ); 00088 00094 virtual void pushSelection( ) {;} 00095 00101 virtual void pop( ); 00102 00110 virtual void redo( ); 00111 00112 void addGID( const GlacierIDDef &gid ); 00113 00114 00119 void updateVersion (QDate * projectVersion) ; 00120 00121 std::vector<GlacierIDDef>& getDefSet( ) { 00122 return mDefSet ; 00123 } 00124 00125 00131 bool validate (ValidationReport * valRep) { 00132 bool dataValid = true ; 00133 mSelSet.clear () ; 00134 std::stringstream rptstream ; 00135 valRep->breakBegin( "Glacier data check..." ) ; 00136 00137 // empty dataset 00138 if ( !mDefSet.size() ) { 00139 valRep->reportWarning( "No glacier IDs have been created!" ) ; 00140 valRep->breakEnd( "CHECK COMPLETE: There are no glacier IDs to check." ) ; 00141 return dataValid ; 00142 } 00143 00144 // there are glacier IDs 00145 for ( unsigned int igid = 0 ; igid < mDefSet.size() ; igid++ ) { 00146 // get the glacier to check 00147 GlacierIDDef & tempGID = dynamic_cast<GlacierIDDef&>( mDefSet[igid] ); 00148 00149 // if glacier id validate returns false, set data valid to failed 00150 if ( !(tempGID.validate(valRep)) ) { 00151 dataValid = false ; 00152 SelectionSet::SelObj selobj ; 00153 selobj.obj = igid ; 00154 mSelSet.add( selobj ) ; 00155 } 00156 } 00157 00158 if (dataValid) { 00159 valRep->breakEnd( "CHECK COMPLETE: All glacier IDs are valid" ) ; 00160 } 00161 else { 00162 valRep->breakEnd( "ERROR: There are glacier IDs with invalid or missing information. These points are highlighted on the screen." ) ; 00163 } 00164 00165 00166 00167 // return status of lines 00168 return dataValid ; 00169 } 00170 00171 }; 00172 00173 #endif 00174 00175 00176
Home |
Search |
Disclaimers & Privacy |
Contact Us GLIMSView Maintainer: dsoltesz@usgs.gov |