[fdo-internals] RE: [fdo-commits] r5557 - in trunk/Providers: ArcSDE/Src/Provider OGR PostGIS/Src/Provider SDF/Src/Provider SDF/Src/UnitTest SHP/Src/Provider SHP/Src/UnitTest SQLite/Src/Provider SQLite/Src/UnitTest

Leaf Li leaf.li at autodesk.com
Wed Jul 21 00:52:29 EDT 2010


All,

Changes proposed in FDO RFC 48 was submitted inadvertently before RFC 48 is formally approved. I apologize for it.

I think I misunderstand the process of FDO RFC. There are the following statement in FDO PSC page (http://fdo.osgeo.org/psc.html) to introduce the process.

If the motion is made on the mailing list a deadline of 48 hours is assumed. The PSC member may request a longer time frame if they deem it necessary.

When I submitted code, it already passes 48 hours and nobody objects to it. So I assume it is already adopted automatically. After checking it with Orest and Greg, they told me that RFC isn't adopted until PSC send a message to state it is adopted.

So please check whether PSC send a message to state whether it is adopted even if it is already voted when you submit changes proposed in RFC. The message is the sign of adoption. If not, please hold on.

Thanks,
Leaf Li

-----Original Message-----
From: fdo-commits-bounces at lists.osgeo.org [mailto:fdo-commits-bounces at lists.osgeo.org] On Behalf Of Orest Halustchak
Sent: Monday, July 19, 2010 8:39 PM
To: FDO Commits Mail List
Subject: RE: [fdo-commits] r5557 - in trunk/Providers: ArcSDE/Src/Provider OGR PostGIS/Src/Provider SDF/Src/Provider SDF/Src/UnitTest SHP/Src/Provider SHP/Src/UnitTest SQLite/Src/Provider SQLite/Src/UnitTest

Hi Leaf,

You can't drop changes against an RFC that has not been approved formally. This RFC is has not been approved yet.

Thanks,
Orest.

-----Original Message-----
From: fdo-commits-bounces at lists.osgeo.org [mailto:fdo-commits-bounces at lists.osgeo.org] On Behalf Of svn_fdo at osgeo.org
Sent: Monday, July 19, 2010 12:28 AM
To: fdo-commits at lists.osgeo.org
Subject: [fdo-commits] r5557 - in trunk/Providers: ArcSDE/Src/Provider OGR PostGIS/Src/Provider SDF/Src/Provider SDF/Src/UnitTest SHP/Src/Provider SHP/Src/UnitTest SQLite/Src/Provider SQLite/Src/UnitTest

Author: leaf
Date: 2010-07-19 04:27:51 +0000 (Mon, 19 Jul 2010) New Revision: 5557

Modified:
   trunk/Providers/ArcSDE/Src/Provider/ArcSDEDescribeSchemaCommand.cpp
   trunk/Providers/OGR/OgrFdoUtil.cpp
   trunk/Providers/OGR/OgrFdoUtil.h
   trunk/Providers/OGR/OgrProvider.cpp
   trunk/Providers/PostGIS/Src/Provider/SchemaDescription.cpp
   trunk/Providers/SDF/Src/Provider/SchemaDb.cpp
   trunk/Providers/SDF/Src/UnitTest/UnitTestUtil.cpp
   trunk/Providers/SHP/Src/Provider/ShpLpClassDefinition.cpp
   trunk/Providers/SHP/Src/UnitTest/SelectTests.cpp
   trunk/Providers/SQLite/Src/Provider/SltMetadata.cpp
   trunk/Providers/SQLite/Src/UnitTest/UnitTestUtil.cpp
Log:
This submission is to implement FDO RFC 48 - Polygon Vertex Order.
http://trac.osgeo.org/fdo/wiki/FDORfc48

In the previous submission, I implemented FDO RFC 48 in FDO API level. This submission is to implement it for FDO Providers. In this submission, I finish adding class capabilities for ArcSDE, OGR, PostGIS, SDF, SHP and SQLite providers. I will add class capabilities for other providers later.

PostGIS FDO provider doesn't set class capabilities for FdoClassDefinition instance before this submission. So it means FdoClassDefinition::GetClassCapabilities(...) will return null when you call it. It is a small bug of PostGIS provider. When implementing polygon vertex order, we will return polygon vertex order rule through feature class capabilities. In this case, we have to fix it and set feature class' capabilities.

The capabilities for FDO providers are as follows.

Provider         Vertex Order   Strictness
WFS            CCW          Not enforced
SQLite         CCW          Not enforced
SHP            CW               Enforced
SDF            CCW          Not enforced
ArcSDE         CCW          Not enforced
ODBC           None         Not enforced
MySQL          CCW          Not enforced
PostGIS        CCW          Not enforced
Oracle         CCW          Enforced
SQLSpatial
  Geometry     CCW          Not enforced
  Geography    CCW          Enforced
OGR
  SHP          CW           Enforced
  Others       CCW          Not enforced

Modified: trunk/Providers/ArcSDE/Src/Provider/ArcSDEDescribeSchemaCommand.cpp
===================================================================
--- trunk/Providers/ArcSDE/Src/Provider/ArcSDEDescribeSchemaCommand.cpp 2010-07-19 03:25:23 UTC (rev 5556)
+++ trunk/Providers/ArcSDE/Src/Provider/ArcSDEDescribeSchemaCommand.cpp
+++ 2010-07-19 04:27:51 UTC (rev 5557)
@@ -350,6 +350,10 @@
                 ((FdoFeatureClass*)newFdoClass.p)->SetGeometryProperty (geometry_definition);
                 properties = newFdoClass->GetProperties ();
                 properties->Add (geometry_definition);
+
+                // Set vertex order and strictness rule for geometry property
+                classCapabilities->SetPolygonVertexOrderRule(fdoPropertyName, FdoPolygonVertexOrderRule_CCW);
+
+ classCapabilities->SetPolygonVertexOrderStrictness(fdoPropertyName,
+ false);
             }
             else  // not a shape column
             {

Modified: trunk/Providers/OGR/OgrFdoUtil.cpp
===================================================================
--- trunk/Providers/OGR/OgrFdoUtil.cpp  2010-07-19 03:25:23 UTC (rev 5556)
+++ trunk/Providers/OGR/OgrFdoUtil.cpp  2010-07-19 04:27:51 UTC (rev
+++ 5557)
@@ -18,6 +18,7 @@

 #include "stdafx.h"
 #include "OgrFdoUtil.h"
+#include "OgrProvider.h"

 void tilde2dot(std::string& mbfc)
 {
@@ -39,7 +40,7 @@
     }
 }

