vtkGeoTerrainNode.h 4.27 KB
Newer Older
Ken Martin's avatar
Ken Martin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkGeoTerrainNode.h

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/

/*-------------------------------------------------------------------------
  Copyright 2008 Sandia Corporation.
  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
  the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/

22 23 24 25 26
/**
 * @class   vtkGeoTerrainNode
 *
 *
*/
27

28 29
#ifndef vtkGeoTerrainNode_h
#define vtkGeoTerrainNode_h
Ken Martin's avatar
Ken Martin committed
30

31
#include "vtkGeovisCoreModule.h" // For export macro
Ken Martin's avatar
Ken Martin committed
32
#include "vtkGeoTreeNode.h"
Ken Martin's avatar
Ken Martin committed
33
#include "vtkSmartPointer.h" // for SP
Ken Martin's avatar
Ken Martin committed
34 35 36

class vtkPolyData;

Sankhesh Jhaveri's avatar
Sankhesh Jhaveri committed
37
#if !defined(VTK_LEGACY_REMOVE)
38
class VTKGEOVISCORE_EXPORT vtkGeoTerrainNode : public vtkGeoTreeNode
Ken Martin's avatar
Ken Martin committed
39 40 41
{
public:
  static vtkGeoTerrainNode *New();
42
  vtkTypeMacro(vtkGeoTerrainNode, vtkGeoTreeNode);
43
  void PrintSelf(ostream& os, vtkIndent indent) override;
Ken Martin's avatar
Ken Martin committed
44

45 46 47 48 49
  //@{
  /**
   * Every subclass implements these methods returning the specific type.
   * This is easier than templating.
   */
Ken Martin's avatar
Ken Martin committed
50 51
  vtkGeoTerrainNode* GetChild(int idx);
  vtkGeoTerrainNode* GetParent();
52
  //@}
53

54 55
  /**
   * Given, a long, lat position, return altitude in meters
luz.paz's avatar
luz.paz committed
56
   * relative to sea level.
57
   */
Ken Martin's avatar
Ken Martin committed
58
  double GetAltitude(double longitude, double latitude);
59

60 61 62 63 64
  //@{
  /**
   * Get the terrrain model.  The user has to copy the terrain
   * into this object.
   */
Ken Martin's avatar
Ken Martin committed
65 66
  vtkPolyData* GetModel();
  void SetModel(vtkPolyData* model);
67
  //@}
68

69 70 71 72
  //@{
  /**
   * Bounding sphere is precomputed for faster updates of terrain.
   */
Ken Martin's avatar
Ken Martin committed
73 74 75
  void UpdateBoundingSphere();
  vtkGetMacro(BoundingSphereRadius, double);
  vtkGetVector3Macro(BoundingSphereCenter, double);
76
  //@}
Ken Martin's avatar
Ken Martin committed
77 78 79 80 81 82

  vtkGetVector3Macro(CornerNormal00,double);
  vtkGetVector3Macro(CornerNormal01,double);
  vtkGetVector3Macro(CornerNormal10,double);
  vtkGetVector3Macro(CornerNormal11,double);

83 84 85 86 87
  //@{
  /**
   * For 2D projections, store the bounds of the node in projected space
   * to quickly determine if a node is offscreen.
   */
88 89
  vtkGetVector4Macro(ProjectionBounds,double);
  vtkSetVector4Macro(ProjectionBounds,double);
90
  //@}
91

92 93 94 95
  //@{
  /**
   * For 2D projections, store the granularity of the graticule in this node.
   */
96 97
  vtkGetMacro(GraticuleLevel,int);
  vtkSetMacro(GraticuleLevel,int);
98
  //@}
99

100 101 102 103 104
  //@{
  /**
   * For 2D projections, store the maximum deviation of line segment centers
   * from the actual projection value.
   */
105 106
  vtkGetMacro(Error,double);
  vtkSetMacro(Error,double);
107
  //@}
108

109 110 111 112 113
  //@{
  /**
   * For 2D projections, store the maximum deviation of line segment centers
   * from the actual projection value.
   */
114 115
  vtkGetMacro(Coverage,float);
  vtkSetMacro(Coverage,float);
116
  //@}
117

118 119 120 121
  //@{
  /**
   * Shallow and Deep copy.
   */
122 123
  void ShallowCopy(vtkGeoTreeNode *src) override;
  void DeepCopy(vtkGeoTreeNode *src) override;
124
  //@}
125

126 127 128 129
  /**
   * Returns whether this node has valid data associated
   * with it, or if it is an "empty" node.
   */
130
  bool HasData() override;
131

132 133 134 135 136
  /**
   * Deletes the data associated with the node to make this
   * an "empty" node. This is performed when the node has
   * been unused for a certain amount of time.
   */
137
  void DeleteData() override;
138

Ken Martin's avatar
Ken Martin committed
139 140
protected:
  vtkGeoTerrainNode();
141
  ~vtkGeoTerrainNode() override;
Ken Martin's avatar
Ken Martin committed
142 143 144 145 146 147 148 149 150 151 152 153 154 155

  vtkSmartPointer<vtkPolyData> Model;

  double BoundingSphereRadius;
  double BoundingSphereCenter[3];

  // I hate having to store this, but it is the easiest
  // way to determine if a node is not visible because
  // it is on the other side of the earth.
  double CornerNormal00[3];
  double CornerNormal01[3];
  double CornerNormal10[3];
  double CornerNormal11[3];

156 157 158
  double ProjectionBounds[4];
  int GraticuleLevel;
  double Error;
159
  float  Coverage;
160

Ken Martin's avatar
Ken Martin committed
161
private:
162 163
  vtkGeoTerrainNode(const vtkGeoTerrainNode&) = delete;
  void operator=(const vtkGeoTerrainNode&) = delete;
Ken Martin's avatar
Ken Martin committed
164 165
};

Sankhesh Jhaveri's avatar
Sankhesh Jhaveri committed
166
#endif //VTK_LEGACY_REMOVE
Ken Martin's avatar
Ken Martin committed
167
#endif