Changes between Version 9 and Version 10 of FDORfc66


Ignore:
Timestamp:
05/09/13 03:00:37 (12 years ago)
Author:
christinebao
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FDORfc66

    v9 v10  
    5757The caller can make a class inherit from !FdoCoordinateSystemTransform and implement real !CoordinateSystemTransform(...) function, set the instance to !FdoXmlFeatureFlags, and the feature data is transformed.
    5858
     59== Managed FDO API ==
     60
     61The managed FDO API is a little tricky because it needs to allow the caller create managed child class and implement the coordinate system transformation in its own child class. A solution is to make a VirtualFdoCoordinateSystemTransform which inherits from VirtualObject, a template in OSGeo.Fdo.Common for forwarding unmanaged methods to managed one:
     62
     63{{{
     64class VirtualFdoCoordinateSystemTransform : public VirtualObject <NAMESPACE_OSGEO_FDO_XML::CoordinateSystemTransform, FdoCoordinateSystemTransform>
     65{
     66public:
     67        FdoIDirectPosition* CoordinateSystemTransform(FdoIDirectPosition* sourceGeometry);
     68
     69private:
     70        enum WrapperCallBits
     71        {
     72                TransformBit              = 0x01,
     73        };
     74        mutable FdoInt32 wrapperCallBits;
     75};
     76
     77FdoIDirectPosition* VirtualFdoCoordinateSystemTransform::CoordinateSystemTransform(FdoIDirectPosition* sourceGeometry)
     78{
     79        if (!WrapperCallWrapper::IsCalling(wrapperCallBits, TransformBit))
     80        {
     81                WrapperCallWrapper ctx(wrapperCallBits, TransformBit);
     82               
     83        NAMESPACE_OSGEO_GEOMETRY::IDirectPosition ^managedSourceGeometry =  gcnew NAMESPACE_OSGEO_GEOMETRY::IDirectPositionImp(IntPtr(sourceGeometry), true);
     84                NAMESPACE_OSGEO_GEOMETRY::IDirectPositionImp^ destGeometry = static_cast<NAMESPACE_OSGEO_GEOMETRY::IDirectPositionImp^>(GetWrapper()->CoordinateSystemTransformPosition(managedSourceGeometry));
     85                return static_cast<FdoIDirectPosition*>(destGeometry->GetDisposableObject().ToPointer());
     86        }
     87        else
     88        {
     89                return 0;
     90        }
     91}
     92}}}
     93
     94And the managed !CoordinateSystemTransform can be initialized in this way:
     95
     96{{{
     97NAMESPACE_OSGEO_FDO_XML::CoordinateSystemTransform::CoordinateSystemTransform() : Disposable(IntPtr(new VirtualFdoCoordinateSystemTransform()), true)
     98{
     99        static_cast<VirtualFdoCoordinateSystemTransform*>(GetImpObj())->SetWrapper(this);
     100}
     101}}}
     102
     103By doing this the child class of !CoordinateSystemTransform can do the coordinate system transformation.
     104
     105Above is pseudo code as a reference. Currently there is no concrete requirement in managed side, so the managed API is not added and tested.
     106
    59107== Implications ==
    60108