[mapguide-commits] r5476 - trunk/MgDev/Common/Geometry/GeometryConsoleTest

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Dec 15 16:50:27 EST 2010


Author: NormOlsen
Date: 2010-12-15 13:50:27 -0800 (Wed, 15 Dec 2010)
New Revision: 5476

Modified:
   trunk/MgDev/Common/Geometry/GeometryConsoleTest/GeometryConsoleTest.cpp
   trunk/MgDev/Common/Geometry/GeometryConsoleTest/ReadMe.txt
Log:
GeometryConsoleTest.cpp
GeometryConsoleTest.cpp a simple test bed enabling testing and debugging of the MgGeometry.dll without the need for building or running any higher level application like MAP or MapGuide Server.  This code is never part of any product, nor is it ever used or seen by anyone other than MapGuide developers.  I submit only to share some test code I have developed with other developers who might find it useful.

Modified: trunk/MgDev/Common/Geometry/GeometryConsoleTest/GeometryConsoleTest.cpp
===================================================================
--- trunk/MgDev/Common/Geometry/GeometryConsoleTest/GeometryConsoleTest.cpp	2010-12-13 12:47:42 UTC (rev 5475)
+++ trunk/MgDev/Common/Geometry/GeometryConsoleTest/GeometryConsoleTest.cpp	2010-12-15 21:50:27 UTC (rev 5476)
@@ -1,3 +1,6 @@
+
+
+
 // GeometryConsoleTest.cpp : Defines the entry point for the console application.
 //
 
