Reload the ENC style on device pixel ratio changes
[GPXSee.git] / src / map / ENC / style.cpp
blobfd4e1659852bb8c5a711f748f198159a3e44491a
1 #include <QPainter>
2 #include "common/util.h"
3 #include "objects.h"
4 #include "style.h"
6 using namespace ENC;
7 using namespace Util;
9 static QImage railroad(qreal ratio)
11 QImage img(16 * ratio, 4 * ratio, QImage::Format_ARGB32_Premultiplied);
12 img.setDevicePixelRatio(ratio);
13 img.fill(Qt::black);
14 QPainter p(&img);
15 p.setPen(QPen(Qt::white, 2));
16 p.drawLine(9, 2, 15, 2);
18 return img;
21 static QFont pixelSizeFont(int pixelSize)
23 QFont f;
24 f.setPixelSize(pixelSize);
25 return f;
28 void Style::polygonStyle()
30 _polygons[TYPE(M_COVR)] = Polygon(QBrush(QColor(0xff, 0xff, 0xff)));
31 _polygons[TYPE(LNDARE)] = Polygon(QBrush(QColor(0xe8, 0xe0, 0x64)));
32 _polygons[TYPE(BUAARE)] = Polygon(QBrush(QColor(0xd9, 0x8b, 0x21)));
33 _polygons[TYPE(BUISGL)] = Polygon(QBrush(QColor(0xd9, 0x8b, 0x21)),
34 QPen(QColor(0x96, 0x61, 0x18), 1.5));
35 _polygons[TYPE(BRIDGE)] = Polygon(QBrush(QColor(0xa5, 0x81, 0x40)));
36 _polygons[TYPE(I_BRIDGE)] = Polygon(QBrush(QColor(0xa5, 0x81, 0x40)));
37 _polygons[SUBTYPE(DEPARE, 0)] = Polygon(QBrush(QColor(0x98, 0xc0, 0x64)));
38 _polygons[SUBTYPE(DEPARE, 1)] = Polygon(QBrush(QColor(0xa0, 0xa0, 0xff)));
39 _polygons[SUBTYPE(DEPARE, 2)] = Polygon(QBrush(QColor(0xb0, 0xb0, 0xff)));
40 _polygons[SUBTYPE(DEPARE, 3)] = Polygon(QBrush(QColor(0xc0, 0xc0, 0xff)));
41 _polygons[SUBTYPE(DEPARE, 4)] = Polygon(QBrush(QColor(0xc0, 0xd0, 0xff)));
42 _polygons[SUBTYPE(DEPARE, 5)] = Polygon(QBrush(QColor(0xc0, 0xe0, 0xff)));
43 _polygons[SUBTYPE(DEPARE, 6)] = Polygon(QBrush(QColor(0xff, 0xff, 0xff)));
44 _polygons[TYPE(DMPGRD)] = Polygon(QBrush(QColor(0xa3, 0xa3, 0xa3),
45 Qt::Dense3Pattern));
46 _polygons[TYPE(FAIRWY)] = Polygon(Qt::NoBrush, QPen(QColor(0x88, 0x88, 0x88),
47 1, Qt::DashDotDotLine));
48 _polygons[TYPE(OBSTRN)] = Polygon(Qt::NoBrush, QPen(QColor(0, 0, 0), 1.5,
49 Qt::DotLine));
50 _polygons[TYPE(UWTROC)] = Polygon(Qt::NoBrush, QPen(QColor(0, 0, 0), 1.5,
51 Qt::DotLine));
52 _polygons[TYPE(PONTON)] = Polygon(QBrush(QColor(0x33, 0x33, 0x33)));
53 _polygons[TYPE(I_PONTON)] = Polygon(QBrush(QColor(0x33, 0x33, 0x33)));
54 _polygons[TYPE(HULKES)] = Polygon(QBrush(QColor(0x33, 0x33, 0x33)));
55 _polygons[TYPE(I_HULKES)] = Polygon(QBrush(QColor(0x33, 0x33, 0x33)));
56 _polygons[TYPE(DRYDOC)] = Polygon(QBrush(QColor(0x33, 0x33, 0x33)));
57 _polygons[TYPE(SLCONS)] = Polygon(Qt::NoBrush,
58 QPen(QColor(0x33, 0x33, 0x33), 1.5, Qt::DashLine));
59 _polygons[TYPE(I_SLCONS)] = Polygon(Qt::NoBrush,
60 QPen(QColor(0x33, 0x33, 0x33), 1.5, Qt::DashLine));
61 _polygons[TYPE(LAKARE)] = Polygon(QBrush(QColor(0x9f, 0xc4, 0xe1)),
62 QPen(QColor(0, 0, 0), 1));
63 _polygons[TYPE(CANALS)] = Polygon(QBrush(QColor(0x9f, 0xc4, 0xe1)),
64 QPen(QColor(0, 0, 0), 1));
65 _polygons[TYPE(RIVERS)] = Polygon(QBrush(QColor(0x9f, 0xc4, 0xe1)));
66 _polygons[TYPE(DYKCON)] = Polygon(QBrush(QColor(0x9f, 0xc4, 0xe1),
67 Qt::Dense4Pattern), QPen(QColor(0, 0, 0), 1));
68 _polygons[TYPE(AIRARE)] = Polygon(QBrush(QColor(0x33, 0x33, 0x33)));
69 _polygons[TYPE(TSEZNE)] = Polygon(QBrush(QColor(0xfc, 0xb4, 0xfc, 0x80)));
70 _polygons[TYPE(DRGARE)] = Polygon(QBrush(QColor(0xa0, 0xa0, 0xff),
71 Qt::Dense4Pattern));
72 _polygons[TYPE(UNSARE)] = Polygon(QBrush(QColor(0x99, 0x99, 0x99)));
73 _polygons[SUBTYPE(RESARE, 9)] = Polygon(QBrush(QColor(0xff, 0x00, 0x00),
74 Qt::BDiagPattern));
75 _polygons[SUBTYPE(RESARE, 2)] = Polygon(QImage(":/marine/noanchor-line.png"));
76 _polygons[SUBTYPE(I_RESARE, 2)] = Polygon(QImage(":/marine/noanchor-line.png"));
77 _polygons[SUBTYPE(RESARE, 17)] = Polygon(
78 QImage(":/marine/entry-prohibited-line.png"));
79 _polygons[SUBTYPE(I_RESARE, 17)] = Polygon(
80 QImage(":/marine/entry-prohibited-line.png"));
81 _polygons[SUBTYPE(RESARE, 12)] = Polygon(QImage(":/marine/safety-zone-line.png"));
82 _polygons[SUBTYPE(I_RESARE, 12)] = Polygon(QImage(":/marine/safety-zone-line.png"));
83 _polygons[SUBTYPE(RESARE, 1)] = Polygon(QImage(":/marine/safety-zone-line.png"));
84 _polygons[SUBTYPE(ACHARE, 1)] = Polygon(QImage(":/marine/anchor-line.png"));
85 _polygons[SUBTYPE(I_ACHARE, 1)] = Polygon(QImage(":/marine/anchor-line.png"));
86 _polygons[TYPE(PRCARE)] = Polygon(QBrush(QColor(0xeb, 0x49, 0xeb),
87 Qt::BDiagPattern));
88 _polygons[TYPE(DAMCON)] = Polygon(QBrush(QColor(0xd9, 0x8b, 0x21)),
89 QPen(QColor(0, 0, 0), 1));
90 _polygons[TYPE(DRYDOC)] = Polygon(QBrush(QColor(0xeb, 0xab, 0x54)),
91 QPen(QColor(0, 0, 0), 1));
92 _polygons[TYPE(PYLONS)] = Polygon(QBrush(QColor(0xa5, 0x81, 0x40)),
93 QPen(QColor(0, 0, 0), 1));
94 _polygons[TYPE(FLODOC)] = Polygon(QBrush(QColor(0x33, 0x33, 0x33)),
95 QPen(QColor(0, 0, 0), 1));
96 _polygons[TYPE(I_FLODOC)] = Polygon(QBrush(QColor(0x33, 0x33, 0x33)),
97 QPen(QColor(0, 0, 0), 1));
98 _polygons[TYPE(DWRTPT)] = Polygon(QImage(":/marine/dw-route-line.png"));
99 _polygons[TYPE(MORFAC)] = Polygon(QBrush(QColor(0xe8, 0xe0, 0x64)),
100 QPen(QColor(0, 0, 0), 2));
101 _polygons[TYPE(GATCON)] = Polygon(QBrush(QColor(0, 0, 0)));
102 _polygons[TYPE(I_GATCON)] = Polygon(QBrush(QColor(0, 0, 0)));
103 _polygons[TYPE(I_TERMNL)] = Polygon(QBrush(QColor(0xb8, 0xb0, 0x4b)),
104 QPen(QColor(0x96, 0x61, 0x18)));
105 _polygons[TYPE(SILTNK)] = Polygon(QBrush(QColor(0xd9, 0x8b, 0x21)),
106 QPen(QColor(0x96, 0x61, 0x18), 2));
107 _polygons[TYPE(LOKBSN)] = Polygon(QBrush(QColor(0x33, 0x33, 0x33),
108 Qt::Dense7Pattern));
109 _polygons[TYPE(I_LOKBSN)] = Polygon(QBrush(QColor(0x33, 0x33, 0x33),
110 Qt::Dense7Pattern));
111 _polygons[TYPE(TUNNEL)] = Polygon(Qt::NoBrush, QPen(QColor(0xa5, 0x81, 0x40),
112 1.5, Qt::DashLine));
113 _polygons[TYPE(CBLARE)] = Polygon(QImage(":/marine/cable-area-line.png"));
114 _polygons[TYPE(PIPARE)] = Polygon(QImage(":/marine/pipeline-area-line.png"));
115 _polygons[SUBTYPE(MARKUL, 3)] = Polygon(QImage(":/marine/fishing-farm-line.png"));
116 _polygons[SUBTYPE(I_BERTHS, 6)] = Polygon(Qt::NoBrush,
117 QPen(QColor(0xeb, 0x49, 0xeb), 1, Qt::DashLine));
118 _polygons[TYPE(CONZNE)] = Polygon(Qt::NoBrush, QPen(QColor(0xeb, 0x49, 0xeb),
119 1, Qt::DashDotLine));
121 _drawOrder
122 << TYPE(M_COVR) << TYPE(LNDARE) << SUBTYPE(DEPARE, 0)
123 << SUBTYPE(DEPARE, 1) << SUBTYPE(DEPARE, 2) << SUBTYPE(DEPARE, 3)
124 << TYPE(UNSARE) << SUBTYPE(DEPARE, 4) << SUBTYPE(DEPARE, 5)
125 << SUBTYPE(DEPARE, 6) << TYPE(LAKARE) << TYPE(CANALS) << TYPE(DYKCON)
126 << TYPE(RIVERS) << TYPE(DRGARE) << TYPE(FAIRWY) << TYPE(LOKBSN)
127 << TYPE(I_LOKBSN) << TYPE(BUAARE) << TYPE(BUISGL) << TYPE(SILTNK)
128 << TYPE(AIRARE) << TYPE(BRIDGE) << TYPE(I_BRIDGE) << TYPE(TUNNEL)
129 << TYPE(I_TERMNL) << TYPE(SLCONS) << TYPE(I_SLCONS) << TYPE(PONTON)
130 << TYPE(I_PONTON) << TYPE(HULKES) << TYPE(I_HULKES) << TYPE(FLODOC)
131 << TYPE(I_FLODOC) << TYPE(DRYDOC) << TYPE(DAMCON) << TYPE(PYLONS)
132 << TYPE(MORFAC) << TYPE(GATCON) << TYPE(I_GATCON) << SUBTYPE(I_BERTHS, 6)
133 << TYPE(DMPGRD) << TYPE(TSEZNE) << TYPE(OBSTRN) << TYPE(UWTROC)
134 << TYPE(DWRTPT) << SUBTYPE(ACHARE, 1) << SUBTYPE(I_ACHARE, 1)
135 << SUBTYPE(RESARE, 9) << SUBTYPE(RESARE, 2) << SUBTYPE(I_RESARE, 2)
136 << SUBTYPE(RESARE, 17) << SUBTYPE(I_RESARE, 17) << SUBTYPE(RESARE, 12)
137 << SUBTYPE(I_RESARE, 12) << SUBTYPE(RESARE, 1) << TYPE(CBLARE)
138 << TYPE(PIPARE) << TYPE(PRCARE) << SUBTYPE(MARKUL, 3) << TYPE(CONZNE);
141 void Style::lineStyle(qreal ratio)
143 _lines[TYPE(BUISGL)] = Line(QPen(QColor(0x96, 0x61, 0x18), 1.5));
144 _lines[TYPE(DEPCNT)] = Line(QPen(QColor(0x65, 0x9a, 0xef), 1, Qt::SolidLine));
145 _lines[TYPE(DEPCNT)].setTextColor(QColor(0x55, 0x8a, 0xdf));
146 _lines[TYPE(DEPCNT)].setTextFontSize(Small);
147 _lines[TYPE(CBLOHD)] = Line(QImage(":/marine/cable-line.png"));
148 _lines[TYPE(I_CBLOHD)] = Line(QImage(":/marine/cable-line.png"));
149 _lines[TYPE(BRIDGE)] = Line(QPen(QColor(0xa5, 0x81, 0x40), 3, Qt::SolidLine));
150 _lines[TYPE(I_BRIDGE)] = Line(QPen(QColor(0xa5, 0x81, 0x40), 3, Qt::SolidLine));
151 _lines[TYPE(CBLSUB)] = Line(QImage(":/marine/cable.png"));
152 _lines[TYPE(CBLSUB)].setTextFontSize(Small);
153 _lines[TYPE(PIPSOL)] = Line(QImage(":/marine/pipeline.png"));
154 _lines[TYPE(PIPSOL)].setTextFontSize(Small);
155 _lines[TYPE(NAVLNE)] = Line(QPen(QColor(0xeb, 0x49, 0xeb), 1, Qt::DashLine));
156 _lines[TYPE(COALNE)] = Line(QPen(QColor(0, 0, 0), 1, Qt::SolidLine));
157 _lines[TYPE(SLCONS)] = Line(QPen(QColor(0, 0, 0), 2, Qt::SolidLine));
158 _lines[TYPE(I_SLCONS)] = Line(QPen(QColor(0, 0, 0), 2, Qt::SolidLine));
159 _lines[TYPE(PONTON)] = Line(QPen(QColor(0x33, 0x33, 0x33), 1, Qt::SolidLine));
160 _lines[TYPE(DYKCON)] = Line(QPen(QColor(0x33, 0x33, 0x33), 2, Qt::SolidLine));
161 _lines[TYPE(RIVERS)] = Line(QPen(QColor(0, 0, 0), 1, Qt::SolidLine));
162 _lines[TYPE(TSSBND)] = Line(QPen(QColor(0xeb, 0x49, 0xeb), 2, Qt::DashLine));
163 _lines[TYPE(LNDELV)] = Line(QPen(QColor(0x99, 0x94, 0x40), 1, Qt::SolidLine));
164 _lines[TYPE(LNDELV)].setTextColor(QColor(0x79, 0x74, 0x20));
165 _lines[TYPE(LNDELV)].setTextFontSize(Small);
166 _lines[TYPE(SLOTOP)] = Line(QPen(QColor(0x79, 0x74, 0x20), 1, Qt::SolidLine));
167 _lines[TYPE(OBSTRN)] = Line(QPen(QColor(0, 0, 0), 1.5, Qt::DotLine));
168 _lines[TYPE(FERYRT)] = Line(QImage(":/marine/ferry-line.png"));
169 _lines[TYPE(FERYRT)].setTextFontSize(Small);
170 _lines[TYPE(I_FERYRT)] = Line(QImage(":/marine/ferry-line.png"));
171 _lines[TYPE(I_FERYRT)].setTextFontSize(Small);
172 _lines[TYPE(RAILWY)] = Line(railroad(ratio));
173 _lines[TYPE(ROADWY)] = Line(QPen(QColor(0, 0, 0), 2, Qt::SolidLine));
174 _lines[TYPE(GATCON)] = Line(QPen(QColor(0, 0, 0), 2, Qt::SolidLine));
175 _lines[TYPE(I_GATCON)] = Line(QPen(QColor(0, 0, 0), 2, Qt::SolidLine));
176 _lines[TYPE(TSELNE)] = Line(QPen(QColor(0xfc, 0xb4, 0xfc, 0x80), 4,
177 Qt::SolidLine));
178 _lines[TYPE(I_WTWAXS)] = Line(QPen(QColor(0, 0, 0), 0, Qt::DashLine));
179 _lines[SUBTYPE(RECTRC, 1)] = Line(QPen(QColor(0, 0, 0), 0, Qt::SolidLine));
180 _lines[SUBTYPE(RECTRC, 2)] = Line(QPen(QColor(0, 0, 0), 0, Qt::DashLine));
181 _lines[SUBTYPE(RCRTCL, 1)] = Line(QPen(QColor(0xeb, 0x49, 0xeb), 0,
182 Qt::SolidLine));
183 _lines[SUBTYPE(RCRTCL, 2)] = Line(QPen(QColor(0xeb, 0x49, 0xeb), 0,
184 Qt::DashLine));
185 _lines[TYPE(FAIRWY)] = Line(QPen(QColor(0x88, 0x88, 0x88), 1,
186 Qt::DashDotDotLine));
187 _lines[TYPE(BERTHS)] = Line(QPen(QColor(0x33, 0x33, 0x33), 2));
188 _lines[TYPE(I_BERTHS)] = Line(QPen(QColor(0x33, 0x33, 0x33), 2));
189 _lines[TYPE(FNCLNE)] = Line(QImage(":/marine/fence-line.png"));
190 _lines[TYPE(CONVYR)] = Line(QImage(":/marine/conveyor-line.png"));
191 _lines[TYPE(PIPOHD)] = Line(QImage(":/marine/pipeline-overhead.png"));
192 _lines[TYPE(I_PIPOHD)] = Line(QImage(":/marine/pipeline-overhead.png"));
193 _lines[TYPE(CANALS)] = Line(QPen(QColor(0x9f, 0xc4, 0xe1), 2));
196 void Style::pointStyle(qreal ratio)
198 _points[SUBTYPE(BUAARE, 1)].setTextFontSize(Large);
199 _points[SUBTYPE(BUAARE, 5)].setTextFontSize(Large);
200 _points[SUBTYPE(BUAARE, 4)].setTextFontSize(Large);
201 _points[SUBTYPE(BUAARE, 2)].setTextFontSize(Small);
202 _points[SUBTYPE(BUAARE, 6)].setTextFontSize(Small);
203 _points[TYPE(SOUNDG)].setTextFontSize(Small);
204 _points[TYPE(SOUNDG)].setHaloColor(QColor());
205 _points[TYPE(BOYCAR)] = Point(QImage(":/marine/buoy.png"), Small);
206 _points[TYPE(BOYINB)] = Point(QImage(":/marine/buoy.png"), Small);
207 _points[TYPE(BOYISD)] = Point(QImage(":/marine/buoy.png"), Small);
208 _points[TYPE(BOYLAT)] = Point(QImage(":/marine/buoy.png"), Small);
209 _points[TYPE(I_BOYLAT)] = Point(QImage(":/marine/buoy.png"), Small);
210 _points[TYPE(BOYSAW)] = Point(QImage(":/marine/buoy.png"), Small);
211 _points[TYPE(BOYSPP)] = Point(QImage(":/marine/buoy.png"), Small);
212 _points[TYPE(BCNCAR)] = Point(QImage(":/marine/beacon.png"), Small);
213 _points[TYPE(BCNISD)] = Point(QImage(":/marine/beacon.png"), Small);
214 _points[TYPE(BCNLAT)] = Point(QImage(":/marine/beacon.png"), Small);
215 _points[TYPE(I_BCNLAT)] = Point(QImage(":/marine/beacon.png"), Small);
216 _points[TYPE(BCNSAW)] = Point(QImage(":/marine/beacon.png"), Small);
217 _points[TYPE(BCNSPP)] = Point(QImage(":/marine/beacon.png"), Small);
218 _points[SUBTYPE(LNDMRK, 3)] = Point(QImage(":/marine/chimney.png"));
219 _points[SUBTYPE(LNDMRK, 5)] = Point(QImage(":/marine/flagstaff.png"));
220 _points[SUBTYPE(LNDMRK, 7)] = Point(QImage(":/marine/pylon.png"));
221 _points[SUBTYPE(LNDMRK, 9)] = Point(QImage(":/marine/monument.png"));
222 _points[SUBTYPE(LNDMRK, 17)] = Point(QImage(":/marine/tower.png"));
223 _points[SUBTYPE(LNDMRK, 18)] = Point(QImage(":/marine/windmill.png"));
224 _points[SUBTYPE(LNDMRK, 19)] = Point(QImage(":/marine/windmotor.png"));
225 _points[SUBTYPE(LNDMRK, 20)] = Point(QImage(":/marine/church.png"));
226 _points[TYPE(LNDELV)] = Point(QImage(":/marine/triangulation-point.png"));
227 _points[TYPE(OBSTRN)] = Point(QImage(":/marine/obstruction.png"), Small);
228 _points[SUBTYPE(WRECKS, 0)] = Point(QImage(":/marine/wreck.png"), Small);
229 _points[SUBTYPE(WRECKS, 1)] = Point(QImage(":/marine/wreck.png"), Small);
230 _points[SUBTYPE(WRECKS, 2)] = Point(QImage(":/marine/wreck-dangerous.png"),
231 Small);
232 _points[SUBTYPE(WRECKS, 3)] = Point(QImage(":/marine/wreck.png"), Small);
233 _points[SUBTYPE(WRECKS, 4)] = Point(QImage(":/marine/wreck.png"), Small);
234 _points[SUBTYPE(WRECKS, 5)] = Point(QImage(":/marine/wreck-exposed.png"));
235 _points[SUBTYPE(UWTROC, 1)] = Point(QImage(":/marine/rock-exposed.png"),
236 Small);
237 _points[SUBTYPE(UWTROC, 2)] = Point(QImage(":/marine/rock-exposed.png"),
238 Small);
239 _points[SUBTYPE(UWTROC, 3)] = Point(QImage(":/marine/rock-dangerous.png"),
240 Small);
241 _points[SUBTYPE(UWTROC, 4)] = Point(QImage(":/marine/rock-dangerous.png"),
242 Small);
243 _points[SUBTYPE(UWTROC, 5)] = Point(QImage(":/marine/rock-dangerous.png"),
244 Small);
245 _points[SUBTYPE(HRBFAC, 4)] = Point(QImage(":/marine/fishing-harbor.png"));
246 _points[SUBTYPE(HRBFAC, 5)] = Point(QImage(":/marine/yacht-harbor.png"));
247 _points[SUBTYPE(HRBFAC, 9)] = Point(QImage(":/marine/shipyard.png"));
248 _points[SUBTYPE(I_HRBFAC, 4)] = Point(QImage(":/marine/fishing-harbor.png"));
249 _points[SUBTYPE(I_HRBFAC, 5)] = Point(QImage(":/marine/yacht-harbor.png"));
250 _points[SUBTYPE(I_HRBFAC, 9)] = Point(QImage(":/marine/shipyard.png"));
251 _points[TYPE(ACHBRT)] = Point(QImage(":/marine/anchorage.png"));
252 _points[TYPE(I_ACHBRT)] = Point(QImage(":/marine/anchorage.png"));
253 _points[TYPE(OFSPLF)] = Point(QImage(":/marine/platform.png"));
254 _points[TYPE(PILPNT)] = Point(QImage(":/marine/pile.png"), Small);
255 _points[SUBTYPE(MORFAC, 1)] = Point(QImage(":/marine/pile.png"), Small);
256 _points[SUBTYPE(MORFAC, 3)] = Point(QImage(":/marine/pile.png"), Small);
257 _points[SUBTYPE(MORFAC, 5)] = Point(QImage(":/marine/pile.png"), Small);
258 _points[SUBTYPE(MORFAC, 7)] = Point(QImage(":/marine/mooring-buoy.png"),
259 Small);
260 _points[TYPE(CRANES)] = Point(QImage(":/marine/crane.png"), Small);
261 _points[TYPE(I_CRANES)] = Point(QImage(":/marine/crane.png"), Small);
262 _points[SUBTYPE(I_DISMAR, 1)] = Point(QImage(":/marine/distance-mark.png"),
263 Small);
264 _points[SUBTYPE(I_DISMAR, 1)].setTextColor(QColor(0xff, 0xff, 0xff));
265 _points[SUBTYPE(I_DISMAR, 1)].setHaloColor(QColor());
266 _points[SUBTYPE(I_DISMAR, 2)] = Point(QImage(":/marine/distance-mark-land.png"),
267 Small);
268 _points[SUBTYPE(I_DISMAR, 2)].setHaloColor(QColor());
269 _points[SUBTYPE(I_DISMAR, 3)] = _points[SUBTYPE(I_DISMAR, 2)];
270 _points[SUBTYPE(I_DISMAR, 4)] = _points[SUBTYPE(I_DISMAR, 2)];
271 _points[TYPE(CGUSTA)] = Point(QImage(":/marine/coast-guard.png"));
272 _points[TYPE(RSCSTA)] = Point(QImage(":/marine/rescue-station.png"));
273 _points[TYPE(RDOSTA)] = Point(QImage(":/marine/radio.png"));
274 _points[TYPE(RADSTA)] = Point(QImage(":/marine/radar.png"));
275 _points[TYPE(RTPBCN)] = Point(QImage(":/marine/radar-transponder.png"));
276 _points[SUBTYPE(SILTNK, 0)] = Point(QImage(":/marine/silo.png"));
277 _points[SUBTYPE(SILTNK, 1)] = Point(QImage(":/marine/silo.png"));
278 _points[SUBTYPE(SILTNK, 2)] = Point(QImage(":/marine/tank.png"));
279 _points[SUBTYPE(SILTNK, 3)] = Point(QImage(":/marine/silo.png"));
280 _points[SUBTYPE(SILTNK, 4)] = Point(QImage(":/marine/silo.png"));
281 _points[TYPE(I_TRNBSN)] = Point(QImage(":/marine/turning-basin.png"));
282 _points[TYPE(I_TRNBSN)].setTextColor(QColor(0xeb, 0x49, 0xeb));
283 _points[TYPE(I_WTWGAG)] = Point(QImage(":/marine/gauge.png"), Small);
284 _points[SUBTYPE(RDOCAL, 1)] = Point(QImage(":/marine/radio-call.png"));
285 _points[SUBTYPE(RDOCAL, 2)] = Point(QImage(":/marine/radio-call.png"));
286 _points[SUBTYPE(RDOCAL, 3)] = Point(QImage(":/marine/radio-call.png"));
287 _points[SUBTYPE(RDOCAL, 4)] = Point(QImage(":/marine/radio-call-2w.png"));
288 _points[SUBTYPE(RDOCAL, 1)].setTextColor(QColor(0xeb, 0x49, 0xeb));
289 _points[SUBTYPE(RDOCAL, 2)].setTextColor(QColor(0xeb, 0x49, 0xeb));
290 _points[SUBTYPE(RDOCAL, 3)].setTextColor(QColor(0xeb, 0x49, 0xeb));
291 _points[SUBTYPE(RDOCAL, 4)].setTextColor(QColor(0xeb, 0x49, 0xeb));
292 _points[SUBTYPE(I_RDOCAL, 1)] = Point(QImage(":/marine/radio-call.png"));
293 _points[SUBTYPE(I_RDOCAL, 2)] = Point(QImage(":/marine/radio-call.png"));
294 _points[SUBTYPE(I_RDOCAL, 3)] = Point(QImage(":/marine/radio-call.png"));
295 _points[SUBTYPE(I_RDOCAL, 4)] = Point(QImage(":/marine/radio-call-2w.png"));
296 _points[SUBTYPE(I_RDOCAL, 1)].setTextColor(QColor(0xeb, 0x49, 0xeb));
297 _points[SUBTYPE(I_RDOCAL, 2)].setTextColor(QColor(0xeb, 0x49, 0xeb));
298 _points[SUBTYPE(I_RDOCAL, 3)].setTextColor(QColor(0xeb, 0x49, 0xeb));
299 _points[SUBTYPE(I_RDOCAL, 4)].setTextColor(QColor(0xeb, 0x49, 0xeb));
300 _points[TYPE(PYLONS)] = Point(QImage(":/marine/pylon.png"));
301 _points[SUBTYPE(I_BERTHS, 6)] = Point(QImage(":/marine/fleeting-area.png"));
302 _points[SUBTYPE(WATTUR, 1)] = Point(QImage(":/marine/breakers.png"));
303 _points[SUBTYPE(WATTUR, 3)] = Point(QImage(":/marine/overfalls.png"));
304 _points[SUBTYPE(WATTUR, 4)] = Point(QImage(":/marine/overfalls.png"));
305 _points[TYPE(PILBOP)] = Point(QImage(":/marine/boarding-place.png"));
306 _points[TYPE(SISTAT)] = Point(QImage(":/marine/pylon.png"));
307 _points[TYPE(SLCONS)] = Point(QImage(":/marine/construction.png"), Small);
308 _points[TYPE(CURENT)] = Point(QImage(":/marine/current.png"));
310 _points[SUBTYPE(SMCFAC, 7)] = Point(svg2img(":/POI/restaurant-11.svg",
311 ratio), Small);
312 _points[SUBTYPE(SMCFAC, 11)] = Point(svg2img(":/POI/pharmacy-11.svg",
313 ratio), Small);
314 _points[SUBTYPE(SMCFAC, 12)] = Point(svg2img(":/POI/drinking-water-11.svg",
315 ratio), Small);
316 _points[SUBTYPE(SMCFAC, 13)] = Point(svg2img(":/POI/fuel-11.svg", ratio),
317 Small);
318 _points[SUBTYPE(SMCFAC, 18)] = Point(svg2img(":/POI/toilet-11.svg", ratio),
319 Small);
320 _points[SUBTYPE(SMCFAC, 20)] = Point(svg2img(":/POI/telephone-11.svg",
321 ratio), Small);
322 _points[SUBTYPE(SMCFAC, 22)] = Point(svg2img(":/POI/parking-11.svg", ratio),
323 Small);
324 _points[SUBTYPE(SMCFAC, 25)] = Point(svg2img(":/POI/campsite-11.svg",
325 ratio), Small);
326 _points[TYPE(BUISGL)] = Point(QImage(":/marine/building.png"), Small);
327 _points[SUBTYPE(BUISGL, 2)] = Point(svg2img(":/POI/harbor-11.svg", ratio),
328 Small);
329 _points[SUBTYPE(BUISGL, 5)] = Point(svg2img(":/POI/hospital-11.svg", ratio),
330 Small);
331 _points[SUBTYPE(BUISGL, 6)] = Point(svg2img(":/POI/post-11.svg", ratio),
332 Small);
333 _points[SUBTYPE(BUISGL, 7)] = Point(svg2img(":/POI/lodging-11.svg", ratio),
334 Small);
335 _points[SUBTYPE(BUISGL, 9)] = Point(svg2img(":/POI/police-11.svg", ratio),
336 Small);
337 _points[SUBTYPE(BUISGL, 13)] = Point(svg2img(":/POI/bank-11.svg", ratio),
338 Small);
339 _points[SUBTYPE(BUISGL, 19)] = Point(svg2img(":/POI/school-11.svg", ratio),
340 Small);
341 _points[SUBTYPE(BUISGL, 20)] = Point(svg2img(":/POI/religious-christian-11.svg",
342 ratio), Small);
343 _points[SUBTYPE(BUISGL, 22)] = Point(svg2img(":/POI/religious-jewish-11.svg",
344 ratio), Small);
345 _points[SUBTYPE(BUISGL, 26)] = Point(svg2img(":/POI/religious-muslim-11.svg",
346 ratio), Small);
347 _points[SUBTYPE(BUISGL, 33)] = Point(QImage(":/marine/pylon.png"), Small);
348 _points[SUBTYPE(BUISGL, 42)] = Point(svg2img(":/POI/bus-11.svg", ratio),
349 Small);
352 Style::Style(qreal ratio)
354 _light = QImage(":/marine/light.png");
355 _signal = QImage(":/marine/fog-signal.png");
357 _large = pixelSizeFont(16);
358 _normal = pixelSizeFont(12);
359 _small = pixelSizeFont(10);
361 polygonStyle();
362 lineStyle(ratio);
363 pointStyle(ratio);
366 const Style::Line &Style::line(uint type) const
368 static Line null;
370 QMap<uint, Line>::const_iterator it(_lines.find(type));
371 return (it == _lines.constEnd()) ? null : *it;
374 const Style::Polygon &Style::polygon(uint type) const
376 static Polygon null;
378 QMap<uint, Polygon>::const_iterator it(_polygons.find(type));
379 return (it == _polygons.constEnd()) ? null : *it;
382 const Style::Point &Style::point(uint type) const
384 static Point null;
386 QMap<uint, Point>::const_iterator it(_points.find(type));
387 return (it == _points.constEnd()) ? null : *it;
390 const QFont *Style::font(Style::FontSize size) const
392 switch (size) {
393 case Style::None:
394 return 0;
395 case Style::Large:
396 return &_large;
397 case Style::Small:
398 return &_small;
399 default:
400 return &_normal;