00001
00002
00003
00004
00005
00006
00007
00008 #ifndef VTDATA_DLGH
00009 #define VTDATA_DLGH
00010
00011 #include <stdio.h>
00012 #include "MathTypes.h"
00013 #include "Projections.h"
00014
00015 #define DLG_ERR_FILE 1
00016 #define DLG_ERR_READ 2
00017 #define DLG_ERR_HEADER 3
00018 #define DLG_ERR_NODE 4
00019 #define DLG_ERR_AREA 5
00020 #define DLG_ERR_LINE 6
00021
00022 enum DLGType
00023 {
00024 DLG_HYPSO,
00025 DLG_HYDRO,
00026 DLG_VEG,
00027 DLG_NONVEG,
00028 DLG_BOUNDARIES,
00029 DLG_MARKERS,
00030 DLG_ROAD,
00031 DLG_RAIL,
00032 DLG_MTF,
00033 DLG_UNKNOWN
00034 };
00035
00036 typedef struct DLGAttribute
00037 {
00038 int m_iMajorAttr, m_iMinorAttr;
00039 } DLGAttribute;
00040
00041
00042 class DLGNode
00043 {
00044 public:
00045 DPoint2 m_p;
00046 int m_iAttribs;
00047 };
00048
00049 class DLGArea
00050 {
00051 public:
00052 DPoint2 m_p;
00053 int m_iAttribs;
00054 };
00055
00056 class DLGLine
00057 {
00058 public:
00059 int HighwayNumber();
00060
00061 int m_iNode1, m_iNode2;
00062 int m_iLeftArea, m_iRightArea;
00063 int m_iCoords;
00064 int m_iAttribs;
00065 DLGAttribute *m_attr;
00066 DPoint2 *m_p;
00067 };
00068
00069 class vtDLGFile
00070 {
00071 public:
00072 vtDLGFile();
00073 ~vtDLGFile();
00074
00075
00076
00077 bool Read(const char *fname, void progress_callback(int) = NULL);
00078
00079
00080 bool GetRecord(char *buf);
00081
00082
00083 DLGType GuessFileType();
00084
00085
00086 const char *GetErrorMessage();
00087
00088
00089 void OpenFile();
00090 void CloseFile();
00091
00092
00093 int m_iError;
00094
00095 char m_header[80];
00096 int m_iNodes;
00097 int m_iAreas;
00098 int m_iLines;
00099 bool m_bLFdelimited;
00100
00101
00102 const char* m_fname;
00103
00104
00105 DPoint2 m_SW_utm, m_NW_utm, m_NE_utm, m_SE_utm;
00106 DPoint2 m_SW_lat, m_NW_lat, m_NE_lat, m_SE_lat;
00107
00108 DLGNode *m_nodes;
00109 DLGArea *m_areas;
00110 DLGLine *m_lines;
00111
00112 vtProjection &GetProjection() { return m_proj; }
00113
00114 protected:
00115 FILE *m_fp;
00116
00117 vtProjection m_proj;
00118 };
00119
00120
00121 bool ConvertDLG_from_LFDelim(const char *fname_from, const char *fname_to);
00122
00123 #endif