Changes between Version 18 and Version 19 of MapGuideRfc29


Ignore:
Timestamp:
09/18/07 05:33:39 (17 years ago)
Author:
waltweltonlair
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MapGuideRfc29

    v18 v19  
    108108The proposed solution to this is to add an optional !UsageContext element to !SymbolInstance that  specifies which usage type should be the active usage.  In the above example you would set the !UsageContext for the first !SymbolInstance to Area and for the second !SymbolInstance to Line.
    109109
     110If the !UsageContext element is not specified then the code will continue to work the way it does in !MapGuide 1.2: it uses the first usage it finds, in order of Point, Line, and Area.
     111
    110112Now let's take this example further.  Suppose the feature source for your layer contains multiple geometry types: points, polylines, and polygons.  You need to be able to control the stylization for each of these types.  You have some predefined symbols you'd like to use for each type: a symbol with a !PointUsage for the points (symbol A), one with a !LineUsage for the polylines (symbol B), one with a !LineUsage for the polygon edges (symbol C), and a final one with an !AreaUsage for the polygon fill (symbol D).  To configure your layer you create !SymbolInstances referencing each of these symbols.  As described above, you set the !UsageType on each !SymbolInstance to remove any redundancy about which usage in the symbol definition should be active.  Now the code starts drawing features from the layer.  The only applicable symbol for point features is symbol A, so those features draw as expected.  For polyline features we have a problem though: symbols A, B, and C can all be used to style polyline features.  The active usage for symbol A is Point, and therefore we could draw a single instance of symbol A at the polyline mid-point.  The active usages for symbols B and C is Line, and therefore we would use those symbols as line styles for that polyline.  (The active usage for symbol D is Area, and that doesn't apply to polylines.)  The same problem happens with polygon features: in this case all four symbols can be used to style polygon features.  The basic problem here is that there's no place in the schema to specify which geometry type a symbol instance should apply to.  There's no way for the code to automatically determine which symbols should be used for different geometry types.
    111113
    112114The proposed solution to this is to add an optional !GeometryContext element to !SymbolInstance that specifies which geometry type the symbol instance applies to.  In the above example you would set the !GeometryContext to Point for !SymbolInstance A, Polyline for !SymbolInstance B, and Polygon for !SymbolInstance C and D.
     115
     116If the !GeometryContext element is not specified then the code will continue to work the way it does in !MapGuide 1.2: it will apply the active usage to all geometry types that support it.
    113117
    114118Adding !UsageContext and !GeometryContext eliminates all ambiguity when it comes to determining how to apply symbol definitions to a given feature.