![]() |
TerraLib 4.1
|
00001 /************************************************************************************ 00002 TerraLib - a library for developing GIS applications. 00003 Copyright © 2001-2007 INPE and Tecgraf/PUC-Rio. 00004 00005 This code is part of the TerraLib library. 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2.1 of the License, or (at your option) any later version. 00010 00011 You should have received a copy of the GNU Lesser General Public 00012 License along with this library. 00013 00014 The authors reassure the license terms regarding the warranties. 00015 They specifically disclaim any warranties, including, but not limited to, 00016 the implied warranties of merchantability and fitness for a particular purpose. 00017 The library provided hereunder is on an "as is" basis, and the authors have no 00018 obligation to provide maintenance, support, updates, enhancements, or modifications. 00019 In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct, 00020 indirect, special, incidental, or consequential damages arising out of the use 00021 of this library and its documentation. 00022 *************************************************************************************/ 00026 #ifndef __TERRALIB_INTERNAL_ATTRIBUTE_H 00027 #define __TERRALIB_INTERNAL_ATTRIBUTE_H 00028 00029 #include "TeDefines.h" 00030 #include "TeDataTypes.h" 00031 #include "TeTime.h" 00032 00038 enum TeMeasurementScale 00039 { ORDINAL, NOMINAL, RATIO, INTERVAL, CYCLIC, PROBABILITY, FUZZY }; 00040 00044 struct TL_DLL TeAttributeRep 00045 { 00046 string name_; 00047 TeAttrDataType type_; 00048 int numChar_; 00049 int decimals_; 00050 bool isPrimaryKey_; 00051 bool isAutoNumber_; 00052 bool null_; 00053 string defaultValue_; 00054 int epsgCode_; 00055 00057 TeAttributeRep(): 00058 name_(""), 00059 type_(TeSTRING), 00060 numChar_(0), 00061 decimals_(0), 00062 isPrimaryKey_(false), 00063 isAutoNumber_(false), 00064 null_(true), 00065 defaultValue_(""), 00066 epsgCode_(-1) 00067 {} 00068 00070 TeAttributeRep(const string& name): 00071 name_(name), 00072 type_(TeSTRING), 00073 numChar_(0), 00074 decimals_(0), 00075 isPrimaryKey_(false), 00076 isAutoNumber_(false), 00077 null_(true), 00078 defaultValue_(""), 00079 epsgCode_(-1) 00080 {} 00081 00083 TeAttributeRep& operator= ( const TeAttributeRep& at ) 00084 { 00085 if ( this != &at ) 00086 { 00087 name_ = at.name_; 00088 type_ = at.type_; 00089 numChar_ = at.numChar_; 00090 decimals_ = at.decimals_; 00091 isPrimaryKey_ = at.isPrimaryKey_; 00092 isAutoNumber_ = at.isAutoNumber_; 00093 null_ = at.null_; 00094 defaultValue_ = at.defaultValue_; 00095 epsgCode_ = at.epsgCode_; 00096 } 00097 return *this; 00098 } 00099 00101 bool operator== ( const TeAttributeRep& at ) 00102 { 00103 return (name_==at.name_ && type_ == at.type_ 00104 && numChar_ == at.numChar_ && decimals_ == at.decimals_ && 00105 isPrimaryKey_ == at.isPrimaryKey_ && 00106 isAutoNumber_ == at.isAutoNumber_ && 00107 null_ == at.null_ && defaultValue_ == at.defaultValue_ && epsgCode_ == at.epsgCode_); 00108 } 00109 00111 bool operator< (const TeAttributeRep& at) const 00112 {return (name_ < at.name_);} 00113 }; 00114 00118 struct TL_DLL TeAttribute 00119 { 00120 TeAttributeRep rep_; 00121 string semantic_; 00122 string unit_; 00123 TeMeasurementScale scale_; 00124 00125 // for RATIO data sets 00126 string minValue_; 00127 string maxValue_; 00128 00129 // for NOMINAL or ORDINAL data sets 00130 vector<string> validValueList_; 00131 00132 // for INTERVAL data sets (??) 00133 string origin_; 00134 string interval_; 00135 00136 string dateTimeFormat_; 00137 string indicatorAM_; 00138 string indicatorPM_; 00139 string dateSeparator_; 00140 string timeSeparator_; 00141 TeChronon dateChronon_; 00142 00144 TeAttribute(): 00145 rep_ (TeAttributeRep()), 00146 dateTimeFormat_ ("DsMsYYYYsHHsmmsSS"), 00147 indicatorAM_ ("AM"), 00148 indicatorPM_ ("PM"), 00149 dateSeparator_ ("/"), 00150 timeSeparator_ (":"), 00151 dateChronon_ (TeSECOND) 00152 {} 00153 00154 TeAttribute& operator= ( const TeAttribute& at ) 00155 { 00156 if ( this != &at ) 00157 { 00158 rep_ = at.rep_; 00159 semantic_ = at.semantic_; 00160 unit_ = at.unit_; 00161 scale_ = at.scale_; 00162 minValue_ = at.minValue_; 00163 maxValue_ = at.maxValue_; 00164 validValueList_ = at.validValueList_; 00165 origin_ = at.origin_; 00166 interval_ = at.interval_; 00167 dateTimeFormat_ = at.dateTimeFormat_; 00168 indicatorAM_ = at.indicatorAM_; 00169 indicatorPM_ = at.indicatorPM_; 00170 dateSeparator_ = at.dateSeparator_; 00171 timeSeparator_ = at.timeSeparator_; 00172 dateChronon_ = at.dateChronon_; 00173 } 00174 00175 return *this; 00176 } 00177 }; 00178 00182 struct TL_DLL TeProperty 00183 { 00184 TeAttribute attr_; 00185 string value_; 00186 }; 00187 00189 typedef vector<TeProperty> TePropertyVector; 00190 00192 typedef vector<TeAttributeRep> TeAttributeRepList; 00193 00195 typedef vector<TeAttribute> TeAttributeList; 00196 00198 typedef vector< pair<TeAttributeRep, TeStatisticType> > TeGroupingAttr; 00199 00200 #endif 00201 00202