@@ -12,7 +15,94 @@
 int _tmain(int argc, _TCHAR* argv[])
 {
 #ifndef __SKIP__
+
+    // This test tests some problematical WKT strings which produced a
+    // regression in Reeses.
+
+    STRING codeOne;
+    STRING codeTwo;
+    STRING codeThree;
+    STRING codeFour;
+ 
+    STRING wktOne   (L"PROJCS[\"DHDN / Gauss-Kruger zone 5\",GEOGCS[\"DHDN\",DATUM[\"Deutsches_Hauptdreiecksnetz\",SPHEROID[\"Bessel 1841\",6377397.155,299.1528128,AUTHORITY[\"EPSG\",\"7004\"]],AUTHORITY[\"EPSG\",\"6314\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4314\"]],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",15],PARAMETER[\"scale_factor\",1],PARAMETER[\"false_easting\",5500000],PARAMETER[\"false_northing\",0],AUTHORITY[\"EPSG\",\"31469\"]]");
+    STRING wktTwo   (L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]");
+    STRING wktThree (L"PROJCS[\"NAD83 / California zone 3 (ftUS)\",GEOGCS[\"NAD83\",DATUM[\"North_American_Datum_1983\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6269\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4269\"]],UNIT[\"US survey foot\",0.3048006096012192,AUTHORITY[\"EPSG\",\"9003\"]],PROJECTION[\"Lambert_Conformal_Conic_2SP\"],PARAMETER[\"standard_parallel_1\",38.43333333333333],PARAMETER[\"standard_parallel_2\",37.06666666666667],PARAMETER[\"latitude_of_origin\",36.5],PARAMETER[\"central_meridian\",-120.5],PARAMETER[\"false_easting\",6561666.667],PARAMETER[\"false_northing\",1640416.667],AUTHORITY[\"EPSG\",\"2227\"],AXIS[\"X\",EAST],AXIS[\"Y\",NORTH]]");
+    STRING wktFour  (L"PROJCS[\"DHDN.Berlin/Cassini\",GEOGCS[\"DHDN.LL\",DATUM[\"DHDN\",SPHEROID[\"BESSEL\",6377397.155,299.15281535],TOWGS84[582.0000,105.0000,414.0000,-1.040000,-0.350000,3.080000,8.30000000]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]],PROJECTION[\"Cassini-Soldner\"],PARAMETER[\"false_easting\",40000.000],PARAMETER[\"false_northing\",10000.000],PARAMETER[\"central_meridian\",13.62720366666667],PARAMETER[\"latitude_of_origin\",52.41864827777778],UNIT[\"Meter\",1.00000000000000]]");
+
+    MgCoordinateSystemFactory factory;
+    MgCoordinateSystemCatalog* catalog;
+    MgCoordinateSystemDictionary* coordsysDict;
+    MgCoordinateSystemEnum* coordsysEnum;
+    MgStringCollection* stringCollection;
+    MgCoordinateSystem* coordsysOne;
+    MgCoordinateSystem* coordsysTwo;
+    MgCoordinateSystem* coordsysThree;
+    MgCoordinateSystem* coordsysFour;
+    MgCoordinateSystemTransform* xfrmOne;
+    MgCoordinateSystemTransform* xfrmThree;
+    MgCoordinateSystemTransform* xfrmFour;
+
+    catalog = factory.GetCatalog ();
+    coordsysDict = catalog->GetCoordinateSystemDictionary ();
+    coordsysEnum = coordsysDict->GetEnum ();
+
+    codeOne   = factory.ConvertWktToCoordinateSystemCode(wktOne);
+    codeTwo   = factory.ConvertWktToCoordinateSystemCode(wktOne);
+    codeThree = factory.ConvertWktToCoordinateSystemCode(wktOne);
+    codeFour  = factory.ConvertWktToCoordinateSystemCode(wktOne);
+
+    coordsysOne   = factory.CreateFromCode (codeOne);
+    coordsysTwo   = factory.CreateFromCode (codeTwo);
+    coordsysThree = factory.CreateFromCode (codeThree);
+    coordsysFour  = factory.CreateFromCode (codeFour);
+
+    xfrmOne   = factory.GetTransform(coordsysOne,coordsysTwo);
+    xfrmThree = factory.GetTransform(coordsysThree,coordsysTwo);
+    xfrmFour  = factory.GetTransform(coordsysFour,coordsysTwo);
+
+    xfrmFour->Release ();
+    xfrmThree->Release ();
+    xfrmOne->Release ();
+
+    coordsysFour->Release ();
+    coordsysThree->Release ();
+    coordsysTwo->Release ();
+    coordsysOne->Release ();
+
+    coordsysEnum->Release ();
+    coordsysDict->Release ();
+    catalog->Release (); 
+     
+#endif
+#ifdef __SKIP__
     // Some Catalog/Dictionary testing and timing.
+    MgCoordinateSystemFactory factory;
+    MgCoordinateSystemCatalog* catalog;
+
+    MgCoordinateSystemDictionary* coordsysDict;
+    MgCoordinateSystemEnum* coordsysEnum;
+
+    MgStringCollection* stringCollection;
+
+    catalog = factory.GetCatalog ();
+    coordsysDict = catalog->GetCoordinateSystemDictionary ();
+    coordsysEnum = coordsysDict->GetEnum ();
+
+    do
+    {
+        stringCollection = coordsysEnum->NextName (1);
+        if (stringCollection->GetCount () > 0)
+        {
+            STRING code = stringCollection->GetItem (0);
+            Ptr<MgCoordinateSystem> coordSysPtr = factory.CreateFromCode (code);
+            printf ("Code = %S, EPSG = %d, SRID = %d\n",(coordSysPtr->GetCsCode()).c_str (),coordSysPtr->GetEpsgCode (),coordSysPtr->GetSridCode ());
+        }
+    } while (stringCollection->GetCount () > 0);
+#endif
+#ifdef __SKIP__
+    // Some Catalog/Dictionary testing and timing.
+    bool isValid;
+   
     clock_t startTime;
     clock_t endTime;
 
@@ -63,6 +153,7 @@
 
     Ptr<MgCoordinateSystemGeodeticTransformDef> xformDef;
     xformDef = xformDict->GetGeodeticTransformationDef (L"NAD83_to_HPGN");
+    isValid = xformDef->IsValid ();
     Ptr<MgCoordinateSystemGeodeticInterpolationTransformDefParams>interpParms;
     interpParms = static_cast<MgCoordinateSystemGeodeticInterpolationTransformDefParams*>(xformDef->GetParameters ());
     Ptr<MgDisposableCollection>gridFiles = interpParms->GetGridFiles ();
@@ -75,9 +166,8 @@
     endTime = clock ();
     printf ("Dictionary enumeration time = %ld milliseconds.\n",endTime - startTime);
 #endif
-
 #ifdef __SKIP__
-    // testing a special WKT string for proer operation.
+    // testing a special WKT string for proper operation.
     clock_t startTime;
     clock_t endTime;
 
@@ -90,7 +180,6 @@
     endTime = clock ();
     printf ("ConvertWktToEpsgCode time = %ld milliseconds.\n",endTime - startTime);
 #endif
-
 #ifdef __SKIP__
     // Test/Debug bed for the MGRS Grid functionality.
 
@@ -283,6 +372,5 @@
 
     pGridSpecification->Release ();
 #endif 
-
     return 0;
 }

