| 283 | == Theming and Localization of Symbols == |
| 284 | |
| 285 | Most properties in the !SymbolDefinition can be parametrized. This means that an expression can be provided that references attributes in the layer feature source for which the !SymbolDefinition is used. An example of a parametrized value would be: |
| 286 | |
| 287 | {{{ |
| 288 | <LineWeight>%1%</LineWeight> |
| 289 | }}} |
| 290 | |
| 291 | This means that the parameter named 1 can be set to an expression in the Layer Definition, based on style choice made by the map author. Optionally the !SymbolDefinition can contain an element that describes what that theming does and also provides a default value for the parameter. For example, here is a !SymbolDefinition with this optional !ParameterDefinition element: |
| 292 | |
| 293 | {{{ |
| 294 | <SimpleSymbolDefinition> |
| 295 | <Name>ThickRail</Name> |
| 296 | <Description>This is a railroad symbol</Description> |
| 297 | <Graphics> |
| 298 | <Path> |
| 299 | <Geometry> |
| 300 | M 0.0, 0.0 L 5.0,0.0 |
| 301 | M 2.5,-2.5 L 2.5,2.5 |
| 302 | </Geometry> |
| 303 | <LineWeight>%LINE_WEIGHT%</LineWeight> |
| 304 | <LineCap>Round</LineCap> |
| 305 | <LineJoin>Round</LineJoin> |
| 306 | </Path> |
| 307 | </Graphics> |
| 308 | <LineUsage> |
| 309 | <VertexControl>OverlapWrap</VertexControl> |
| 310 | <Repeat>5.0</Repeat> |
| 311 | </LineUsage> |
| 312 | <ParameterDefintion> |
| 313 | <Parameter> |
| 314 | <Identifier>%LINE_WEIGHT%</Identifier> |
| 315 | <DefaultValue>1mm</DefaultValue> |
| 316 | <DisplayName>Line Weight:<DisplayName> |
| 317 | <Description>This is a sample</Description> |
| 318 | <ValueList>1mm 2mm 3mm 4mm</ValueList> |
| 319 | </Parameter> |
| 320 | </ParameterDefintion> |
| 321 | </SimpleSymbolDefinition> |
| 322 | }}} |
| 323 | |
| 324 | |
| 325 | For translation of this symbol into another language, our solution is to create a translated parameter section and attach that to the !SymbolDefinition resource in the !MapGuide repository. The name of the attached resource will contain the locale of the translation. For example if the original symbol is called Symbol.xml, the German translated section would be called Symbol.xml.de. Here is what it would look like: |
| 326 | |
| 327 | {{{ |
| 328 | <SimpleSymbolDefinition> |
| 329 | <Name>DickeEisenBahnShiene</Name> |
| 330 | <Description>Das ist ein Eisenbahnschienen Symbol.</Description> |
| 331 | <ParameterDefintion> |
| 332 | <Parameter> |
| 333 | <Identifier>%LINE_WEIGHT%</Identifier> |
| 334 | <DefaultValue>0.0393700787in</DefaultValue> |
| 335 | <DisplayName>Linien Dicke:<DisplayName> |
| 336 | <Description>Das is nur Beispiel.</Description> |
| 337 | <ValueList>0.0393700787in 1in 2in 3in 4in</ValueList> |
| 338 | </Parameter> |
| 339 | </ParameterDefintion> |
| 340 | </SimpleSymbolDefinition> |
| 341 | }}} |
| 342 | |
| 343 | |