libosmscout 1.1.1
Loading...
Searching...
No Matches
MapPainterGDI.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_MAP_MAPPAINTERGDI_H
2#define OSMSCOUT_MAP_MAPPAINTERGDI_H
3
4/*
5 This source is part of the libosmscout-map-gdi library
6 Copyright (C) 2020 Transporter
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
24
26
27namespace osmscout {
28
30 {
31 public:
32 struct NativeLabel {
33 std::wstring wstr;
34 void* font;
35 void* render;
36 };
37
38 struct NativeGlyph {
39 std::string character;
40 double width;
41 double height;
42 };
43
45
46 private:
47 using GdiGlyph = Glyph<NativeGlyph>;
48 using GdiLabelInstance = LabelInstance<NativeGlyph, NativeLabel>;
50 friend GdiLabelLayouter;
51
52 GdiLabelLayouter m_labelLayouter;
53 void *m_pBuffer;
54 static ULONG_PTR m_gdiplusToken;
55 static DWORD m_gdiplusInstCount;
56
57 private:
58 osmscout::ScreenVectorRectangle GlyphBoundingBox(const NativeGlyph &glyph) const;
59
60 std::shared_ptr<GdiLabel> Layout(const Projection &projection,
61 const MapParameter &parameter,
62 const std::string &text,
63 double fontSize,
64 double objectWidth,
65 bool enableWrapping = false,
66 bool contourLabel = false);
67
68 void DrawLabel(const Projection &projection,
69 const MapParameter &parameter,
70 const ScreenVectorRectangle &labelRectangle,
71 const LabelData &label,
72 const NativeLabel &layout);
73
74 void DrawGlyphs(const Projection &projection,
75 const MapParameter &parameter,
76 const osmscout::PathTextStyleRef &style,
77 const std::vector<GdiGlyph> &glyphs);
78
79 protected:
81 const Projection &projection,
82 const MapParameter &parameter,
83 const MapData &data) override;
84
86 const Projection &projection,
87 const MapParameter &parameter,
88 const MapData &data) override;
89
91 const Projection &projection,
92 const MapParameter &parameter,
93 const MapData &data) override;
94
96 const Projection &projection,
97 const MapParameter &parameter,
98 IconStyle &style) override;
99
100 double GetFontHeight(const Projection &projection,
101 const MapParameter &parameter,
102 double fontSize) override;
103
104 void DrawGround(const Projection &projection,
105 const MapParameter &parameter,
106 const FillStyle &style) override;
107
112 void RegisterRegularLabel(const Projection &projection,
113 const MapParameter &parameter,
114 const ObjectFileRef& ref,
115 const std::vector<LabelData> &labels,
116 const Vertex2D &position,
117 double objectWidth) override;
118
122 void RegisterContourLabel(const Projection &projection,
123 const MapParameter &parameter,
124 const ObjectFileRef& ref,
125 const PathLabelData &label,
126 const LabelPath &labelPath) override;
127
128 void DrawLabels(const Projection &projection,
129 const MapParameter &parameter,
130 const MapData &data) override;
131
132 void DrawSymbol(const Projection &projection,
133 const MapParameter &parameter,
134 const Symbol &style,
135 const Vertex2D& screenPos,
136 double scaleFactor) override;
137
138 void DrawIcon(const IconStyle *style,
139 const Vertex2D& centerPos,
140 double width, double height) override;
141
142 void DrawPath(const Projection &projection,
143 const MapParameter &parameter,
144 const Color &color,
145 double width,
146 const std::vector<double> &dash,
147 LineStyle::CapStyle startCap,
148 LineStyle::CapStyle endCap,
149 const CoordBufferRange& coordRange) override;
150
152 const Projection &projection,
153 const MapParameter &parameter,
154 const WayData &data);
155
157 const Projection &projection,
158 const MapParameter &parameter,
159 const WayData &data) override;
160
161 void DrawContourSymbol(const Projection &projection,
162 const MapParameter &parameter,
163 const Symbol &symbol,
164 const ContourSymbolData& data) override;
165
166 void DrawArea(const Projection &projection,
167 const MapParameter &parameter,
168 const AreaData &area) override;
169
170 public:
171 bool DrawMap(const Projection& projection,
172 const MapParameter& parameter,
173 const MapData& data,
174 HDC hdc,
177
184 ~MapPainterGDI() override;
185 };
186}
187
188#endif
#define OSMSCOUT_MAP_GDI_API
Definition MapGDIImportExport.h:43
Definition LabelLayouter.h:103
Definition LabelLayouter.h:57
Definition LabelLayouter.h:119
Definition LabelLayouter.h:147
Definition LabelLayouter.h:230
Definition LabelPath.h:44
Definition MapPainter.h:112
void DrawWay(const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter, const WayData &data) override
void BeforeDrawing(const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter, const MapData &data) override
void RegisterContourLabel(const Projection &projection, const MapParameter &parameter, const ObjectFileRef &ref, const PathLabelData &label, const LabelPath &labelPath) override
void AfterPreprocessing(const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter, const MapData &data) override
void AfterDrawing(const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter, const MapData &data) override
void DrawIcon(const IconStyle *style, const Vertex2D &centerPos, double width, double height) override
void DrawSymbol(const Projection &projection, const MapParameter &parameter, const Symbol &style, const Vertex2D &screenPos, double scaleFactor) override
MapPainterGDI(const StyleConfigRef &styleConfig)
Default constructor.
void DrawContourSymbol(const Projection &projection, const MapParameter &parameter, const Symbol &symbol, const ContourSymbolData &data) override
void DrawWayOutline(const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter, const WayData &data)
void DrawGround(const Projection &projection, const MapParameter &parameter, const FillStyle &style) override
void RegisterRegularLabel(const Projection &projection, const MapParameter &parameter, const ObjectFileRef &ref, const std::vector< LabelData > &labels, const Vertex2D &position, double objectWidth) override
bool DrawMap(const Projection &projection, const MapParameter &parameter, const MapData &data, HDC hdc, RenderSteps startStep=RenderSteps::FirstStep, RenderSteps endStep=RenderSteps::LastStep)
void DrawLabels(const Projection &projection, const MapParameter &parameter, const MapData &data) override
bool HasIcon(const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter, IconStyle &style) override
double GetFontHeight(const Projection &projection, const MapParameter &parameter, double fontSize) override
Label< NativeGlyph, NativeLabel > GdiLabel
Definition MapPainterGDI.h:44
void DrawPath(const Projection &projection, const MapParameter &parameter, const Color &color, double width, const std::vector< double > &dash, LineStyle::CapStyle startCap, LineStyle::CapStyle endCap, const CoordBufferRange &coordRange) override
void DrawArea(const Projection &projection, const MapParameter &parameter, const AreaData &area) override
MapPainter(const StyleConfigRef &styleConfig)
StyleConfigRef styleConfig
Reference to the style configuration to be used.
Definition MapPainter.h:250
Definition LabelLayouter.h:46
Definition Projection.h:46
Index selectors by type and level.
Definition StyleConfig.h:552
Definition Area.h:39
std::shared_ptr< PathTextStyle > PathTextStyleRef
Definition Styles.h:890
std::shared_ptr< StyleConfig > StyleConfigRef
Definition StyleConfig.h:859
RenderSteps
Definition MapPainter.h:64
@ LastStep
Definition MapPainter.h:92
@ FirstStep
Definition MapPainter.h:65
Definition MapPainter.h:174
Definition MapPainter.h:200
Definition MapPainterGDI.h:38
double width
Definition MapPainterGDI.h:40
std::string character
Definition MapPainterGDI.h:39
double height
Definition MapPainterGDI.h:41
Definition MapPainterGDI.h:32
std::wstring wstr
Definition MapPainterGDI.h:33
void * font
Definition MapPainterGDI.h:34
void * render
Definition MapPainterGDI.h:35
Definition LabelLayouterHelper.h:73