= FDO RFC 10 - Modify WMS override API to support additional parameters and bit depth variations = This page contains a request for comments document (RFC) for the FDO Open Source project. More FDO RFCs can be found on the [wiki:FDORfcs RFCs] page. == Status == ||RFC Template Version||(1.0)|| ||Submission Date|||| ||Last Modified||Greg Boone [[Timestamp]]|| ||Author||Klain Qin|| ||RFC Status||Draft|| ||Implementation Status ||Under Development|| ||Proposed Milestone||3.3.0.0|| ||Assigned PSC guide(s)||Greg Boone|| ||'''Voting History'''|| || ||+1||Greg, Orest, Mateusz, Frank, Jason || ||+0|||| ||-0|||| ||-1|||| == Overview == The purpose is to add support to additional parameters and bit-depth variations to image formats. Currently, WMS Provider supports four image formats: image/png, image/jpg, image/tif, image/gif. They are defined as: {{{ enum FdoWmsOvFormatType{ FdoWmsOvFormatType_Png = 0, FdoWmsOvFormatType_Tif, FdoWmsOvFormatType_Jpg, FdoWmsOvFormatType_Gif }; }}} This enhancement will support additional parameters and bit-depth variations such as: {{{ image/png; PhotometricInterpretation=PaletteColor image/png; PhotometricInterpretation=RGB image/png; mode=24bit }}} == Proposed Solution == WMS Override API will accept a string instead of the enumeration for image format. It will only accept server defined format strings that contain ‘png’, ‘tiff’, ‘jpeg’ or ‘gif’ in their definitions. For example, by calling {{{ SetImageFormat("image/png; PhotometricInterpretation=PaletteColor") }}} The WMS Provider will return raster stream in palette model. And by calling {{{ SetImageFormat("image/png; PhotometricInterpretation=RGB") }}} the raster stream will be returned in RGB model. In this way, WMS Provider could fully make use of the server capability to support different bit-depth. These additional parameters will go into the configuration file in a NEW WMS configuration element : {{{ image/png;PhotometricInterpretation=PaletteColor ... }}} However, still only four image file formats are supported: png, tiff, jpeg, and gif. If the user passed a string that contains other image formats like "bmp", "wbmp", etc, an exception will be thrown. This following section outlines the necessary code changes in the unmanaged and managed code. === Unmanaged Code === {{{ /// \brief /// /// The FdoWmsOvRasterDefinition class defines the physical overrides for a raster property in a WMS FDO schema. class FdoWmsOvRasterDefinition : public FdoPhysicalElementMapping { ... /// \brief /// Gets the format type in which the WMS image will be generated. /// /// \remarks /// Allowed map formats are "picture" formats . Picture formats constitute /// a rectangular pixel array of fixed size. Picture formats include file types such /// as Portable Network Graphics (PNG), Joint Photographics Expert Group (JPEG) /// and file types such as Tagged Image File Format (TIFF). /// /// \return /// Returns the WMS image format. /// FDOWMS_API FdoString* GetImageFormat(void) const; /// \brief /// Sets the format type in which the WMS image will be generated. /// /// \remarks /// Allowed map formats are "picture" formats . Picture formats constitute /// a rectangular pixel array of fixed size. Picture formats include file types such /// as Portable Network Graphics (PNG), Joint Photographics Expert Group (JPEG) /// and file types such as Tagged Image File Format (TIFF). /// /// \return /// Returns nothing. /// FDOWMS_API void SetImageFormat(FdoString* value); ... } }}} === Managed Code === {{{ /// /// The FdoWmsOvRasterDefinition class defines the physical overrides for a raster property in a WMS FDO schema. /// public __gc class OvRasterDefinition : public NAMESPACE_OSGEO_FDO_COMMANDS_SCHEMA::PhysicalElementMapping { ... /// Gets the format type in which the WMS image will be generated. /// Returns the WMS format type. /// Allowed map formats are "picture" formats . Picture formats constitute /// a rectangular pixel array of fixed size. Picture formats include file types such /// as Portable Network Graphics (PNG), Joint Photographics Expert Group (JPEG) /// and file types such as Tagged Image File Format (TIFF). __property System::String* get_ImageFormat(); /// Sets the format type in which the WMS image will be generated. /// Returns nothing. /// Allowed map formats are "picture" formats . Picture formats constitute /// a rectangular pixel array of fixed size. Picture formats include file types such /// as Portable Network Graphics (PNG), Joint Photographics Expert Group (JPEG) /// and file types such as Tagged Image File Format (TIFF). __property System::Void set_ImageFormat(System::String* value); ... } }}} === Notes === In order to make the proposed change both backwards and forwards compatible. Configuration files created by the 3.3.0 version of the WMS Provider will continue to write the value of the element as was previously done in FDO 3.2.2. This would allow continued compatibility with applications written for 3.2.2. At the same time the FDO 3.3 WMS provider configuration file would be modified to contain a new element that would only be evaluated by the 3.3 version of the WMS provider and subsequent releases. FDO 3.3 would look for first and if not found evaluate . FDO 3.2.2 would continue to evaluate and ignore . There would some duplication of information, but applications written on both versions of the WMS Provider should continue to work as designed. The would be deemed deprecated and removed once forward compatibility support is no longer required. The resulting 3.3 WMS configuration xml document would take the form of... {{{ PNG // Deprecated element. This one is consistent with FDO 3.2.2 image/png;PhotometricInterpretation=PaletteColor ... }}} '''For the 3.2.2 FDO WMS configuration API'''.... Calls to {{{ void FdoWmsOvRasterDefinition::SetFormatType(FdoWmsOvFormatType value); }}} would continue to result in the generation of XML content that contained only the element as follows {{{ PNG ... }}} Calls to {{{ FdoWmsOvFormatType FdoWmsOvRasterDefinition::GetFormatType(void) const; }}} would continue to result in the return of the expected !FdoWmsOvFormatType enumeration type '''For the 3.3 FDO WMS configuration API'''.... Calls to {{{ void SetImageFormat(FdoString* value); }}} would result in the generation of XML content that contained both and {{{ PNG image/png;PhotometricInterpretation=PaletteColor ... }}} where the content of is the content passed through the call to !SetImageFormat() and the content of is interpreted and set form the allowed values of , with a default value of PNG being used no valid interpretation can be made. Calls to {{{ FdoString* GetImageFormat(void) const; }}} would result in the return of the expected string set through the call to !SetImageFormat() and/or the value contained in the element. The content in would not be returned or evaluated. == Test Plan == Existing unit tests will be expanded to test those changes. Regression testing will be performed against applications using FDO 3.2.2. == Funding/Resources == Autodesk to provide resources / funding to update WMS Override API.