HOG2
MapOverlay.h
Go to the documentation of this file.
1 /*
2  * mapOverlay.h
3  * hog
4  *
5  * Created by Nathan Sturtevant on 3/21/06.
6  * Copyright 2006 Nathan Sturtevant. All rights reserved.
7  *
8  */
9 
10 #include <vector>
11 #include "Map.h"
12 #include <float.h>
13 #include <string>
14 #include <unordered_map>
15 #include "Graphics.h"
16 
17 #ifndef MAPOVERLAY_H
18 #define MAPOVERLAY_H
19 
20 class MapOverlay {
21 public:
22  MapOverlay(Map *m);
23  Map *GetMap() { return m; }
24  void Clear();
25 
26  void SetOverlayValue(int x, int y, double value);
27  double GetOverlayValue(int x, int y);
28  void OpenGLDraw() const;
29  std::string SVGDraw() const;
30  void Draw(Graphics::Display &display) const;
31 
32  void SetTransparentValue(double v) { ignoreVal = v; }
33  rgbColor GetValueColor(double value) const;
34  void SetColorMap(int val) { colorMap = val; }
35  int GetColorMap() { return colorMap; }
36  void SetColor(int value, rgbColor c) { colors[value] = c; }
37  void IncreaseColorMap() { colorMap++; }
38  void DecreaseColorMap() { colorMap--; }
39  double GetMaxValue() { return maxVal; }
40  double GetMinValue() { return minVal; }
41 
42  static const int customColorMap = -1;
43 private:
44  void resetValues();
45  Map *m;
46  std::vector<double> values;
47  std::unordered_map<int, rgbColor> colors;
48  double maxVal, minVal;
49  double ignoreVal;
50  int colorMap;
52  mutable GLuint displayList;
53 };
54 
55 #endif
MapOverlay::IncreaseColorMap
void IncreaseColorMap()
Definition: MapOverlay.h:37
rgbColor
A color; r/g/b are between 0...1.
Definition: Colors.h:17
MapOverlay::resetValues
void resetValues()
Definition: MapOverlay.cpp:42
MapOverlay::minVal
double minVal
Definition: MapOverlay.h:48
MapOverlay::ignoreVal
double ignoreVal
Definition: MapOverlay.h:49
MapOverlay::colors
std::unordered_map< int, rgbColor > colors
Definition: MapOverlay.h:47
MapOverlay::GetMaxValue
double GetMaxValue()
Definition: MapOverlay.h:39
MapOverlay::DecreaseColorMap
void DecreaseColorMap()
Definition: MapOverlay.h:38
MapOverlay::GetOverlayValue
double GetOverlayValue(int x, int y)
Definition: MapOverlay.cpp:82
MapOverlay::drawBorders
bool drawBorders
Definition: MapOverlay.h:51
MapOverlay::SetColor
void SetColor(int value, rgbColor c)
Definition: MapOverlay.h:36
MapOverlay::SVGDraw
std::string SVGDraw() const
Definition: MapOverlay.cpp:294
MapOverlay::SetOverlayValue
void SetOverlayValue(int x, int y, double value)
Definition: MapOverlay.cpp:63
MapOverlay::maxVal
double maxVal
Definition: MapOverlay.h:48
MapOverlay::GetValueColor
rgbColor GetValueColor(double value) const
Definition: MapOverlay.cpp:89
Graphics::Display
Definition: Graphics.h:146
MapOverlay::MapOverlay
MapOverlay(Map *m)
Definition: MapOverlay.cpp:18
MapOverlay
Definition: MapOverlay.h:20
Graphics.h
MapOverlay::OpenGLDraw
void OpenGLDraw() const
Definition: MapOverlay.cpp:98
MapOverlay::Draw
void Draw(Graphics::Display &display) const
Definition: MapOverlay.cpp:275
MapOverlay::GetMap
Map * GetMap()
Definition: MapOverlay.h:23
MapOverlay::colorMap
int colorMap
Definition: MapOverlay.h:50
MapOverlay::GetMinValue
double GetMinValue()
Definition: MapOverlay.h:40
MapOverlay::SetTransparentValue
void SetTransparentValue(double v)
Definition: MapOverlay.h:32
MapOverlay::SetColorMap
void SetColorMap(int val)
Definition: MapOverlay.h:34
MapOverlay::displayList
GLuint displayList
Definition: MapOverlay.h:52
Map.h
MapOverlay::customColorMap
static const int customColorMap
Definition: MapOverlay.h:42
MapOverlay::m
Map * m
Definition: MapOverlay.h:45
MapOverlay::values
std::vector< double > values
Definition: MapOverlay.h:46
MapOverlay::Clear
void Clear()
Definition: MapOverlay.cpp:27
MapOverlay::GetColorMap
int GetColorMap()
Definition: MapOverlay.h:35
Map
A tile-based representation of the world.
Definition: Map.h:142