[fdo-commits] r2618 - trunk/Providers/GDAL/testwrk

svn_fdo at osgeo.org svn_fdo at osgeo.org
Thu Mar 1 16:38:51 EST 2007


Author: warmerdam
Date: 2007-03-01 16:38:51 -0500 (Thu, 01 Mar 2007)
New Revision: 2618

Modified:
   trunk/Providers/GDAL/testwrk/fdorastutil.cpp
Log:
added spatial context reporting

Modified: trunk/Providers/GDAL/testwrk/fdorastutil.cpp
===================================================================
--- trunk/Providers/GDAL/testwrk/fdorastutil.cpp	2007-03-01 15:58:12 UTC (rev 2617)
+++ trunk/Providers/GDAL/testwrk/fdorastutil.cpp	2007-03-01 21:38:51 UTC (rev 2618)
@@ -40,6 +40,7 @@
 static void ReportSchemas( FdoPtr<FdoIConnection> conn, FdoStringP &FeatureClassName,
                            FdoStringP &FeatureIdName, FdoStringP &RasterName,
                            int bActuallyReport );
+static void ReportSpatialContexts( FdoPtr<FdoIConnection> connection );
 
 /************************************************************************/
 /*                               Usage()                                */
@@ -197,6 +198,12 @@
     }
 
 /* -------------------------------------------------------------------- */
+/*      Report on spatial contexts if requested.                        */
+/* -------------------------------------------------------------------- */
+    if( bReportSpatialContexts )
+        ReportSpatialContexts( conn );
+
+/* -------------------------------------------------------------------- */
 /*      Describe layer.                                                 */
 /* -------------------------------------------------------------------- */
     FdoStringP  FeatureIdName;
@@ -215,7 +222,7 @@
         FdoPtr<FdoIFeatureReader> reader = select->Execute ();
         int iCounter = 0;
     
-        while (reader->ReadNext ())
+        while (reader->ReadNext () && bReportFeatures )
         {
             FdoPtr<FdoIRaster>  raster;
 
@@ -224,7 +231,6 @@
             printf( "  Id = %ls\n", reader->GetString( FeatureIdName ) );
 
             raster = reader->GetRaster( RasterName );
-
             if( raster != NULL || !raster->IsNull() )
             {
                 FdoPtr<FdoRasterDataModel> data_model;
@@ -311,6 +317,7 @@
                 }
                 catch(...)
                 {
+                    printf( "    No Palette\n" );
                 }
 
                 // For now, only translate the first file. 
@@ -322,7 +329,7 @@
             }
         }
 
-        if( iCounter == 0 )
+        if( iCounter == 0 && bReportFeatures )
         {
             printf( "No features found for class %s.\n", 
                     (const char *) FeatureClassName );
@@ -516,6 +523,43 @@
 }
 
 /************************************************************************/
+/*                       ReportSpatialContexts()                        */
+/************************************************************************/
+
+static void ReportSpatialContexts( FdoPtr<FdoIConnection> connection )
+
+{
+    FdoICommand* cmd = connection->CreateCommand(FdoCommandType_GetSpatialContexts);
+    FdoPtr<FdoIGetSpatialContexts> getSpatialContexts = static_cast<FdoIGetSpatialContexts*>(cmd);
+    FdoPtr<FdoISpatialContextReader> spatialContextsReader = getSpatialContexts->Execute();
+	
+    //test the first spatial context
+    while( spatialContextsReader->ReadNext() )
+    {
+        printf( "Spatial Context\n"
+                "  Name:              %ls\n"
+                "  Description:       %ls\n"
+                "  Coordinate System: %ls\n"
+                "  CS WKT:            %ls\n",
+                spatialContextsReader->GetName(),
+                spatialContextsReader->GetDescription(),
+                spatialContextsReader->GetCoordinateSystem(),
+                spatialContextsReader->GetCoordinateSystemWkt() );
+
+        FdoSpatialContextExtentType type = spatialContextsReader->GetExtentType() ;
+	
+        FdoByteArray *byteArray = spatialContextsReader->GetExtent() ;
+        FdoPtr<FdoFgfGeometryFactory> agfFactory = FdoFgfGeometryFactory::GetInstance();
+        FdoPtr<FdoIGeometry> geometry = agfFactory->CreateGeometryFromFgf(byteArray);
+        FdoPtr<FdoIEnvelope> envelope = geometry->GetEnvelope();
+
+        printf( "  Extent: (%g,%g)-(%g,%g)\n",
+                envelope->GetMinX(), envelope->GetMinY(),
+                envelope->GetMaxX(), envelope->GetMaxY() );
+    }
+}
+
+/************************************************************************/
 /*                           ReportSchemas()                            */
 /************************************************************************/
 



More information about the fdo-commits mailing list