Changes between Initial Version and Version 1 of MapGuideRfc128


Ignore:
Timestamp:
Oct 22, 2012, 5:45:42 AM (12 years ago)
Author:
jng
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MapGuideRfc128

    v1 v1  
     1
     2= !MapGuide RFC 128 - WebLayout schema update =
     3
     4This page contains a change request (RFC) for the !MapGuide Open Source project.
     5More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page.
     6
     7
     8== Status ==
     9
     10||RFC Template Version||(1.0)||
     11||Submission Date||22 Oct 2012||
     12||Last Modified||22 Oct 2012||
     13||Author||Jackie Ng||
     14||RFC Status||draft||
     15||Implementation Status||||
     16||Proposed Milestone||2.5||
     17||Assigned PSC guide(s)||(when determined)||
     18||'''Voting History'''||(vote date)||
     19||+1||||
     20||+0||||
     21||-0||||
     22||-1||||
     23||no vote|| ||
     24
     25== Overview ==
     26
     27This RFC proposes to update the WebLayout schema to expose settings for commonly customized properties/behaviour in the AJAX viewer.
     28
     29== Motivation ==
     30
     31There are certain bits of the AJAX viewer that are commonly customized, but they can only be customized by modifying the viewer template files because such behaviour is not exposed in the WebLayout schema:
     32
     33 * Selection Color
     34 * Map/Overlay Image Format
     35 * Point Selection Pixel buffer
     36
     37In addition, there is a lack of a well-defined javascript entry point that can be invoked after the viewer has been loaded. Currently hack-ish solutions like [http://trac.osgeo.org/mapguide/wiki/CodeSamples/JavaScript/AJAXViewerEventHooking this]
     38have to be employed.
     39
     40Such customizations can be (and should be) declaratively driven through a Web Layout using a schema that supports such elements.
     41
     42== Proposed Solution ==
     43
     44Bump the WebLayout schema version to 2.5.0. Introduce the following '''optional''' XML schema elements to the WebLayoutType root element
     45
     46{{{
     47
     48    <xs:element name="SelectionColor" type="xs:string" minOccurs="0" />
     49    <xs:element name="PointSelectionBuffer" type="xs:integer" minOccurs="0" />
     50    <xs:element name="MapImageFormat" type="xs:string" minOccurs="0" />
     51    <xs:element name="SelectionImageFormat" type="xs:string" minOccurs="0" />
     52    <xs:element name="StartupScript" type="xs:string" minOccurs="0" />
     53
     54}}}
     55
     56 * SelectionColor - Defines the HTML selection color (RGBA) to use (default: 0000FFFF)
     57 * PointSelectionBuffer - Selections by mouse click are inflated by this value (in pixels) to form the querying geometry that is passed to QueryMapFeatures (default: 2)
     58 * MapImageFormat - The image format for rendered maps (PNG/PNG8/JPG/GIF) (default: PNG)
     59 * SelectionImageFormat - The image format for selection overlays (PNG/PNG8/GIF) (default: PNG). JPG is technically supported by RenderDynamicOverlay, but why would you want an opaque selection image on top of your map?
     60 * StartupScript - The javascript code to execute once the viewer has been loaded (default: empty string)
     61
     62Where such elements are not specified in the WebLayout document, the existing default values are used instead.
     63
     64Similarly, the MgWebLayout class also needs to be updated to match as well so that the .net/PHP/Java viewers can access these new elements:
     65
     66{{{
     67
     68class MG_WEBAPP_API MgWebLayout : public MgGuardDisposable
     69{
     70PUBLISHED_API:
     71    ...
     72
     73    ///////////////////////////////////////////////////////////////////////////
     74    /// <summary>
     75    /// Returns the selection color in HTML RGBA format
     76    /// </summary>
     77    /// <returns>
     78    /// The selection color in HTML RGBA format
     79    /// </returns>
     80    STRING GetSelectionColor();
     81
     82    ///////////////////////////////////////////////////////////////////////////
     83    /// <summary>
     84    /// Returns the point selection buffer size in pixels
     85    /// </summary>
     86    /// <returns>
     87    /// The point selection buffer size in pixels
     88    /// </returns>
     89    INT32 GetPointSelectionBuffer();
     90
     91    ///////////////////////////////////////////////////////////////////////////
     92    /// <summary>
     93    /// Returns the map image format
     94    /// </summary>
     95    /// <returns>
     96    /// The map image format
     97    /// </returns>
     98    STRING GetMapImageFormat();
     99
     100    ///////////////////////////////////////////////////////////////////////////
     101    /// <summary>
     102    /// Returns the selection overlay image format
     103    /// </summary>
     104    /// <returns>
     105    /// The selection overlay image format
     106    /// </returns>
     107    STRING GetSelectionImageFormat();
     108
     109    ///////////////////////////////////////////////////////////////////////////
     110    /// <summary>
     111    /// Returns the startup script code that is executed when the viewer has loaded
     112    /// </summary>
     113    /// <returns>
     114    /// The startup script code
     115    /// </returns>
     116    STRING GetStartupScript();
     117
     118    ...
     119};
     120
     121}}}
     122
     123If startup script code is specified, it is executed in the context of the main viewer frame (ie. The script code is injected into mainframe.templ). It therefore has the same JavaScript scope as any existing invoke script command and follows the same rules in terms of syntax and API access. This code is encapsulated in a StartupFunc() function that is called by OnMapLoaded()
     124
     125If there is no startup script code specified, this function will be empty and does nothing when called.
     126
     127This RFC has already been implemented in [http://trac.osgeo.org/mapguide/browser/sandbox/jng/weblayout this sandbox]. Upon adoption of this RFC, the changes in this sandbox will be merged back into the trunk code stream.
     128
     129== Implications ==
     130
     131All these new properties are optional, loading Web Layouts of previous schema versions will use the same default values.
     132
     133The next version of Infrastructure Studio and Maestro need to be updated to allow editing these properties in the Web Layout editor. Such editors should ensure that:
     134
     135 * Selection colors are valid RGBA HTML colors
     136 * Image formats can only be one of: PNG/PNG8/JPG/GIF
     137
     138Due to #852. The alpha component of the selection color is currently not respected by the renderer. However if/when this gets fixed, the updated schema as proposed by this RFC will provide the necessary means to customize the alpha component of the selection color.
     139
     140== Test Plan ==
     141
     142Verify new WebLayout properties through all 3 viewers (.net/PHP/Java). Verify old WebLayouts (2.4.0 and older) behave as before with these changes.
     143
     144== Funding / Resources ==
     145
     146Community