56 | | <SymbolDefinition> |
57 | | <SimpleSymbolDefinition> |
58 | | <Name>US_Interstate</Name> |
59 | | <Graphics> |
60 | | <Image> |
61 | | <Reference>Library%3A%2F%2FHighwaySymbols%2FInterstateImage.png</Reference> |
62 | | <SizeX>10.8</SizeX> |
63 | | <SizeY>11.2</SizeY> |
64 | | <PositionX>0</PositionX> |
65 | | <PositionY>0.8</PositionY> |
66 | | </Image> |
67 | | <Text> |
68 | | <String>%INTERSTATE_NUMBER%</String> |
69 | | <FontName>Arial</FontName> |
70 | | <Height>6</Height> |
71 | | <PositionX>0</PositionX> |
72 | | <PositionY>0</PositionY> |
73 | | <HorizontalAlignment>Center</HorizontalAlignment> |
74 | | <VerticalAlignment>Halfline</VerticalAlignment> |
75 | | </Text> |
76 | | </Graphics> |
77 | | <LineUsage> |
78 | | <AngleControl>FromAngle</AngleControl> |
79 | | <VertexControl>OverlapNoWrap</VertexControl> |
80 | | <Angle>0</Angle> |
81 | | <StartOffset>30</StartOffset> |
82 | | <EndOffset>30</EndOffset> |
83 | | <Repeat>100</Repeat> |
84 | | </LineUsage> |
85 | | <ParameterDefinition> |
86 | | <Parameter> |
87 | | <Identifier>%INTERSTATE_NUMBER%</Identifier> |
88 | | <DefaultValue>0</DefaultValue> |
89 | | <DisplayName>Interstate Number</DisplayName> |
90 | | <Description>The interstate number</Description> |
91 | | </Parameter> |
92 | | </ParameterDefinition> |
93 | | </SimpleSymbolDefinition> |
94 | | </SymbolDefinition> |
95 | | }}} |
96 | | |
97 | | The symbol graphics are defined such that the center of the text label is the symbol origin. The image is therefore shifted upwards slightly to compensate for this. The text string is also parametrized. Its value is obtained from an expression in the symbol instance. In this case the expression would be set to the interstate number attribute. One limitation of this symbol definition is that it doesn't resize if the number of characters in the text string changes. This limitation is removed in example 6 below. |
98 | | |
99 | | '''Example 2:''' line style with simple dashing |
100 | | |
101 | | [[Image(ex2.jpg)]] |
102 | | |
103 | | The repeating dash pattern is “long dash / dot / short dash / dot”. The long dash is 10 mm long and the short dash is 5 mm long. Each gap is 2.5 mm. The overall period of the dashing is 25 mm. The symbol definition XML would be: |
104 | | |
105 | | {{{ |
106 | | <SymbolDefinition> |
107 | | <SimpleSymbolDefinition> |
108 | | <Name>LongDash-Dot-ShortDash-Dot</Name> |
109 | | <Graphics> |
110 | | <Path> |
111 | | <Geometry> |
112 | | M 0.0,0 L 10.0,0 |
113 | | M 12.5,0 L 12.5,0 |
114 | | M 15.0,0 L 20.0,0 |
115 | | M 22.5,0 L 22.5,0 |
116 | | </Geometry> |
117 | | <LineColor>ff00000</LineColor> |
118 | | </Path> |
119 | | </Graphics> |
120 | | <LineUsage> |
121 | | <VertexControl>OverlapWrap</VertexControl> |
122 | | <Repeat>25</Repeat> |
123 | | </LineUsage> |
124 | | <ParameterDefinition> |
125 | | </ParameterDefinition> |
126 | | </SimpleSymbolDefinition> |
127 | | </SymbolDefinition> |
128 | | }}} |
129 | | |
130 | | In the path geometry all the formatting elements (line color, line cap, line join, …) are left out – they take on their default values. For the !LineUsage the default vertex control is !OverlapNoWrap, and here we set it to !OverlapWrap. !OverlapWrap means it’s ok to draw the symbol if it overlaps a vertex, but make it bend around the vertex. For simple line styles consisting of centerline dashing, !OverlapWrap is the standard behavior we’re used to. |
131 | | |
132 | | '''Example 3:''' line style with a decoration and thickness |
133 | | |
134 | | [[Image(ex3.jpg)]] |
135 | | |
136 | | The repeating pattern is just a cross. It repeats with period 5 mm. |
137 | | |
138 | | {{{ |
139 | | <SymbolDefinition> |
140 | | <SimpleSymbolDefinition> |
141 | | <Name>ThickRail</Name> |
142 | | <Description>This is a railroad symbol</Description> |
143 | | <Graphics> |
144 | | <Path> |
145 | | <Geometry> |
146 | | M 0.0, 0.0 L 5.0,0.0 |
147 | | M 2.5,-2.5 L 2.5,2.5 |
148 | | </Geometry> |
149 | | <LineWeight>%LINE_WEIGHT%</LineWeight> |
150 | | <LineCap>Round</LineCap> |
151 | | <LineJoin>Round</LineJoin> |
152 | | </Path> |
153 | | </Graphics> |
154 | | <LineUsage> |
155 | | <VertexControl>OverlapWrap</VertexControl> |
156 | | <Repeat>5</Repeat> |
157 | | </LineUsage> |
158 | | <ParameterDefinition> |
159 | | <Parameter> |
160 | | <Identifier>%LINE_WEIGHT%</Identifier> |
161 | | <DefaultValue>1</DefaultValue> |
162 | | <DisplayName>Line Weight</DisplayName> |
163 | | </Parameter> |
164 | | </ParameterDefinition> |
165 | | </SimpleSymbolDefinition> |
166 | | </SymbolDefinition> |
167 | | }}} |
168 | | |
169 | | This time the line weight for the path has been parametrized. Its default value is 1 mm, as specified in the !ParameterDefinition element, and this can be overridden at the symbol instance level. We’ve also changed the path’s line cap and line join styles to round. |
170 | | |
171 | | Note that when the line weight is modified the spacing between the vertical ticks does *not* change. The path geometry is fixed. If you want the symbol to get bigger / smaller to account for the line weight then this would be done using the symbol instance scales. For example, setting the scales to “1 + %LINE_WEIGHT% / 5” would ensure that there is always 5 mm of empty horizontal space between adjacent vertical ticks. |
172 | | |
173 | | '''Example 4:''' line style with start / end symbols |
174 | | |
175 | | [[Image(ex4.jpg)]] |
176 | | |
177 | | This line style includes text along the centerline, and start / end symbols. In order to store all three components of the line style together we need to make this a compound symbol definition. |
178 | | |
179 | | {{{ |
180 | | <SymbolDefinition> |
181 | | <CompoundSymbolDefinition> |
182 | | <Name>GasWithStartEndSymbols</Name> |
183 | | <SimpleSymbol> |
184 | | <SimpleSymbolDefinition> |
185 | | <Name>GasStyle</Name> |
186 | | <Graphics> |
187 | | <Path> |
188 | | <Geometry>M 0,0 H 5 M 15,0 H 5</Geometry> |
189 | | <LineWeight>1</LineWeight> |
190 | | <LineCap>Round</LineCap> |
191 | | <LineJoin>Round</LineJoin> |
192 | | </Path> |
193 | | <Text> |
194 | | <String>GAS</String> |
195 | | <FontName>Arial</FontName> |
196 | | <Height>3.5</Height> |
197 | | <PositionX>10</PositionX> |
198 | | <PositionY>0</PositionY> |
199 | | <HorizontalAlignment>Center</HorizontalAlignment> |
200 | | <VerticalAlignment>Halfline</VerticalAlignment> |
201 | | </Text> |
202 | | </Graphics> |
203 | | <LineUsage> |
204 | | <VertexControl>OverlapWrap</VertexControl> |
205 | | <Repeat>20</Repeat> |
206 | | </LineUsage> |
207 | | <ParameterDefinition> |
208 | | </ParameterDefinition> |
209 | | </SimpleSymbolDefinition> |
210 | | </SimpleSymbol> |
211 | | <SimpleSymbol> |
212 | | <SimpleSymbolDefinition> |
213 | | <Name>BlueSquare</Name> |
214 | | <Graphics> |
215 | | <Path> |
216 | | <Geometry>M -0.5,-0.5 H 1, V 1, H -1, Z</Geometry> |
217 | | <FillColor>c00000ff</FillColor> |
218 | | </Path> |
219 | | </Graphics> |
220 | | <LineUsage> |
221 | | <VertexControl>OverlapNoWrap</VertexControl> |
222 | | <StartOffset>0</StartOffset> |
223 | | <Repeat>0</Repeat> |
224 | | </LineUsage> |
225 | | <ParameterDefinition> |
226 | | </ParameterDefinition> |
227 | | </SimpleSymbolDefinition> |
228 | | </SimpleSymbol> |
229 | | <SimpleSymbol> |
230 | | <SimpleSymbolDefinition> |
231 | | <Name>RedTriangle</Name> |
232 | | <Graphics> |
233 | | <Path> |
234 | | <Geometry>M -0.5,-0.5 H 1, L 0,1, Z</Geometry> |
235 | | <FillColor>c0ff0000</FillColor> |
236 | | </Path> |
237 | | </Graphics> |
238 | | <LineUsage> |
239 | | <VertexControl>OverlapNoWrap</VertexControl> |
240 | | <EndOffset>0</EndOffset> |
241 | | <Repeat>0</Repeat> |
242 | | </LineUsage> |
243 | | <ParameterDefinition> |
244 | | </ParameterDefinition> |
245 | | </SimpleSymbolDefinition> |
246 | | </SimpleSymbol> |
247 | | </CompoundSymbolDefinition> |
248 | | </SymbolDefinition> |
249 | | }}} |
250 | | |
251 | | In this case the order of the symbols in the compound determines the draw order. Here, the start and end symbols are drawn on top of the dashing. For the start symbol the !StartOffset and Repeat are set to 0. This ensures the symbol is only drawn once at the start of the feature. Likewise, for the end symbol we set the !EndOffset and Repeat to 0. We also want !OverlapNoWrap for the !VertexControl. The symbol can overlap a vertex, but we simply want to “stamp” it – no bending around vertices. |
252 | | |
253 | | One other note: the default !AngleControl behavior is !FromGeometry. This means the angle of the start / end symbol will be computed from the geometry, as shown here. |
254 | | |
255 | | [[Image(ex4a.jpg)]] |
256 | | |
257 | | If you wanted the start / end symbol angles to be a fixed value you would change !AngleControl to !FromAngle and specify the Angle, e.g. |
258 | | |
259 | | {{{ |
260 | | <SimpleSymbolDefinition> |
261 | | <Name>BlueSquare</Name> |
262 | | ... |
263 | | <LineUsage> |
264 | | <AngleControl>FromAngle</AngleControl> |
265 | | <VertexControl>OverlapNoWrap</VertexControl> |
266 | | <Angle>0</Angle> |
267 | | <StartOffset>0</Repeat> |
268 | | <Repeat>0</Repeat> |
269 | | </LineUsage> |
270 | | ... |
271 | | </SimpleSymbolDefinition> |
272 | | }}} |
273 | | |
274 | | [[Image(ex4b.jpg)]] |
275 | | |
276 | | |
277 | | '''Example 5:''' line style with a special cross-tick offset requirement |
278 | | |
279 | | [[Image(ex5.jpg)]] |
280 | | |
281 | | This line style is one that the current !MapGuide stylization code can’t handle. The problem is that the cross tick decoration needs to have a different start offset than the other decorations. Our new stylization schema handles this easily though. We have to create a compound symbol definition since we have two symbol components with different distributions. |
282 | | |
283 | | {{{ |
284 | | <SymbolDefinition> |
285 | | <CompoundSymbolDefinition> |
286 | | <Name>MTYP1500a</Name> |
287 | | <SimpleSymbol> |
288 | | <SimpleSymbolDefinition> |
289 | | <Name>UpperLowerDashing</Name> |
290 | | <Graphics> |
291 | | <Path> |
292 | | <Geometry> |
293 | | M 0,-2.5 h 8 m 2,0 h 8 m 2,0 h 2 |
294 | | M 0,2.5 h 8 m 2,0 h 8 m 2,0 h 2 |
295 | | </Geometry> |
296 | | </Path> |
297 | | </Graphics> |
298 | | <LineUsage> |
299 | | <VertexControl>OverlapWrap</VertexControl> |
300 | | <Repeat>24</Repeat> |
301 | | </LineUsage> |
302 | | <ParameterDefinition> |
303 | | </ParameterDefinition> |
304 | | </SimpleSymbolDefinition> |
305 | | </SimpleSymbol> |
306 | | <SimpleSymbol> |
307 | | <SimpleSymbolDefinition> |
308 | | <Name>OffsetCrossTick</Name> |
309 | | <Graphics> |
310 | | <Path> |
311 | | <Geometry>M 0.0,-2.5 v 5</Geometry> |
312 | | </Path> |
313 | | </Graphics> |
314 | | <LineUsage> |
315 | | <VertexControl>OverlapWrap</VertexControl> |
316 | | <StartOffset>28</StartOffset> |
317 | | <Repeat>24</Repeat> |
318 | | </LineUsage> |
319 | | <ParameterDefinition> |
320 | | </ParameterDefinition> |
321 | | </SimpleSymbolDefinition> |
322 | | </SimpleSymbol> |
323 | | </CompoundSymbolDefinition> |
324 | | </SymbolDefinition> |
325 | | }}} |
326 | | |
327 | | The upper / lower dashing has zero start offset, whereas the cross tick has a 28 mm offset. This horizontally positions the first cross tick at the center of the first long dash in the second cycle of upper / lower dashing. |
328 | | |
329 | | '''Example 6:''' auto-resizing interstate highway symbol |
330 | | |
331 | | The highway in example 1 was designed to display 1 or 2 digit interstate numbers. In the case of a 3 digit number you would end up with something like: |
332 | | |
333 | | [[Image(ex6a.jpg)]] |
334 | | |
335 | | To fix this we can update the symbol to auto-resize based on the text string: |
336 | | |
337 | | {{{ |
338 | | <SymbolDefinition> |
339 | | <SimpleSymbolDefinition> |
340 | | <Name>US_Interstate</Name> |
341 | | <Graphics> |
342 | | <Image> |
343 | | <ResizeControl>AdjustToResizeBox</ResizeControl> |
344 | | <Reference>Library%3A%2F%2FHighwaySymbols%2FInterstateImage.png</Reference> |
345 | | <SizeX>10.8</SizeX> |
346 | | <SizeY>11.2</SizeY> |
347 | | <PositionX>0</PositionX> |
348 | | <PositionY>0.8</PositionY> |
349 | | </Image> |
350 | | <Text> |
351 | | <ResizeControl>AddToResizeBox</ResizeControl> |
352 | | <String>%INTERSTATE_NUMBER%</String> |
353 | | <FontName>Arial</FontName> |
354 | | <Height>6</Height> |
355 | | <PositionX>0</PositionX> |
356 | | <PositionY>0</PositionY> |
357 | | <HorizontalAlignment>Center</HorizontalAlignment> |
358 | | <VerticalAlignment>Halfline</VerticalAlignment> |
359 | | </Text> |
360 | | </Graphics> |
361 | | <ResizeBox> |
| 56 | <SimpleSymbolDefinition> |
| 57 | <Name>US_Interstate</Name> |
| 58 | <Graphics> |
| 59 | <Image> |
| 60 | <Reference>Library%3A%2F%2FHighwaySymbols%2FInterstateImage.png</Reference> |
| 61 | <SizeX>10.8</SizeX> |
| 62 | <SizeY>11.2</SizeY> |
| 63 | <PositionX>0</PositionX> |
| 64 | <PositionY>0.8</PositionY> |
| 65 | </Image> |
| 66 | <Text> |
| 67 | <String>%INTERSTATE_NUMBER%</String> |
| 68 | <FontName>'Arial'</FontName> |
| 69 | <Height>6</Height> |
364 | | <SizeX>6</SizeX> |
365 | | <SizeY>5</SizeY> |
366 | | <GrowControl>GrowInX</GrowControl> |
367 | | </ResizeBox> |
368 | | <LineUsage> |
369 | | <AngleControl>FromAngle</AngleControl> |
370 | | <VertexControl>OverlapNoWrap</VertexControl> |
371 | | <Angle>0</Angle> |
372 | | <StartOffset>30</StartOffset> |
373 | | <EndOffset>30</EndOffset> |
374 | | <Repeat>100</Repeat> |
375 | | </LineUsage> |
376 | | <ParameterDefinition> |
377 | | <Parameter> |
378 | | <Identifier>%INTERSTATE_NUMBER%</Identifier> |
379 | | <DefaultValue>0</DefaultValue> |
380 | | <DisplayName>Interstate Number</DisplayName> |
381 | | <Description>The interstate number</Description> |
382 | | </Parameter> |
383 | | </ParameterDefinition> |
384 | | </SimpleSymbolDefinition> |
385 | | </SymbolDefinition> |
| 72 | <HorizontalAlignment>'Center'</HorizontalAlignment> |
| 73 | <VerticalAlignment>'Halfline'</VerticalAlignment> |
| 74 | </Text> |
| 75 | </Graphics> |
| 76 | <LineUsage> |
| 77 | <AngleControl>'FromAngle'</AngleControl> |
| 78 | <VertexControl>'OverlapNoWrap'</VertexControl> |
| 79 | <Angle>0</Angle> |
| 80 | <StartOffset>30</StartOffset> |
| 81 | <EndOffset>30</EndOffset> |
| 82 | <Repeat>100</Repeat> |
| 83 | </LineUsage> |
| 84 | <ParameterDefinition> |
| 85 | <Parameter> |
| 86 | <Identifier>%INTERSTATE_NUMBER%</Identifier> |
| 87 | <DefaultValue>0</DefaultValue> |
| 88 | <DisplayName>Interstate Number</DisplayName> |
| 89 | <Description>The interstate number</Description> |
| 90 | </Parameter> |
| 91 | </ParameterDefinition> |
| 92 | </SimpleSymbolDefinition> |
| 93 | }}} |
| 94 | |
| 95 | The symbol graphics are defined such that the center of the text label is the symbol origin. The image is therefore shifted upwards slightly to compensate for this. The text string is also parametrized. Its value is obtained from an expression in the symbol instance. In this case the expression would be set to the interstate number attribute. One limitation of this symbol definition is that it doesn't resize if the number of characters in the text string changes. This limitation is removed in example 6 below. |
| 96 | |
| 97 | '''Example 2:''' line style with simple dashing |
| 98 | |
| 99 | [[Image(ex2.jpg)]] |
| 100 | |
| 101 | The repeating dash pattern is “long dash / dot / short dash / dot”. The long dash is 10 mm long and the short dash is 5 mm long. Each gap is 2.5 mm. The overall period of the dashing is 25 mm. The symbol definition XML would be: |
| 102 | |
| 103 | {{{ |
| 104 | <SimpleSymbolDefinition> |
| 105 | <Name>LongDash-Dot-ShortDash-Dot</Name> |
| 106 | <Graphics> |
| 107 | <Path> |
| 108 | <Geometry> |
| 109 | M 0.0,0 L 10.0,0 |
| 110 | M 12.5,0 L 12.5,0 |
| 111 | M 15.0,0 L 20.0,0 |
| 112 | M 22.5,0 L 22.5,0 |
| 113 | </Geometry> |
| 114 | <LineColor>ff00000</LineColor> |
| 115 | </Path> |
| 116 | </Graphics> |
| 117 | <LineUsage> |
| 118 | <VertexControl>'OverlapWrap'</VertexControl> |
| 119 | <Repeat>25</Repeat> |
| 120 | </LineUsage> |
| 121 | <ParameterDefinition/> |
| 122 | </SimpleSymbolDefinition> |
| 123 | }}} |
| 124 | |
| 125 | In the path geometry all the formatting elements (line color, line cap, line join, …) are left out – they take on their default values. For the !LineUsage the default vertex control is !OverlapNoWrap, and here we set it to !OverlapWrap. !OverlapWrap means it’s ok to draw the symbol if it overlaps a vertex, but make it bend around the vertex. For simple line styles consisting of centerline dashing, !OverlapWrap is the standard behavior we’re used to. |
| 126 | |
| 127 | '''Example 3:''' line style with a decoration and thickness |
| 128 | |
| 129 | [[Image(ex3.jpg)]] |
| 130 | |
| 131 | The repeating pattern is just a cross. It repeats with period 5 mm. |
| 132 | |
| 133 | {{{ |
| 134 | <SimpleSymbolDefinition> |
| 135 | <Name>ThickRail</Name> |
| 136 | <Description>This is a railroad symbol</Description> |
| 137 | <Graphics> |
| 138 | <Path> |
| 139 | <Geometry> |
| 140 | M 0.0, 0.0 L 5.0,0.0 |
| 141 | M 2.5,-2.5 L 2.5,2.5 |
| 142 | </Geometry> |
| 143 | <LineWeight>%LINE_WEIGHT%</LineWeight> |
| 144 | <LineCap>Round</LineCap> |
| 145 | <LineJoin>Round</LineJoin> |
| 146 | </Path> |
| 147 | </Graphics> |
| 148 | <LineUsage> |
| 149 | <VertexControl>'OverlapWrap'</VertexControl> |
| 150 | <Repeat>5</Repeat> |
| 151 | </LineUsage> |
| 152 | <ParameterDefinition> |
| 153 | <Parameter> |
| 154 | <Identifier>%LINE_WEIGHT%</Identifier> |
| 155 | <DefaultValue>1</DefaultValue> |
| 156 | <DisplayName>Line Weight</DisplayName> |
| 157 | </Parameter> |
| 158 | </ParameterDefinition> |
| 159 | </SimpleSymbolDefinition> |
| 160 | }}} |
| 161 | |
| 162 | This time the line weight for the path has been parametrized. Its default value is 1 mm, as specified in the !ParameterDefinition element, and this can be overridden at the symbol instance level. We’ve also changed the path’s line cap and line join styles to round. |
| 163 | |
| 164 | Note that when the line weight is modified the spacing between the vertical ticks does *not* change. The path geometry is fixed. If you want the symbol to get bigger / smaller to account for the line weight then this would be done using the symbol instance scales. For example, setting the scales to “1 + %LINE_WEIGHT% / 5” would ensure that there is always 5 mm of empty horizontal space between adjacent vertical ticks. |
| 165 | |
| 166 | '''Example 4:''' line style with start / end symbols |
| 167 | |
| 168 | [[Image(ex4.jpg)]] |
| 169 | |
| 170 | This line style includes text along the centerline, and start / end symbols. In order to store all three components of the line style together we need to make this a compound symbol definition. |
| 171 | |
| 172 | {{{ |
| 173 | <CompoundSymbolDefinition> |
| 174 | <Name>GasWithStartEndSymbols</Name> |
| 175 | <SimpleSymbol> |
| 176 | <SimpleSymbolDefinition> |
| 177 | <Name>GasStyle</Name> |
| 178 | <Graphics> |
| 179 | <Path> |
| 180 | <Geometry>M 0,0 H 5 M 15,0 H 5</Geometry> |
| 181 | <LineWeight>1</LineWeight> |
| 182 | <LineCap>'Round'</LineCap> |
| 183 | <LineJoin>'Round'</LineJoin> |
| 184 | </Path> |
| 185 | <Text> |
| 186 | <String>GAS</String> |
| 187 | <FontName>'Arial'</FontName> |
| 188 | <Height>3.5</Height> |
| 189 | <PositionX>10</PositionX> |
| 190 | <PositionY>0</PositionY> |
| 191 | <HorizontalAlignment>'Center'</HorizontalAlignment> |
| 192 | <VerticalAlignment>'Halfline'</VerticalAlignment> |
| 193 | </Text> |
| 194 | </Graphics> |
| 195 | <LineUsage> |
| 196 | <VertexControl>OverlapWrap</VertexControl> |
| 197 | <Repeat>20</Repeat> |
| 198 | </LineUsage> |
| 199 | <ParameterDefinition/> |
| 200 | </SimpleSymbolDefinition> |
| 201 | </SimpleSymbol> |
| 202 | <SimpleSymbol> |
| 203 | <SimpleSymbolDefinition> |
| 204 | <Name>BlueSquare</Name> |
| 205 | <Graphics> |
| 206 | <Path> |
| 207 | <Geometry>M -0.5,-0.5 H 1, V 1, H -1, Z</Geometry> |
| 208 | <FillColor>c00000ff</FillColor> |
| 209 | </Path> |
| 210 | </Graphics> |
| 211 | <LineUsage> |
| 212 | <VertexControl>OverlapNoWrap</VertexControl> |
| 213 | <StartOffset>0</StartOffset> |
| 214 | <Repeat>0</Repeat> |
| 215 | </LineUsage> |
| 216 | <ParameterDefinition/> |
| 217 | </SimpleSymbolDefinition> |
| 218 | </SimpleSymbol> |
| 219 | <SimpleSymbol> |
| 220 | <SimpleSymbolDefinition> |
| 221 | <Name>RedTriangle</Name> |
| 222 | <Graphics> |
| 223 | <Path> |
| 224 | <Geometry>M -0.5,-0.5 H 1, L 0,1, Z</Geometry> |
| 225 | <FillColor>c0ff0000</FillColor> |
| 226 | </Path> |
| 227 | </Graphics> |
| 228 | <LineUsage> |
| 229 | <VertexControl>'OverlapNoWrap'</VertexControl> |
| 230 | <EndOffset>0</EndOffset> |
| 231 | <Repeat>0</Repeat> |
| 232 | </LineUsage> |
| 233 | <ParameterDefinition/> |
| 234 | </SimpleSymbolDefinition> |
| 235 | </SimpleSymbol> |
| 236 | </CompoundSymbolDefinition> |
| 237 | }}} |
| 238 | |
| 239 | In this case the order of the symbols in the compound determines the draw order. Here, the start and end symbols are drawn on top of the dashing. For the start symbol the !StartOffset and Repeat are set to 0. This ensures the symbol is only drawn once at the start of the feature. Likewise, for the end symbol we set the !EndOffset and Repeat to 0. We also want !OverlapNoWrap for the !VertexControl. The symbol can overlap a vertex, but we simply want to “stamp” it – no bending around vertices. |
| 240 | |
| 241 | One other note: the default !AngleControl behavior is !FromGeometry. This means the angle of the start / end symbol will be computed from the geometry, as shown here. |
| 242 | |
| 243 | [[Image(ex4a.jpg)]] |
| 244 | |
| 245 | If you wanted the start / end symbol angles to be a fixed value you would change !AngleControl to !FromAngle and specify the Angle, e.g. |
| 246 | |
| 247 | {{{ |
| 248 | <SimpleSymbolDefinition> |
| 249 | <Name>BlueSquare</Name> |
| 250 | ... |
| 251 | <LineUsage> |
| 252 | <AngleControl>'FromAngle'</AngleControl> |
| 253 | <VertexControl>'OverlapNoWrap'</VertexControl> |
| 254 | <Angle>0</Angle> |
| 255 | <StartOffset>0</Repeat> |
| 256 | <Repeat>0</Repeat> |
| 257 | </LineUsage> |
| 258 | ... |
| 259 | </SimpleSymbolDefinition> |
| 260 | }}} |
| 261 | |
| 262 | [[Image(ex4b.jpg)]] |
| 263 | |
| 264 | |
| 265 | '''Example 5:''' line style with a special cross-tick offset requirement |
| 266 | |
| 267 | [[Image(ex5.jpg)]] |
| 268 | |
| 269 | This line style is one that the current !MapGuide stylization code can’t handle. The problem is that the cross tick decoration needs to have a different start offset than the other decorations. Our new stylization schema handles this easily though. We have to create a compound symbol definition since we have two symbol components with different distributions. |
| 270 | |
| 271 | {{{ |
| 272 | <CompoundSymbolDefinition> |
| 273 | <Name>MTYP1500a</Name> |
| 274 | <SimpleSymbol> |
| 275 | <SimpleSymbolDefinition> |
| 276 | <Name>UpperLowerDashing</Name> |
| 277 | <Graphics> |
| 278 | <Path> |
| 279 | <Geometry> |
| 280 | M 0,-2.5 h 8 m 2,0 h 8 m 2,0 h 2 |
| 281 | M 0,2.5 h 8 m 2,0 h 8 m 2,0 h 2 |
| 282 | </Geometry> |
| 283 | </Path> |
| 284 | </Graphics> |
| 285 | <LineUsage> |
| 286 | <VertexControl>'OverlapWrap'</VertexControl> |
| 287 | <Repeat>24</Repeat> |
| 288 | </LineUsage> |
| 289 | <ParameterDefinition/> |
| 290 | </SimpleSymbolDefinition> |
| 291 | </SimpleSymbol> |
| 292 | <SimpleSymbol> |
| 293 | <SimpleSymbolDefinition> |
| 294 | <Name>OffsetCrossTick</Name> |
| 295 | <Graphics> |
| 296 | <Path> |
| 297 | <Geometry>M 0.0,-2.5 v 5</Geometry> |
| 298 | </Path> |
| 299 | </Graphics> |
| 300 | <LineUsage> |
| 301 | <VertexControl>'OverlapWrap'</VertexControl> |
| 302 | <StartOffset>28</StartOffset> |
| 303 | <Repeat>24</Repeat> |
| 304 | </LineUsage> |
| 305 | <ParameterDefinition/> |
| 306 | </SimpleSymbolDefinition> |
| 307 | </SimpleSymbol> |
| 308 | </CompoundSymbolDefinition> |
| 309 | }}} |
| 310 | |
| 311 | The upper / lower dashing has zero start offset, whereas the cross tick has a 28 mm offset. This horizontally positions the first cross tick at the center of the first long dash in the second cycle of upper / lower dashing. |
| 312 | |
| 313 | '''Example 6:''' auto-resizing interstate highway symbol |
| 314 | |
| 315 | The highway in example 1 was designed to display 1 or 2 digit interstate numbers. In the case of a 3 digit number you would end up with something like: |
| 316 | |
| 317 | [[Image(ex6a.jpg)]] |
| 318 | |
| 319 | To fix this we can update the symbol to auto-resize based on the text string: |
| 320 | |
| 321 | {{{ |
| 322 | <SimpleSymbolDefinition> |
| 323 | <Name>US_Interstate</Name> |
| 324 | <Graphics> |
| 325 | <Image> |
| 326 | <ResizeControl>AdjustToResizeBox</ResizeControl> |
| 327 | <Reference>Library%3A%2F%2FHighwaySymbols%2FInterstateImage.png</Reference> |
| 328 | <SizeX>10.8</SizeX> |
| 329 | <SizeY>11.2</SizeY> |
| 330 | <PositionX>0</PositionX> |
| 331 | <PositionY>0.8</PositionY> |
| 332 | </Image> |
| 333 | <Text> |
| 334 | <ResizeControl>AddToResizeBox</ResizeControl> |
| 335 | <String>%INTERSTATE_NUMBER%</String> |
| 336 | <FontName>'Arial'</FontName> |
| 337 | <Height>6</Height> |
| 338 | <PositionX>0</PositionX> |
| 339 | <PositionY>0</PositionY> |
| 340 | <HorizontalAlignment>'Center'</HorizontalAlignment> |
| 341 | <VerticalAlignment>'Halfline'</VerticalAlignment> |
| 342 | </Text> |
| 343 | </Graphics> |
| 344 | <ResizeBox> |
| 345 | <PositionX>0</PositionX> |
| 346 | <PositionY>0</PositionY> |
| 347 | <SizeX>6</SizeX> |
| 348 | <SizeY>5</SizeY> |
| 349 | <GrowControl>'GrowInX'</GrowControl> |
| 350 | </ResizeBox> |
| 351 | <LineUsage> |
| 352 | <AngleControl>'FromAngle'</AngleControl> |
| 353 | <VertexControl>'OverlapNoWrap'</VertexControl> |
| 354 | <Angle>0</Angle> |
| 355 | <StartOffset>30</StartOffset> |
| 356 | <EndOffset>30</EndOffset> |
| 357 | <Repeat>100</Repeat> |
| 358 | </LineUsage> |
| 359 | <ParameterDefinition> |
| 360 | <Parameter> |
| 361 | <Identifier>%INTERSTATE_NUMBER%</Identifier> |
| 362 | <DefaultValue>0</DefaultValue> |
| 363 | <DisplayName>Interstate Number</DisplayName> |
| 364 | <Description>The interstate number</Description> |
| 365 | </Parameter> |
| 366 | </ParameterDefinition> |
| 367 | </SimpleSymbolDefinition> |