-FdoClassDefinition* OgrFdoUtil::ConvertClass(OGRLayer* layer, FdoIdentifierCollection* requestedProps)
+FdoClassDefinition* OgrFdoUtil::ConvertClass(OgrConnection* connection,
+OGRLayer* layer, FdoIdentifierCollection* requestedProps)
 {
     OGRFeatureDefn* fdefn = layer->GetLayerDefn();

@@ -52,7 +53,33 @@
     printf ("Feature class name: %s\n", name);  #endif
     FdoPtr<FdoFeatureClass> fc = FdoFeatureClass::Create(wname.c_str(), L"");
+    FdoPtr<FdoClassCapabilities> classCapabilities = FdoClassCapabilities::Create(*fc.p);
+    classCapabilities->SetSupportsLocking(false);
+    classCapabilities->SetSupportsLongTransactions(false);
+    classCapabilities->SetSupportsWrite(false);
+    fc->SetCapabilities(classCapabilities);

+    FdoPolygonVertexOrderRule vertexOrderRule = FdoPolygonVertexOrderRule_CCW;
+    bool bStrictness = false;
+    OGRDataSource* dataStore = connection->GetOGRDataSource();
+    if (NULL != dataStore)
+    {
+        OGRSFDriver* driver = dataStore->GetDriver();
+        if (NULL != driver)
+        {
+            const char* name = driver->GetName();
+
+            // As far as I know, ESRI Shapefile is the only feature source that uses
+            // clockwise vertex order. I assume other feature sources use counterclockwise
+            // vertex order.
+            if (strcmp(name, "ESRI Shapefile") == 0)
+            {
+                vertexOrderRule = FdoPolygonVertexOrderRule_CW;
+                bStrictness = true;
+            }
+        }
+    }
+
     FdoPtr<FdoPropertyDefinitionCollection> pdc = fc->GetProperties();

     //data properties (attributes)
@@ -137,8 +164,11 @@
             gpd->SetSpatialContextAssociation(wname.c_str());
             pdc->Add(gpd);
             fc->SetGeometryProperty(gpd);
+
+            // Set vertex order and strictness rule for geometry property
+            classCapabilities->SetPolygonVertexOrderRule(gpd->GetName(), vertexOrderRule);
+
+ classCapabilities->SetPolygonVertexOrderStrictness(gpd->GetName(),
+ bStrictness);
         }
