[mapguide-internals] Fwd: Feature stylization draw order question

Walt Welton-Lair walt.welton-lair at autodesk.com
Sun Nov 22 02:51:03 EST 2009


Fix has been submitted.

I attached a small image as an example (it may get dropped by the osgeo email server):
* the yellow triangles are a regular old stylization point layer
* the grey text boxes are regular feature labels for the previous layer
* the orange squares are for a different point layer, configured using the new stylization as below
The orange squares draw nicely on top of the text labels.

-----Original Message-----
From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-internals-bounces at lists.osgeo.org] On Behalf Of Walt Welton-Lair
Sent: Saturday, November 21, 2009 5:29 PM
To: MapGuide Internals Mail List
Subject: RE: [mapguide-internals] Fwd: Feature stylization draw order question

Let me make sure I understand.  You have layers using the old stylization (some of which have labels), and you have a point layer that uses the new stylization, but you would like it to draw on top of the labels for the other layers?  If that's correct, then I think there's a way to do it, but it requires a code fix (see further below).

Since labels always draw last, the only way to have your point symbol draw on top of other labels is to make it also be a label.  You can do that by setting DrawLast to true in your symbol instance.

Once you've made it a label you'll no longer have other labels that draw on top of it since by default it will participate in the overposting algorithm.  But that introduces another side effect: any labels from layers higher in the draw order have priority and so some of your point symbols may not draw.  You can eliminate this by making it the topmost layer.  But you can still have interference from within your label: if two point symbols in your layer overlap then only one is drawn.  The API provides a way to avoid this: set CheckExclusionRegion to false in the SymbolInstance.  Then the point symbol labels will draw even if they overlap other labels.  However, I looked at the code and support for CheckExclusionRegion is not implemented - the setting is ignored.  I think it's just a one line change though, and so I plan on fixing it shortly.

So until the fix is available, the closest way to achieve what you want is to:
* set DrawLast to true to make your point symbol be treated as a label
* set AddToExclusionRegion to true to ensure other (lower-priority) labels don't draw on top of your point symbol labels
* make your point layer the topmost layer so that the point symbol labels have highest priority

Once the code is fixed you will be able to achieve your scenario:
* set DrawLast to true to make your point symbol be treated as a label
* set AddToExclusionRegion to true to ensure other (lower-priority) labels don't draw on top of your point symbol labels
* set CheckExclusionRegion to false to ensure all the point symbol labels get drawn during the labeling pass
* set the draw order position of your point layer
    * the point symbol labels will draw on top of labels from layers higher in the draw order
    * labels from layers below the point layer will not overpost the point symbol layers

Example:
  layer 1 - old style polygon layer with labels
  layer 2 - old style polyline layer with labels
  layer 3 - new style point layer (a label symbol)
  layer 4 - old style point layer with labels

For the regular rendering pass, the polygons are drawn first, then the polylines, and then the old style points.  The new style point layer only has a label symbol, and it doesn't draw anything during the regular rendering.

For the labeling pass, the old style point labels (layer 4) are drawn first, followed by *all* of your new style point labels (some of which may overpost labels from layer 4).  Then layer 2 and layer 1's labels are drawn, as long as they don't overlap other labels.


One thing to note: since labels are accumulated during the regular rendering pass in a list, if your point layer has lots of features then the list will get large and the memory use during stylization of your map will increase.  Point symbol labels using the new stylization also need more memory than simple text labels for old style layers.  As long as your point layer doesn't have "too many" features then this approach should work ok.

Walt

-----Original Message-----
From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-internals-bounces at lists.osgeo.org] On Behalf Of Jason Birch
Sent: Friday, November 20, 2009 11:42 PM
To: MapGuide Internals Mail List
Subject: [mapguide-internals] Fwd: Feature stylization draw order question

Anyone have an answer to this newbie's question from the -users list?


---------- Forwarded message ----------
From: Jason Birch <jason at jasonbirch.com>
Date: Wed, 18 Nov 2009 14:05:07 -0800
Subject: Feature stylization draw order question
To: MapGuide Users Mail List <mapguide-users at lists.osgeo.org>

Hi all,

I've been playing around with advanced stylization for the past while, but
still have a number of layers in the simple (point, line, polygon, text)
format.

I have some custom styled point features that I would like to have drawn
entirely due to layer order rather than allowing label text to float on top
of it.

Is there a way I can achieve this?  RenderingPass (from RFC29) looked
promising, but only appears to work for the current layer.

Layer Definition snippet:

<CompositeTypeStyle>
  <CompositeRule>
    <LegendLabel />
    <CompositeSymbolization>
    <SymbolInstance>

 <ResourceId>Library://Nanaimo/Shared/Symbols/POI/Fire.SymbolDefinition</ResourceId>
      <ParameterOverrides />
      <AddToExclusionRegion>true</AddToExclusionRegion>
    </SymbolInstance>
    </CompositeSymbolization>
  </CompositeRule>
</CompositeTypeStyle>

Symbol Definition snippet:

<Graphics>
  <Image>
    <ResizeControl>'ResizeNone'</ResizeControl>
    <Reference>
    <ResourceId/>
    <LibraryItemName>'fire.png'</LibraryItemName>
    </Reference>
    <SizeX>8.0</SizeX>
    <SizeY>9.0</SizeY>
    <SizeScalable>True</SizeScalable>
    <Angle>0.0</Angle>
    <PositionX>0.0</PositionX>
    <PositionY>4.0</PositionY>
  </Image>
  <Path>
    <Geometry>M -1.0,0.0 L 0.0,1.0 L 1.0,0.0 L 0.0,-1.0 Z</Geometry>
    <FillColor>ff008800</FillColor>
  </Path>
</Graphics>

Thanks!
Jason
_______________________________________________
mapguide-internals mailing list
mapguide-internals at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PointSymbolLabels.png
Type: image/png
Size: 8877 bytes
Desc: PointSymbolLabels.png
Url : http://lists.osgeo.org/pipermail/mapguide-internals/attachments/20091121/3076dc93/PointSymbolLabels.png


More information about the mapguide-internals mailing list