Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
StructLayer.h
1 //
2 // StructureLayer.h
3 //
4 // Copyright (c) 2001-2008 Virtual Terrain Project
5 // Free for all uses, see license.txt for details.
6 //
7 
8 #ifndef STRUCTLAYER_H
9 #define STRUCTLAYER_H
10 
11 #include "vtdata/shapelib/shapefil.h"
12 #include "vtdata/Features.h"
13 #include "vtdata/StructArray.h"
14 #include "vtdata/Features.h"
15 #include "Layer.h"
16 
17 class vtDLGFile;
18 class vtElevLayer;
19 class vtScaledView;
20 
22 
24 {
25 public:
27 
28  // Implement vtLayer methods
29  bool GetExtent(DRECT &rect);
30  void DrawLayer(wxDC *pDC, vtScaledView *pView);
31  bool TransformCoords(vtProjection &proj);
32  bool OnSave(bool progress_callback(int) = NULL);
33  bool OnLoad();
34  void GetProjection(vtProjection &proj);
35  void SetProjection(const vtProjection &proj);
36  bool AppendDataFrom(vtLayer *pL);
37  void Offset(const DPoint2 &p);
38  void GetPropertyText(wxString &str);
39  bool AskForSaveFilename();
40 
41  wxString GetLayerFilename() { return wxString(GetFilename(), wxConvUTF8); }
42  void SetLayerFilename(const wxString &fname)
43  {
44  SetFilename((const char *) fname.mb_str(wxConvUTF8));
45  vtLayer::SetLayerFilename(fname);
46  }
47 
48  // UI event handlers
49  void OnLeftDown(BuilderView *pView, UIContext &ui);
50  void OnLeftUp(BuilderView *pView, UIContext &ui);
51  void OnRightDown(BuilderView *pView, UIContext &ui);
52  void OnMouseMove(BuilderView *pView, UIContext &ui);
53 
54  void OnLeftDownEditBuilding(BuilderView *pView, UIContext &ui);
55  void OnLeftDownBldAddPoints(BuilderView *pView, UIContext &ui);
56  void OnLeftDownBldDeletePoints(BuilderView *pView, UIContext &ui);
57  void OnLeftDownEditLinear(BuilderView *pView, UIContext &ui);
58  void OnLeftDownAddInstance(BuilderView *pView, UIContext &ui, vtTagArray *tags);
59  void UpdateMove(UIContext &ui);
60  void UpdateRotate(UIContext &ui);
61  void UpdateResizeScale(BuilderView *pView, UIContext &ui);
62 
63  void DrawBuildingHighlight(wxDC *pDC, vtScaledView *pView);
64  bool AddElementsFromSHP(const wxString &filename, const vtProjection &proj, DRECT rect);
65  void AddElementsFromDLG(vtDLGFile *pDlg);
66 
67  bool EditBuildingProperties();
68  void AddFoundations(vtElevLayer *pEL);
69 
70  void DrawBuilding(wxDC *pDC, vtScaledView *pView, vtBuilding *bld);
71  void DrawLinear(wxDC *pDC, vtScaledView *pView, vtFence *fen);
72 
73  // inverts selection values on all structures.
74  void InvertSelection();
75  void DeselectAll();
76  int DoBoxSelect(const DRECT &rect, SelectionType st);
77 
78  // override to catch edit hightlighting
79  virtual void SetEditedEdge(vtBuilding *bld, int lev, int edge);
80 
81  void ResolveInstancesOfItems();
82  void CleanFootprints(double epsilon, int &degenerate, int &overlapping);
83 
84 protected:
85  void DrawStructures(wxDC *pDC, vtScaledView *pView, bool bOnlySelected);
86 
87  int m_size; // size in pixels of the small crosshair at building center
88  bool m_bPreferGZip; // user wants their elevation treated as a .gz file};
89  vtScaledView *m_pLastView;
90 };
91 
92 #endif // STRUCTLAYER_H
93