-
     }

     //identity property
@@ -170,7 +200,7 @@
         //set the ID property of the feature class
         FdoPtr<FdoDataPropertyDefinitionCollection> idpdc = fc->GetIdentityProperties();
         idpdc->Add(fid);
-    }
+    }

     return FDO_SAFE_ADDREF(fc.p);
 }

Modified: trunk/Providers/OGR/OgrFdoUtil.h ===================================================================
--- trunk/Providers/OGR/OgrFdoUtil.h    2010-07-19 03:25:23 UTC (rev 5556)
+++ trunk/Providers/OGR/OgrFdoUtil.h    2010-07-19 04:27:51 UTC (rev 5557)
@@ -17,20 +17,18 @@
 //

 class OGRLayer;
+class OgrConnection;


 //Utility functions for conversion between FDO and OGR data  class OgrFdoUtil  {
 public:
-
-
-    static FdoClassDefinition* ConvertClass(OGRLayer* layer, FdoIdentifierCollection* requestedProps = NULL);
+    static FdoClassDefinition* ConvertClass(OgrConnection* connection,
+ OGRLayer* layer, FdoIdentifierCollection* requestedProps = NULL);
     static void ConvertFeature(FdoPropertyValueCollection* src, OGRFeature* dst, OGRLayer* layer);
     static void ApplyFilter(OGRLayer* layer, FdoFilter* filter);
     static int Fgf2Wkb(const unsigned char* fgf, unsigned char* wkb);
     static int Wkb2Fgf(const unsigned char* wkb, unsigned char* fgf);
-
 };



Modified: trunk/Providers/OGR/OgrProvider.cpp
===================================================================
--- trunk/Providers/OGR/OgrProvider.cpp 2010-07-19 03:25:23 UTC (rev 5556)
+++ trunk/Providers/OGR/OgrProvider.cpp 2010-07-19 04:27:51 UTC (rev
+++ 5557)
@@ -365,7 +365,7 @@
             for (int i=0; i<count; i++)
             {
                 OGRLayer* layer = m_poDS->GetLayer(i);
-                FdoPtr<FdoClassDefinition> fc = OgrFdoUtil::ConvertClass(layer);
+                FdoPtr<FdoClassDefinition> fc =
+ OgrFdoUtil::ConvertClass(this, layer);
                 classes->Add(fc);
             }
         }
@@ -761,7 +761,7 @@
     //TODO: cache the result of this
     //also this always returns all properties regardless
     //of what was given in the select command
-    return OgrFdoUtil::ConvertClass(m_poLayer, m_props);
+    return OgrFdoUtil::ConvertClass(m_connection, m_poLayer, m_props);
 }

 FdoInt32 OgrFeatureReader::GetDepth()

Modified: trunk/Providers/PostGIS/Src/Provider/SchemaDescription.cpp
===================================================================
--- trunk/Providers/PostGIS/Src/Provider/SchemaDescription.cpp  2010-07-19 03:25:23 UTC (rev 5556)
+++ trunk/Providers/PostGIS/Src/Provider/SchemaDescription.cpp
+++ 2010-07-19 04:27:51 UTC (rev 5557)
@@ -199,6 +199,10 @@
     PgTablesReader::Ptr stReader(new PgTablesReader(mConn.p));
     stReader->Open();

+    FdoPtr<FdoIConnectionCapabilities> connCaps = conn->GetConnectionCapabilities();
+    FdoInt32 lockTypeCount;
+    const FdoLockType* lockTypes = connCaps->GetLockTypes(
+ lockTypeCount );
+
     while (stReader->ReadNext())
     {
         ////////////////// CALCULATE SPATIAL EXTENT ////////////////// @@ -230,6 +234,12 @@
               FDOLOG_WRITE(L"Created class: %ls", static_cast<FdoString*>(fdoClassName));
           }

