libosmscout  1.1.1
MapPainterOpenGL.h
Go to the documentation of this file.
1 #ifndef OSMSCOUT_MAP_MAPPAINTEROPENGL_H
2 #define OSMSCOUT_MAP_MAPPAINTEROPENGL_H
3 
4 /*
5  This source is part of the libosmscout-map library
6  Copyright (C) 2013 Tim Teulings
7  Copyright (C) 2017 Fanny Monori
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23 
24 #define GLEW_STATIC
25 
26 #include <GL/glew.h>
27 
28 #include <osmscout/MapOpenGLFeatures.h>
29 
30 #include <osmscout/OpenGLMapData.h>
31 
33 #include <osmscout/TextLoader.h>
34 
35 namespace osmscout {
37  {
38  private:
39 
40  int width;
41  int height;
42  double dpi;
43 
44  int screenWidth;
45  int screenHeight;
46 
47  float minLon;
48  float minLat;
49  float maxLon;
50  float maxLat;
51 
52  float lookX;
53  float lookY;
54 
55  OpenGLMapData AreaRenderer;
56  OpenGLMapData GroundTileRenderer;
57  OpenGLMapData GroundRenderer;
58  OpenGLMapData WayRenderer;
59  OpenGLMapData ImageRenderer;
60  OpenGLMapData TextRenderer;
61 
62  TextLoader Textloader;
63 
64  osmscout::MapData MapData;
65  osmscout::StyleConfigRef styleConfig;
66  osmscout::MapParameter Parameter;
67  osmscout::FillStyleRef landFill;
68  osmscout::FillStyleRef seaFill;
69  osmscout::GeoCoord Center;
70  osmscout::Magnification Magnification;
71 
75  void ProcessAreas(const osmscout::MapData &data, const osmscout::MapParameter &parameter,
76  const osmscout::Projection &projection, const osmscout::StyleConfigRef &styleConfig);
77 
81  void ProcessGround(const osmscout::MapData &data, const osmscout::MapParameter &parameter,
82  const osmscout::Projection &projection, const osmscout::StyleConfigRef &styleConfig);
83 
87  void ProcessWays(const osmscout::MapData &data, const osmscout::MapParameter &parameter,
88  const osmscout::Projection &projection,
89  const osmscout::StyleConfigRef &styleConfig);
90 
94  void ProcessNodes(const osmscout::MapData &data, const osmscout::MapParameter &parameter,
95  const osmscout::Projection &projection,
96  const osmscout::StyleConfigRef &styleConfig);
97 
101  void SwapAreaData();
102 
106  void SwapGroundData();
107 
111  void SwapNodeData();
112 
116  void SwapWayData();
117 
118  void AddPathVertex(osmscout::Point current, osmscout::Point previous, osmscout::Point next,
119  osmscout::Color color, int type, float width, glm::vec3 barycentric, int border = 0,
120  double z = 0, float dashsize = 0.0, float length = 1,
121  osmscout::Color gapcolor = osmscout::Color(1.0, 1.0, 1.0, 1.0));
122 
123  bool PixelToGeo(double x, double y, double &lon, double &lat);
124 
125  bool IsVisibleArea(const Projection &projection, const GeoBox &boundingBox, double pixelOffset);
126 
127  public:
128 
129  MapPainterOpenGL(int width, int height, double dpi, int screenWidth, int screenHeight, std::string fontPath);
130 
131  ~MapPainterOpenGL();
132 
136  void OnZoom(float zoomDirection);
137 
141  void OnTranslation(int startPointX, int startPointY, int endPointX, int endPointY);
142 
146  osmscout::GeoCoord GetCenter();
147 
151  void ProcessData(const osmscout::MapData &data, const osmscout::MapParameter &parameter,
152  const osmscout::Projection &projection, const osmscout::StyleConfigRef &styleConfig);
153 
157  void SwapData();
158 
162  void DrawMap();
163 
164  };
165 }
166 
167 #endif
Definition: OpenGLMapData.h:53
std::shared_ptr< FillStyle > FillStyleRef
Definition: Styles.h:349
Definition: TextLoader.h:78
#define OSMSCOUT_MAP_OPENGL_API
Definition: MapOpenGLImportExport.h:45
Definition: MapPainterOpenGL.h:36
Definition: Projection.h:43
Definition: Area.h:38
std::shared_ptr< StyleConfig > StyleConfigRef
Definition: StyleConfig.h:849