| 1 | = !MapGuide RFC 109 # - RenderMapLegend API enhancement = |
| 2 | |
| 3 | This page contains a change request (RFC) for the !MapGuide Open Source project. |
| 4 | More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page. |
| 5 | |
| 6 | |
| 7 | == Status == |
| 8 | |
| 9 | ||RFC Template Version||(1.0)|| |
| 10 | ||Submission Date||3rd August 2010|| |
| 11 | ||Last Modified||Jackie Ng 3rd August 2010|| |
| 12 | ||Author||Jackie Ng|| |
| 13 | ||RFC Status||draft|| |
| 14 | ||Implementation Status||pending|| |
| 15 | ||Proposed Milestone||2.3|| |
| 16 | ||Assigned PSC guide(s)||(when determined)|| |
| 17 | ||'''Voting History'''||(vote date)|| |
| 18 | ||+1|||| |
| 19 | ||+0|||| |
| 20 | ||-0|||| |
| 21 | ||-1|||| |
| 22 | ||no vote|| || |
| 23 | |
| 24 | == Overview == |
| 25 | |
| 26 | This RFC proposes to add an enhanced {{{RenderMapLegend()}}} API to the rendering service. This enhanced API allows the option to omit empty layer groups from being rendered into the resulting image. |
| 27 | |
| 28 | == Motivation == |
| 29 | |
| 30 | Under the current {{{RenderMapLegend()}}} API, all layer groups are rendered regardless of whether it has any visible layers or not. For maps with lots of layer groups, this can produce unnecessary clutter in the overall legend image. |
| 31 | |
| 32 | == Proposed Solution == |
| 33 | |
| 34 | Introduce a new overload of {{{RenderMapLegend()}}} to the {{{MgRenderingService}}} class: |
| 35 | |
| 36 | {{{ |
| 37 | ///////////////////////////////////////////////////////////////// |
| 38 | /// \brief |
| 39 | /// Renders the legend for the specified MgMap to the requested size and format |
| 40 | /// |
| 41 | /// \param map |
| 42 | /// Input |
| 43 | /// map object containing current state of map. |
| 44 | /// \param width |
| 45 | /// Input |
| 46 | /// width of legend image in pixels |
| 47 | /// \param height |
| 48 | /// Input |
| 49 | /// height of legend image in pixels |
| 50 | /// \param backgroundColor |
| 51 | /// Input |
| 52 | /// background color. Specifies the map legend background color |
| 53 | /// \param format |
| 54 | /// Input |
| 55 | /// image format. Defines the format of the resulting image |
| 56 | /// \param omitEmptyLayerGroups |
| 57 | /// Input |
| 58 | /// indicates whether layer groups with no visible layers should be drawn in the resulting image. If true, these groups will not be drawn. If false, these groups will be drawn |
| 59 | /// |
| 60 | /// \return |
| 61 | /// A byte reader containing the rendered image |
| 62 | /// |
| 63 | virtual MgByteReader* RenderMapLegend( |
| 64 | MgMap* map, |
| 65 | INT32 width, |
| 66 | INT32 height, |
| 67 | MgColor* backgroundColor, |
| 68 | CREFSTRING format, |
| 69 | bool omitEmptyLayerGroups) = 0; |
| 70 | |
| 71 | }}} |
| 72 | |
| 73 | When {{{omitEmptyLayerGroups}}} is {{{false}}}, this will function like the original API. |
| 74 | When {{{omitEmptyLayerGroups}}} is {{{true}}}, this will skip rendering the names of any layer groups that have no visible layers at the current map scale. |
| 75 | |
| 76 | Because this API has a HTTP counterpart, we will also introduce a new version of the GETMAPLEGENDIMAGE operation: |
| 77 | |
| 78 | === Parameters === |
| 79 | || '''Name''' || '''Value''' || '''Required''' || '''Description''' || |
| 80 | || [#Operation1.0 OPERATION] || GETMAPLEGENDIMAGE || Yes || Operation to execute || |
| 81 | || [#Version1.0 VERSION] || 2.3.0 || Yes || Operation version || |
| 82 | || [#ClientAgent2.1 CLIENTAGENT] || text || Optional || Descriptive text for client || |
| 83 | || [#Session1.0 SESSION] || session identifier || Yes || !MapGuide session identifier containing map to display || |
| 84 | || [#MapName1.0 MAPNAME] || text || Yes || Name of the map to display.[[BR]]This corresponds to the !GetName() value for the resource identifier. || |
| 85 | || [#Format1.0 FORMAT] || JPG/PNG/PNG8 || Yes || Image format for rendered image || |
| 86 | || [#Width1.0 WIDTH] || integer || Yes || Width of legend image || |
| 87 | || [#Height1.0 HEIGHT] || integer || Yes || Height of legend image || |
| 88 | || [#OmitEmptyLayerGroups1.0 OMITEMPTYLAYERGROUPS] || boolean || Optional || Indicates whether to omit layer groups from the rendered image. Default is false. || |
| 89 | |
| 90 | == Implications == |
| 91 | |
| 92 | This is an API addition. Backward compatibility is not compromised. The existing API will still be available and function as before. |
| 93 | |
| 94 | == Test Plan == |
| 95 | |
| 96 | Add new test case for Rendering Service unit test: |
| 97 | |
| 98 | * Create a map of Sheboygan which is the same as the existing rendering test map, but includes a visible Layer Group containing a Parcels layer (visible at 12000) |
| 99 | * Set view scale of this map to > 12000 |
| 100 | * Render the legend of this map with {{{omitEmptyLayerGroups = true}}} and {{{omitEmptyLayerGroups = false}}} |
| 101 | * When {{{omitEmptyLayerGroups = false}}}, verify the resulting image is as though the original API was called (layer group is drawn to the resulting image) |
| 102 | * When {{{omitEmptyLayerGroups = true}}}, verify the empty layer group is not drawn to the resulting image. |
| 103 | |
| 104 | |
| 105 | |
| 106 | == Funding / Resources == |
| 107 | |
| 108 | Community |