+          FdoPtr<FdoClassCapabilities> caps = FdoClassCapabilities::Create(*xClass);
+          caps->SetSupportsLocking(connCaps->SupportsLocking());
+          caps->SetSupportsLongTransactions(connCaps->SupportsLongTransactions());
+          caps->SetSupportsWrite(connCaps->SupportsWrite());
+          caps->SetLockTypes( lockTypes, lockTypeCount );
+          xClass->SetCapabilities(caps);

           FdoPtr<FdoPropertyDefinitionCollection> pdc = xClass->GetProperties();

@@ -302,6 +312,9 @@
             FDOLOG_WRITE(L"+ geometric property: %ls",
                 static_cast<FdoString*>(geomColumn->GetName()));

+            // Set vertex order and strictness rule for geometry property
+            caps->SetPolygonVertexOrderRule(geomPropDef->GetName(), FdoPolygonVertexOrderRule_CCW);
+
+ caps->SetPolygonVertexOrderStrictness(geomPropDef->GetName(), false);
           } //if stReader->IsSpatialTable()

           ////////////////// CREATE DATA PROPERTIES //////////////////

Modified: trunk/Providers/SDF/Src/Provider/SchemaDb.cpp
===================================================================
--- trunk/Providers/SDF/Src/Provider/SchemaDb.cpp       2010-07-19 03:25:23 UTC (rev 5556)
+++ trunk/Providers/SDF/Src/Provider/SchemaDb.cpp       2010-07-19 04:27:51 UTC (rev 5557)
@@ -587,6 +587,10 @@
             //property. FDO makes this a little ugly...
             pd = dynamic_cast<FdoGeometricPropertyDefinition*>(pdc->FindItem(geomname));

+            // Set vertex order and strictness rule for geometry property
+            classcaps->SetPolygonVertexOrderRule(geomname, FdoPolygonVertexOrderRule_CCW);
+            classcaps->SetPolygonVertexOrderStrictness(geomname,
+ false);
+
             //if we could not find it in the class properties, look in the inherited properties
             //if it's not there, the class does not have a geometry property
             if (pd == NULL)

Modified: trunk/Providers/SDF/Src/UnitTest/UnitTestUtil.cpp
===================================================================
--- trunk/Providers/SDF/Src/UnitTest/UnitTestUtil.cpp   2010-07-19 03:25:23 UTC (rev 5556)
+++ trunk/Providers/SDF/Src/UnitTest/UnitTestUtil.cpp   2010-07-19 04:27:51 UTC (rev 5557)
@@ -362,6 +362,10 @@
     FdoPtr<FdoClassCapabilities> caps = cdef->GetCapabilities();
     CPPUNIT_ASSERT(caps->SupportsLocking() == false);
     CPPUNIT_ASSERT(caps->SupportsLongTransactions() == false);
+    CPPUNIT_ASSERT (caps->GetPolygonVertexOrderRule (L"Data") == FdoPolygonVertexOrderRule_CCW);
+    CPPUNIT_ASSERT (caps->GetPolygonVertexOrderStrictness (L"Data") == false);
+    CPPUNIT_ASSERT (caps->GetPolygonVertexOrderRule (L"Data2") == FdoPolygonVertexOrderRule_CCW);
+    CPPUNIT_ASSERT (caps->GetPolygonVertexOrderStrictness (L"Data2") ==
+ false);

        FdoPtr<FdoPropertyDefinition> gpd = pdc->GetItem(L"Data2");
     CPPUNIT_ASSERT_MESSAGE("Expected a geometry property type", gpd->GetPropertyType() == FdoPropertyType_GeometricProperty );

Modified: trunk/Providers/SHP/Src/Provider/ShpLpClassDefinition.cpp
===================================================================
--- trunk/Providers/SHP/Src/Provider/ShpLpClassDefinition.cpp   2010-07-19 03:25:23 UTC (rev 5556)
+++ trunk/Providers/SHP/Src/Provider/ShpLpClassDefinition.cpp   2010-07-19 04:27:51 UTC (rev 5557)
@@ -152,6 +152,10 @@
             FdoFeatureClass *logicalFeatureClass = static_cast<FdoFeatureClass*>(m_logicalClassDefinition.p);
             logicalFeatureClass->SetGeometryProperty(logicalGeomProp);
         }
