2#ifndef OSMSCOUT_MAP_MAPPAINTERSVG_H
3#define OSMSCOUT_MAP_MAPPAINTERSVG_H
29#include <unordered_map>
31#include <osmscoutmapsvg/MapSVGFeatures.h>
33#if defined(OSMSCOUT_MAP_SVG_HAVE_LIB_PANGO)
34 #include <pango/pangoft2.h>
45#if defined(OSMSCOUT_MAP_SVG_HAVE_LIB_PANGO)
48 struct StandaloneGlyph {
49 std::shared_ptr<PangoFont> font;
50 std::shared_ptr<PangoGlyphString> glyphString;
51 std::string character;
57 using FontMap = std::unordered_map<size_t,PangoFontDescription*> ;
58 PangoFontMap *pangoFontMap;
59 PangoContext *pangoContext;
80 friend SvgLabelLayouter;
82 SvgLabelLayouter labelLayouter;
84 std::map<FillStyle,std::string> fillStyleNameMap;
85 std::map<BorderStyle,std::string> borderStyleNameMap;
86 std::map<LineStyle,std::string> lineStyleNameMap;
92 std::vector<std::string> images;
95 std::string GetColorValue(
const Color& color);
99 std::shared_ptr<SvgLabel> Layout(
const Projection& projection,
100 const MapParameter& parameter,
101 const std::string& text,
104 bool enableWrapping =
false,
105 bool contourLabel =
false);
108 const MapParameter& parameter,
114 const MapParameter ¶meter,
116 const std::vector<SvgGlyph> &glyphs);
118#if defined(OSMSCOUT_MAP_SVG_HAVE_LIB_PANGO)
119 PangoFontDescription* GetFont(
const Projection& projection,
120 const MapParameter& parameter,
128 void WriteHeader(
size_t width,
size_t height);
130 const MapParameter& parameter,
134 void StartMainGroup();
135 void FinishMainGroup();
137 std::string StrEscape(
const std::string &str)
const;
140 const MapParameter& parameter);
145 const MapParameter& parameter,
146 const MapData& data)
override;
150 const MapParameter& parameter,
151 const MapData& data)
override;
155 const MapParameter& parameter,
156 const MapData& data)
override;
160 const MapParameter& parameter,
161 IconStyle& style)
override;
164 const MapParameter& parameter,
165 double fontSize)
override;
168 const MapParameter& parameter,
169 const FillStyle& style)
override;
176 const MapParameter ¶meter,
177 const ObjectFileRef& ref,
178 const std::vector<LabelData> &labels,
179 const Vertex2D &position,
180 double objectWidth)
override;
186 const MapParameter ¶meter,
187 const ObjectFileRef& ref,
192 const MapParameter& parameter,
193 const MapData& data)
override;
196 const MapParameter& parameter,
198 const Vertex2D& screenPos,
199 double scaleFactor)
override;
202 const Vertex2D& centerPos,
203 double width,
double height)
override;
206 const MapParameter& parameter,
209 const std::vector<double>& dash,
210 LineStyle::CapStyle startCap,
211 LineStyle::CapStyle endCap,
212 const CoordBufferRange& coordRange)
override;
215 const MapParameter& parameter,
216 const std::string& styleName,
217 const std::optional<Color> &colorOverride,
219 LineStyle::CapStyle startCap,
220 LineStyle::CapStyle endCap,
221 size_t transStart,
size_t transEnd);
225 const MapParameter& parameter,
230 const MapParameter& parameter,
234 const MapParameter& parameter,
235 const Symbol& symbol,
239 const MapParameter& parameter,
248 const MapParameter& parameter,
250 std::ostream& stream);
#define OSMSCOUT_MAP_SVG_API
Definition MapSVGImportExport.h:45
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
MapPainter(const StyleConfigRef &styleConfig)
StyleConfigRef styleConfig
Reference to the style configuration to be used.
Definition MapPainter.h:250
static constexpr double AverageCharacterWidth
Definition MapPainterSVG.h:70
void AfterPreprocessing(const StyleConfig &styleConfig, const Projection &projection, const MapParameter ¶meter, const MapData &data) override
virtual void RegisterContourLabel(const Projection &projection, const MapParameter ¶meter, const ObjectFileRef &ref, const PathLabelData &label, const LabelPath &labelPath) override
void DrawPath(const Projection &projection, const MapParameter ¶meter, const Color &color, double width, const std::vector< double > &dash, LineStyle::CapStyle startCap, LineStyle::CapStyle endCap, const CoordBufferRange &coordRange) override
void DrawContourSymbol(const Projection &projection, const MapParameter ¶meter, const Symbol &symbol, const ContourSymbolData &data) override
void BeforeDrawing(const StyleConfig &styleConfig, const Projection &projection, const MapParameter ¶meter, const MapData &data) override
virtual void DrawLabels(const Projection &projection, const MapParameter ¶meter, const MapData &data) override
std::wstring NativeLabel
Definition MapPainterSVG.h:64
bool HasIcon(const StyleConfig &styleConfig, const Projection &projection, const MapParameter ¶meter, IconStyle &style) override
double GetFontHeight(const Projection &projection, const MapParameter ¶meter, double fontSize) override
void DrawGround(const Projection &projection, const MapParameter ¶meter, const FillStyle &style) override
bool DrawMap(const Projection &projection, const MapParameter ¶meter, const MapData &data, std::ostream &stream)
void DrawPath(const Projection &projection, const MapParameter ¶meter, const std::string &styleName, const std::optional< Color > &colorOverride, double width, LineStyle::CapStyle startCap, LineStyle::CapStyle endCap, size_t transStart, size_t transEnd)
Label< NativeGlyph, NativeLabel > SvgLabel
Definition MapPainterSVG.h:74
void DrawIcon(const IconStyle *style, const Vertex2D ¢erPos, double width, double height) override
~MapPainterSVG() override
void DrawWay(const StyleConfig &styleConfig, const Projection &projection, const MapParameter ¶meter, const WayData &data) override
MapPainterSVG(const StyleConfigRef &styleConfig)
void DrawArea(const Projection &projection, const MapParameter ¶meter, const AreaData &area) override
void AfterDrawing(const StyleConfig &styleConfig, const Projection &projection, const MapParameter ¶meter, const MapData &data) override
virtual void RegisterRegularLabel(const Projection &projection, const MapParameter ¶meter, const ObjectFileRef &ref, const std::vector< LabelData > &labels, const Vertex2D &position, double objectWidth) override
void DrawSymbol(const Projection &projection, const MapParameter ¶meter, const Symbol &style, const Vertex2D &screenPos, double scaleFactor) override
void DrawWayOutline(const StyleConfig &styleConfig, const Projection &projection, const MapParameter ¶meter, const WayData &data)
Definition LabelLayouter.h:46
Definition Projection.h:46
Index selectors by type and level.
Definition StyleConfig.h:552
std::shared_ptr< TypeConfig > TypeConfigRef
Definition TypeConfig.h:1396
std::shared_ptr< PathTextStyle > PathTextStyleRef
Definition Styles.h:890
std::shared_ptr< StyleConfig > StyleConfigRef
Definition StyleConfig.h:859
std::shared_ptr< BorderStyle > BorderStyleRef
Definition Styles.h:464
std::shared_ptr< FillStyle > FillStyleRef
Definition Styles.h:356
Definition MapPainter.h:174
Definition MapPainter.h:200
Definition MapPainterSVG.h:65
double height
Definition MapPainterSVG.h:68
std::string character
Definition MapPainterSVG.h:66
double width
Definition MapPainterSVG.h:67
Definition LabelLayouterHelper.h:73