libosmscout 1.1.1
Loading...
Searching...
No Matches
Styles.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_STYLES_H
2#define OSMSCOUT_STYLES_H
3
4/*
5 This source is part of the libosmscout library
6 Copyright (C) 2009 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 <set>
25#include <vector>
26
28
29#include <osmscout/Pixel.h>
30
32
33#include <osmscout/util/Color.h>
36
38
39namespace osmscout {
40
64
65 extern bool IsLaneOffset(OffsetRel rel);
66
69
75 class OSMSCOUT_MAP_API LineStyle CLASS_FINAL : public Style
76 {
77 public:
83
99
100 private:
101 std::string slot;
102 Color lineColor;
103 Color gapColor;
104 bool preferColorFeature;
105 double displayWidth;
106 double width;
107 double displayOffset;
108 double offset;
109 CapStyle joinCap;
110 CapStyle endCap;
111 std::vector<double> dash;
112 int priority;
113 int zIndex;
114 OffsetRel offsetRel;
115
116 public:
118
119 void SetColorValue(int attribute, const Color& value) override;
120 void SetDoubleValue(int attribute, double value) override;
121 void SetDoubleArrayValue(int attribute, const std::vector<double>& value) override;
122 void SetIntValue(int attribute, int value) override;
123 void SetBoolValue(int attribute, bool value) override;
124
125 LineStyle& SetSlot(const std::string& slot);
126
131 LineStyle& SetWidth(double value);
133 LineStyle& SetOffset(double value);
136 LineStyle& SetDashes(const std::vector<double>& dashes);
137 LineStyle& SetPriority(int priority);
138 LineStyle& SetZIndex(int zIndex);
140
141 bool IsVisible() const
142 {
143 return (displayWidth>0.0 ||
144 width>0.0) &&
145 lineColor.IsVisible();
146 }
147
148 const std::string& GetSlot() const
149 {
150 return slot;
151 }
152
153 const Color& GetLineColor() const
154 {
155 return lineColor;
156 }
157
158 const Color& GetGapColor() const
159 {
160 return gapColor;
161 }
162
164 {
165 return preferColorFeature;
166 }
167
168 double GetDisplayWidth() const
169 {
170 return displayWidth;
171 }
172
173 double GetWidth() const
174 {
175 return width;
176 }
177
178 double GetDisplayOffset() const
179 {
180 return displayOffset;
181 }
182
183 double GetOffset() const
184 {
185 return offset;
186 }
187
189 {
190 return joinCap;
191 }
192
194 {
195 return endCap;
196 }
197
198 bool HasDashes() const
199 {
200 return !dash.empty();
201 }
202
203 const std::vector<double>& GetDash() const
204 {
205 return dash;
206 }
207
208 int GetPriority() const
209 {
210 return priority;
211 }
212
213 int GetZIndex() const
214 {
215 return zIndex;
216 }
217
219 {
220 return offsetRel;
221 }
222
224
225 void CopyAttributes(const LineStyle& other,
226 const std::set<Attribute>& attributes);
227
228 bool operator==(const LineStyle& other) const;
229 bool operator!=(const LineStyle& other) const;
230 bool operator<(const LineStyle& other) const;
231 };
232
233 class OSMSCOUT_MAP_API CapStyleEnumAttributeDescriptor CLASS_FINAL : public StyleEnumAttributeDescriptor
234 {
235 public:
236 CapStyleEnumAttributeDescriptor(const std::string& name,
237 int attribute)
239 attribute)
240 {
241 AddEnumValue("butt",LineStyle::capButt);
242 AddEnumValue("round",LineStyle::capRound);
243 AddEnumValue("square",LineStyle::capSquare);
244 }
245 };
246
247 class OSMSCOUT_MAP_API OffsetRelAttributeDescriptor CLASS_FINAL : public StyleEnumAttributeDescriptor
248 {
249 public:
250 OffsetRelAttributeDescriptor(const std::string& name,
251 int attribute)
253 attribute)
254 {
259
260 AddEnumValue2("laneForwardLeft",OffsetRel::laneForwardLeft);
261 AddEnumValue2("laneForwardThroughLeft",OffsetRel::laneForwardThroughLeft);
262 AddEnumValue2("laneForwardThrough",OffsetRel::laneForwardThrough);
263 AddEnumValue2("laneForwardThroughRight",OffsetRel::laneForwardThroughRight);
264 AddEnumValue2("laneForwardRight",OffsetRel::laneForwardRight);
265 AddEnumValue2("laneBackwardLeft",OffsetRel::laneBackwardLeft);
266 AddEnumValue2("laneBackwardThroughLeft",OffsetRel::laneBackwardThroughLeft);
267 AddEnumValue2("laneBackwardThrough",OffsetRel::laneBackwardThrough);
268 AddEnumValue2("laneBackwardThroughRight",OffsetRel::laneBackwardThroughRight);
269 AddEnumValue2("laneBackwardRight",OffsetRel::laneBackwardRight);
270
272 }
273
274 void AddEnumValue2(const std::string& name,
275 OffsetRel value)
276 {
277 AddEnumValue(name, static_cast<int>(value));
278 }
279 };
280
281 using LineStyleRef = std::shared_ptr<LineStyle>;
282
288 class OSMSCOUT_MAP_API FillStyle CLASS_FINAL : public Style
289 {
290 public:
296
297 private:
298 Color fillColor;
299 std::string pattern;
300 mutable size_t patternId;
301 Magnification patternMinMag;
302
303 public:
305
306 void SetStringValue(int attribute, const std::string& value) override;
307 void SetColorValue(int attribute, const Color& value) override;
308 void SetMagnificationValue(int attribute, const Magnification& value) override;
309
311 FillStyle& SetPattern(const std::string& pattern);
312 void SetPatternId(size_t id) const;
314
315 bool IsVisible() const
316 {
317 return (fillColor.IsVisible() ||
318 !pattern.empty());
319 }
320
321 const Color& GetFillColor() const
322 {
323 return fillColor;
324 }
325
326 bool HasPattern() const
327 {
328 return !pattern.empty();
329 }
330
331 std::string GetPatternName() const
332 {
333 return pattern;
334 }
335
336 size_t GetPatternId() const
337 {
338 return patternId;
339 }
340
342 {
343 return patternMinMag;
344 }
345
347
348 void CopyAttributes(const FillStyle& other,
349 const std::set<Attribute>& attributes);
350
351 bool operator==(const FillStyle& other) const;
352 bool operator!=(const FillStyle& other) const;
353 bool operator<(const FillStyle& other) const;
354 };
355
356 using FillStyleRef = std::shared_ptr<FillStyle>;
357
363 class OSMSCOUT_MAP_API BorderStyle CLASS_FINAL : public Style
364 {
365 public:
375
376 private:
377 std::string slot;
378 Color color;
379 Color gapColor;
380 double width;
381 std::vector<double> dash;
382 double displayOffset;
383 double offset;
384 int priority;
385
386 public:
388
389 void SetColorValue(int attribute, const Color& value) override;
390 void SetDoubleValue(int attribute, double value) override;
391 void SetDoubleArrayValue(int attribute, const std::vector<double>& value) override;
392 void SetIntValue(int attribute, int value) override;
393
394 BorderStyle& SetSlot(const std::string& slot);
395
396 BorderStyle& SetColor(const Color& color);
398 BorderStyle& SetWidth(double value);
399 BorderStyle& SetDashes(const std::vector<double>& dashes);
401 BorderStyle& SetOffset(double value);
402 BorderStyle& SetPriority(int priority);
403
404 bool IsVisible() const
405 {
406 return width>0 && color.IsVisible();
407 }
408
409 const std::string& GetSlot() const
410 {
411 return slot;
412 }
413
414 const Color& GetColor() const
415 {
416 return color;
417 }
418
419 const Color& GetGapColor() const
420 {
421 return gapColor;
422 }
423
424 double GetWidth() const
425 {
426 return width;
427 }
428
429 bool HasDashes() const
430 {
431 return !dash.empty();
432 }
433
434 const std::vector<double>& GetDash() const
435 {
436 return dash;
437 }
438
439 double GetDisplayOffset() const
440 {
441 return displayOffset;
442 }
443
444 double GetOffset() const
445 {
446 return offset;
447 }
448
449 int GetPriority() const
450 {
451 return priority;
452 }
453
455
456 void CopyAttributes(const BorderStyle& other,
457 const std::set<Attribute>& attributes);
458
459 bool operator==(const BorderStyle& other) const;
460 bool operator!=(const BorderStyle& other) const;
461 bool operator<(const BorderStyle& other) const;
462 };
463
464 using BorderStyleRef = std::shared_ptr<BorderStyle>;
465
473 {
474 private:
475 size_t priority;
476 double size;
477
478 public:
480
481 virtual bool IsVisible() const = 0;
482 virtual double GetAlpha() const = 0;
483
484 LabelStyle& SetPriority(size_t priority);
485
486 virtual LabelStyle& SetSize(double size);
487
488 size_t GetPriority() const
489 {
490 return priority;
491 }
492
493 double GetSize() const
494 {
495 return size;
496 }
497 };
498
499 using LabelStyleRef = std::shared_ptr<LabelStyle>;
500
506 class OSMSCOUT_MAP_API TextStyle CLASS_FINAL : public LabelStyle
507 {
508 public:
513
525
526 private:
527 std::string slot;
528 LabelProviderRef label;
529 size_t position;
530 Color textColor;
531 Color emphasizeColor;
532 Style style;
533 Magnification scaleAndFadeMag;
534 bool autoSize;
535
536 public:
538
539 void SetBoolValue(int attribute, bool value) override;
540 void SetColorValue(int attribute, const Color& value) override;
541 void SetMagnificationValue(int attribute, const Magnification& value) override;
542 void SetDoubleValue(int attribute, double value) override;
543 void SetIntValue(int attribute, int value) override;
544 void SetUIntValue(int attribute, size_t value) override;
545 void SetLabelValue(int attribute, const LabelProviderRef& value) override;
546
547 TextStyle& SetSlot(const std::string& slot);
548
549 TextStyle& SetSize(double size) override;
551 TextStyle& SetPosition(size_t position);
556 TextStyle& SetAutoSize(bool autoSize);
557
558 bool IsVisible() const override
559 {
560 return label &&
561 GetTextColor().IsVisible();
562 }
563
564 double GetAlpha() const override
565 {
566 return textColor.GetA();
567 }
568
569 const std::string& GetSlot() const
570 {
571 return slot;
572 }
573
575 {
576 return label;
577 }
578
579 size_t GetPosition() const
580 {
581 return position;
582 }
583
584 const Color& GetTextColor() const
585 {
586 return textColor;
587 }
588
590 {
591 return emphasizeColor;
592 }
593
594 const Style& GetStyle() const
595 {
596 return style;
597 }
598
600 {
601 return scaleAndFadeMag;
602 }
603
604 bool GetAutoSize() const
605 {
606 return autoSize;
607 }
608
610
611 void CopyAttributes(const TextStyle& other,
612 const std::set<Attribute>& attributes);
613
614 bool operator==(const TextStyle& other) const;
615 bool operator!=(const TextStyle& other) const;
616 bool operator<(const TextStyle& other) const;
617 };
618
619 class OSMSCOUT_MAP_API TextStyleEnumAttributeDescriptor CLASS_FINAL : public StyleEnumAttributeDescriptor
620 {
621 public:
622 TextStyleEnumAttributeDescriptor(const std::string& name,
623 int attribute)
625 attribute)
626 {
627 AddEnumValue("normal",TextStyle::normal);
628 AddEnumValue("emphasize",TextStyle::emphasize);
629 }
630 };
631
632 using TextStyleRef = std::shared_ptr<TextStyle>;
633
640 {
641 public:
650
651 private:
652 LabelProviderRef label;
653 Color textColor;
654 Color bgColor;
655 Color borderColor;
656
657 public:
659
661 ShieldStyle& SetSize(double size) override;
662 ShieldStyle& SetTextColor(const Color& color);
663 ShieldStyle& SetBgColor(const Color& color);
664 ShieldStyle& SetBorderColor(const Color& color);
665
666 bool IsVisible() const override
667 {
668 return label &&
669 GetTextColor().IsVisible();
670 }
671
672 double GetAlpha() const override
673 {
674 return textColor.GetA();
675 }
676
678 {
679 return label;
680 }
681
682 const Color& GetTextColor() const
683 {
684 return textColor;
685 }
686
687 const Color& GetBgColor() const
688 {
689 return bgColor;
690 }
691
692 const Color& GetBorderColor() const
693 {
694 return borderColor;
695 }
696
697 void CopyAttributes(const ShieldStyle& other,
698 const std::set<Attribute>& attributes);
699 };
700
701 using ShieldStyleRef = std::shared_ptr<ShieldStyle>;
702
711 {
712 public:
722
723 private:
724 ShieldStyleRef shieldStyle;
725 double shieldSpace;
726
727 public:
729 // Explicit copy constructor because of shieldStyle attribute
732
734 PathShieldStyle& operator=(const PathShieldStyle&& style) = delete;
735
736 void SetLabelValue(int attribute, const LabelProviderRef& value) override;
737 void SetColorValue(int attribute, const Color& value) override;
738 void SetDoubleValue(int attribute, double value) override;
739 void SetUIntValue(int attribute, size_t value) override;
740
742 PathShieldStyle& SetPriority(size_t priority);
744 PathShieldStyle& SetTextColor(const Color& color);
745 PathShieldStyle& SetBgColor(const Color& color);
746 PathShieldStyle& SetBorderColor(const Color& color);
747 PathShieldStyle& SetShieldSpace(double shieldSpace);
748
749 bool IsVisible() const
750 {
751 return shieldStyle->IsVisible();
752 }
753
754 double GetAlpha() const
755 {
756 return shieldStyle->GetAlpha();
757 }
758
759 size_t GetPriority() const
760 {
761 return shieldStyle->GetPriority();
762 }
763
764 double GetSize() const
765 {
766 return shieldStyle->GetSize();
767 }
768
770 {
771 return shieldStyle->GetLabel();
772 }
773
774 const Color& GetTextColor() const
775 {
776 return shieldStyle->GetTextColor();
777 }
778
779 const Color& GetBgColor() const
780 {
781 return shieldStyle->GetBgColor();
782 }
783
784 const Color& GetBorderColor() const
785 {
786 return shieldStyle->GetBorderColor();
787 }
788
789 double GetShieldSpace() const
790 {
791 return shieldSpace;
792 }
793
795 {
796 return shieldStyle;
797 }
798
800
802 const std::set<Attribute>& attributes);
803 };
804
805 using PathShieldStyleRef = std::shared_ptr<PathShieldStyle>;
806
813 class OSMSCOUT_MAP_API PathTextStyle CLASS_FINAL : public Style
814 {
815 public:
824
825 private:
826 LabelProviderRef label;
827 double size;
828 Color textColor;
829 double displayOffset;
830 double offset;
831 size_t priority;
832
833 public:
835
836 void SetColorValue(int attribute, const Color& value) override;
837 void SetDoubleValue(int attribute, double value) override;
838 void SetLabelValue(int attribute, const LabelProviderRef& value) override;
839 void SetUIntValue(int attribute, size_t value) override;
840
842 PathTextStyle& SetSize(double size);
845 PathTextStyle& SetOffset(double value);
847
848 bool IsVisible() const
849 {
850 return label &&
851 textColor.IsVisible();
852 }
853
855 {
856 return label;
857 }
858
859 double GetSize() const
860 {
861 return size;
862 }
863
864 const Color& GetTextColor() const
865 {
866 return textColor;
867 }
868
869 double GetDisplayOffset() const
870 {
871 return displayOffset;
872 }
873
874 double GetOffset() const
875 {
876 return offset;
877 }
878
879 size_t GetPriority() const
880 {
881 return priority;
882 }
883
885
886 void CopyAttributes(const PathTextStyle& other,
887 const std::set<Attribute>& attributes);
888 };
889
890 using PathTextStyleRef = std::shared_ptr<PathTextStyle>;
891
897 class OSMSCOUT_MAP_API IconStyle CLASS_FINAL : public Style
898 {
899 public:
907
908 private:
909 SymbolRef symbol;
910 std::string iconName;
911 size_t iconId;
912 unsigned int width;
913 unsigned int height;
914 size_t position;
915 size_t priority;
916 bool overlay;
917
918 public:
920
921 void SetBoolValue(int attribute, bool value) override;
922 void SetStringValue(int attribute, const std::string& value) override;
923 void SetSymbolValue(int attribute, const SymbolRef& value) override;
924 void SetUIntValue(int attribute, size_t value) override;
925
927 IconStyle& SetIconName(const std::string& iconName);
928 IconStyle& SetIconId(size_t id);
929 IconStyle& SetWidth(unsigned int w);
930 IconStyle& SetHeight(unsigned int h);
931 IconStyle& SetPosition(size_t position);
932 IconStyle& SetPriority(size_t priority);
933 IconStyle& SetOverlay(bool overlay);
934
935 size_t GetPriority() const
936 {
937 return priority;
938 }
939
940 bool IsVisible() const
941 {
942 return !iconName.empty() ||
943 symbol;
944 }
945
946 const SymbolRef& GetSymbol() const
947 {
948 return symbol;
949 }
950
951 std::string GetIconName() const
952 {
953 return iconName;
954 }
955
956 size_t GetIconId() const
957 {
958 return iconId;
959 }
960
961 unsigned int GetWidth() const
962 {
963 return width;
964 }
965
966 unsigned int GetHeight() const
967 {
968 return height;
969 }
970
971 size_t GetPosition() const
972 {
973 return position;
974 }
975
976 bool IsOverlay() const
977 {
978 return overlay;
979 }
980
982
983 void CopyAttributes(const IconStyle& other,
984 const std::set<Attribute>& attributes);
985 };
986
987 using IconStyleRef = std::shared_ptr<IconStyle>;
988
994 {
995
996 private:
997 FillStyleRef fillStyle;
998 BorderStyleRef borderStyle;
999
1000 public:
1001 DrawPrimitive(const FillStyleRef& fillStyle,
1002 const BorderStyleRef& borderStyle);
1003 virtual ~DrawPrimitive() = default;
1004
1006 {
1007 return fillStyle;
1008 }
1009
1011 {
1012 return borderStyle;
1013 }
1014
1015 virtual ScreenBox GetBoundingBox() const = 0;
1016 };
1017
1018 using DrawPrimitiveRef = std::shared_ptr<DrawPrimitive>;
1019
1024 class OSMSCOUT_MAP_API PolygonPrimitive CLASS_FINAL : public DrawPrimitive
1025 {
1026 private:
1027 std::list<Vertex2D> coords;
1028
1029 public:
1031 const BorderStyleRef& borderStyle);
1032
1034
1035 const std::list<Vertex2D>& GetCoords() const
1036 {
1037 return coords;
1038 }
1039
1040 ScreenBox GetBoundingBox() const override;
1041 };
1042
1043 using PolygonPrimitiveRef = std::shared_ptr<PolygonPrimitive>;
1044
1049 class OSMSCOUT_MAP_API RectanglePrimitive CLASS_FINAL : public DrawPrimitive
1050 {
1051 private:
1052 Vertex2D topLeft;
1053 double width;
1054 double height;
1055
1056 public:
1058 double width,
1059 double height,
1060 const FillStyleRef& fillStyle,
1061 const BorderStyleRef& borderStyle);
1062
1063 const Vertex2D& GetTopLeft() const
1064 {
1065 return topLeft;
1066 }
1067
1068 const double& GetWidth() const
1069 {
1070 return width;
1071 }
1072
1073 const double& GetHeight() const
1074 {
1075 return height;
1076 }
1077
1078 ScreenBox GetBoundingBox() const override;
1079 };
1080
1081 using RectanglePrimitiveRef = std::shared_ptr<RectanglePrimitive>;
1082
1087 class OSMSCOUT_MAP_API CirclePrimitive CLASS_FINAL : public DrawPrimitive
1088 {
1089 private:
1090 Vertex2D center;
1091 double radius;
1092
1093 public:
1095 double radius,
1096 const FillStyleRef& fillStyle,
1097 const BorderStyleRef& borderStyle);
1098
1099 const Vertex2D& GetCenter() const
1100 {
1101 return center;
1102 }
1103
1104 const double& GetRadius() const
1105 {
1106 return radius;
1107 }
1108
1109 ScreenBox GetBoundingBox() const override;
1110 };
1111
1112 using CirclePrimitiveRef = std::shared_ptr<CirclePrimitive>;
1113
1120 class OSMSCOUT_MAP_API Symbol CLASS_FINAL
1121 {
1122 public:
1123 enum class ProjectionMode {
1124 MAP,
1125 GROUND
1126 };
1127
1128 private:
1129 std::string name;
1130 ProjectionMode projectionMode;
1131 std::list<DrawPrimitiveRef> primitives;
1132 ScreenBox mapBoundingBox;
1133 ScreenBox groundBoundingBox;
1134 double maxBorderWidth=0;
1135
1136 public:
1137 explicit Symbol(const std::string& name,
1138 ProjectionMode projectionMode);
1139
1140 void AddPrimitive(const DrawPrimitiveRef& primitive);
1141
1142 std::string GetName() const
1143 {
1144 return name;
1145 }
1146
1147 Symbol::ProjectionMode GetProjectionMode() const
1148 {
1149 return projectionMode;
1150 }
1151
1152 const std::list<DrawPrimitiveRef>& GetPrimitives() const
1153 {
1154 return primitives;
1155 }
1156
1160 ScreenBox GetBoundingBox(const Projection &projection) const
1161 {
1162 if (projectionMode==ProjectionMode::GROUND) {
1163 return {Vertex2D(projection.GetMeterInPixel() * groundBoundingBox.GetMinX(),
1164 projection.GetMeterInPixel() * groundBoundingBox.GetMinY()),
1165 Vertex2D(projection.GetMeterInPixel() * groundBoundingBox.GetMaxX(),
1166 projection.GetMeterInPixel() * groundBoundingBox.GetMaxY())};
1167 }
1168 else {
1169 return {Vertex2D(projection.ConvertWidthToPixel(mapBoundingBox.GetMinX()),
1170 projection.ConvertWidthToPixel(mapBoundingBox.GetMinY())),
1171 Vertex2D(projection.ConvertWidthToPixel(mapBoundingBox.GetMaxX()),
1172 projection.ConvertWidthToPixel(mapBoundingBox.GetMaxY()))};
1173 }
1174 }
1175
1183 double GetMaxBorderWidth(const Projection &projection) const
1184 {
1185 return projection.ConvertWidthToPixel(maxBorderWidth);
1186 }
1187
1191 double GetWidth(const Projection &projection) const
1192 {
1193 return std::max(projection.ConvertWidthToPixel(mapBoundingBox.GetWidth()),
1194 projection.GetMeterInPixel() * groundBoundingBox.GetWidth());
1195 }
1196
1200 double GetHeight(const Projection &projection) const
1201 {
1202 return std::max(projection.ConvertWidthToPixel(mapBoundingBox.GetHeight()),
1203 projection.GetMeterInPixel() * groundBoundingBox.GetHeight());
1204 }
1205
1206 };
1207
1213 class OSMSCOUT_MAP_API PathSymbolStyle CLASS_FINAL : public Style
1214 {
1215 public:
1216 enum class RenderMode : int {
1217 fixed,
1218 scale
1219 };
1220
1230
1231 private:
1232 std::string slot;
1233 SymbolRef symbol;
1234 RenderMode renderMode=RenderMode::fixed;
1235 double scale=1.0;
1236 double symbolSpace=15.0;
1237 double displayOffset=0.0;
1238 double offset=0.0;
1239 OffsetRel offsetRel{OffsetRel::base};
1240
1241 public:
1242 PathSymbolStyle() = default;
1243
1244 void SetDoubleValue(int attribute, double value) override;
1245 void SetSymbolValue(int attribute, const SymbolRef& value) override;
1246 void SetIntValue(int attribute, int value) override;
1247
1248 PathSymbolStyle& SetSlot(const std::string& slot);
1249
1257
1258 bool IsVisible() const
1259 {
1260 return (bool)symbol;
1261 }
1262
1263 const std::string& GetSlot() const
1264 {
1265 return slot;
1266 }
1267
1268 const SymbolRef& GetSymbol() const
1269 {
1270 return symbol;
1271 }
1272
1274 {
1275 return renderMode;
1276 }
1277
1278 double GetScale() const
1279 {
1280 return scale;
1281 }
1282
1283 double GetSymbolSpace() const
1284 {
1285 return symbolSpace;
1286 }
1287
1288 bool HasDisplayOffset() const
1289 {
1290 return displayOffset!=0.0;
1291 }
1292
1293 double GetDisplayOffset() const
1294 {
1295 return displayOffset;
1296 }
1297
1298 bool HasOffset() const
1299 {
1300 return offset!=0.0;
1301 }
1302
1303 double GetOffset() const
1304 {
1305 return offset;
1306 }
1307
1309 {
1310 return offsetRel;
1311 }
1312
1314
1316 const std::set<Attribute>& attributes);
1317 };
1318
1319 using PathSymbolStyleRef = std::shared_ptr<PathSymbolStyle>;
1320
1321 class OSMSCOUT_MAP_API RenderModeEnumAttributeDescriptor CLASS_FINAL : public StyleEnumAttributeDescriptor
1322 {
1323 public:
1324 RenderModeEnumAttributeDescriptor(const std::string& name,
1325 int attribute)
1327 attribute)
1328 {
1329 AddEnumValue("fixed",(int)PathSymbolStyle::RenderMode::fixed);
1330 AddEnumValue("scale",(int)PathSymbolStyle::RenderMode::scale);
1331 }
1332 };
1333
1334}
1335
1336#endif
#define CLASS_FINAL
Definition Compiler.h:26
#define OSMSCOUT_MAP_API
Definition MapImportExport.h:45
Definition Area.h:88
bool operator!=(const LineStyle &other) const
TextStyle & SetAutoSize(bool autoSize)
double GetHeight(const Projection &projection) const
Definition Styles.h:1200
const Color & GetEmphasizeColor() const
Definition Styles.h:589
size_t GetPosition() const
Definition Styles.h:579
double GetWidth() const
Definition Styles.h:173
BorderStyle & SetWidth(double value)
RenderMode
Definition Styles.h:1216
const GeoCoord coord
Definition RouteStateAgent.h:49
PathSymbolStyle & SetOffsetRel(OffsetRel offsetRel)
double GetAlpha() const override
Definition Styles.h:564
void SetDoubleValue(int attribute, double value) override
OffsetRelAttributeDescriptor(const std::string &name, int attribute)
Definition Styles.h:250
PathSymbolStyle & SetScale(double scale)
PathTextStyle & SetTextColor(const Color &color)
void CopyAttributes(const TextStyle &other, const std::set< Attribute > &attributes)
PolygonPrimitive(const FillStyleRef &fillStyle, const BorderStyleRef &borderStyle)
bool IsOverlay() const
Definition Styles.h:976
BorderStyle & SetPriority(int priority)
bool GetPreferColorFeature() const
Definition Styles.h:163
TextStyle & SetTextColor(const Color &color)
size_t GetPatternId() const
Definition Styles.h:336
BorderStyle & SetDashes(const std::vector< double > &dashes)
double GetDisplayOffset() const
Definition Styles.h:178
bool HasPattern() const
Definition Styles.h:326
bool HasDisplayOffset() const
Definition Styles.h:1288
PathTextStyle & SetPriority(size_t value)
TextStyle & SetSlot(const std::string &slot)
void SetColorValue(int attribute, const Color &value) override
CirclePrimitive(const Vertex2D &center, double radius, const FillStyleRef &fillStyle, const BorderStyleRef &borderStyle)
CapStyleEnumAttributeDescriptor(const std::string &name, int attribute)
Definition Styles.h:236
const Color & GetFillColor() const
Definition Styles.h:321
unsigned int GetWidth() const
Definition Styles.h:961
bool operator!=(const TextStyle &other) const
BorderStyle & SetGapColor(const Color &color)
TextStyleEnumAttributeDescriptor(const std::string &name, int attribute)
Definition Styles.h:622
TextStyle & SetScaleAndFadeMag(const Magnification &mag)
int GetPriority() const
Definition Styles.h:208
IconStyle & SetPriority(size_t priority)
void SetUIntValue(int attribute, size_t value) override
RenderModeEnumAttributeDescriptor(const std::string &name, int attribute)
Definition Styles.h:1324
FillStyle & SetPattern(const std::string &pattern)
std::string GetName() const
Definition Styles.h:1142
const std::list< DrawPrimitiveRef > & GetPrimitives() const
Definition Styles.h:1152
std::vector< Coord > coords
Optional coordinates for coastline.
Definition GroundTile.h:99
BorderStyle & SetDisplayOffset(double value)
LineStyle & SetDashes(const std::vector< double > &dashes)
double GetScale() const
Definition Styles.h:1278
bool operator<(const LineStyle &other) const
IconStyle & SetWidth(unsigned int w)
bool GetAutoSize() const
Definition Styles.h:604
bool HasOffset() const
Definition Styles.h:1298
const double & GetWidth() const
Definition Styles.h:1068
const LabelProviderRef & GetLabel() const
Definition Styles.h:574
size_t GetIconId() const
Definition Styles.h:956
LineStyle & SetPreferColorFeature(bool value)
PathSymbolStyle & SetOffset(double value)
const Magnification & GetPatternMinMag() const
Definition Styles.h:341
const Vertex2D & GetTopLeft() const
Definition Styles.h:1063
void CopyAttributes(const FillStyle &other, const std::set< Attribute > &attributes)
std::string GetIconName() const
Definition Styles.h:951
LineStyle & SetGapColor(const Color &color)
FillStyle & SetFillColor(const Color &color)
unsigned int GetHeight() const
Definition Styles.h:966
bool operator==(const LineStyle &other) const
CapStyle
Definition Styles.h:78
@ capRound
Definition Styles.h:80
@ capButt
Definition Styles.h:79
@ capSquare
Definition Styles.h:81
const std::list< Vertex2D > & GetCoords() const
Definition Styles.h:1035
LineStyle & SetPriority(int priority)
bool IsVisible() const override
Definition Styles.h:558
TextStyle & SetPosition(size_t position)
bool HasDashes() const
Definition Styles.h:198
const Color & GetTextColor() const
Definition Styles.h:584
CapStyle GetEndCap() const
Definition Styles.h:193
Attribute
Definition Styles.h:84
@ attrPatternMinMag
Definition Styles.h:294
@ attrScaleAndFadeMag
Definition Styles.h:522
@ attrGapColor
Definition Styles.h:86
@ attrSymbol
Definition Styles.h:901
@ attrLineColor
Definition Styles.h:85
@ attrOffset
Definition Styles.h:91
@ attrSymbolSpace
Definition Styles.h:1225
@ attrFillColor
Definition Styles.h:292
@ attrPosition
Definition Styles.h:518
@ attrIconName
Definition Styles.h:902
@ attrDisplayOffset
Definition Styles.h:90
@ attrZIndex
Definition Styles.h:96
@ attrEndCap
Definition Styles.h:93
@ attrAutoSize
Definition Styles.h:523
@ attrPriority
Definition Styles.h:95
@ attrColor
Definition Styles.h:367
@ attrEmphasizeColor
Definition Styles.h:520
@ attrOffsetRel
Definition Styles.h:97
@ attrPattern
Definition Styles.h:293
@ attrDashes
Definition Styles.h:94
@ attrPreferColorFeature
Definition Styles.h:87
@ attrSize
Definition Styles.h:516
@ attrDisplayWidth
Definition Styles.h:88
@ attrTextColor
Definition Styles.h:519
@ attrLabel
Definition Styles.h:517
@ attrScale
Definition Styles.h:1224
@ attrRenderMode
Definition Styles.h:1223
@ attrOverlay
Definition Styles.h:905
@ attrWidth
Definition Styles.h:89
@ attrJoinCap
Definition Styles.h:92
@ attrStyle
Definition Styles.h:521
PathTextStyle & SetLabel(const LabelProviderRef &label)
Symbol::ProjectionMode GetProjectionMode() const
Definition Styles.h:1147
void CopyAttributes(const LineStyle &other, const std::set< Attribute > &attributes)
PathSymbolStyle & SetSymbol(const SymbolRef &symbol)
std::string GetPatternName() const
Definition Styles.h:331
PathSymbolStyle & SetSlot(const std::string &slot)
bool operator==(const BorderStyle &other) const
const std::vector< double > & GetDash() const
Definition Styles.h:203
LineStyle & SetLineColor(const Color &color)
LineStyle & SetWidth(double value)
BorderStyle & SetSlot(const std::string &slot)
void SetSymbolValue(int attribute, const SymbolRef &value) override
PathSymbolStyle & SetSymbolSpace(double space)
const SymbolRef & GetSymbol() const
Definition Styles.h:946
void AddEnumValue2(const std::string &name, OffsetRel value)
Definition Styles.h:274
const Color & GetGapColor() const
Definition Styles.h:158
const double & GetHeight() const
Definition Styles.h:1073
RenderMode GetRenderMode() const
Definition Styles.h:1273
void CopyAttributes(const PathSymbolStyle &other, const std::set< Attribute > &attributes)
LineStyle & SetOffset(double value)
void SetDoubleArrayValue(int attribute, const std::vector< double > &value) override
bool IsVisible() const
Definition Styles.h:141
void SetMagnificationValue(int attribute, const Magnification &value) override
PathTextStyle & SetDisplayOffset(double value)
PathSymbolStyle & SetDisplayOffset(double value)
int GetZIndex() const
Definition Styles.h:213
double GetOffset() const
Definition Styles.h:183
static StyleDescriptorRef GetDescriptor()
ScreenBox GetBoundingBox() const override
PathSymbolStyle & SetRenderMode(RenderMode renderMode)
LineStyle & SetEndCap(CapStyle endCap)
IconStyle & SetPosition(size_t position)
size_t GetPriority() const
Definition Styles.h:879
void SetIntValue(int attribute, int value) override
bool operator<(const BorderStyle &other) const
IconStyle & SetSymbol(const SymbolRef &symbol)
BorderStyle & SetColor(const Color &color)
OffsetRel GetOffsetRel() const
Definition Styles.h:218
TextStyle & SetSize(double size) override
CapStyle GetJoinCap() const
Definition Styles.h:188
IconStyle & SetHeight(unsigned int h)
bool operator<(const FillStyle &other) const
void SetStringValue(int attribute, const std::string &value) override
void CopyAttributes(const BorderStyle &other, const std::set< Attribute > &attributes)
double GetSymbolSpace() const
Definition Styles.h:1283
const Color & GetLineColor() const
Definition Styles.h:153
void SetLabelValue(int attribute, const LabelProviderRef &value) override
bool operator!=(const BorderStyle &other) const
double GetDisplayWidth() const
Definition Styles.h:168
FillStyle & SetPatternMinMag(const Magnification &mag)
TextStyle & SetEmphasizeColor(const Color &color)
void CopyAttributes(const IconStyle &other, const std::set< Attribute > &attributes)
TextStyle & SetStyle(Style style)
bool operator!=(const FillStyle &other) const
ScreenBox GetBoundingBox(const Projection &projection) const
Definition Styles.h:1160
LineStyle & SetJoinCap(CapStyle joinCap)
LineStyle & SetZIndex(int zIndex)
double GetWidth(const Projection &projection) const
Definition Styles.h:1191
Magnification GetScaleAndFadeMag() const
Definition Styles.h:599
bool operator==(const TextStyle &other) const
IconStyle & SetIconName(const std::string &iconName)
const Vertex2D & GetCenter() const
Definition Styles.h:1099
const Style & GetStyle() const
Definition Styles.h:594
LineStyle & SetSlot(const std::string &slot)
void CopyAttributes(const PathTextStyle &other, const std::set< Attribute > &attributes)
ProjectionMode
Definition Styles.h:1123
@ GROUND
Definition Styles.h:1125
LineStyle & SetDisplayOffset(double value)
void AddCoord(const Vertex2D &coord)
const Color & GetColor() const
Definition Styles.h:414
bool operator<(const TextStyle &other) const
LineStyle & SetOffsetRel(OffsetRel offsetRel)
const std::string & GetSlot() const
Definition Styles.h:148
double GetSize() const
Definition Styles.h:859
Symbol(const std::string &name, ProjectionMode projectionMode)
TextStyle & SetLabel(const LabelProviderRef &label)
void AddPrimitive(const DrawPrimitiveRef &primitive)
void SetBoolValue(int attribute, bool value) override
bool operator==(const FillStyle &other) const
IconStyle & SetOverlay(bool overlay)
const double & GetRadius() const
Definition Styles.h:1104
double GetMaxBorderWidth(const Projection &projection) const
Definition Styles.h:1183
Style
Definition Styles.h:509
@ emphasize
Definition Styles.h:511
@ normal
Definition Styles.h:510
void SetPatternId(size_t id) const
IconStyle & SetIconId(size_t id)
PathTextStyle & SetSize(double size)
RectanglePrimitive(const Vertex2D &topLeft, double width, double height, const FillStyleRef &fillStyle, const BorderStyleRef &borderStyle)
PathTextStyle & SetOffset(double value)
BorderStyle & SetOffset(double value)
LineStyle & SetDisplayWidth(double value)
Definition Styles.h:994
const BorderStyleRef & GetBorderStyle() const
Definition Styles.h:1010
DrawPrimitive(const FillStyleRef &fillStyle, const BorderStyleRef &borderStyle)
virtual ~DrawPrimitive()=default
const FillStyleRef & GetFillStyle() const
Definition Styles.h:1005
virtual ScreenBox GetBoundingBox() const =0
Definition Styles.h:473
virtual bool IsVisible() const =0
LabelStyle & SetPriority(size_t priority)
size_t GetPriority() const
Definition Styles.h:488
double GetSize() const
Definition Styles.h:493
virtual double GetAlpha() const =0
virtual LabelStyle & SetSize(double size)
PathShieldStyle & SetLabel(const LabelProviderRef &label)
double GetAlpha() const
Definition Styles.h:754
const Color & GetTextColor() const
Definition Styles.h:774
PathShieldStyle(const PathShieldStyle &style)
PathShieldStyle & operator=(const PathShieldStyle &style)=delete
double GetShieldSpace() const
Definition Styles.h:789
const ShieldStyleRef & GetShieldStyle() const
Definition Styles.h:794
bool IsVisible() const
Definition Styles.h:749
void SetLabelValue(int attribute, const LabelProviderRef &value) override
PathShieldStyle & SetSize(double size)
PathShieldStyle(const PathShieldStyle &&style)
Attribute
Definition Styles.h:713
@ attrBgColor
Definition Styles.h:718
@ attrShieldSpace
Definition Styles.h:720
@ attrSize
Definition Styles.h:715
@ attrLabel
Definition Styles.h:716
@ attrPriority
Definition Styles.h:714
@ attrBorderColor
Definition Styles.h:719
@ attrTextColor
Definition Styles.h:717
double GetSize() const
Definition Styles.h:764
void CopyAttributes(const PathShieldStyle &other, const std::set< Attribute > &attributes)
static StyleDescriptorRef GetDescriptor()
void SetColorValue(int attribute, const Color &value) override
PathShieldStyle & SetTextColor(const Color &color)
PathShieldStyle & SetShieldSpace(double shieldSpace)
const Color & GetBorderColor() const
Definition Styles.h:784
size_t GetPriority() const
Definition Styles.h:759
void SetUIntValue(int attribute, size_t value) override
PathShieldStyle & operator=(const PathShieldStyle &&style)=delete
const LabelProviderRef & GetLabel() const
Definition Styles.h:769
PathShieldStyle & SetPriority(size_t priority)
const Color & GetBgColor() const
Definition Styles.h:779
PathShieldStyle & SetBorderColor(const Color &color)
PathShieldStyle & SetBgColor(const Color &color)
void SetDoubleValue(int attribute, double value) override
Definition Projection.h:46
double GetMeterInPixel() const
Definition Projection.h:271
double ConvertWidthToPixel(double width) const
Definition Projection.h:292
ShieldStyle & SetBorderColor(const Color &color)
const LabelProviderRef & GetLabel() const
Definition Styles.h:677
const Color & GetBorderColor() const
Definition Styles.h:692
const Color & GetTextColor() const
Definition Styles.h:682
bool IsVisible() const override
Definition Styles.h:666
ShieldStyle & SetSize(double size) override
const Color & GetBgColor() const
Definition Styles.h:687
void CopyAttributes(const ShieldStyle &other, const std::set< Attribute > &attributes)
double GetAlpha() const override
Definition Styles.h:672
ShieldStyle & SetBgColor(const Color &color)
ShieldStyle & SetLabel(const LabelProviderRef &label)
Attribute
Definition Styles.h:642
@ attrTextColor
Definition Styles.h:646
@ attrBorderColor
Definition Styles.h:648
@ attrLabel
Definition Styles.h:645
@ attrSize
Definition Styles.h:644
@ attrPriority
Definition Styles.h:643
@ attrBgColor
Definition Styles.h:647
ShieldStyle & SetTextColor(const Color &color)
Definition StyleDescription.h:232
StyleEnumAttributeDescriptor(const std::string &name, int attribute)
Definition StyleDescription.h:240
void AddEnumValue(const std::string &name, int value)
Definition StyleDescription.h:250
Definition StyleDescription.h:52
LaneTurn
Definition LaneTurn.h:47
Definition Area.h:39
std::shared_ptr< TextStyle > TextStyleRef
Definition Styles.h:632
std::shared_ptr< PolygonPrimitive > PolygonPrimitiveRef
Definition Styles.h:1043
std::shared_ptr< PathTextStyle > PathTextStyleRef
Definition Styles.h:890
std::shared_ptr< StyleDescriptor > StyleDescriptorRef
Definition StyleDescription.h:498
std::shared_ptr< RectanglePrimitive > RectanglePrimitiveRef
Definition Styles.h:1081
std::shared_ptr< Symbol > SymbolRef
Definition StyleDescription.h:37
std::shared_ptr< PathSymbolStyle > PathSymbolStyleRef
Definition Styles.h:1319
bool IsLaneOffset(OffsetRel rel)
std::shared_ptr< LabelProvider > LabelProviderRef
Definition LabelProvider.h:60
std::shared_ptr< ShieldStyle > ShieldStyleRef
Definition Styles.h:701
std::shared_ptr< BorderStyle > BorderStyleRef
Definition Styles.h:464
OffsetRel ParseForwardTurnStringToOffset(LaneTurn turn)
OffsetRel ParseBackwardTurnStringToOffset(LaneTurn turn)
std::shared_ptr< LineStyle > LineStyleRef
Definition Styles.h:281
std::shared_ptr< DrawPrimitive > DrawPrimitiveRef
Definition Styles.h:1018
std::shared_ptr< LabelStyle > LabelStyleRef
Definition Styles.h:499
std::shared_ptr< FillStyle > FillStyleRef
Definition Styles.h:356
std::shared_ptr< IconStyle > IconStyleRef
Definition Styles.h:987
OffsetRel
Definition Styles.h:44
@ laneBackwardThroughLeft
Definition Styles.h:57
@ laneForwardThroughLeft
Definition Styles.h:52
@ laneDivider
when way has multiple lanes, line is rendered as its divider
Definition Styles.h:48
@ laneForwardThroughRight
Definition Styles.h:54
@ laneBackwardThrough
Definition Styles.h:58
@ base
way center
Definition Styles.h:45
@ laneForwardLeft
Definition Styles.h:51
@ leftOutline
left side of the way
Definition Styles.h:46
@ laneForwardThrough
Definition Styles.h:53
@ sidecar
special offset for routes, line are stacked next to way, same colors are "collapsed"
Definition Styles.h:62
@ rightOutline
right side of the way
Definition Styles.h:47
@ laneBackwardRight
Definition Styles.h:60
@ laneForwardRight
Definition Styles.h:55
@ laneBackwardLeft
Definition Styles.h:56
@ laneBackwardThroughRight
Definition Styles.h:59
std::shared_ptr< PathShieldStyle > PathShieldStyleRef
Definition Styles.h:805
std::shared_ptr< CirclePrimitive > CirclePrimitiveRef
Definition Styles.h:1112