= !MapGuide RFC 133 - Additional Stylization Expression Functions = This page contains a change request (RFC) for the !MapGuide Open Source project. More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page. == Status == ||RFC Template Version||(1.0)|| ||Submission Date||18 Apr 2013|| ||Last Modified||6 May 2013|| ||Author||Jackie Ng|| ||RFC Status||implemented|| ||Implementation Status||implemented|| ||Proposed Milestone||2.6|| ||Assigned PSC guide(s)||(when determined)|| ||'''Voting History'''||(vote date)|| ||+1|||| ||+0|||| ||-0|||| ||-1|||| ||no vote|| || == Overview == This RFC proposes to add support for additional expression engine functions to allow for greater stylization flexibility == Motivation == There are several scenarios that the current stylization expression function suite fails to address, mostly centered around tooltips: * Ability to stylize based on current map scale (eg. Scale-dependent tooltips) * Ability to stylize based on view location (eg. View-specific tooltips) * Ability to construct useful tooltips for debugging/informative purposes due to key information that about the stylized feature that is missing This RFC expands the suite of FDO stylization functions to fulfil these scenarios == Proposed Solution == Implement the following FDO expression engine functions in the Stylization library: * HTMLCOLOR(r, g, b)+ * FEATURESOURCE() * LAYERDEFINITION() * MAPSCALE() * MAPCENTERX() * MAPCENTERY() + Denotes a MapGuide-specific stylization function Each function is described in detail below === HTMLCOLOR(r, g, b) === Returns the HTML color string based on the integer red, green and blue values provided. This function is more useful for tooltip construction where the existing ARGB() function is inadequate. === FEATURESOURCE() === Returns the resource ID of the Feature Source where this stylized feature originates from Implementation details: Store the Feature Source id into the RS_FeatureClassInfo class that is created and set before rendering begins and is also referred to by other stylization functions. Evaluating this function returns this set value. === LAYERDEFINITION() === Returns the resource ID of the Layer Definition that is being used to stylize this feature Implementation details: Store the Layer Definition id into the RS_LayerUIInfo class that is created and set before rendering begins and is also referred to by other stylization functions. Evaluating this function returns this set value. === MAPSCALE() === Returns the current scale of the map being rendered. Implementation details: We store the map scale into the RS_MapUIInfo class that is created and set before rendering begins and is also referred to by other stylization functions. Evaluating this function returns this set value. === MAPCENTERX() === Returns the X coordinate of the map's current view center Implementation details: We store the X coordinate into the RS_MapUIInfo class that is created and set before rendering begins and is also referred to by other stylization functions. Evaluating this function returns this set value. === MAPCENTERY() === Returns the Y coordinate of the map's current view center Implementation details: We store the Y coordinate into the RS_MapUIInfo class that is created and set before rendering begins and is also referred to by other stylization functions. Evaluating this function returns this set value. All of the above changes have been implemented in [http://trac.osgeo.org/mapguide/browser/sandbox/jng/extra_stylization_funcs this sandbox]. Upon adoption of this RFC, the changes in this sandbox will be merged back into the trunk code stream. == Implications == Layer definitions that use expressions containing theming functions will be stylized correctly only on MapGuide servers from a release that implements those functions. == Test Plan == Render some labels exercising all of the above functions for a layer in a map at various positions and zoom levels. The labels rendered out should contain the expected values returned by these functions. == Funding / Resources == Community