00001
00094 #ifndef INC_MI32_LATLONFM_H
00095 #define INC_MI32_LATLONFM_H
00096
00097 #ifndef INC_MI32_MISTRING_H
00098 #include <mi32/mistring.h>
00099 #endif
00100
00101 #ifndef INC_MI32_SIMPLEAR_H
00102 #include <mi32/simplear.h>
00103 #endif
00104
00105 #ifdef GEOMDLL
00106 #define LIBEXPORT MI_DLLEXPORT
00107 #else
00108 #define LIBEXPORT MI_DLLIMPORT
00109 #endif
00110
00111
00112
00113
00114
00115 enum DMSTYPE {
00116 DMSTYPE_MASK_Components = 0x000F,
00117 DMSTYPE_Deg = 0x0001,
00118 DMSTYPE_DegMinSec = 0x0002,
00119 DMSTYPE_DegMin = 0x0003,
00120 DMSTYPE_Sec = 0x0004,
00121 DMSTYPE_MinSec = 0x0005,
00122 DMSTYPE_Min = 0x0006,
00123
00124 DMSTYPE_MASK_Hemisphere = 0x0030,
00125 DMSTYPE_DF = 0x0010,
00126 DMSTYPE_DB = 0x0020,
00127
00128 DMSTYPE_CD = 0x0100,
00129 DMSTYPE_CW = 0x0200,
00130
00131 DMSTYPE_MASK_Precision = 0xF000,
00132 DMSTYPE_0P = 0x0000,
00133 DMSTYPE_1P = 0x1000,
00134 DMSTYPE_2P = 0x2000,
00135 DMSTYPE_3P = 0x3000,
00136 DMSTYPE_4P = 0x4000,
00137 DMSTYPE_5P = 0x5000,
00138 DMSTYPE_6P = 0x6000,
00139 DMSTYPE_7P = 0x7000,
00140 DMSTYPE_8P = 0x8000,
00141 DMSTYPE_9P = 0x9000,
00142
00143 DMSTYPE_None = 0,
00144 DMSTYPE_DecDeg = DMSTYPE_Deg | DMSTYPE_CD,
00145 DMSTYPE_IDecDeg = DMSTYPE_Deg | DMSTYPE_DF | DMSTYPE_CD,
00146 DMSTYPE_DDDdddddd = DMSTYPE_Deg | DMSTYPE_CD | DMSTYPE_6P,
00147 DMSTYPE_IDDDdddddd = DMSTYPE_Deg | DMSTYPE_DF | DMSTYPE_CD | DMSTYPE_6P,
00148 DMSTYPE_DDDMMSS = DMSTYPE_DegMinSec | DMSTYPE_CD | DMSTYPE_CW,
00149 DMSTYPE_IDDDMMSS = DMSTYPE_DegMinSec | DMSTYPE_DF | DMSTYPE_CW,
00150 DMSTYPE_DDDMMSSI = DMSTYPE_DegMinSec | DMSTYPE_DB | DMSTYPE_CW,
00151 DMSTYPE_DDDMMSSS = DMSTYPE_DegMinSec | DMSTYPE_CD | DMSTYPE_1P,
00152 DMSTYPE_IDDDMMSSS = DMSTYPE_DegMinSec | DMSTYPE_DF | DMSTYPE_1P,
00153 DMSTYPE_DDDMMSSSI = DMSTYPE_DegMinSec | DMSTYPE_DB | DMSTYPE_1P,
00154 DMSTYPE_DDDMMSSSS = DMSTYPE_DegMinSec | DMSTYPE_CD | DMSTYPE_2P,
00155 DMSTYPE_IDDDMMSSSS = DMSTYPE_DegMinSec | DMSTYPE_DF | DMSTYPE_2P,
00156 DMSTYPE_DDDMMSSSSI = DMSTYPE_DegMinSec | DMSTYPE_DB | DMSTYPE_2P,
00157 DMSTYPE_DDDMMSSSSS = DMSTYPE_DegMinSec | DMSTYPE_CD | DMSTYPE_3P,
00158 DMSTYPE_IDDDMMSSSSS = DMSTYPE_DegMinSec | DMSTYPE_DF | DMSTYPE_3P,
00159 DMSTYPE_DDDMMSSSSSI = DMSTYPE_DegMinSec | DMSTYPE_DB | DMSTYPE_3P,
00160 DMSTYPE_DDDMMSS_SS = DMSTYPE_DegMinSec | DMSTYPE_2P | DMSTYPE_CD | DMSTYPE_CW,
00161 DMSTYPE_IDDDMMSS_SS = DMSTYPE_DegMinSec | DMSTYPE_2P | DMSTYPE_DF | DMSTYPE_CW,
00162 DMSTYPE_DDDMMSS_SSI = DMSTYPE_DegMinSec | DMSTYPE_2P | DMSTYPE_DB | DMSTYPE_CW,
00163 DMSTYPE_DDDMMSS_sss = DMSTYPE_DegMinSec | DMSTYPE_3P | DMSTYPE_CD | DMSTYPE_CW,
00164 DMSTYPE_IDDDMMSS_sss = DMSTYPE_DegMinSec | DMSTYPE_3P | DMSTYPE_DF | DMSTYPE_CW,
00165 DMSTYPE_DDDMMSS_sssI = DMSTYPE_DegMinSec | DMSTYPE_3P | DMSTYPE_DB | DMSTYPE_CW,
00166 DMSTYPE_DDDMMSS_ssssss = DMSTYPE_DegMinSec | DMSTYPE_6P | DMSTYPE_CD | DMSTYPE_CW,
00167 DMSTYPE_IDDDMMSS_ssssss = DMSTYPE_DegMinSec | DMSTYPE_6P | DMSTYPE_DF | DMSTYPE_CW,
00168 DMSTYPE_DDDMMSS_ssssssI = DMSTYPE_DegMinSec | DMSTYPE_6P | DMSTYPE_DB | DMSTYPE_CW,
00169 DMSTYPE_DDDMM_MM = DMSTYPE_DegMinSec | DMSTYPE_DegMin | DMSTYPE_CD | DMSTYPE_CW,
00170 DMSTYPE_IDDDMM_MM = DMSTYPE_DegMinSec | DMSTYPE_DegMin | DMSTYPE_DF | DMSTYPE_CW,
00171 DMSTYPE_DDDMM_MMI = DMSTYPE_DegMinSec | DMSTYPE_DegMin | DMSTYPE_DB | DMSTYPE_CW,
00172 DMSTYPE_Seconds = DMSTYPE_Sec | DMSTYPE_CD,
00173 DMSTYPE_ISeconds = DMSTYPE_Sec | DMSTYPE_DF,
00174 DMSTYPE_SecondsI = DMSTYPE_Sec | DMSTYPE_DB,
00175 };
00176 #ifndef GENERATING_DOXYGEN_OUTPUT
00177 DEFINE_ENUM_OP_BITWISE(DMSTYPE)
00178 #endif
00179
00180 enum CONVDMSFLAGS {
00181 CONVDMSFLAG_None = 0,
00182 CONVDMSFLAG_IN_String = 0x00010000,
00183 CONVDMSFLAG_IN_WArray = 0x00020000,
00184 CONVDMSFLAG_IN_Double = 0x00040000,
00185 CONVDMSFLAG_IN_UseSpaces = 0x00080000,
00186 CONVDMSFLAG_OUT_String = 0x01000000,
00187 CONVDMSFLAG_OUT_WArray = 0x02000000,
00188 CONVDMSFLAG_OUT_Double = 0x04000000,
00189 CONVDMSFLAG_OUT_PutSpaces = 0x10000000,
00190 CONVDMSFLAG_OUT_IsLatitude = 0x20000000,
00191 CONVDMSFLAG_OUT_IsLongitude = 0x00000000,
00192 CONVDMSFLAG_OUT_LocalHemisphere = 0x40000000,
00193 };
00194 #ifndef GENERATING_DOXYGEN_OUTPUT
00195 DEFINE_ENUM_OP_BITWISE(CONVDMSFLAGS)
00196 #endif
00197
00198 struct DMSTYPEANDNAME {
00199 DMSTYPE type;
00200 TEXTID name;
00201 };
00202
00203
00204
00205
00206
00209
00213 LIBEXPORT void ConvLatLonToString (
00214 double degrees,
00215 char *string,
00216 DMSTYPE desttype,
00217 CONVDMSFLAGS flags
00218 );
00219
00227 LIBEXPORT void ConvLatLonToString (
00228 double degrees,
00229 char *string,
00230 DMSTYPE desttype,
00231 CONVDMSFLAGS flags,
00232 double confidence
00233 );
00234
00238 LIBEXPORT double ConvLatLonValue (
00239 const void *srcbuf,
00240 DMSTYPE srctype,
00241 void *destbuf,
00242 DMSTYPE desttype,
00243 CONVDMSFLAGS flags
00244 );
00245
00249 inline double ConvLatLonValue (
00250 double value,
00251 DMSTYPE srctype
00252 ) {
00253 return (ConvLatLonValue(&value,srctype,0,DMSTYPE_None,CONVDMSFLAG_IN_Double));
00254 }
00255
00261 LIBEXPORT double ConvStringToLatLon (
00262 const char *string,
00263 DMSTYPE srctype,
00264 CONVDMSFLAGS flags = CONVDMSFLAG_None
00265 );
00266
00267 #ifndef NO_DEPRECATED
00272 LIBEXPORT const char** GetLatLonNames (void);
00273
00278 LIBEXPORT DMSTYPE GetLatLonType (
00279 int index
00280 );
00281 #endif
00282
00286 LIBEXPORT ERRVALUE GetLatLonTypeList (
00287 SIMPLE_ARRAY<DMSTYPEANDNAME>& types
00288 );
00289
00292 LIBEXPORT MISTRING GetLatLonTypeStrAbbr (
00293 DMSTYPE type,
00294 CONVDMSFLAGS flags = CONVDMSFLAG_OUT_PutSpaces
00295 );
00296
00298
00299 #undef LIBEXPORT
00300
00301 #endif // INC_MI32_LATLONFM_H