| 1 | |
| 2 | = !MapGuide RFC 148 - Support user-defined selection color in RenderMap = |
| 3 | |
| 4 | This page contains a change request (RFC) for the !MapGuide Open Source project. |
| 5 | More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page. |
| 6 | |
| 7 | == Status == |
| 8 | |
| 9 | ||RFC Template Version||(1.0)|| |
| 10 | ||Submission Date||20 Oct 2014|| |
| 11 | ||Last Modified|||| |
| 12 | ||Author||Jackie Ng|| |
| 13 | ||RFC Status||draft|| |
| 14 | ||Implementation Status||not ready|| |
| 15 | ||Proposed Milestone||3.0|| |
| 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 extend the RenderMap API to support user-defined selection colors |
| 27 | |
| 28 | == Motivation == |
| 29 | |
| 30 | Currently, the RenderMap API does not offer the ability to pass in a custom selection color. As a result, any selections rendered via the RenderMap API will always be blue, which may not be suitable for particular maps. |
| 31 | |
| 32 | == Proposed Solution == |
| 33 | |
| 34 | Add a new overload of RenderMap that accepts a selection color to MgRenderingService. For simplicity of implementation, we've based this new overload on the existing overload method with the most parameters. |
| 35 | |
| 36 | {{{ |
| 37 | class MgRenderingService |
| 38 | { |
| 39 | PUBLISHED_API: |
| 40 | ... |
| 41 | ///////////////////////////////////////////////////////////////// |
| 42 | /// \brief |
| 43 | /// Renders the specified MgMap to the requested image format. |
| 44 | /// |
| 45 | /// \param map |
| 46 | /// Input |
| 47 | /// map object containing current state of map. |
| 48 | /// \param selection |
| 49 | /// Input |
| 50 | /// map feature selection. Specifies the selected features on the map |
| 51 | /// \param center |
| 52 | /// Input |
| 53 | /// map center point. Specifies the center point for the map |
| 54 | /// \param scale |
| 55 | /// Input |
| 56 | /// map scale. Specifies the scale for the map |
| 57 | /// \param width |
| 58 | /// Input |
| 59 | /// image width. Specifies the image width in pixels |
| 60 | /// \param height |
| 61 | /// Input |
| 62 | /// image height. Specifies the image height in pixels |
| 63 | /// \param backgroundColor |
| 64 | /// Input |
| 65 | /// background color. Specifies the map background color |
| 66 | /// \param format |
| 67 | /// Input |
| 68 | /// image format. Defines the format of the resulting image |
| 69 | /// \param bKeepSelection |
| 70 | /// Input |
| 71 | /// true if you want to keep the selection |
| 72 | /// \param selectionColor |
| 73 | /// Input |
| 74 | /// The color to use for rendered selections |
| 75 | /// |
| 76 | /// \return |
| 77 | /// A byte reader containing the rendered image |
| 78 | /// |
| 79 | virtual MgByteReader* RenderMap( |
| 80 | MgMap* map, |
| 81 | MgSelection* selection, |
| 82 | MgCoordinate* center, |
| 83 | double scale, |
| 84 | INT32 width, |
| 85 | INT32 height, |
| 86 | MgColor* backgroundColor, |
| 87 | CREFSTRING format, |
| 88 | bool bKeepSelection, |
| 89 | MgColor* selectionColor) = 0; |
| 90 | }; |
| 91 | }}} |
| 92 | |
| 93 | In the mapagent, we'll introduce a version 3.0.0 GETMAPIMAGE that supports a user-defined selection color. |
| 94 | |
| 95 | || '''Name''' || '''Value''' || '''Required''' || '''Description''' || |
| 96 | || OPERATION || GETMAPIMAGE || Yes || Operation to execute || |
| 97 | || VERSION || 3.0.0 || Yes || Operation version || |
| 98 | || CLIENTAGENT || text || Optional || Descriptive text for client || |
| 99 | || SESSION || session identifier || Optional || !MapGuide session identifier containing map to display.[[BR]]SESSION or USERNAME and PASSWORD must be specified. || |
| 100 | || USERNAME || text || Optional || !MapGuide user id.[[BR]]SESSION or USERNAME and PASSWORD must be specified.|| |
| 101 | || PASSWORD || text || Optional || Password for !MapGuide user.[[BR]]SESSION or USERNAME and PASSWORD must be specified. || |
| 102 | || MAPNAME || text || Optional || Name of the map to display.[[BR]]This corresponds to the !GetName() value for the resource identifier.[[BR]]MAPNAME or MAPDEFINITION must be specified. || |
| 103 | || MAPDEFINITION || text || Optional || Resource identifier for the map definition.[[BR]]MAPNAME or MAPDEFINITION must be specified. || |
| 104 | || FORMAT || JPG/PNG/PNG8 || Yes || Image format for rendered image || |
| 105 | || KEEPSELECTION || 0/1 || Optional || If true, render selected feature(s) even if they are outside the current scale. || |
| 106 | || SETVIEWCENTERX || double || Optional || Set X coordinate for center of map. || |
| 107 | || SETVIEWCENTERY || double || Optional || Set Y coordinate for center of map. || |
| 108 | || SETVIEWSCALE || double || Optional || Set scale for map. || |
| 109 | || SETDISPLAYDPI || integer || Optional || Set DPI for map. || |
| 110 | || SETDISPLAYWIDTH || integer || Optional || Set width of image in pixels. || |
| 111 | || SETDISPLAYHEIGHT || integer || Optional || Set height of image in pixels. || |
| 112 | || SHOWLAYERS || text || Optional || List of layers to display. || |
| 113 | || HIDELAYERS || text || Optional || List of layers to hide. || |
| 114 | || SHOWGROUPS || text || Optional || List of groups to display. || |
| 115 | || HIDEGROUPS || text || Optional || List of groups to hide. || |
| 116 | || CLIP || 0/1 || Optional || If true, additional clipping will be performed on image. || |
| 117 | || SELECTIONCOLOR || RGBA hex color || Optional || If specified, any selections rendered will use the specified color. Defaults to blue if not specified || |
| 118 | |
| 119 | == Implications == |
| 120 | |
| 121 | None. This is a new API. |
| 122 | |
| 123 | == Test Plan == |
| 124 | |
| 125 | Add new rendering tests that pass in specific colors. Verify image output results. |
| 126 | |
| 127 | == Funding / Resources == |
| 128 | |
| 129 | Community |
| 130 | |
| 131 | == References == |
| 132 | |
| 133 | * #2399 |