Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
QuikGrid.h
1 //
2 // QuikGrid.h
3 //
4 // This code provides an interface to the QuikGrid LGPL library
5 // (http://www.perspectiveedge.com/source.html)
6 //
7 // In particular, it solves the problem that QuikGrid can only link to
8 // a single callback function for contour output.
9 //
10 // Copyright (c) 2007-2011 Virtual Terrain Project
11 // Free for all uses, see license.txt for details.
12 //
13 
14 #pragma once
15 
16 #if SUPPORT_QUIKGRID
17 
18 // QuikGrid headers
19 #include "surfgrid.h"
20 #include "contour.h"
21 
22 #include "HeightField.h"
23 #include "Features.h"
24 
25 typedef void (*ContourCallback)(void *context, float x, float y, bool bStart);
26 
27 void SetQuikGridCallbackFunction(ContourCallback fn, void *context);
28 
29 class ContourConverter
30 {
31 public:
32  ContourConverter();
33  ~ContourConverter();
34 
36  bool Setup(vtHeightFieldGrid3d *pHGGrid, vtFeatureSetLineString *fset);
37 
38  void GenerateContour(float fAlt);
39  void GenerateContours(float fAInterval);
40  void Finish();
41  void Coord(float x, float y, bool bStart);
42 
43 protected:
44  bool SetupGrid(vtHeightFieldGrid3d *pHGGrid);
45  void Flush();
46 
47  class SurfaceGrid *m_pGrid;
48 
49  vtHeightFieldGrid3d *m_pHF;
50  DRECT m_ext;
51  DPoint2 m_spacing;
52  float m_fAltitude;
53  float m_fHeight;
54  DLine2 m_line;
55 
57 };
58 
59 #endif // SUPPORT_QUIKGRID