00001
00002
00003
00004
00005
00006
00007
00008 #ifndef LULCH
00009 #define LULCH
00010
00011 #include <stdio.h>
00012 #include "MathTypes.h"
00013
00014 #define LULC_ERR_FILE 1
00015 #define LULC_ERR_READ 2
00016 #define LULC_ERR_HEADER 3
00017
00018 typedef struct
00019 {
00020 short x;
00021 short y;
00022 } Coord;
00023
00024 typedef struct
00025 {
00026 short first_coord;
00027 short last_coord;
00028 short PL;
00029 short PR;
00030 int PAL;
00031 int PAR;
00032 int Length;
00033 short StartNode;
00034 short FinishNode;
00035 } LULCArc;
00036
00037 class LULCPoly
00038 {
00039 public:
00040 LULCPoly();
00041 ~LULCPoly();
00042
00043 short first_arc;
00044 short last_arc;
00045 int Attribute;
00046 int PerimeterLength;
00047 short NumIslands;
00048 short SurroundingPoly;
00049
00050
00051 int m_iCoords;
00052 DPoint2 *m_p;
00053
00054
00055 double xmin, zmin, xmax, zmax;
00056 };
00057
00058 class LULCSection
00059 {
00060 public:
00061 ~LULCSection();
00062
00063 int m_iNumArcs;
00064 int m_iNumCoords;
00065 int m_iNumPolys;
00066 int m_iLengthOfFAP;
00067 int m_iNumNodes;
00068
00069 LULCArc *m_pArc;
00070 Coord *m_pCoord;
00071 LULCPoly *m_pPoly;
00072 short *m_pFAP;
00073 };
00074
00075 class vtLULCFile
00076 {
00077 public:
00078
00079 vtLULCFile(const char *fname);
00080
00081
00082 ~vtLULCFile();
00083
00084
00085 void SetupMapping();
00086
00087
00088 void ReadSection(LULCSection *pSection, FILE *fp);
00089
00090
00091 int GetRecord(FILE *fp, char *buf);
00092
00093
00094 void LocalToLatlon(Coord &local, DPoint2 &latlon);
00095
00096
00097 void ProcessLULCPolys();
00098 void ProcessLULCPoly(LULCSection *pSection, LULCPoly *pPoly);
00099 int FindAttribute(double utm_x, double utm_y);
00100
00101
00102 int m_iError;
00103
00104 const char *GetErrorMessage();
00105
00106
00107 Coord m_cMin, m_cMax;
00108
00109
00110 Coord m_cCorners[6];
00111
00112
00113 DPoint2 m_Corners[6];
00114
00115
00116 int NumSections() { return m_iNumSections; };
00117 LULCSection *GetSection(int i) { return m_pSection+i; };
00118
00119
00120 vtLULCFile *m_pNext;
00121
00122 private:
00123 int m_iNumSections;
00124 LULCSection *m_pSection;
00125 DMatrix3 m_transform;
00126
00127 };
00128
00129 #endif // LULCH