Modified: trunk/MgDev/Common/Geometry/GeometryConsoleTest/ReadMe.txt
===================================================================
--- trunk/MgDev/Common/Geometry/GeometryConsoleTest/ReadMe.txt	2010-12-13 12:47:42 UTC (rev 5475)
+++ trunk/MgDev/Common/Geometry/GeometryConsoleTest/ReadMe.txt	2010-12-15 21:50:27 UTC (rev 5476)
@@ -1,39 +1,28 @@
-========================================================================
+===============================================================================
     CONSOLE APPLICATION : GeometryConsoleTest Project Overview
-========================================================================
+===============================================================================
 
-This application is designed to be a module which can be used to test and debug the Open Source GIS
-platform without the additional burden of having to have full blown MAP or MapGuide running on the
-development system.  Currently, the module only has code to test the new Grid/Graticule portion of the
-platform.  It is expected that a complete series of regression test will be added.  Hopefully, this same
-module can be made usable in the Linux environemnt as well.  See below for some useage notes.
-/////////////////////////////////////////////////////////////////////////////
+This application is designed to be a module which can be used to test and debug
+the Open Source GIS platform without the additional burden of having to have
+full blown MAP or MapGuide running on the development system.  The module
+serves as a shell in which one or more test sequences can be coded.  Currently,
+they are separated by conditional compile preprocessor statements which limit
+the executable to a single test.
 
-The project file expects that the GIISPLATFORMROOT environmental variable is set to the root
-of the MapGuide development directroy tree.  ON my system this is:
+Typically, this module needs to run from an environment where environment
+variables GISPLATFORMROOTDIR and MENTOR_DICTIONARY_PATH are properly set.
+Also, you will probably need to set the PATH variable to include paths to the
+folders containing over modules referenced by the MgGeometry.dll.  The
+ACE_wrappers is an example of such a need.  Pasted below is the command line
+script this author uses for testin and debugging:
 
-C:\Perforce\caldiesel\MgDev
+set GISPLATFORMROOTDIR=C:\Development\Perforce\Map\trunk\Components\MgDev
+set MENTOR_DICTIONARY_PATH=%GISPLATFORMROOTDIR%\Oem\CsMap\Dictionaries
+subst Q: %GISPLATFORMROOTDIR%
+echo Setting the PATH variable to Platform componentes in the %GISPLATFORMROOTDIR" directory.
+echo off
+set PATH=%PATH%;Q:\Common\bin\debug;Q:\Oem\ACE\ACE_wrappers\lib;Q:\Oem\dbxml-2.3.10\bin\debug;Q:\Oem\geos-2.2.0\VisualStudio\Debug
+set PATH=%PATH%;Q:\Common\bin\release;Q:\Oem\dbxml-2.3.10\bin;Q:\Oem\geos-2.2.0\VisualStudio\Release
+echo on
 
-Obviously, this will be different on your system.  You may want to add this environmental
-variable to the standard environment list maintained by Windows, or use the command window
-and "devenv" trick.  See below about runtime considerations before you make your decision.
-
 /////////////////////////////////////////////////////////////////////////////
-
-At runtime, Windows (and Linux I presume) will need to know where to look for all the
-DLL's associated with the platform.  MgFoundation.dll, MgGeometry.dll, etc.  One way to
-achieve this is to have your PATH variable modified to include the appropriate directories.
-
-Thus, I suggest that you use a command file (setPath.bat for example) which accomplishes all
-of the following:
-
-1> Add the directories in which all of the appropiate DLL's reside to the PATH variable.
-2> Set the MENTOR_DICTIONARY_PATH variable to point to the location of the dictionaries (*.CSD files).
-3> Set the value of the GISPLATFORMROOTDIR variable.
-4> Activate the Visual Studio variable setting for command line operation.
-
-I then start the development environment from the command line.  This seems to work rather
-weel, and the whole platform can be tested/debugged without having to wait for MAP or MapGuide
-to put themselves together.
-
-/////////////////////////////////////////////////////////////////////////////



More information about the mapguide-commits mailing list