libosmscout 1.1.1
Loading...
Searching...
No Matches
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#include <GL/glew.h>
25
26#include <osmscoutmapopengl/MapOpenGLFeatures.h>
31
32namespace osmscout {
34 {
35 private:
45 enum PathVertexType: int {
46 TStart = 1,
47 BStart = 2,
48 TR = 3,
49 BR = 4,
50 TL = 5,
51 BL = 6,
52 TEnd = 7,
53 BEnd = 8
54 };
55 private:
56 bool initialized = false;
57
58 OpenGLProjection mapProjection;
59
60 float lookX;
61 float lookY;
62
63 GLuint projectionShader=0;
64
65 OpenGLMapData<GL_RGBA, 4> areaRenderer;
66 OpenGLMapData<GL_RGBA, 4> groundTileRenderer;
67 OpenGLMapData<GL_RGBA, 4> groundRenderer;
68 OpenGLMapData<GL_RGBA, 4> wayRenderer;
69 OpenGLMapData<GL_RGBA, 4> imageRenderer;
70 OpenGLMapData<GL_RED, 1> textRenderer;
71
72 TextLoader textLoader;
73
74 osmscout::MapData mapData;
75 osmscout::StyleConfigRef styleConfig;
76 osmscout::StyleConfigRef dataStyleConfig;
77 osmscout::MapParameter parameter;
78
82 void ProcessAreas(const osmscout::MapData &data,
83 const osmscout::Projection &loadProjection,
84 const osmscout::StyleConfigRef &styleConfig);
85
89 void ProcessGround(const osmscout::MapData &data,
90 const osmscout::Projection &loadProjection,
91 const osmscout::StyleConfigRef &styleConfig);
92
93 void ProcessWay(const osmscout::WayRef &way,
94 const osmscout::Projection &loadProjection,
95 const osmscout::StyleConfigRef &styleConfig,
96 const WidthFeatureValueReader &widthReader);
97
101 void ProcessWays(const osmscout::MapData &data,
102 const osmscout::Projection &loadProjection,
103 const osmscout::StyleConfigRef &styleConfig);
104
105 void ProcessNode(const osmscout::NodeRef &node,
106 const osmscout::Projection &loadProjection,
107 const osmscout::StyleConfigRef &styleConfig,
108 std::vector<int> &icons);
109
113 void ProcessNodes(const osmscout::MapData &data,
114 const osmscout::Projection &loadProjection,
115 const osmscout::StyleConfigRef &styleConfig);
116
120 void SwapAreaData();
121
125 void SwapGroundData();
126
130 void SwapNodeData();
131
135 void SwapWayData();
136
137 void AddPathVertex(osmscout::Point current, osmscout::Point previous, osmscout::Point next,
138 osmscout::Color color, PathVertexType type, float width, glm::vec3 barycentric, int border = 0,
139 double z = 0, float dashsize = 0.0, float length = 1,
140 osmscout::Color gapcolor = osmscout::Color(1.0, 1.0, 1.0, 1.0));
141
142 bool IsVisibleArea(const Projection &projection, const GeoBox &boundingBox, double pixelOffset);
143
144 public:
145
146 MapPainterOpenGL(int width, int height, double dpi,
147 const std::string &fontPath, const std::string &shaderDir,
148 const osmscout::MapParameter &parameter);
149
151
152 bool IsInitialized() const
153 {
154 return initialized;
155 }
156
160 void OnZoom(float zoomDirection);
161
162 void SetSize(int width, int height);
163
167 void OnTranslation(int startPointX, int startPointY, int endPointX, int endPointY);
168
172 osmscout::GeoCoord GetCenter() const;
173
174 void SetCenter(const osmscout::GeoCoord &center);
175
176 osmscout::Magnification GetMagnification() const;
177
178 void SetMagnification(const osmscout::Magnification &magnification);
179
181
185 void ProcessData(const osmscout::MapData &data,
186 const osmscout::Projection &loadProjection,
187 const osmscout::StyleConfigRef &styleConfig);
188
192 void SwapData();
193
199
200 };
201}
202
203#endif
#define OSMSCOUT_MAP_OPENGL_API
Definition MapOpenGLImportExport.h:45
void SetSize(int width, int height)
MercatorProjection GetProjection() const
void SetCenter(const osmscout::GeoCoord &center)
osmscout::Magnification GetMagnification() const
void OnZoom(float zoomDirection)
void OnTranslation(int startPointX, int startPointY, int endPointX, int endPointY)
void DrawMap(RenderSteps startStep=RenderSteps::FirstStep, RenderSteps endStep=RenderSteps::LastStep)
void SetMagnification(const osmscout::Magnification &magnification)
MapPainterOpenGL(int width, int height, double dpi, const std::string &fontPath, const std::string &shaderDir, const osmscout::MapParameter &parameter)
void ProcessData(const osmscout::MapData &data, const osmscout::Projection &loadProjection, const osmscout::StyleConfigRef &styleConfig)
bool IsInitialized() const
Definition MapPainterOpenGL.h:152
osmscout::GeoCoord GetCenter() const
Definition MercatorProjection.h:40
Definition OpenGLMapData.h:75
Definition OpenGLProjection.h:33
Definition Projection.h:46
Definition TextLoader.h:78
Definition Area.h:39
std::shared_ptr< Way > WayRef
Definition Way.h:213
FeatureValueReader< WidthFeature, WidthFeatureValue > WidthFeatureValueReader
Definition WidthFeature.h:87
std::shared_ptr< StyleConfig > StyleConfigRef
Definition StyleConfig.h:859
RenderSteps
Definition MapPainter.h:64
@ LastStep
Definition MapPainter.h:92
@ FirstStep
Definition MapPainter.h:65
std::shared_ptr< Node > NodeRef
Definition Node.h:125