+
+        // Set vertex order and strictness rule for geometry property
+        classCapabilities->SetPolygonVertexOrderRule(logicalGeomProp->GetName(), FdoPolygonVertexOrderRule_CW);
+
+ classCapabilities->SetPolygonVertexOrderStrictness(logicalGeomProp->Ge
+ tName(), true);
     }

     // Create & add the identity property (always exactly one identity property):

Modified: trunk/Providers/SHP/Src/UnitTest/SelectTests.cpp
===================================================================
--- trunk/Providers/SHP/Src/UnitTest/SelectTests.cpp    2010-07-19 03:25:23 UTC (rev 5556)
+++ trunk/Providers/SHP/Src/UnitTest/SelectTests.cpp    2010-07-19 04:27:51 UTC (rev 5557)
@@ -462,6 +462,8 @@
         FdoPtr<FdoClassCapabilities> caps = definition->GetCapabilities ();
         CPPUNIT_ASSERT_MESSAGE ("supports locking?", !caps->SupportsLocking ());
         CPPUNIT_ASSERT_MESSAGE ("supports long transactions?", !caps->SupportsLongTransactions ());
+        CPPUNIT_ASSERT_MESSAGE ("wrong polygon vertex order rule", caps->GetPolygonVertexOrderRule (L"Geometry") == FdoPolygonVertexOrderRule_CW);
+        CPPUNIT_ASSERT_MESSAGE ("wrong polygon vertex order strictness
+ rule", caps->GetPolygonVertexOrderStrictness (L"Geometry") == true);
         FdoPtr<FdoDataPropertyDefinitionCollection> identities = definition->GetIdentityProperties ();
         CPPUNIT_ASSERT_MESSAGE ("too many id properties", 1 == identities->GetCount ());
         FdoPtr<FdoDataPropertyDefinition> id = identities->GetItem (0);

Modified: trunk/Providers/SQLite/Src/Provider/SltMetadata.cpp
===================================================================
--- trunk/Providers/SQLite/Src/Provider/SltMetadata.cpp 2010-07-19 03:25:23 UTC (rev 5556)
+++ trunk/Providers/SQLite/Src/Provider/SltMetadata.cpp 2010-07-19
+++ 04:27:51 UTC (rev 5557)
@@ -288,6 +288,10 @@
             }

             pdc->Add(gpd);
+
+            // Set vertex order and strictness rule for geometry property
+            caps->SetPolygonVertexOrderRule(gpd->GetName(), FdoPolygonVertexOrderRule_CCW);
+            caps->SetPolygonVertexOrderStrictness(gpd->GetName(),
+ false);
         }
         else
         {

Modified: trunk/Providers/SQLite/Src/UnitTest/UnitTestUtil.cpp
===================================================================
--- trunk/Providers/SQLite/Src/UnitTest/UnitTestUtil.cpp        2010-07-19 03:25:23 UTC (rev 5556)
+++ trunk/Providers/SQLite/Src/UnitTest/UnitTestUtil.cpp        2010-07-19 04:27:51 UTC (rev 5557)
@@ -379,6 +379,10 @@
     FdoPtr<FdoClassCapabilities> caps = cdef->GetCapabilities();
     CPPUNIT_ASSERT(caps->SupportsLocking() == false);
     CPPUNIT_ASSERT(caps->SupportsLongTransactions() == false);
+    CPPUNIT_ASSERT (caps->GetPolygonVertexOrderRule (L"Data") == FdoPolygonVertexOrderRule_CCW);
+    CPPUNIT_ASSERT (caps->GetPolygonVertexOrderStrictness (L"Data") == false);
+    CPPUNIT_ASSERT (caps->GetPolygonVertexOrderRule (L"Data2") == FdoPolygonVertexOrderRule_CCW);
+    CPPUNIT_ASSERT (caps->GetPolygonVertexOrderStrictness (L"Data2") ==
+ false);

        FdoPtr<FdoPropertyDefinition> gpd = pdc->GetItem(L"Data2");
     CPPUNIT_ASSERT_MESSAGE("Expected a geometry property type", gpd->GetPropertyType() == FdoPropertyType_GeometricProperty );

_______________________________________________
fdo-commits mailing list
fdo-commits at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/fdo-commits


More information about the fdo-internals mailing list