wiki:MapGuideRfc44

Version 3 (modified by tomfukushima, 16 years ago) ( diff )

--

MapGuide RFC 44 - Specific Geometry Types in Property Definition

This page contains a change request (RFC) for the MapGuide Open Source project. More MapGuide RFCs can be found on the RFCs page.

Status

RFC Template Version(1.0)
Submission Date2007dec20
Last ModifiedGavin Cramer Timestamp
AuthorGavin Cramer
RFC Statusadopted
Implementation Statuspending
Proposed Milestone2.0
Assigned PSC guide(s)Tom
Voting History(vote date)
+1Tom, Paul, Bruce, Jason, Andy
+0
-0
-1

Overview

The geometric property definition only describes geometry types grouped by their shape’s dimensionality. In order to successfully persist data to some providers with more specific restrictions (e.g. SHP), the undiluted list of geometric types is required. This has already been done in the FDO API. This RFC proposes to offer the same via MapGuide API.

Motivation

The current API describes the allowed geometry types via MgGeometricPropertyDefinition::GetGeometryTypes, which returns a bit-mask value composed of values from the MgFeatureGeometricType enumeration. The allowed values pertain to the shape dimensionality (Point, Curve, Surface or Solid), rather than to specific geometry types as described by MgGeometryType (Point, LineString, CurveString, Polygon, etc.). Some FDO Providers restrict the type of geometry in a geometric property to a specific. SHP is a good example of this. The provider may advertise that the geometry can be a Curve, which implies LineString, MultiLineString, CurveString, and MultiCurveString. However, the provider might only allow LineString in this case. If an attempt is made to insert a MultiLineString geometry, an exception is thrown that it cannot be written. A more fine grained specification of allowed geometry types will avoid these situations because the caller can check specific types beforehand. FDO supports the needed check via the FdoGeometricPropertyDefinition::GetSpecificGeometryTypes method, and its counterpart, SetSpecificGeometryTypes. These more specific method were never added to the corresponding GIS Platform class, MgGeometricPropertyDefinition. This RFC proposes to add the same methods to the Platform.

Proposed Solution

Add the following class to contain the accessor’s results (in lieu of the FDO method’s use of an output parameter):

#define MAX_GEOMETRY_TYPE_SIZE    12

class MG_PLATFORMBASE_API MgGeometryTypeInfo : public MgSerializable
{
PUBLISHED_API:
    MgGeometryType GetType(INT32 index);
    INT32 GetCount();

INTERNAL_API:
    virtual INT32 GetClassId();
    virtual void Serialize(MgStream* stream);
    virtual void Deserialize(MgStream* stream);
    virtual void ToXml(string &str);
    virtual void SetTypes(MgGeometryType * types, INT32 count);

protected:
    virtual void Dispose();

private:
    MgGeometryType m_types[MAX_GEOMETRY_TYPE_SIZE];
    INT32          m_count;

CLASS_ID:
    static const INT32 m_cls_id = PlatformBase_FeatureService_GeometryTypeInfo;
};

Add the following methods to the PUBLISHED_API section of MgGeometricPropertyDefinition. Descriptions are adapted from the FDO API version for brevity.

    /// \brief
    /// Gets the specific geometry types that can be stored in this geometric
    /// property. The returned value is a list of geometry types that are
    /// supported.  The caller does NOT own the array of types and should not free its memory.
    /// 
    /// \return
    /// Returns a list of geometry types that are supported.
    /// 
    MgGeometryTypeInfo * GetSpecificGeometryTypes();

    /// \brief
    /// Sets the specific set of geometry types that can be stored in this
    /// geometric property. The provided value is a list of geometry types
    /// that are supported. 
    /// 
    /// \param typeInfo
    /// The specific set of geometry types that can be stored in this
    /// geometric property.
    ///
    /// \return
    /// Returns nothing.
    /// 
    void SetSpecificGeometryTypes(MgGeometryTypeInfo * typeInfo);

Defaults will be applied as appropriate when the older SetGeometryTypes method is used. The MgFeatureGeometricType --> MgGeometryType mappings are:

Implications

This is strictly an API change.

Test Plan

  • Add unit tests which test the new API methods.

Funding/Resources

Autodesk to supply the resources to make the required changes.

Note: See TracWiki for help on using the wiki.