1#ifndef OSMSCOUT_MAP_MAPPAINTERCAIRO_H
2#define OSMSCOUT_MAP_MAPPAINTERCAIRO_H
23#include <osmscoutmapcairo/MapCairoFeatures.h>
26#include <unordered_map>
28#if defined(__WIN32__) || defined(WIN32)
31 #include <cairo/cairo.h>
34#if defined(OSMSCOUT_MAP_CAIRO_HAVE_LIB_PANGO)
35 #include <pango/pangocairo.h>
36 #include <pango/pango-glyph.h>
49#if defined(OSMSCOUT_MAP_CAIRO_HAVE_LIB_PANGO)
52 struct PangoStandaloneGlyph {
53 std::shared_ptr<PangoFont> font;
54 std::shared_ptr<PangoGlyphString> glyphString;
84 using FontMap = std::unordered_map<size_t,CairoFont>;
87 std::vector<cairo_surface_t*> images;
88 std::vector<cairo_surface_t*> patternImages;
89 std::vector<cairo_pattern_t*> patterns;
91 double minimumLineWidth;
97 const MapParameter& parameter,
100 void SetLineAttributes(
const Color& color,
102 const std::vector<double>& dash);
104 void DrawFillStyle(
const Projection& projection,
105 const MapParameter& parameter,
112 const MapParameter& parameter,
113 IconStyle& style)
override;
116 const FillStyle& style);
119 const MapParameter& parameter,
120 double fontSize)
override;
123 const MapParameter& parameter,
124 const FillStyle& style)
override;
127 const MapParameter& parameter,
128 const std::string& text,
131 bool enableWrapping =
false,
132 bool contourLabel =
false);
137 const MapParameter& parameter,
143 const MapParameter ¶meter,
145 const std::vector<CairoGlyph> &glyphs);
149 const MapParameter& parameter,
150 const MapData& data)
override;
157 const MapParameter& parameter,
158 const ObjectFileRef& ref,
159 const std::vector<LabelData>& labels,
160 const Vertex2D& position,
161 double objectWidth)
override;
167 const MapParameter& parameter,
168 const ObjectFileRef& ref,
173 const MapParameter& parameter,
174 const MapData& data)
override;
177 const MapParameter& parameter,
178 const Symbol& symbol,
179 const Vertex2D& screenPos,
180 double scaleFactor)
override;
183 const Vertex2D& centerPos,
184 double width,
double height)
override;
187 const MapParameter& parameter,
190 const std::vector<double>& dash,
191 LineStyle::CapStyle startCap,
192 LineStyle::CapStyle endCap,
193 const CoordBufferRange& coordRange)
override;
196 const MapParameter& parameter,
197 const Symbol& symbol,
201 const MapParameter& parameter,
210 const MapParameter& parameter,
#define OSMSCOUT_MAP_CAIRO_API
Definition MapCairoImportExport.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
void DrawSymbol(const Projection &projection, const MapParameter ¶meter, const Symbol &symbol, const Vertex2D &screenPos, double scaleFactor) override
cairo_scaled_font_t * CairoFont
Definition MapPainterCairo.h:59
osmscout::ScreenVectorRectangle GlyphBoundingBox(const CairoNativeGlyph &glyph) const
void RegisterRegularLabel(const Projection &projection, const MapParameter ¶meter, const ObjectFileRef &ref, const std::vector< LabelData > &labels, const Vertex2D &position, double objectWidth) override
void DrawGlyphs(const Projection &projection, const MapParameter ¶meter, const osmscout::PathTextStyleRef &style, const std::vector< CairoGlyph > &glyphs)
MapPainterCairo(const StyleConfigRef &styleConfig)
bool HasIcon(const StyleConfig &styleConfig, const Projection &projection, const MapParameter ¶meter, IconStyle &style) override
Label< CairoNativeGlyph, CairoNativeLabel > CairoLabel
Definition MapPainterCairo.h:75
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 DrawArea(const Projection &projection, const MapParameter ¶meter, const AreaData &area) override
void DrawLabel(const Projection &projection, const MapParameter ¶meter, const ScreenVectorRectangle &labelRectangle, const LabelData &label, const CairoNativeLabel &layout)
void RegisterContourLabel(const Projection &projection, const MapParameter ¶meter, const ObjectFileRef &ref, const PathLabelData &label, const LabelPath &labelPath) override
double GetFontHeight(const Projection &projection, const MapParameter ¶meter, double fontSize) override
void DrawGround(const Projection &projection, const MapParameter ¶meter, const FillStyle &style) 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
std::shared_ptr< CairoLabel > Layout(const Projection &projection, const MapParameter ¶meter, const std::string &text, double fontSize, double objectWidth, bool enableWrapping=false, bool contourLabel=false)
~MapPainterCairo() override
Glyph< CairoNativeGlyph > CairoGlyph
Definition MapPainterCairo.h:76
void DrawIcon(const IconStyle *style, const Vertex2D ¢erPos, double width, double height) override
bool DrawMap(const Projection &projection, const MapParameter ¶meter, const MapData &data, cairo_t *draw, RenderSteps startStep=RenderSteps::FirstStep, RenderSteps endStep=RenderSteps::LastStep)
void DrawLabels(const Projection &projection, const MapParameter ¶meter, const MapData &data) override
LabelInstance< CairoNativeGlyph, CairoNativeLabel > CairoLabelInstance
Definition MapPainterCairo.h:77
LabelLayouter< CairoNativeGlyph, CairoNativeLabel, MapPainterCairo > CairoLabelLayouter
Definition MapPainterCairo.h:78
bool HasPattern(const MapParameter ¶meter, const FillStyle &style)
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
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
RenderSteps
Definition MapPainter.h:64
@ LastStep
Definition MapPainter.h:92
@ FirstStep
Definition MapPainter.h:65
std::shared_ptr< FillStyle > FillStyleRef
Definition Styles.h:356
Definition MapPainter.h:174
Definition MapPainter.h:200
Definition MapPainterCairo.h:67
double height
Definition MapPainterCairo.h:70
std::string character
Definition MapPainterCairo.h:68
double width
Definition MapPainterCairo.h:69
Definition MapPainterCairo.h:60
cairo_text_extents_t textExtents
Definition MapPainterCairo.h:63
cairo_font_extents_t fontExtents
Definition MapPainterCairo.h:64
std::wstring wstr
Definition MapPainterCairo.h:61
CairoFont font
Definition MapPainterCairo.h:62
Definition LabelLayouterHelper.h:73