[mapguide-trac] #381: MgMappingService::GenerateLegendImage() fails when layer uses Composite feature type styles

MapGuide Open Source trac_mapguide at osgeo.org
Sun Jan 6 01:48:17 EST 2008


#381: MgMappingService::GenerateLegendImage() fails when layer uses Composite
feature type styles
-----------------------------+----------------------------------------------
 Reporter:  ronnielouie      |         Owner:  waltweltonlair
     Type:  defect           |        Status:  closed        
 Priority:  medium           |     Milestone:  2.1           
Component:  Mapping Service  |       Version:                
 Severity:  major            |    Resolution:  fixed         
 Keywords:                   |   External_id:  1031059       
-----------------------------+----------------------------------------------
Changes (by waltweltonlair):

  * status:  assigned => closed
  * resolution:  => fixed

Comment:

 !GetLegendImage was missing support for composite type styles, and
 therefore the returned byte reader was NULL.  I updated !GetLegendImage to
 handle composite type styles.  This ended up being relatively
 straightforward: the !GeometryContext on the symbol instances determines
 whether a composite type style is compatible with the supplied geometry
 type.

 I also noticed that !GetLegendImage was being called with invalid theme
 categories, and this was also causing the returned byte reader to be NULL.
 Although returning NULL no longer causes a crash due to Ronnie's fix, it
 does result in a missing image in the legend.  So instead of returning
 NULL I made the method return a blank image.

 The cause of the invalid theme categories is some invalid logic in the
 legend UI web code.  In my example I had a layer with 2 theme rules.  The
 layer has 3 composite type styles, the first with 2 rules (this is the
 type style of interest - the one with the correct geometry usage), and the
 other two with 1 rule each (these have an incompatible geometry usage).
 The legend UI code simply adds up all rules for each type style type and
 assumes there are that many categories altogether (so 4 in this example).
 In any case, the logic I added to !GetLegendImage will detect the correct
 type style / rule to use when called with the valid theme categories, so
 there's no strong need to fix the logic in legend UI code right now.

 I also cleaned up StylizationUtil::!DrawStylePreview quite a bit - code
 that was duplicated 4 times now appears just once.

-- 
Ticket URL: <http://trac.osgeo.org/mapguide/ticket/381#comment:3>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals


More information about the mapguide-trac mailing list