libosmscout  1.1.1
MapParameter.h
Go to the documentation of this file.
1 #ifndef OSMSCOUT_MAP_MAPPARAMETER_H
2 #define OSMSCOUT_MAP_MAPPARAMETER_H
3 
4 /*
5  This source is part of the libosmscout-map library
6  Copyright (C) 2009, 2015 Tim Teulings
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 
23 #include <list>
24 #include <string>
25 
27 
29 
30 #include <osmscout/util/Breaker.h>
32 
33 namespace osmscout {
34 
40  class OSMSCOUT_MAP_API MapParameter CLASS_FINAL
41  {
42  public:
43  enum class IconMode
44  {
45  FixedSizePixmap, // !< raster icons should be used, iconPixelSize will be used for rendering
46  ScaledPixmap, // !< raster icons should be used, icons will be scaled to iconSize
47  OriginalPixmap, // !< raster icons should be used, icons will keep dimensions of original image
48  Scalable // !< vector icons should be used, icons will be scaled to iconSize
49  };
50 
51  enum class PatternMode
52  {
53  OriginalPixmap, // !< raster pattern should be used, it will keep dimensions of original image
54  Scalable // !< vector pattern should be used, it will be scaled to patternSize
55  };
56 
57  private:
58  std::string fontName;
59  double fontSize;
60 
61  std::list<std::string> iconPaths;
62  std::list<std::string> patternPaths;
63 
64  double lineMinWidthPixel;
65  double areaMinDimensionMM;
66 
67  double sidecarMaxDistanceMM;
68  double sidecarDistance;
69  double sidecarMinDistanceMM;
70 
71  TransPolygon::OptimizeMethod optimizeWayNodes;
72  TransPolygon::OptimizeMethod optimizeAreaNodes;
73  double optimizeErrorToleranceMm;
74  bool drawFadings;
75  bool drawWaysWithFixedWidth;
76 
77  // Node and area labels, icons
78  size_t labelLineMinCharCount;
79  size_t labelLineMaxCharCount;
80  bool labelLineFitToArea;
81  double labelLineFitToWidth;
82 
83  double labelPadding;
84  double plateLabelPadding;
85  double overlayLabelPadding;
86 
87  IconMode iconMode;
88  double iconSize;
89  double iconPixelSize;
90  double iconPadding;
91 
92  PatternMode patternMode;
93  double patternSize;
94 
95  double labelLayouterOverlap;
96 
97  private:
98 // Contour labels
99  double contourLabelOffset;
100  double contourLabelSpace;
101  double contourLabelPadding;
102 
103  std::string routeLabelSeparator;
104 
105  bool renderBackground;
106  bool renderSeaLand;
107  bool renderUnknowns;
108  bool renderContourLines;
109  bool renderHillShading;
110 
111  bool debugData;
112  bool debugPerformance;
113 
114  size_t warnObjectCountLimit;
115  size_t warnCoordCountLimit;
116 
117  bool showAltLanguage;
118 
119  Locale locale;
120 
121  std::vector<FillStyleProcessorRef > fillProcessors;
122 
123  BreakerRef breaker;
124 
125  public:
126  MapParameter();
127 
128  void SetFontName(const std::string& fontName);
129  void SetFontSize(double fontSize);
130 
131  void SetIconPaths(const std::list<std::string>& paths);
132  void SetPatternPaths(const std::list<std::string>& paths);
133 
134  void SetLineMinWidthPixel(double lineMinWidthPixel);
135  void SetAreaMinDimensionMM(double areaMinDimensionMM);
136 
137  void SetSidecarMaxDistanceMM();
138  void SetSidecarDistance();
139  void SetSidecarMinDistanceMM();
140 
141  void SetOptimizeWayNodes(TransPolygon::OptimizeMethod optimize);
142  void SetOptimizeAreaNodes(TransPolygon::OptimizeMethod optimize);
143  void SetOptimizeErrorToleranceMm(double errorToleranceMm);
144 
145  void SetDrawFadings(bool drawFadings);
146  void SetDrawWaysWithFixedWidth(bool drawWaysWithFixedWidth);
147 
148  void SetLabelLineMinCharCount(size_t labelLineMinCharCount);
149  void SetLabelLineMaxCharCount(size_t labelLineMaxCharCount);
150  void SetLabelLineFitToArea(bool labelLineFitToArea);
151  void SetLabelLineFitToWidth(double labelLineFitToWidth);
152 
153  void SetLabelPadding(double labelPadding);
154  void SetPlateLabelPadding(double plateLabelPadding);
155  void SetOverlayLabelPadding(double padding);
156 
157  void SetIconMode(const IconMode &mode);
158  void SetIconSize(double size);
159  void SetIconPixelSize(double size);
160  void SetIconPadding(double padding);
161 
162  void SetPatternMode(const PatternMode &mode);
163  void SetPatternSize(double size);
164 
165  void SetContourLabelPadding(double padding);
166 
167  void SetRouteLabelSeparator(const std::string &separator);
168 
169  void SetLabelLayouterOverlap(double labelLayouterOverlap);
170 
171  void SetContourLabelOffset(double contourLabelOffset);
172  void SetContourLabelSpace(double contourLabelSpace);
173 
174  void SetRenderBackground(bool render);
175  void SetRenderSeaLand(bool render);
176  void SetRenderUnknowns(bool render);
177  void SetRenderContourLines(bool render);
178  void SetRenderHillShading(bool render);
179 
180  void SetDebugData(bool debug);
181  void SetDebugPerformance(bool debug);
182 
183  void SetWarningObjectCountLimit(size_t limit);
184  void SetWarningCoordCountLimit(size_t limit);
185 
186  void SetShowAltLanguage(bool showAltLanguage);
187 
188  void SetLocale(const Locale &locale);
189 
190  void RegisterFillStyleProcessor(size_t typeIndex,
191  const FillStyleProcessorRef& processor);
192 
193  FillStyleProcessorRef GetFillStyleProcessor(size_t typeIndex) const;
194 
195  void SetBreaker(const BreakerRef& breaker);
196 
197 
198  inline std::string GetFontName() const
199  {
200  return fontName;
201  }
202 
203  inline double GetFontSize() const
204  {
205  return fontSize;
206  }
207 
208  inline const std::list<std::string>& GetIconPaths() const
209  {
210  return iconPaths;
211  }
212 
213  inline const std::list<std::string>& GetPatternPaths() const
214  {
215  return patternPaths;
216  }
217 
218  inline double GetLineMinWidthPixel() const
219  {
220  return lineMinWidthPixel;
221  }
222 
223  inline double GetAreaMinDimensionMM() const
224  {
225  return areaMinDimensionMM;
226  }
227 
228  inline double GetSidecarMaxDistanceMM() const
229  {
230  return sidecarMaxDistanceMM;
231  }
232 
233  inline double GetSidecarDistance() const
234  {
235  return sidecarDistance;
236  }
237 
238  inline double GetSidecarMinDistanceMM() const
239  {
240  return sidecarMinDistanceMM;
241  }
242 
243  inline TransPolygon::OptimizeMethod GetOptimizeWayNodes() const
244  {
245  return optimizeWayNodes;
246  }
247 
248  inline TransPolygon::OptimizeMethod GetOptimizeAreaNodes() const
249  {
250  return optimizeAreaNodes;
251  }
252 
253  inline double GetOptimizeErrorToleranceMm() const
254  {
255  return optimizeErrorToleranceMm;
256  }
257 
258  inline bool GetDrawFadings() const
259  {
260  return drawFadings;
261  }
262 
263  inline bool GetDrawWaysWithFixedWidth() const
264  {
265  return drawWaysWithFixedWidth;
266  }
267 
268  inline size_t GetLabelLineMinCharCount() const
269  {
270  return labelLineMinCharCount;
271  }
272 
273  inline size_t GetLabelLineMaxCharCount() const
274  {
275  return labelLineMaxCharCount;
276  }
277 
278  inline bool GetLabelLineFitToArea() const
279  {
280  return labelLineFitToArea;
281  }
282 
283  inline double GetLabelLineFitToWidth() const
284  {
285  return labelLineFitToWidth;
286  }
287 
288  inline double GetLabelPadding() const
289  {
290  return labelPadding;
291  }
292 
293  inline double GetPlateLabelPadding() const
294  {
295  return plateLabelPadding;
296  }
297 
298  inline double GetOverlayLabelPadding() const
299  {
300  return overlayLabelPadding;
301  }
302 
303  inline IconMode GetIconMode() const
304  {
305  return iconMode;
306  }
307 
308  inline double GetIconSize() const
309  {
310  return iconSize;
311  }
312 
313  inline double GetIconPixelSize() const
314  {
315  return iconPixelSize;
316  }
317 
318  inline double GetIconPadding() const
319  {
320  return iconPadding;
321  }
322 
324  {
325  return patternMode;
326  }
327 
328  inline double GetPatternSize() const
329  {
330  return patternSize;
331  }
332 
333  inline double GetContourLabelPadding() const
334  {
335  return contourLabelPadding;
336  }
337 
338  inline std::string GetRouteLabelSeparator() const
339  {
340  return routeLabelSeparator;
341  }
342 
343  inline double GetLabelLayouterOverlap() const
344  {
345  return labelLayouterOverlap;
346  }
347 
348  inline double GetContourLabelOffset() const
349  {
350  return contourLabelOffset;
351  }
352 
353  inline double GetContourLabelSpace() const
354  {
355  return contourLabelSpace;
356  }
357 
358  inline bool GetRenderBackground() const
359  {
360  return renderBackground;
361  }
362 
363  inline bool GetRenderSeaLand() const
364  {
365  return renderSeaLand;
366  }
367 
368  inline bool GetRenderUnknowns() const
369  {
370  return renderUnknowns;
371  }
372 
373  inline bool GetRenderContourLines() const
374  {
375  return renderContourLines;
376  }
377 
378  inline bool GetRenderHillShading() const
379  {
380  return renderHillShading;
381  }
382 
383  inline bool IsDebugPerformance() const
384  {
385  return debugPerformance;
386  }
387 
388  inline bool IsDebugData() const
389  {
390  return debugData;
391  }
392 
393  inline size_t GetWarningObjectCountLimit() const
394  {
395  return warnObjectCountLimit;
396  }
397 
398  inline size_t GetWarningCoordCountLimit() const
399  {
400  return warnCoordCountLimit;
401  }
402 
403  inline bool GetShowAltLanguage() const
404  {
405  return showAltLanguage;
406  }
407 
408  inline Locale GetLocale() const
409  {
410  return locale;
411  }
412 
413  inline Locale& GetLocaleRef()
414  {
415  return locale;
416  }
417 
418  bool IsAborted() const
419  {
420  if (breaker) {
421  return breaker->IsAborted();
422  }
423 
424  return false;
425  }
426  };
427 }
428 
429 #endif
IconMode
Definition: MapParameter.h:43
std::shared_ptr< FillStyleProcessor > FillStyleProcessorRef
Definition: StyleProcessor.h:39
const std::list< std::string > & GetIconPaths() const
Definition: MapParameter.h:208
double GetAreaMinDimensionMM() const
Definition: MapParameter.h:223
size_t GetWarningCoordCountLimit() const
Definition: MapParameter.h:398
PatternMode
Definition: MapParameter.h:51
bool IsAborted() const
Definition: MapParameter.h:418
double GetPlateLabelPadding() const
Definition: MapParameter.h:293
double GetIconPixelSize() const
Definition: MapParameter.h:313
bool GetRenderUnknowns() const
Definition: MapParameter.h:368
double GetLabelLineFitToWidth() const
Definition: MapParameter.h:283
bool GetRenderSeaLand() const
Definition: MapParameter.h:363
double GetOptimizeErrorToleranceMm() const
Definition: MapParameter.h:253
double GetContourLabelOffset() const
Definition: MapParameter.h:348
std::shared_ptr< Breaker > BreakerRef
Definition: Breaker.h:65
double GetLineMinWidthPixel() const
Definition: MapParameter.h:218
const std::list< std::string > & GetPatternPaths() const
Definition: MapParameter.h:213
double GetLabelLayouterOverlap() const
Definition: MapParameter.h:343
size_t GetWarningObjectCountLimit() const
Definition: MapParameter.h:393
double GetLabelPadding() const
Definition: MapParameter.h:288
TransPolygon::OptimizeMethod GetOptimizeWayNodes() const
Definition: MapParameter.h:243
bool GetDrawWaysWithFixedWidth() const
Definition: MapParameter.h:263
double GetSidecarDistance() const
Definition: MapParameter.h:233
Definition: Area.h:38
Locale & GetLocaleRef()
Definition: MapParameter.h:413
bool GetRenderHillShading() const
Definition: MapParameter.h:378
#define CLASS_FINAL
Definition: Compiler.h:26
double GetIconSize() const
Definition: MapParameter.h:308
#define OSMSCOUT_MAP_API
Definition: MapImportExport.h:45
double GetSidecarMinDistanceMM() const
Definition: MapParameter.h:238
double GetIconPadding() const
Definition: MapParameter.h:318
double GetOverlayLabelPadding() const
Definition: MapParameter.h:298
bool IsDebugData() const
Definition: MapParameter.h:388
bool GetLabelLineFitToArea() const
Definition: MapParameter.h:278
PatternMode GetPatternMode() const
Definition: MapParameter.h:323
double GetSidecarMaxDistanceMM() const
Definition: MapParameter.h:228
bool GetShowAltLanguage() const
Definition: MapParameter.h:403
std::string GetFontName() const
Definition: MapParameter.h:198
bool IsDebugPerformance() const
Definition: MapParameter.h:383
size_t GetLabelLineMinCharCount() const
Definition: MapParameter.h:268
double GetContourLabelSpace() const
Definition: MapParameter.h:353
Locale GetLocale() const
Definition: MapParameter.h:408
size_t GetLabelLineMaxCharCount() const
Definition: MapParameter.h:273
std::string GetRouteLabelSeparator() const
Definition: MapParameter.h:338
double GetFontSize() const
Definition: MapParameter.h:203
bool GetRenderContourLines() const
Definition: MapParameter.h:373
double GetContourLabelPadding() const
Definition: MapParameter.h:333
double GetPatternSize() const
Definition: MapParameter.h:328
TransPolygon::OptimizeMethod GetOptimizeAreaNodes() const
Definition: MapParameter.h:248
bool GetDrawFadings() const
Definition: MapParameter.h:258
bool GetRenderBackground() const
Definition: MapParameter.h:358
IconMode GetIconMode() const
Definition: MapParameter.h:303