Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
VegLayer.h
1 //
2 // VegLayer.h
3 //
4 // Copyright (c) 2001-2006 Virtual Terrain Project
5 // Free for all uses, see license.txt for details.
6 //
7 
8 #ifndef VEGLAYER_H
9 #define VEGLAYER_H
10 
11 #include "vtdata/LULC.h"
12 #include "vtdata/RoadMap.h"
13 #include "vtdata/Plants.h"
14 #include "RawLayer.h"
15 #include "VegPointOptions.h"
16 
17 enum VegLayerType
18 {
19  VLT_None,
20  VLT_Density,
21  VLT_BioMap,
22  VLT_Instances
23 };
24 
25 enum VegImportFieldType
26 {
27  VIFT_Density,
28  VIFT_BiotypeName,
29  VIFT_BiotypeID
30 };
31 
32 class vtVegLayer : public vtRawLayer
33 {
34 public:
35  vtVegLayer();
36  ~vtVegLayer();
37 
38  // Projection
39  vtProjection m_proj;
40 
41  // Basics to overwrite vtLayer / vtRawLayer
42  bool OnSave(bool progress_callback(int) = NULL);
43  bool OnLoad();
44  bool AppendDataFrom(vtLayer *pL);
45  void GetPropertyText(wxString &str);
46  bool CanBeSaved();
47  wxString GetFileExtension();
48 
49  void SetVegType(VegLayerType type);
50  VegLayerType GetVegType() { return m_VLType; }
51 
52  // Importing data into veglayer
53  void AddElementsFromLULC(vtLULCFile *pLULC);
54  bool AddElementsFromSHP_Polys(const wxString &filename, const vtProjection &proj,
55  int fieldindex, VegImportFieldType datatype);
56  bool AddElementsFromSHP_Points(const wxString &filename, const vtProjection &proj,
57  VegPointOptions &opt);
58 
59  // Search functionality
60  float FindDensity(const DPoint2 &p);
61  int FindBiotype(const DPoint2 &p);
62 
63  // Exporting data
64  bool ExportToSHP(const char *fname);
65 
66  vtPlantInstanceArray *GetPIA() { return (vtPlantInstanceArray *) m_pSet; }
67  vtFeatureSetPolygon *GetPS() { return (vtFeatureSetPolygon *) m_pSet; }
68 
69 protected:
70  VegLayerType m_VLType;
71 
72  int m_field_density;
73  int m_field_biotype;
74 };
75 
76 #endif // VEGLAYER_H
77