[mapguide-commits] r8236 - in trunk/MgDev: . Doc/devguide/source Doc/samples/dotnetviewersample/findaddress Doc/samples/dotnetviewersample/plot Doc/samples/dotnetviewersample/query/classes Doc/samples/dotnetviewersample/theme/classes Doc/samples/javasamples/hello_map Doc/samples/javasamples/interacting_with_layers Doc/samples/javaviewersample/findaddress Doc/samples/javaviewersample/plot Doc/samples/javaviewersample/query/classes Doc/samples/javaviewersample/theme/classes Doc/samples/phpsamples/analyzing_features Doc/samples/phpsamples/common Doc/samples/phpsamples/custom_output Doc/samples/phpsamples/modifying_maps_and_layers Doc/samples/phpsamples/working_with_feature_data Doc/samples/phpviewersample Doc/samples/phpviewersample/findaddress Doc/samples/phpviewersample/plot Doc/samples/phpviewersample/query/classes Doc/samples/phpviewersample/theme/classes UnitTest/Common/DotNetWrappers UnitTest/WebTier/DotNet/TestMapGuideApi UnitTest/WebTier/Php Web/src/mapadmin Web/src/mapviewerjava Web/src/mapviewernet Web/src/mapviewerphp

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Jun 17 03:16:52 PDT 2014


Author: jng
Date: 2014-06-17 03:16:51 -0700 (Tue, 17 Jun 2014)
New Revision: 8236

Added:
   trunk/MgDev/Doc/samples/phpviewersample/composer.json
   trunk/MgDev/Doc/samples/phpviewersample/vendor/
   trunk/MgDev/UnitTest/WebTier/Php/SQLiteEngine.php
   trunk/MgDev/UnitTest/WebTier/Php/UpdateDumpFiles.php
Removed:
   trunk/MgDev/Doc/samples/phpviewersample/findaddress/kd_xmlrpc.php
Modified:
   trunk/MgDev/
   trunk/MgDev/Doc/devguide/source/interacting_with_layers.rst
   trunk/MgDev/Doc/devguide/source/introduction.rst
   trunk/MgDev/Doc/devguide/source/modifying_maps_and_layers.rst
   trunk/MgDev/Doc/samples/dotnetviewersample/findaddress/clearaddressresults.aspx
   trunk/MgDev/Doc/samples/dotnetviewersample/findaddress/findaddress.aspx
   trunk/MgDev/Doc/samples/dotnetviewersample/findaddress/findaddressmain.aspx
   trunk/MgDev/Doc/samples/dotnetviewersample/plot/plot.aspx
   trunk/MgDev/Doc/samples/dotnetviewersample/plot/plotmain.aspx
   trunk/MgDev/Doc/samples/dotnetviewersample/query/classes/query.aspx
   trunk/MgDev/Doc/samples/dotnetviewersample/theme/classes/theme.aspx
   trunk/MgDev/Doc/samples/javasamples/hello_map/display_spatial_reference.jsp
   trunk/MgDev/Doc/samples/javasamples/interacting_with_layers/layer_visibility.jsp
   trunk/MgDev/Doc/samples/javasamples/interacting_with_layers/toggle_roads_label.jsp
   trunk/MgDev/Doc/samples/javaviewersample/findaddress/clearaddressresults.jsp
   trunk/MgDev/Doc/samples/javaviewersample/findaddress/findaddress.jsp
   trunk/MgDev/Doc/samples/javaviewersample/findaddress/findaddressmain.jsp
   trunk/MgDev/Doc/samples/javaviewersample/plot/plot.jsp
   trunk/MgDev/Doc/samples/javaviewersample/plot/plotmain.jsp
   trunk/MgDev/Doc/samples/javaviewersample/query/classes/query.jsp
   trunk/MgDev/Doc/samples/javaviewersample/theme/classes/theme.jsp
   trunk/MgDev/Doc/samples/phpsamples/analyzing_features/bufferfunctions.php
   trunk/MgDev/Doc/samples/phpsamples/common/common.php
   trunk/MgDev/Doc/samples/phpsamples/custom_output/createmapimage.php
   trunk/MgDev/Doc/samples/phpsamples/custom_output/eplot.php
   trunk/MgDev/Doc/samples/phpsamples/custom_output/multiplot.php
   trunk/MgDev/Doc/samples/phpsamples/custom_output/property_report.php
   trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers/create_new_line_layer_definition.php
   trunk/MgDev/Doc/samples/phpsamples/working_with_feature_data/queryfeatures.php
   trunk/MgDev/Doc/samples/phpsamples/working_with_feature_data/selectfeatures.php
   trunk/MgDev/Doc/samples/phpviewersample/findaddress/clearaddressresults.php
   trunk/MgDev/Doc/samples/phpviewersample/findaddress/findaddress.php
   trunk/MgDev/Doc/samples/phpviewersample/findaddress/findaddressfunctions.php
   trunk/MgDev/Doc/samples/phpviewersample/findaddress/findaddressmain.php
   trunk/MgDev/Doc/samples/phpviewersample/plot/plot.php
   trunk/MgDev/Doc/samples/phpviewersample/plot/plotmain.php
   trunk/MgDev/Doc/samples/phpviewersample/query/classes/query.php
   trunk/MgDev/Doc/samples/phpviewersample/theme/classes/theme.php
   trunk/MgDev/UnitTest/Common/DotNetWrappers/CollectionTest.cs
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/MapGuideTestExecutorCollection.cs
   trunk/MgDev/UnitTest/WebTier/Php/HtmlPrinter.php
   trunk/MgDev/UnitTest/WebTier/Php/MapLayerAPI.php
   trunk/MgDev/UnitTest/WebTier/Php/Run.php
   trunk/MgDev/UnitTest/WebTier/Php/RunTests.php
   trunk/MgDev/UnitTest/WebTier/Php/Utils.php
   trunk/MgDev/UnitTest/WebTier/Php/Validate.php
   trunk/MgDev/UnitTest/WebTier/Php/testAwSelection.php
   trunk/MgDev/Web/src/mapadmin/performanceReport_GetResult.php
   trunk/MgDev/Web/src/mapviewerjava/buffer.jsp
   trunk/MgDev/Web/src/mapviewerjava/legend.jsp
   trunk/MgDev/Web/src/mapviewerjava/mapframe.jsp
   trunk/MgDev/Web/src/mapviewerjava/measure.jsp
   trunk/MgDev/Web/src/mapviewerjava/quickplotgeneratepicture.jsp
   trunk/MgDev/Web/src/mapviewerjava/search.jsp
   trunk/MgDev/Web/src/mapviewerjava/selectwithin.jsp
   trunk/MgDev/Web/src/mapviewerjava/setselection.jsp
   trunk/MgDev/Web/src/mapviewernet/buffer.aspx
   trunk/MgDev/Web/src/mapviewernet/legend.aspx
   trunk/MgDev/Web/src/mapviewernet/mapframe.aspx
   trunk/MgDev/Web/src/mapviewernet/measure.aspx
   trunk/MgDev/Web/src/mapviewernet/quickplotgeneratepicture.aspx
   trunk/MgDev/Web/src/mapviewernet/search.aspx
   trunk/MgDev/Web/src/mapviewernet/selectwithin.aspx
   trunk/MgDev/Web/src/mapviewernet/setselection.aspx
   trunk/MgDev/Web/src/mapviewerphp/buffer.php
   trunk/MgDev/Web/src/mapviewerphp/legend.php
   trunk/MgDev/Web/src/mapviewerphp/mapframe.php
   trunk/MgDev/Web/src/mapviewerphp/measure.php
   trunk/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php
   trunk/MgDev/Web/src/mapviewerphp/search.php
   trunk/MgDev/Web/src/mapviewerphp/selectwithin.php
   trunk/MgDev/Web/src/mapviewerphp/setselection.php
   trunk/MgDev/run_tests.bat
   trunk/MgDev/updateversion.vbs
Log:
Merged revision(s) 8212, 8214, 8217, 8220-8221, 8223-8225 from sandbox/jng/v30:
Fix updateversion.vbs not version stamping profiling service dll.
........
Fix updateversion.vbs also not version stamping the enhanced Java wrapper
........
Fix updateversion.vbs also not version stamping the enhanced Java wrapper for mg-desktop
........
Now for the big one: MgMap and its family of deprecated APIs.

Before we do the actual API removal from MgMap, this submission includes modifications to various .net/PHP/Java sample code and actual code to no longer use MgMap's set of deprecated API. At the same time, various bits of sample code have been cleaned up to:

 - Use the recommended coding patterns when working with layers as suggested by MapGuide RFC9 (ie. Using the convenience methods of MgLayerBase and MgSelectionBase instead of going to the MgFeatureService directly)
 - Fix various PHP warnings due to now using PHP 5.5
 - Replace the broken kd_xmlrpc.php with fXmlRpc (https://github.com/lstrojny/fxmlrpc) for the PHP address search sample.

Even if the PSC has decided these APIs I'm currently removing in this sandbox should stay, this submission is still worth merging back into trunk and relevant branches as it updates the various sample code to reflect proper API usage.
........
Update .net test runner to not use deprecated MgMap APIs
........
Fix HtmlPrinter syntax
........
PHP test runner updates:
 - Add an overwrite flag to Utils::CreateDumpFile()
 - Add a new UpdateDumpFiles.php whose sole purpose is to update dump files from their respective dbs. This presents a simpler way of updating test database source without having to run the test runner through the whole suite in "generate" mode.
........
PHP test runner improvements:
 - Fix PHP warnings in HtmlPrinter
 - Add a PHP implementation of SqliteDB and SqliteVM (based on PDO). This is used by run_tests.bat to avoid random access violations that seem to be happening in my test runs. The existing SWIG PHP wrapper is still required for dump file generation/updates.
........



Property changes on: trunk/MgDev
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/sandbox/jng/createruntimemap:7486-7555
/sandbox/rfc94:5099-5163
   + /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/v30:8212,8214,8217,8220-8221,8223-8225
/sandbox/rfc94:5099-5163

Modified: trunk/MgDev/Doc/devguide/source/interacting_with_layers.rst
===================================================================
--- trunk/MgDev/Doc/devguide/source/interacting_with_layers.rst	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/devguide/source/interacting_with_layers.rst	2014-06-17 10:16:51 UTC (rev 8236)
@@ -285,9 +285,6 @@
 Example
 """""""
 
-.. todo::
-    Update code samples to not use MgMap() ctor. That is deprecated.
-
 The following example toggles the label of the Roads layer between Roads and
 Streets.
 
@@ -301,10 +298,8 @@
     $userInfo = new MgUserInformation($mgSessionId);
     $siteConnection = new MgSiteConnection();
     $siteConnection->Open($userInfo);
-    $resourceService =
-    $siteConnection->CreateService(MgServiceType::ResourceService);
-    $map = new MgMap();
-    $map->Open($resourceService, $mgMapName);
+    $map = new MgMap($siteConnection);
+    $map->Open($mgMapName);
     $layers = $map->GetLayers();
     $roadLayer = $layers->GetItem('Roads');
     $roadLabel = $roadLayer->GetLegendLabel();
@@ -316,7 +311,7 @@
     // You must save the updated map or the
     // changes will not be applied
     // Also be sure to refresh the map on page load.
-    $map->Save($resourceService);
+    $map->Save();
     
 **.net (C#)**
 
@@ -328,9 +323,8 @@
     MgUserInformation userInfo = new MgUserInformation(mgSessionId);
     MgSiteConnection siteConnection = new MgSiteConnection();
     siteConnection.Open(userInfo);
-    MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
-    MgMap map = new MgMap();
-    map.Open(resourceService, mgMapName);
+    MgMap map = new MgMap(siteConnection);
+    map.Open(mgMapName);
     MgLayerCollection layers = map.GetLayers();
     MgLayer roadLayer = layers.GetItem("Roads");
     String roadLabel = roadLayer.GetLegendLabel();
@@ -341,7 +335,7 @@
     // You must save the updated map or the
     // changes will not be applied
     // Also be sure to refresh the map on page load.
-    map.Save(resourceService);
+    map.Save();
 
 **Java**
     
@@ -353,9 +347,8 @@
     MgUserInformation userInfo = new MgUserInformation(mgSessionId);
     MgSiteConnection siteConnection = new MgSiteConnection();
     siteConnection.Open(userInfo);
-    MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
-    MgMap map = new MgMap();
-    map.Open(resourceService, mgMapName);
+    MgMap map = new MgMap(siteConnection);
+    map.Open(mgMapName);
     MgLayerCollection layers = map.GetLayers();
     MgLayer roadLayer = layers.GetItem("Roads");
     String roadLabel = roadLayer.GetLegendLabel();
@@ -366,7 +359,6 @@
     // You must save the updated map or the
     // changes will not be applied
     // Also be sure to refresh the map on page load.
-    map.Save(resourceService);
 
 .. index::
     single: Layers; Changing Visibility

Modified: trunk/MgDev/Doc/devguide/source/introduction.rst
===================================================================
--- trunk/MgDev/Doc/devguide/source/introduction.rst	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/devguide/source/introduction.rst	2014-06-17 10:16:51 UTC (rev 8236)
@@ -209,10 +209,15 @@
 .. highlight:: php
 .. code-block:: php
 
+    $siteConnection = new MgSiteConnection();
+    $userInfo = new MgUserInformation($sessionId);
+    $siteConnection->Open();
+    $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);
+
     $mapDefId = new MgResourceIdentifier("Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition");
-    $map = new MgMap();
+    $map = new MgMap($siteConnection);
     $mapName = $mapDefId->GetName();
-    $map->Create($resourceService, $mapDefId, $mapName);
+    $map->Create($mapDefId, $mapName);
     $mapId = new MgResourceIdentifier("Session:$sessionId//$mapName." . MgResourceType::Map);
     $map->Save($resourceService, $mapId);
 
@@ -222,12 +227,16 @@
 .. code-block:: csharp
 
     //Note: This code fragment assumes you have imported the OSGeo.MapGuide namespace
+    MgSiteConnection siteConnection = new MgSiteConnection();
+    MgUserInformation userInfo = new MgUserInformation(sessionId);
+    siteConnection.Open(userInfo);
+    MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType::ResourceService);
 
     MgResourceIdentifier mapDefId = new MgResourceIdentifier("Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition");
-    MgMap map = new MgMap();
+    MgMap map = new MgMap(siteConnection);
     String mapName = mapDefId.GetName();
-    map.Create(resourceService, mapDefId, mapName);
-    MgResourceIdentifier mapId = new MgResourceIdentifier("Session:$sessionId//$mapName." + MgResourceType.Map);
+    map.Create(mapDefId, mapName);
+    MgResourceIdentifier mapId = new MgResourceIdentifier("Session:" + sessionId + "//" + mapName + "." + MgResourceType.Map);
     map.Save(resourceService, mapId);
     
 **Java**
@@ -236,12 +245,16 @@
 .. code-block:: java
 
     //Note: This code fragment assumes you have imported the org.osgeo.mapguide package
+    MgSiteConnection siteConnection = new MgSiteConnection();
+    MgUserInformation userInfo = new MgUserInformation(sessionId);
+    siteConnection.Open(userInfo);
+    MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType::ResourceService);
 
     MgResourceIdentifier mapDefId = new MgResourceIdentifier("Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition");
-    MgMap map = new MgMap();
+    MgMap map = new MgMap(siteConnection);
     String mapName = mapDefId.GetName();
-    map.Create(resourceService, mapDefId, mapName);
-    MgResourceIdentifier mapId = new MgResourceIdentifier("Session:$sessionId//$mapName." + MgResourceType.Map);
+    map.Create(mapDefId, mapName);
+    MgResourceIdentifier mapId = new MgResourceIdentifier("Session:" + sessionId + "//" + mapName + "." + MgResourceType.Map);
     map.Save(resourceService, mapId);
 
 .. index::
@@ -490,13 +503,9 @@
                 $siteConnection = new MgSiteConnection();
                 $siteConnection->Open($userInfo);
 
-                // Get an instance of the required service(s).
-                $resourceService = $siteConnection->
-                CreateService(MgServiceType::ResourceService);
-
                 // Display the spatial reference system used for the map.
-                $map = new MgMap();
-                $map->Open($resourceService, $mgMapName);
+                $map = new MgMap($siteConnection);
+                $map->Open($mgMapName);
                 $srs = $map->GetMapSRS();
                 echo 'Map <strong>' . $map->GetName() .
                 '</strong> uses this reference system: <br />' . $srs;

Modified: trunk/MgDev/Doc/devguide/source/modifying_maps_and_layers.rst
===================================================================
--- trunk/MgDev/Doc/devguide/source/modifying_maps_and_layers.rst	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/devguide/source/modifying_maps_and_layers.rst	2014-06-17 10:16:51 UTC (rev 8236)
@@ -92,8 +92,8 @@
 
     // (initialization etc. not shown here)
     // Open the map
-    $map = new MgMap();
-    $map->Open($resourceService, $mapName);
+    $map = new MgMap($siteConnection);
+    $map->Open($mapName);
     // --------------------------------------------------//
     // Load a layer from XML, and use the DOM to change it
     // Load the prototype layer definition into

Modified: trunk/MgDev/Doc/samples/dotnetviewersample/findaddress/clearaddressresults.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetviewersample/findaddress/clearaddressresults.aspx	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/dotnetviewersample/findaddress/clearaddressresults.aspx	2014-06-17 10:16:51 UTC (rev 8236)
@@ -50,20 +50,14 @@
 
     featureService.UpdateFeatures(addressMarkerDataResId, commands, false);
 
-    // Create a ReserviceService object and use it to open the Map
-    // object from the sessions repository. Use the Map object to hide
-    // the "ParcelMarker" layer and then save the updated Map back to
-    // the session.
+    MgMap map = new MgMap(siteConnection);
+    map.Open("Sheboygan");
 
-    MgResourceService resourceService = siteConnection.CreateService(MgServiceType.ResourceService) as MgResourceService;
-    MgMap map = new MgMap();
-    map.Open(resourceService, "Sheboygan");
-
     MgLayer layer = GetLayerByName(map, "AddressMarker");
     layer.SetVisible(false);
     layer.ForceRefresh();
 
-    map.Save(resourceService);
+    map.Save();
 }
 catch (MgException mge)
 {

Modified: trunk/MgDev/Doc/samples/dotnetviewersample/findaddress/findaddress.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetviewersample/findaddress/findaddress.aspx	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/dotnetviewersample/findaddress/findaddress.aspx	2014-06-17 10:16:51 UTC (rev 8236)
@@ -85,8 +85,8 @@
         MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
         MgFeatureService featureService = (MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService);
 
-        MgMap map = new MgMap();
-        map.Open(resourceService, "Sheboygan");
+        MgMap map = new MgMap(siteConnection);
+        map.Open("Sheboygan");
 
         // Check the map for the AddressMarker layer. If it does not
         // exist then create a feature source to store address results
@@ -129,7 +129,7 @@
         addressLayer.SetVisible(true);
         addressLayer.ForceRefresh();
 
-        map.Save(resourceService);
+        map.Save();
 
         success = true;
     }

Modified: trunk/MgDev/Doc/samples/dotnetviewersample/findaddress/findaddressmain.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetviewersample/findaddress/findaddressmain.aspx	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/dotnetviewersample/findaddress/findaddressmain.aspx	2014-06-17 10:16:51 UTC (rev 8236)
@@ -31,12 +31,12 @@
     <script language="javascript">
     function Submit()
     {
-    	var addressForm = document.getElementById("addressForm");
-    	var addressValue = document.getElementById("addressValue");
-    	var addressInput = document.getElementById("addressInput");
-    	
-    	addressValue.value = addressInput.value;
-    	addressForm.submit();
+        var addressForm = document.getElementById("addressForm");
+        var addressValue = document.getElementById("addressValue");
+        var addressInput = document.getElementById("addressInput");
+        
+        addressValue.value = addressInput.value;
+        addressForm.submit();
     }
     </script>
 </head>
@@ -59,13 +59,8 @@
     siteConnection = new MgSiteConnection();
     siteConnection.Open(userInfo);
 
-    // Create a ReserviceService object and use it to open the Map
-    // object from the sessions repository. Use the Map object to
-    // determine if the "AddressMarker" layer is visible.
-
-    MgResourceService resourceService = siteConnection.CreateService(MgServiceType.ResourceService) as MgResourceService;
-    MgMap map = new MgMap();
-    map.Open(resourceService, "Sheboygan");
+    MgMap map = new MgMap(siteConnection);
+    map.Open("Sheboygan");
     MgLayer addressLayer = GetLayerByName(map, "AddressMarker");
 
     if (addressLayer != null)

Modified: trunk/MgDev/Doc/samples/dotnetviewersample/plot/plot.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetviewersample/plot/plot.aspx	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/dotnetviewersample/plot/plot.aspx	2014-06-17 10:16:51 UTC (rev 8236)
@@ -32,13 +32,9 @@
     MgSiteConnection siteConnection = new MgSiteConnection();
     siteConnection.Open(userInfo);
 
-    // Create an instance of ResourceService and use that to open the
-    // current map instance stored in session state.
+    MgMap map = new MgMap(siteConnection);
+    map.Open("Sheboygan");
 
-    MgResourceService resourceService = siteConnection.CreateService(MgServiceType.ResourceService) as MgResourceService;
-    MgMap map = new MgMap();
-    map.Open(resourceService, "Sheboygan");
-
     // Now create an instance of MappingService and use it to plot the
     // current view of the map.
 

Modified: trunk/MgDev/Doc/samples/dotnetviewersample/plot/plotmain.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetviewersample/plot/plotmain.aspx	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/dotnetviewersample/plot/plotmain.aspx	2014-06-17 10:16:51 UTC (rev 8236)
@@ -87,15 +87,9 @@
     MgSiteConnection siteConnection = new MgSiteConnection();
     siteConnection.Open(userInfo);
 
-    // Create a ReserviceService object and use it to open the Map
-    // object from the sessions repository. Use the Map object to
-    // determine the current scale of the map for display on this
-    // page.
+    MgMap map = new MgMap(siteConnection);
+    map.Open("Sheboygan");
 
-    MgResourceService resourceService = siteConnection.CreateService(MgServiceType.ResourceService) as MgResourceService;
-    MgMap map = new MgMap();
-    map.Open(resourceService, "Sheboygan");
-
     viewCenter = map.GetViewCenter();
     viewScale = map.GetViewScale();
 }

Modified: trunk/MgDev/Doc/samples/dotnetviewersample/query/classes/query.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetviewersample/query/classes/query.aspx	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/dotnetviewersample/query/classes/query.aspx	2014-06-17 10:16:51 UTC (rev 8236)
@@ -61,9 +61,8 @@
         
         public ArrayList GetMapLayerNames()
         {
-            MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
-            MgMap map = new MgMap();
-            map.Open(resourceService, GetParameter(this.args, "MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(GetParameter(this.args, "MAPNAME"));
             MgLayerCollection layers = map.GetLayers();
             ArrayList layerNames = new ArrayList();
 
@@ -86,17 +85,12 @@
         public ArrayList GetLayerProperties()
         {
             ArrayList properties = new ArrayList();
-            MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
-            MgMap map = new MgMap();
-            map.Open(resourceService, GetParameter(this.args, "MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(GetParameter(this.args, "MAPNAME"));
             MgLayer layer = (MgLayer) map.GetLayers().GetItem(GetParameter(this.args, "LAYERNAME"));
 
-            MgFeatureService featureService = (MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
-            MgResourceIdentifier resId = new MgResourceIdentifier(layer.GetFeatureSourceId());
-            String[] schemaClass = layer.GetFeatureClassName().Split(new Char[]{':'});
+            MgClassDefinition classDef = layer.GetClassDefinition();
 
-            MgClassDefinition classDef = featureService.GetClassDefinition(resId, schemaClass[0], schemaClass[1]);
-
             for(int i=0; i<classDef.GetProperties().GetCount(); i++)
             {
                 MgPropertyDefinition propertyDef = classDef.GetProperties().GetItem(i);
@@ -117,9 +111,8 @@
         public bool ToggleSpatialFilter()
         {
             bool result = true;
-            MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
-            MgMap map = new MgMap();
-            map.Open(resourceService, GetParameter(this.args, "MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(GetParameter(this.args, "MAPNAME"));
 
             MgLayerCollection layers = map.GetLayers();
             if(layers.Contains("_QuerySpatialFilter"))
@@ -130,7 +123,7 @@
                 else
                     layer.SetVisible(false);
 
-                map.Save(resourceService);
+                map.Save();
             }
 
             return result;
@@ -146,8 +139,8 @@
 
             MgFeatureCommandCollection updateCommands = new MgFeatureCommandCollection();
 
-            MgMap map = new MgMap();
-            map.Open(resourceService, GetParameter(this.args, "MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(GetParameter(this.args, "MAPNAME"));
 
             MgLayer layer = null;
             MgLayerCollection layers = map.GetLayers();
@@ -207,21 +200,19 @@
         public ArrayList Execute()
         {
             ArrayList result = new ArrayList();
-            MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
 
-            MgMap map = new MgMap();
-            map.Open(resourceService, GetParameter(this.args, "MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(GetParameter(this.args, "MAPNAME"));
             MgLayer layer = (MgLayer) map.GetLayers().GetItem(GetParameter(this.args, "LAYERNAME"));
 
             MgFeatureService featureService = (MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
             MgResourceIdentifier resId = new MgResourceIdentifier(layer.GetFeatureSourceId());
-            String featureClass = layer.GetFeatureClassName();
             String featureGeometry = layer.GetFeatureGeometryName();
 
             // Initialize the coordinate system transform
 
             String[] schemaClass = layer.GetFeatureClassName().Split(new Char[]{':'});
-            MgClassDefinition classDef = featureService.GetClassDefinition(resId, schemaClass[0], schemaClass[1]);
+            MgClassDefinition classDef = layer.GetClassDefinition();
             MgGeometricPropertyDefinition geomProp = (MgGeometricPropertyDefinition) classDef.GetProperties().GetItem(featureGeometry);
             String spatialContext = geomProp.GetSpatialContextAssociation();
 
@@ -271,7 +262,7 @@
 
             int count = 0;
             MgAgfReaderWriter geometryReaderWriter = new MgAgfReaderWriter();
-            MgFeatureReader featureReader = featureService.SelectFeatures(resId, layer.GetFeatureClassName(), queryOptions);
+            MgFeatureReader featureReader = layer.SelectFeatures(queryOptions);
             while(featureReader.ReadNext() && (queryMax <= 0 || count < queryMax))
             {
                 MgByteReader byteReader = featureReader.GetGeometry(featureGeometry);
@@ -289,17 +280,12 @@
         
         public String GetSelectionXML()
         {
-            MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
-            MgFeatureService featureService = (MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
-
-            MgMap map = new MgMap();
-            map.Open(resourceService, GetParameter(this.args, "MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(GetParameter(this.args, "MAPNAME"));
             MgLayer layer = (MgLayer) map.GetLayers().GetItem(GetParameter(this.args, "LAYERNAME"));
-            MgResourceIdentifier resId = new MgResourceIdentifier(layer.GetFeatureSourceId());
             String featureClass = layer.GetFeatureClassName();
 
-            String[] schemaClass = layer.GetFeatureClassName().Split(new Char[]{':'});
-            MgClassDefinition classDef = featureService.GetClassDefinition(resId, schemaClass[0], schemaClass[1]);
+            MgClassDefinition classDef = layer.GetClassDefinition();
 
             MgPropertyCollection properties = new MgPropertyCollection();
             MgDataPropertyDefinition dataPropDef = null;

Modified: trunk/MgDev/Doc/samples/dotnetviewersample/theme/classes/theme.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetviewersample/theme/classes/theme.aspx	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/dotnetviewersample/theme/classes/theme.aspx	2014-06-17 10:16:51 UTC (rev 8236)
@@ -56,23 +56,19 @@
         
         public ArrayList GetMapLayerNames()
         {
-            MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
             MgFeatureService featureService = (MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
             
-            MgMap map = new MgMap();
-            map.Open(resourceService, GetParameter(this.args, "MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(GetParameter(this.args, "MAPNAME"));
             MgLayerCollection layers = map.GetLayers();
             ArrayList layerNames = new ArrayList();
 
             for(int i=0; i<layers.GetCount(); i++)
             {
-            MgLayer layer = (MgLayer) layers.GetItem(i);
+                MgLayer layer = (MgLayer) layers.GetItem(i);
                 if(!layer.GetName().StartsWith("_") && !layer.GetFeatureSourceId().ToUpper().StartsWith("SESSION"))
                 {
-                    MgResourceIdentifier resId = new MgResourceIdentifier(layer.GetFeatureSourceId());
-                    String[] schemaClass = layer.GetFeatureClassName().Split(new Char[]{':'});
-
-                    MgClassDefinition classDef = featureService.GetClassDefinition(resId, schemaClass[0], schemaClass[1]);
+                    MgClassDefinition classDef = layer.GetClassDefinition();
                     MgPropertyDefinition propDef = classDef.GetProperties().GetItem(layer.GetFeatureGeometryName());
                 
                     if(propDef.GetPropertyType() == MgFeaturePropertyType.GeometricProperty)
@@ -98,16 +94,12 @@
             
             MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
             
-            MgMap map = new MgMap();
-            map.Open(resourceService, GetParameter(this.args, "MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(GetParameter(this.args, "MAPNAME"));
             MgLayer layer = (MgLayer) map.GetLayers().GetItem(GetParameter(this.args, "LAYERNAME"));
 
-            MgFeatureService featureService = (MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
-            MgResourceIdentifier resId = new MgResourceIdentifier(layer.GetFeatureSourceId());
-            String[] schemaClass = layer.GetFeatureClassName().Split(new Char[]{':'});
+            MgClassDefinition classDef = layer.GetClassDefinition();
 
-            MgClassDefinition classDef = featureService.GetClassDefinition(resId, schemaClass[0], schemaClass[1]);
-
             for(int i=0; i<classDef.GetProperties().GetCount(); i++)
             {
                 MgPropertyDefinition propertyDef = classDef.GetProperties().GetItem(i);
@@ -167,15 +159,10 @@
         {
             ArrayList propertyMinMaxCount = new ArrayList();
             
-            MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
-            
-            MgMap map = new MgMap();
-            map.Open(resourceService, GetParameter(this.args, "MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(GetParameter(this.args, "MAPNAME"));
             MgLayer layer = (MgLayer) map.GetLayers().GetItem(GetParameter(this.args, "LAYERNAME"));
 
-            MgFeatureService featureService = (MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
-            MgResourceIdentifier resId = new MgResourceIdentifier(layer.GetFeatureSourceId());
-            
             String minValue = null;
             String maxValue = null;
             int count = 0;
@@ -183,7 +170,7 @@
             MgFeatureQueryOptions queryOptions = new MgFeatureQueryOptions();
             queryOptions.AddFeatureProperty(GetParameter(this.args, "PROPERTYNAME"));
             
-            MgFeatureReader featureReader = featureService.SelectFeatures(resId, layer.GetFeatureClassName(), queryOptions);
+            MgFeatureReader featureReader = layer.SelectFeatures(queryOptions);
             while(featureReader.ReadNext())
             {
                 String value = GetFeaturePropertyValue(featureReader, GetParameter(this.args, "PROPERTYNAME"));
@@ -252,8 +239,8 @@
             MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
             MgFeatureService featureService = (MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
 
-            MgMap map = new MgMap();
-            map.Open(resourceService, GetParameter(this.args, "MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(GetParameter(this.args, "MAPNAME"));
             MgLayerCollection layers = map.GetLayers();
             MgLayer layer = (MgLayer) layers.GetItem(GetParameter(this.args, "LAYERNAME"));
             
@@ -301,7 +288,7 @@
                 aggregateOptions.AddFeatureProperty(GetParameter(this.args, "PROPERTYNAME"));
                 aggregateOptions.SelectDistinct(true);
                 
-                MgDataReader dataReader = featureService.SelectAggregate(resId, layer.GetFeatureClassName(), aggregateOptions);
+                MgDataReader dataReader = layer.SelectAggregate(aggregateOptions);
                 while(dataReader.ReadNext())
                 {
                     value = GetFeaturePropertyValue(dataReader, GetParameter(this.args, "PROPERTYNAME"));
@@ -332,7 +319,7 @@
                 
                 aggregateOptions.AddComputedProperty("THEME_VALUE",
                     GetParameter(this.args, "DISTRO") + "(\"" + GetParameter(this.args, "PROPERTYNAME") + "\"," + GetParameter(this.args, "NUMRULES") + "," + GetParameter(this.args, "MINVALUE") + "," + GetParameter(this.args, "MAXVALUE") + ")");
-                MgDataReader dataReader = featureService.SelectAggregate(resId, layer.GetFeatureClassName(), aggregateOptions);
+                MgDataReader dataReader = layer.SelectAggregate(aggregateOptions);
                 while(dataReader.ReadNext())
                 {
                     value = GetFeaturePropertyValue(dataReader, "THEME_VALUE");
@@ -382,7 +369,7 @@
             newLayer.SetSelectable(layer.GetSelectable());
             layers.Insert(layers.IndexOf(layer), newLayer);
             
-            map.Save(resourceService);
+            map.Save();
 
             return uniqueName;
         }

Modified: trunk/MgDev/Doc/samples/javasamples/hello_map/display_spatial_reference.jsp
===================================================================
--- trunk/MgDev/Doc/samples/javasamples/hello_map/display_spatial_reference.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/javasamples/hello_map/display_spatial_reference.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -51,17 +51,13 @@
       MgSiteConnection siteConnection = new MgSiteConnection();
       siteConnection.Open(userInfo);
 
-      // Get an instance of the required service(s).
-      
-      MgResourceService resourceService = (MgResourceService) siteConnection.CreateService(MgServiceType.ResourceService);
-
       // Finished basic initialization.
       // --------------------------------------------------//
       
       // Query the spatial reference system used for the map.
       
-      MgMap map = new MgMap();
-      map.Open(resourceService, mapName);
+      MgMap map = new MgMap(siteConnection);
+      map.Open(mapName);
       String srs = map.GetMapSRS();
       
       // Format it and display it in the task pane.

Modified: trunk/MgDev/Doc/samples/javasamples/interacting_with_layers/layer_visibility.jsp
===================================================================
--- trunk/MgDev/Doc/samples/javasamples/interacting_with_layers/layer_visibility.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/javasamples/interacting_with_layers/layer_visibility.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -47,14 +47,10 @@
       MgUserInformation userInfo = new MgUserInformation(sessionId);
       MgSiteConnection siteConnection = new MgSiteConnection();
       siteConnection.Open(userInfo);
-  
-      // Get an instance of the required service(s).
-      
-      MgResourceService resourceService = (MgResourceService) siteConnection.CreateService(MgServiceType.ResourceService);
-  
-      MgMap map = new MgMap();
-      map.Open(resourceService, mapName);
 
+      MgMap map = new MgMap(siteConnection);
+      map.Open(mapName);
+
       MgLayerCollection layers = map.GetLayers(); // Get layer collection
       out.println("<p>Layers, in draw order:</p>");
       out.println("<table class=\"taskPane\" cellspacing=\"0\">");

Modified: trunk/MgDev/Doc/samples/javasamples/interacting_with_layers/toggle_roads_label.jsp
===================================================================
--- trunk/MgDev/Doc/samples/javasamples/interacting_with_layers/toggle_roads_label.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/javasamples/interacting_with_layers/toggle_roads_label.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -59,13 +59,9 @@
       MgUserInformation userInfo = new MgUserInformation(sessionId);
       MgSiteConnection siteConnection = new MgSiteConnection();
       siteConnection.Open(userInfo);
-  
-      // Get an instance of the required service(s).
-      
-      MgResourceService resourceService = (MgResourceService) siteConnection.CreateService(MgServiceType.ResourceService);
 
-      MgMap map = new MgMap(); 
-      map.Open(resourceService, mapName);
+      MgMap map = new MgMap(siteConnection); 
+      map.Open(mapName);
 
       MgLayerCollection layers = map.GetLayers(); // Get layer collection
 
@@ -82,7 +78,7 @@
       // You must save the updated map or the
       // changes will not be applied
       // Also be sure to refresh the map on page load.
-      map.Save(resourceService);
+      map.Save();
 
       out.println("<p>Layer label has been changed to " + newLabel + ".</p>");
 

Modified: trunk/MgDev/Doc/samples/javaviewersample/findaddress/clearaddressresults.jsp
===================================================================
--- trunk/MgDev/Doc/samples/javaviewersample/findaddress/clearaddressresults.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/javaviewersample/findaddress/clearaddressresults.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -54,20 +54,14 @@
 
         featureService.UpdateFeatures(addressMarkerDataResId, commands, false);
 
-        // Create a ReserviceService object and use it to open the Map
-        // object from the sessions repository. Use the Map object to hide
-        // the "ParcelMarker" layer and then save the updated Map back to
-        // the session.
+        MgMap map = new MgMap(siteConnection);
+        map.Open("Sheboygan");
 
-        MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
-        MgMap map = new MgMap();
-        map.Open(resourceService, "Sheboygan");
-
         MgLayer layer = GetLayerByName(map, "AddressMarker");
         layer.SetVisible(false);
         layer.ForceRefresh();
 
-        map.Save(resourceService);
+        map.Save();
     }
     catch (MgException e)
     {

Modified: trunk/MgDev/Doc/samples/javaviewersample/findaddress/findaddress.jsp
===================================================================
--- trunk/MgDev/Doc/samples/javaviewersample/findaddress/findaddress.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/javaviewersample/findaddress/findaddress.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -84,8 +84,8 @@
             MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
             MgFeatureService featureService = (MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService);
 
-            MgMap map = new MgMap();
-            map.Open(resourceService, "Sheboygan");
+            MgMap map = new MgMap(siteConnection);
+            map.Open("Sheboygan");
 
             // Check the map for the AddressMarker layer. If it does not
             // exist then create a feature source to store address results
@@ -128,7 +128,7 @@
             addressLayer.SetVisible(true);
             addressLayer.ForceRefresh();
 
-            map.Save(resourceService);
+            map.Save();
 
             success = true;
         }

Modified: trunk/MgDev/Doc/samples/javaviewersample/findaddress/findaddressmain.jsp
===================================================================
--- trunk/MgDev/Doc/samples/javaviewersample/findaddress/findaddressmain.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/javaviewersample/findaddress/findaddressmain.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -34,12 +34,12 @@
     <script language="javascript">
     function Submit()
     {
-    	var addressForm = document.getElementById("addressForm");
-    	var addressValue = document.getElementById("addressValue");
-    	var addressInput = document.getElementById("addressInput");
-    	
-    	addressValue.value = addressInput.value;
-    	addressForm.submit();
+        var addressForm = document.getElementById("addressForm");
+        var addressValue = document.getElementById("addressValue");
+        var addressInput = document.getElementById("addressInput");
+        
+        addressValue.value = addressInput.value;
+        addressForm.submit();
     }
     </script>
 </head>
@@ -66,9 +66,8 @@
         // object from the sessions repository. Use the Map object to
         // determine if the "AddressMarker" layer is visible.
 
-        MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
-        MgMap map = new MgMap();
-        map.Open(resourceService, "Sheboygan");
+        MgMap map = new MgMap(siteConnection);
+        map.Open("Sheboygan");
         MgLayer addressLayer = GetLayerByName(map, "AddressMarker");
 
         if (addressLayer != null)

Modified: trunk/MgDev/Doc/samples/javaviewersample/plot/plot.jsp
===================================================================
--- trunk/MgDev/Doc/samples/javaviewersample/plot/plot.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/javaviewersample/plot/plot.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -39,13 +39,9 @@
         MgSiteConnection siteConnection = new MgSiteConnection();
         siteConnection.Open(userInfo);
 
-        // Create an instance of ResourceService and use that to open the
-        // current map instance stored in session state.
+        MgMap map = new MgMap(siteConnection);
+        map.Open("Sheboygan");
 
-        MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
-        MgMap map = new MgMap();
-        map.Open(resourceService, "Sheboygan");
-
         // Now create an instance of MappingService and use it to plot the
         // current view of the map.
 

Modified: trunk/MgDev/Doc/samples/javaviewersample/plot/plotmain.jsp
===================================================================
--- trunk/MgDev/Doc/samples/javaviewersample/plot/plotmain.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/javaviewersample/plot/plotmain.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -41,8 +41,8 @@
             useLayoutValue.value = "true";
         else
             useLayoutValue.value = "false";
-    	
-    	scaleValue.value = "0";
+        
+        scaleValue.value = "0";
         plotForm.submit();	
     }
     function SubmitAtScale()
@@ -95,9 +95,8 @@
         // determine the current scale of the map for display on this
         // page.
 
-        MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
-        MgMap map = new MgMap();
-        map.Open(resourceService, "Sheboygan");
+        MgMap map = new MgMap(siteConnection);
+        map.Open("Sheboygan");
 
         viewCenter = map.GetViewCenter();
         viewScale = map.GetViewScale();

Modified: trunk/MgDev/Doc/samples/javaviewersample/query/classes/query.jsp
===================================================================
--- trunk/MgDev/Doc/samples/javaviewersample/query/classes/query.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/javaviewersample/query/classes/query.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -67,9 +67,8 @@
         
         public ArrayList<String> GetMapLayerNames() throws MgException
         {
-            MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
-            MgMap map = new MgMap();
-            map.Open(resourceService, this.args.get("MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(this.args.get("MAPNAME"));
             MgLayerCollection layers = map.GetLayers();
             ArrayList<String> layerNames = new ArrayList<String>();
 
@@ -90,17 +89,12 @@
         public ArrayList<Property> GetLayerProperties() throws MgException
         {
             ArrayList<Property> properties = new ArrayList<Property>();
-            MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
-            MgMap map = new MgMap();
-            map.Open(resourceService, this.args.get("MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(this.args.get("MAPNAME"));
             MgLayer layer = (MgLayer) map.GetLayers().GetItem(this.args.get("LAYERNAME"));
 
-            MgFeatureService featureService = (MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
-            MgResourceIdentifier resId = new MgResourceIdentifier(layer.GetFeatureSourceId());
-            String[] schemaClass = layer.GetFeatureClassName().split(":");
+            MgClassDefinition classDef = layer.GetClassDefinition();
 
-            MgClassDefinition classDef = featureService.GetClassDefinition(resId, schemaClass[0], schemaClass[1]);
-
             for(int i=0; i<classDef.GetProperties().GetCount(); i++)
             {
                 MgPropertyDefinition propertyDef = classDef.GetProperties().GetItem(i);
@@ -121,9 +115,8 @@
         public boolean ToggleSpatialFilter() throws MgException
         {
             boolean result = true;
-            MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
-            MgMap map = new MgMap();
-            map.Open(resourceService, this.args.get("MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(this.args.get("MAPNAME"));
 
             MgLayerCollection layers = map.GetLayers();
             if(layers.Contains("_QuerySpatialFilter"))
@@ -134,7 +127,7 @@
                 else
                     layer.SetVisible(false);
 
-                map.Save(resourceService);
+                map.Save();
             }
 
             return result;
@@ -150,8 +143,8 @@
 
             MgFeatureCommandCollection updateCommands = new MgFeatureCommandCollection();
 
-            MgMap map = new MgMap();
-            map.Open(resourceService, this.args.get("MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(this.args.get("MAPNAME"));
 
             MgLayer layer = null;
             MgLayerCollection layers = map.GetLayers();
@@ -200,7 +193,7 @@
             // Make the layer visible
 
             layer.SetVisible(true);
-            map.Save(resourceService);
+            map.Save();
 
             // Add the geometry to the filter feature source
 
@@ -221,21 +214,18 @@
         public ArrayList<Feature> Execute() throws MgException
         {
             ArrayList<Feature> result = new ArrayList<Feature>();
-            MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
 
-            MgMap map = new MgMap();
-            map.Open(resourceService, this.args.get("MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(this.args.get("MAPNAME"));
             MgLayer layer = (MgLayer) map.GetLayers().GetItem(this.args.get("LAYERNAME"));
 
             MgFeatureService featureService = (MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
             MgResourceIdentifier resId = new MgResourceIdentifier(layer.GetFeatureSourceId());
-            String featureClass = layer.GetFeatureClassName();
             String featureGeometry = layer.GetFeatureGeometryName();
 
             // Initialize the coordinate system transform
 
-            String[] schemaClass = layer.GetFeatureClassName().split(":");
-            MgClassDefinition classDef = featureService.GetClassDefinition(resId, schemaClass[0], schemaClass[1]);
+            MgClassDefinition classDef = layer.GetClassDefinition();
             MgGeometricPropertyDefinition geomProp = (MgGeometricPropertyDefinition) classDef.GetProperties().GetItem(featureGeometry);
             String spatialContext = geomProp.GetSpatialContextAssociation();
 
@@ -286,7 +276,7 @@
 
             int count = 0;
             MgAgfReaderWriter geometryReaderWriter = new MgAgfReaderWriter();
-            MgFeatureReader featureReader = featureService.SelectFeatures(resId, layer.GetFeatureClassName(), queryOptions);
+            MgFeatureReader featureReader = layer.SelectFeatures(queryOptions);
             String displayValue = null;
             while(featureReader.ReadNext() && (queryMax <= 0 || count < queryMax))
             {
@@ -351,18 +341,14 @@
 
         public String GetSelectionXML() throws MgException, JSONException
         {
-            MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
             MgFeatureService featureService = (MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
 
-            MgMap map = new MgMap();
-            map.Open(resourceService, this.args.get("MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(this.args.get("MAPNAME"));
             MgLayer layer = (MgLayer) map.GetLayers().GetItem(this.args.get("LAYERNAME"));
-            MgResourceIdentifier resId = new MgResourceIdentifier(layer.GetFeatureSourceId());
             String featureClass = layer.GetFeatureClassName();
+            MgClassDefinition classDef = layer.GetClassDefinition();
 
-            String[] schemaClass = layer.GetFeatureClassName().split(":");
-            MgClassDefinition classDef = featureService.GetClassDefinition(resId, schemaClass[0], schemaClass[1]);
-
             MgPropertyCollection properties = new MgPropertyCollection();
             MgDataPropertyDefinition dataPropDef = null;
             JSONObject json = new JSONObject(this.args.get("IDLIST"));

Modified: trunk/MgDev/Doc/samples/javaviewersample/theme/classes/theme.jsp
===================================================================
--- trunk/MgDev/Doc/samples/javaviewersample/theme/classes/theme.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/javaviewersample/theme/classes/theme.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -33,92 +33,84 @@
 <%!
     public class Theme
     {
-    	Map<String, String> args = null;
-    	private MgSiteConnection site = null;
-    	private String[] distNameArray = null;
-    	private String[] distValueArray = null;
-    	
-    	public Theme(Map<String, String> incomingArgs) throws MgException
-    	{
-    	    this.args = incomingArgs;
-    	    this.site = new MgSiteConnection();
-    	    this.site.Open(new MgUserInformation(this.args.get("SESSION")));
-    	    this.distNameArray = new String[] {"Individual", "Equal", "Standard Deviation", "Quantile", "Jenks (Natural Breaks)"};
-    	    this.distValueArray = new String[] {"INDIV_DIST", "EQUAL_DIST", "STDEV_DIST", "QUANT_DIST", "JENK_DIST"};
-    	}
-    	
-    	public String getNameArray()
-	{
-	    JSONArray jsonArray = new JSONArray();
-	    for(int i=0;i<5;i++)
-	    {
-		jsonArray.put(distNameArray[i]);
-	    }
-	    return jsonArray.toString();
-	}
-
-	public String getValueArray()
-	{
-	    JSONArray jsonArray = new JSONArray();
-	    for(int i=0;i<5;i++)
-	    {
-		jsonArray.put(distValueArray[i]);
-	    }
-	    return jsonArray.toString();
-	}
+        Map<String, String> args = null;
+        private MgSiteConnection site = null;
+        private String[] distNameArray = null;
+        private String[] distValueArray = null;
         
+        public Theme(Map<String, String> incomingArgs) throws MgException
+        {
+            this.args = incomingArgs;
+            this.site = new MgSiteConnection();
+            this.site.Open(new MgUserInformation(this.args.get("SESSION")));
+            this.distNameArray = new String[] {"Individual", "Equal", "Standard Deviation", "Quantile", "Jenks (Natural Breaks)"};
+            this.distValueArray = new String[] {"INDIV_DIST", "EQUAL_DIST", "STDEV_DIST", "QUANT_DIST", "JENK_DIST"};
+        }
+        
+        public String getNameArray()
+        {
+            JSONArray jsonArray = new JSONArray();
+            for(int i=0;i<5;i++)
+            {
+                jsonArray.put(distNameArray[i]);
+            }
+            return jsonArray.toString();
+        }
+
+        public String getValueArray()
+        {
+            JSONArray jsonArray = new JSONArray();
+            for(int i=0;i<5;i++)
+            {
+            jsonArray.put(distValueArray[i]);
+            }
+            return jsonArray.toString();
+        }
+            
         public ArrayList<String> GetMapLayerNames() throws MgException
-	{
-	    MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
-	    MgFeatureService featureService = (MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
-	    
-	    MgMap map = new MgMap();
-	    map.Open(resourceService, this.args.get("MAPNAME"));
-	    MgLayerCollection layers = map.GetLayers();
-	    ArrayList<String> layerNames = new ArrayList<String>();
+        {
+            MgFeatureService featureService = (MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
+            
+            MgMap map = new MgMap(this.site);
+            map.Open(this.args.get("MAPNAME"));
+            MgLayerCollection layers = map.GetLayers();
+            ArrayList<String> layerNames = new ArrayList<String>();
 
-	    for(int i=0; i<layers.GetCount(); i++)
-	    {
-		MgLayer layer = (MgLayer) layers.GetItem(i);
-		if(!layer.GetName().startsWith("_") && !layer.GetFeatureSourceId().toUpperCase().startsWith("SESSION"))
-		{
-		    MgResourceIdentifier resId = new MgResourceIdentifier(layer.GetFeatureSourceId());
-		    String[] schemaClass = layer.GetFeatureClassName().split(":");
-		
-		    MgClassDefinition classDef = featureService.GetClassDefinition(resId, schemaClass[0], schemaClass[1]);
-		    MgPropertyDefinition propDef = classDef.GetProperties().GetItem(layer.GetFeatureGeometryName());
-		    
-		    if(propDef.GetPropertyType() == MgFeaturePropertyType.GeometricProperty)
-		    {
-			MgGeometricPropertyDefinition geomPropDef = (MgGeometricPropertyDefinition) propDef;
-			
-			if(geomPropDef.GetGeometryTypes() == MgFeatureGeometricType.Surface)
-			    layerNames.add(layer.GetLegendLabel());
-		    }
-		}
-	    }
-	    Collections.sort(layerNames);
+            for(int i=0; i<layers.GetCount(); i++)
+            {
+                MgLayer layer = (MgLayer) layers.GetItem(i);
+                if(!layer.GetName().startsWith("_") && !layer.GetFeatureSourceId().toUpperCase().startsWith("SESSION"))
+                {
+                    MgClassDefinition classDef = layer.GetClassDefinition();
+                    MgPropertyDefinition propDef = classDef.GetProperties().GetItem(layer.GetFeatureGeometryName());
+                    
+                    if(propDef.GetPropertyType() == MgFeaturePropertyType.GeometricProperty)
+                    {
+                        MgGeometricPropertyDefinition geomPropDef = (MgGeometricPropertyDefinition) propDef;
+                        
+                        if(geomPropDef.GetGeometryTypes() == MgFeatureGeometricType.Surface)
+                            layerNames.add(layer.GetLegendLabel());
+                    }
+                }
+            }
+            Collections.sort(layerNames);
 
-	    return layerNames;
+            return layerNames;
         }
-        
-	public LayerInfo GetLayerInfo() throws MgException, ParserConfigurationException, IOException, SAXException
+            
+        public LayerInfo GetLayerInfo() throws MgException, ParserConfigurationException, IOException, SAXException
         {
             ArrayList<Property> properties = new ArrayList<Property>();
             ArrayList<String> scaleRanges = new ArrayList<String>();
             
             MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
             
-            MgMap map = new MgMap();
-            map.Open(resourceService, this.args.get("MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(this.args.get("MAPNAME"));
             MgLayer layer = (MgLayer) map.GetLayers().GetItem(this.args.get("LAYERNAME"));
 
-            MgFeatureService featureService = (MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
-            MgResourceIdentifier resId = new MgResourceIdentifier(layer.GetFeatureSourceId());
-            String[] schemaClass = layer.GetFeatureClassName().split(":");
+            MgClassDefinition classDef = layer.GetClassDefinition();
 
-            MgClassDefinition classDef = featureService.GetClassDefinition(resId, schemaClass[0], schemaClass[1]);
-
             for(int i=0; i<classDef.GetProperties().GetCount(); i++)
             {
                 MgPropertyDefinition propertyDef = classDef.GetProperties().GetItem(i);
@@ -172,14 +164,9 @@
         {
             ArrayList<String> propertyMinMaxCount = new ArrayList<String>();
             
-            MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
-            
-            MgMap map = new MgMap();
-            map.Open(resourceService, this.args.get("MAPNAME"));
+            MgMap map = new MgMap(this.site);
+            map.Open(this.args.get("MAPNAME"));
             MgLayer layer = (MgLayer) map.GetLayers().GetItem(this.args.get("LAYERNAME"));
-
-            MgFeatureService featureService = (MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
-            MgResourceIdentifier resId = new MgResourceIdentifier(layer.GetFeatureSourceId());
             
             String minValue = null;
             String maxValue = null;
@@ -189,7 +176,7 @@
             MgFeatureQueryOptions queryOptions = new MgFeatureQueryOptions();
             queryOptions.AddFeatureProperty(this.args.get("PROPERTYNAME"));
             
-            MgFeatureReader featureReader = featureService.SelectFeatures(resId, layer.GetFeatureClassName(), queryOptions);
+            MgFeatureReader featureReader = layer.SelectFeatures(queryOptions);
             while(featureReader.ReadNext())
             {
                 String value = this.GetFeaturePropertyValue(featureReader, this.args.get("PROPERTYNAME"));
@@ -256,12 +243,11 @@
         
         public String ApplyTheme() throws MgException, ParserConfigurationException, IOException, SAXException, TransformerConfigurationException, TransformerException
         {
-    	    MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
-    	    MgFeatureService featureService = (MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
+            MgResourceService resourceService = (MgResourceService)this.site.CreateService(MgServiceType.ResourceService);
 
-    	    MgMap map = new MgMap();
-    	    map.Open(resourceService, this.args.get("MAPNAME"));
-    	    MgLayerCollection layers = map.GetLayers();
+            MgMap map = new MgMap(this.site);
+            map.Open(this.args.get("MAPNAME"));
+            MgLayerCollection layers = map.GetLayers();
             MgLayer layer = (MgLayer) layers.GetItem(this.args.get("LAYERNAME"));
             
             MgResourceIdentifier resId = new MgResourceIdentifier(layer.GetFeatureSourceId());
@@ -315,7 +301,7 @@
                 aggregateOptions.AddFeatureProperty(this.args.get("PROPERTYNAME"));
                 aggregateOptions.SelectDistinct(true);
                 
-                MgDataReader dataReader = featureService.SelectAggregate(resId, layer.GetFeatureClassName(), aggregateOptions);
+                MgDataReader dataReader = layer.SelectAggregate(aggregateOptions);
                 while(dataReader.ReadNext())
                 {
                     value = this.GetFeaturePropertyValue(dataReader, this.args.get("PROPERTYNAME"));
@@ -349,7 +335,7 @@
                 aggregateOptions.AddComputedProperty("THEME_VALUE",
                     this.args.get("DISTRO") + "(\"" + this.args.get("PROPERTYNAME") + "\"," + this.args.get("NUMRULES") + "," + this.args.get("MINVALUE") + "," + this.args.get("MAXVALUE") + ")");
                 
-                MgDataReader dataReader = featureService.SelectAggregate(resId, layer.GetFeatureClassName(), aggregateOptions);
+                MgDataReader dataReader = layer.SelectAggregate(aggregateOptions);
                 while(dataReader.ReadNext())
                 {
                     value = this.GetFeaturePropertyValue(dataReader, "THEME_VALUE");
@@ -377,7 +363,7 @@
 
                     areaNode = doc.importNode(areaDoc.getDocumentElement(), true);
                     areaTypeStyle.appendChild(areaNode);
-		                        
+                                
                     portion = portion + increment;
                 }
             }
@@ -409,7 +395,7 @@
             newLayer.SetSelectable(layer.GetSelectable());
             layers.Insert(layers.IndexOf(layer), newLayer);
             
-            map.Save(resourceService);
+            map.Save();
 
             return uniqueName;
         }

Modified: trunk/MgDev/Doc/samples/phpsamples/analyzing_features/bufferfunctions.php
===================================================================
--- trunk/MgDev/Doc/samples/phpsamples/analyzing_features/bufferfunctions.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpsamples/analyzing_features/bufferfunctions.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -56,7 +56,8 @@
     // modify its content to reference the temporary
     // feature source.
 
-    $doc = DOMDocument::load('bufferlayerdefinition.xml');
+    $doc = new DOMDocument();
+    $doc->load('bufferlayerdefinition.xml');
     $featureSourceNode = $doc->getElementsByTagName('ResourceId')->item(0);
     $featureSourceNode->nodeValue = $bufferFeatureResId->ToString();
 
@@ -125,7 +126,8 @@
     // modify its content to reference the temporary
     // feature source.
 
-    $doc = DOMDocument::load('parcelmarker.xml');
+    $doc = new DOMDocument();
+    $doc->load('parcelmarker.xml');
     $featureSourceNode = $doc->getElementsByTagName('ResourceId')->item(0);
     $featureSourceNode->nodeValue = $parcelMarkerDataResId->ToString();
 

Modified: trunk/MgDev/Doc/samples/phpsamples/common/common.php
===================================================================
--- trunk/MgDev/Doc/samples/phpsamples/common/common.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpsamples/common/common.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -19,10 +19,10 @@
 // -----------------------------------------------------------------------------------
 // Use the following for Windows installations
 // -----------------------------------------------------------------------------------
-$webExtensionsDirectory = 'C:\Program Files\OSGeo\MapGuide\Web\\';
-  
-$MapGuideServerDirectory = 'C:\Program Files\OSGeo\MapGuide\Server\\';
-  
+//$webExtensionsDirectory = 'C:\Program Files\OSGeo\MapGuide\Web\\';
+$webExtensionsDirectory = 'D:\mg-trunk\MgDev\Release\Web\\';
+//$MapGuideServerDirectory = 'C:\Program Files\OSGeo\MapGuide\Server\\';
+$MapGuideServerDirectory = 'D:\mg-trunk\MgDev\Release\Server\\';
 $viewerFilesDirectory = $webExtensionsDirectory . 'www\viewerfiles\\';
   
 $schemaDirectory = $MapGuideServerDirectory . 'Schema\\';

Modified: trunk/MgDev/Doc/samples/phpsamples/custom_output/createmapimage.php
===================================================================
--- trunk/MgDev/Doc/samples/phpsamples/custom_output/createmapimage.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpsamples/custom_output/createmapimage.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -43,15 +43,13 @@
 
   // Create the necessary services.
 
-  $resourceService = $siteConnection->
-    CreateService(MgServiceType::ResourceService);
   $renderingService = $siteConnection->
     CreateService(MgServiceType::RenderingService);
 
   // Open the map and get its SRS
 
-  $map = new MgMap();
-  $map->Open($resourceService, $mapName);
+  $map = new MgMap($siteConnection);
+  $map->Open($mapName);
   $srsWkt = $map->GetMapSRS();
   $coordinateSystemFactory = new MgCoordinateSystemFactory();
   $srs = $coordinateSystemFactory->Create($srsWkt);

Modified: trunk/MgDev/Doc/samples/phpsamples/custom_output/eplot.php
===================================================================
--- trunk/MgDev/Doc/samples/phpsamples/custom_output/eplot.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpsamples/custom_output/eplot.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -34,13 +34,9 @@
   $siteConnection = new MgSiteConnection();
   $siteConnection->Open($userInfo);
 
-  // Create an instance of ResourceService and use that to open the
-  // current map instance stored in session state.
+  $map = new MgMap($siteConnection);
+  $map->Open($mapName);
 
-  $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);
-  $map = new MgMap();
-  $map->Open($resourceService, $mapName);
-
   $mappingService = $siteConnection->CreateService(MgServiceType::MappingService);
 
   $dwfVersion = new MgDwfVersion("6.01", "1.2");

Modified: trunk/MgDev/Doc/samples/phpsamples/custom_output/multiplot.php
===================================================================
--- trunk/MgDev/Doc/samples/phpsamples/custom_output/multiplot.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpsamples/custom_output/multiplot.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -34,13 +34,9 @@
   $siteConnection = new MgSiteConnection();
   $siteConnection->Open($userInfo);
 
-  // Create an instance of ResourceService and use that to open the
-  // current map instance stored in session state.
+  $map = new MgMap($siteConnection);
+  $map->Open($mapName);
 
-  $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);
-  $map = new MgMap();
-  $map->Open($resourceService, $mapName);
-
   $mappingService = $siteConnection->CreateService(MgServiceType::MappingService);
 
   $dwfVersion = new MgDwfVersion("6.01", "1.2");
@@ -61,8 +57,8 @@
   // Create a second map for the second sheet in the DWF. This second sheet uses the print layout
   // to display a page title and legend.
 
-  $map2 = new MgMap();
-  $map2->Create($resourceService, $map->GetMapDefinition(), 'Sheet 2');
+  $map2 = new MgMap($siteConnection);
+  $map2->Create($map->GetMapDefinition(), 'Sheet 2');
   $plot2 = new MgMapPlot($map2, $plotSpec, $layout);
   $plot2->SetCenterAndScale($map->GetViewCenter()->GetCoordinate(), $map->GetViewScale());
   // $plot2 = new MgMapPlot($map2, $map->GetViewCenter()->GetCoordinate(), $map->GetViewScale(), $plotSpec, $layout);

Modified: trunk/MgDev/Doc/samples/phpsamples/custom_output/property_report.php
===================================================================
--- trunk/MgDev/Doc/samples/phpsamples/custom_output/property_report.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpsamples/custom_output/property_report.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -44,12 +44,10 @@
   // If any parcels have been selected, recenter the image on the first selected parcel.
   if ($xmlSelection != '')
   {
-    $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);
-    $featureService = $siteConnection->CreateService(MgServiceType::FeatureService);
     $queryOptions = new MgFeatureQueryOptions();
 
-    $map = new MgMap();
-    $map->Open($resourceService, $mapName);
+    $map = new MgMap($siteConnection);
+    $map->Open($mapName);
 
     $selection = new MgSelection($map, $xmlSelection);
     $layers = $selection->GetLayers();
@@ -65,22 +63,8 @@
         if ($layer && $layer->GetName() == 'Parcels')
         {
 
-          // Create a filter containing the IDs of the selected features on this layer
+          $featureReader = $selection->GetSelectedFeatures($layer, $layer->GetFeatureClassName(), false);
 
-          $layerClassName = $layer->GetFeatureClassName();
-          $selectionString = $selection->GenerateFilter($layer, $layerClassName);
-
-          // Get the feature resource for the selected layer
-
-          $layerFeatureId = $layer->GetFeatureSourceId();
-          $layerFeatureResource = new MgResourceIdentifier($layerFeatureId);
-
-          // Apply the filter to the feature resource for the selected layer. This returns
-          // an MgFeatureReader of all the selected features.
-
-          $queryOptions->SetFilter($selectionString);
-          $featureReader = $featureService->SelectFeatures($layerFeatureResource, $layerClassName, $queryOptions);
-
           // Create the report details using the first selected parcel. Position the image so the
           // centroid of the selected parcel is in the center of the map.
 

Modified: trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers/create_new_line_layer_definition.php
===================================================================
--- trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers/create_new_line_layer_definition.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers/create_new_line_layer_definition.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -54,21 +54,21 @@
 
     // --------------------------------------------------//
     // Open the map
-    $map = new MgMap();
-    $map->Open($resourceService, $mapName);
+    $map = new MgMap($siteConnection);
+    $map->Open($mapName);
 
-	// ...
+    // ...
     //---------------------------------------------------//
     // Create a new layer
 
-	$factory = new LayerDefinitionFactory();
+    $factory = new LayerDefinitionFactory();
 
     // Create a line rule.
     $legendLabel = '';
     $filter = '';
     $color = 'FF0000FF';
-	$lineRule = $factory->CreateLineRule(
-	  $legendLabel, $filter, $color);
+    $lineRule = $factory->CreateLineRule(
+      $legendLabel, $filter, $color);
 
     // Create a line type style.
     $lineTypeStyle = $factory->
@@ -86,9 +86,9 @@
       . 'HydrographicLines.FeatureSource';
     $featureName = 'SHP_Schema:HydrographicLines';
     $geometry = 'SHPGEOM';
-	$layerDefinition = $factory->
-	  CreateLayerDefinition($featureClass, $featureName,
-	  $geometry, $lineScaleRange);
+    $layerDefinition = $factory->
+      CreateLayerDefinition($featureClass, $featureName,
+      $geometry, $lineScaleRange);
 
     //---------------------------------------------------//
     // ...
@@ -120,9 +120,9 @@
 }
 catch (MgException $e)
 {
-	echo "<script language=\"javascript\" type=\"text/javascript\"> \n";
-	echo "    alert(\" " . $e->GetExceptionMessage() . " \"); \n";
-	echo "</script> \n";
+    echo "<script language=\"javascript\" type=\"text/javascript\"> \n";
+    echo "    alert(\" " . $e->GetExceptionMessage() . " \"); \n";
+    echo "</script> \n";
 }
 ?>
 

Modified: trunk/MgDev/Doc/samples/phpsamples/working_with_feature_data/queryfeatures.php
===================================================================
--- trunk/MgDev/Doc/samples/phpsamples/working_with_feature_data/queryfeatures.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpsamples/working_with_feature_data/queryfeatures.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -56,13 +56,15 @@
       // Get the geometry for the boundaries of District 1
 
       $districtQuery = new MgFeatureQueryOptions();
-      $districtQuery->SetFilter("Autogenerated_SDF_ID = 1");
-
       $layer = $map->GetLayers()->GetItem('Districts');
+      $classDef = $layer->GetClassDefinition();
+      $clsIdProps = $classDef->GetIdentityProperties();
+      $idProp = $clsIdProps->GetItem(0);      
+      $districtQuery->SetFilter($idProp->GetName()." = 1");
+      
       $featureReader = $layer->SelectFeatures($districtQuery);
       $featureReader->ReadNext();
-      $districtGeometryData = $featureReader->
-      GetGeometry('Data');
+      $districtGeometryData = $featureReader->GetGeometry($layer->GetFeatureGeometryName());
 
       // Convert the AGF binary data to MgGeometry.
 
@@ -99,6 +101,7 @@
     }
     catch (MgException $e)
     {
+      echo $e->getTraceAsString();
       echo $e->GetExceptionMessage();
       echo $e->GetDetails();
     }

Modified: trunk/MgDev/Doc/samples/phpsamples/working_with_feature_data/selectfeatures.php
===================================================================
--- trunk/MgDev/Doc/samples/phpsamples/working_with_feature_data/selectfeatures.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpsamples/working_with_feature_data/selectfeatures.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -55,13 +55,15 @@
       // Get the geometry for the boundaries of District 1
 
       $districtQuery = new MgFeatureQueryOptions();
-      $districtQuery->SetFilter("Autogenerated_SDF_ID = 1");
+      $layer = $map->GetLayers()->GetItem('Districts');
+      $classDef = $layer->GetClassDefinition();
+      $clsIdProps = $classDef->GetIdentityProperties();
+      $idProp = $clsIdProps->GetItem(0);      
+      $districtQuery->SetFilter($idProp->GetName()." = 1");
 
-      $layer = $map->GetLayers()->GetItem('Districts');
       $featureReader = $layer->SelectFeatures($districtQuery);
       $featureReader->ReadNext();
-      $districtGeometryData = $featureReader->
-      GetGeometry('Data');
+      $districtGeometryData = $featureReader->GetGeometry($layer->GetFeatureGeometryName());
 
       // Convert the AGF binary data to MgGeometry.
 

Copied: trunk/MgDev/Doc/samples/phpviewersample/composer.json (from rev 8221, sandbox/jng/v30/Doc/samples/phpviewersample/composer.json)
===================================================================
--- trunk/MgDev/Doc/samples/phpviewersample/composer.json	                        (rev 0)
+++ trunk/MgDev/Doc/samples/phpviewersample/composer.json	2014-06-17 10:16:51 UTC (rev 8236)
@@ -0,0 +1,5 @@
+{
+    "require": {
+        "lstrojny/fxmlrpc": "*"
+    }
+}

Modified: trunk/MgDev/Doc/samples/phpviewersample/findaddress/clearaddressresults.php
===================================================================
--- trunk/MgDev/Doc/samples/phpviewersample/findaddress/clearaddressresults.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpviewersample/findaddress/clearaddressresults.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -53,20 +53,14 @@
 
         $featureService->UpdateFeatures($addressMarkerDataResId, $commands, false);
 
-        // Create a ReserviceService object and use it to open the Map
-        // object from the sessions repository. Use the Map object to hide
-        // the "ParcelMarker" layer and then save the updated Map back to
-        // the session.
+        $map = new MgMap($siteConnection);
+        $map->Open('Sheboygan');
 
-        $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);
-        $map = new MgMap();
-        $map->Open($resourceService, 'Sheboygan');
-
         $layer = GetLayerByName($map, 'AddressMarker');
         $layer->SetVisible(false);
         $layer->ForceRefresh();
 
-        $map->Save($resourceService);
+        $map->Save();
     }
     catch (MgException $e)
     {

Modified: trunk/MgDev/Doc/samples/phpviewersample/findaddress/findaddress.php
===================================================================
--- trunk/MgDev/Doc/samples/phpviewersample/findaddress/findaddress.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpviewersample/findaddress/findaddress.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -44,10 +44,8 @@
 <?php
     include '../utilityfunctions.php';
     include 'findaddressfunctions.php';
+    require_once '../vendor/autoload.php';
 
-    // Include the xmlrpc library.
-    require_once('kd_xmlrpc.php');
-
     $mgSessionId = ($_SERVER['REQUEST_METHOD'] == "POST")? $_POST['SESSION']: $_GET['SESSION'];
     $success = false;
     $long = 0; $lat = 0;
@@ -66,8 +64,10 @@
         $address = $_GET['address'] . ', Sheboygan, WI';
 
         // Make the request to geocoder.us passing the address.
-        list($success, $response) = XMLRPC_request('rpc.geocoder.us', '/service/xmlrpc', 'geocode', array(XMLRPC_prepare($address)));
-
+        $url = 'http://rpc.geocoder.us/service/xmlrpc';
+        $client = new fXmlRpc\Client($url);
+        $response = $client->call('geocode', array($address, true));
+        
         // Stuff the response into a new variable:
         $nested_array = $response;
 
@@ -81,13 +81,13 @@
         // we can't use this to check for errors. Instead, we'll check the values in the
         // array and deem success or failure based on that.
 
-        if (array_key_exists('lat', $geoarray) && array_key_exists('long', $geoarray))
+        if (NULL != $geoarray && array_key_exists('lat', $geoarray) && array_key_exists('long', $geoarray))
         {
             // The geocode successfully returned a location.
 
             $lat = $geoarray['lat'];
             $long = $geoarray['long'];
-
+            
             // Build an address1 and address2 variables from the result.
             $address1 = $geoarray['number'] . ' '
                 . (strlen($geoarray['prefix']) > 0 ? $geoarray['prefix'] . ' ' : '')
@@ -98,7 +98,7 @@
             $address2 = $geoarray['city']
                 . ', ' . $geoarray['state']
                 . '  ' . $geoarray['zip'];
-
+            
             echo '<tr><td><img src="../images/pushpinblue.jpg">';
             echo '<a href="gotopoint.php?X=' . $long . '&Y=' . $lat . '&Scale=2000" target="scriptFrame"> ' . $address1 . '</a></td></tr>';
             echo '<tr><td>' . $address2 . '</td></tr>';
@@ -113,8 +113,8 @@
             $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);
             $featureService = $siteConnection->CreateService(MgServiceType::FeatureService);
 
-            $map = new MgMap();
-            $map->Open($resourceService, 'Sheboygan');
+            $map = new MgMap($siteConnection);
+            $map->Open('Sheboygan');
 
             // Check the map for the AddressMarker layer. If it does not
             // exist then create a feature source to store address results
@@ -157,7 +157,7 @@
             $addressLayer->SetVisible(true);
             $addressLayer->ForceRefresh();
 
-            $map->Save($resourceService);
+            $map->Save();
 
             $success = true;
         }

Modified: trunk/MgDev/Doc/samples/phpviewersample/findaddress/findaddressfunctions.php
===================================================================
--- trunk/MgDev/Doc/samples/phpviewersample/findaddress/findaddressfunctions.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpviewersample/findaddress/findaddressfunctions.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -101,7 +101,8 @@
     // modify it's content to reference the temporary
     // feature source.
 
-    $doc = DOMDocument::load(GetXmlPath());
+    $doc = new DOMDocument();
+    $doc->load(GetXmlPath());
     $featureSourceNode = $doc->getElementsByTagName('ResourceId')->item(0);
     $featureSourceNode->nodeValue = $addressMarkerDataResId->ToString();
 

Modified: trunk/MgDev/Doc/samples/phpviewersample/findaddress/findaddressmain.php
===================================================================
--- trunk/MgDev/Doc/samples/phpviewersample/findaddress/findaddressmain.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpviewersample/findaddress/findaddressmain.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -30,12 +30,12 @@
     <script language="javascript">
     function Submit()
     {
-    	var addressForm = document.getElementById("addressForm");
-    	var addressValue = document.getElementById("addressValue");
-    	var addressInput = document.getElementById("addressInput");
+        var addressForm = document.getElementById("addressForm");
+        var addressValue = document.getElementById("addressValue");
+        var addressInput = document.getElementById("addressInput");
 
-    	addressValue.value = addressInput.value;
-    	addressForm.submit();
+        addressValue.value = addressInput.value;
+        addressForm.submit();
     }
     </script>
 </head>
@@ -60,13 +60,8 @@
         $siteConnection = new MgSiteConnection();
         $siteConnection->Open($userInfo);
 
-        // Create a ReserviceService object and use it to open the Map
-        // object from the sessions repository. Use the Map object to
-        // determine if the "AddressMarker" layer is visible.
-
-        $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);
-        $map = new MgMap();
-        $map->Open($resourceService, 'Sheboygan');
+        $map = new MgMap($siteConnection);
+        $map->Open('Sheboygan');
         $addressLayer = GetLayerByName($map, 'AddressMarker');
 
         if ($addressLayer != null)

Deleted: trunk/MgDev/Doc/samples/phpviewersample/findaddress/kd_xmlrpc.php
===================================================================
--- trunk/MgDev/Doc/samples/phpviewersample/findaddress/kd_xmlrpc.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpviewersample/findaddress/kd_xmlrpc.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -1,498 +0,0 @@
-<?php
-/*
-An XML-RPC implementation by Keith Devens, version 2.5f.
-http://www.keithdevens.com/software/xmlrpc/
-
-Release history available at:
-http://www.keithdevens.com/software/xmlrpc/history/
-
-This code is Open Source, released under terms similar to the Artistic License.
-Read the license at http://www.keithdevens.com/software/license/
-
-Note: this code requires version 4.1.0 or higher of PHP.
-*/
-
-function & XML_serialize(&$data, $level = 0, $prior_key = NULL){
-    #assumes a hash, keys are the variable names
-    $xml_serialized_string = "";
-    while(list($key, $value) = each($data)){
-        $inline = false;
-        $numeric_array = false;
-        $attributes = "";
-        #echo "My current key is '$key', called with prior key '$prior_key'<br>";
-        if(!strstr($key, " attr")){ #if it's not an attribute
-            if(array_key_exists("$key attr", $data)){
-                while(list($attr_name, $attr_value) = each($data["$key attr"])){
-                    #echo "Found attribute $attribute_name with value $attribute_value<br>";
-                    $attr_value = &htmlspecialchars($attr_value, ENT_QUOTES);
-                    $attributes .= " $attr_name=\"$attr_value\"";
-                }
-            }
-
-            if(is_numeric($key)){
-                #echo "My current key ($key) is numeric. My parent key is '$prior_key'<br>";
-                $key = $prior_key;
-            }else{
-                #you can't have numeric keys at two levels in a row, so this is ok
-                #echo "Checking to see if a numeric key exists in data.";
-                if(is_array($value) and array_key_exists(0, $value)){
-                #   echo " It does! Calling myself as a result of a numeric array.<br>";
-                    $numeric_array = true;
-                    $xml_serialized_string .= XML_serialize($value, $level, $key);
-                }
-                #echo "<br>";
-            }
-
-            if(!$numeric_array){
-                $xml_serialized_string .= str_repeat("\t", $level) . "<$key$attributes>";
-
-                if(is_array($value)){
-                    $xml_serialized_string .= "\r\n" . XML_serialize($value, $level+1);
-                }else{
-                    $inline = true;
-                    $xml_serialized_string .= htmlspecialchars($value);
-                }
-
-                $xml_serialized_string .= (!$inline ? str_repeat("\t", $level) : "") . "</$key>\r\n";
-            }
-        }else{
-            #echo "Skipping attribute record for key $key<bR>";
-        }
-    }
-    if($level == 0){
-        $xml_serialized_string = "<?xml version=\"1.0\" ?>\r\n" . $xml_serialized_string;
-        return $xml_serialized_string;
-    }else{
-        return $xml_serialized_string;
-    }
-}
-
-class XML {
-    var $parser; #a reference to the XML parser
-    var $document; #the entire XML structure built up so far
-    var $current; #a pointer to the current item - what is this
-    var $parent; #a pointer to the current parent - the parent will be an array
-    var $parents; #an array of the most recent parent at each level
-
-    var $last_opened_tag;
-
-    function XML($data=null){
-        $this->parser = xml_parser_create();
-
-        xml_parser_set_option ($this->parser, XML_OPTION_CASE_FOLDING, 0);
-        xml_set_object($this->parser, &$this);
-        xml_set_element_handler($this->parser, "open", "close");
-        xml_set_character_data_handler($this->parser, "data");
-#       register_shutdown_function(array(&$this, 'destruct'));
-    }
-
-    function destruct(){
-        xml_parser_free($this->parser);
-    }
-
-    function parse($data){
-        $this->document = array();
-        $this->parent = &$this->document;
-        $this->parents = array();
-        $this->last_opened_tag = NULL;
-        xml_parse($this->parser, $data);
-        return $this->document;
-    }
-
-    function open($parser, $tag, $attributes){
-        #echo "Opening tag $tag<br>\n";
-        $this->data = "";
-        $this->last_opened_tag = $tag; #tag is a string
-        if(array_key_exists($tag, $this->parent)){
-            #echo "There's already an instance of '$tag' at the current level ($level)<br>\n";
-            if(is_array($this->parent[$tag]) and array_key_exists(0, $this->parent[$tag])){ #if the keys are numeric
-                #need to make sure they're numeric (account for attributes)
-                $key = count_numeric_items($this->parent[$tag]);
-                #echo "There are $key instances: the keys are numeric.<br>\n";
-            }else{
-                #echo "There is only one instance. Shifting everything around<br>\n";
-                $temp = &$this->parent[$tag];
-                unset($this->parent[$tag]);
-                $this->parent[$tag][0] = &$temp;
-
-                if(array_key_exists("$tag attr", $this->parent)){
-                    #shift the attributes around too if they exist
-                    $temp = &$this->parent["$tag attr"];
-                    unset($this->parent["$tag attr"]);
-                    $this->parent[$tag]["0 attr"] = &$temp;
-                }
-                $key = 1;
-            }
-            $this->parent = &$this->parent[$tag];
-        }else{
-            $key = $tag;
-        }
-        if($attributes){
-            $this->parent["$key attr"] = $attributes;
-        }
-
-        $this->parent[$key] = array();
-        $this->parent = &$this->parent[$key];
-        array_unshift($this->parents, &$this->parent);
-    }
-
-    function data($parser, $data){
-        #echo "Data is '", htmlspecialchars($data), "'<br>\n";
-        if($this->last_opened_tag != NULL){
-            $this->data .= $data;
-        }
-    }
-
-    function close($parser, $tag){
-        #echo "Close tag $tag<br>\n";
-        if($this->last_opened_tag == $tag){
-            $this->parent = $this->data;
-            $this->last_opened_tag = NULL;
-        }
-        array_shift($this->parents);
-        $this->parent = &$this->parents[0];
-    }
-}
-
-function & XML_unserialize(&$xml){
-    $xml_parser = new XML();
-    $data = &$xml_parser->parse(&$xml);
-    $xml_parser->destruct();
-    return $data;
-}
-
-function & XMLRPC_parse(&$request){
-    if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
-        XMLRPC_debug('XMLRPC_parse', "<p>Received the following raw request:</p>" . XMLRPC_show($request, 'print_r', true));
-    }
-    $data = &XML_unserialize(&$request);
-    if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
-        XMLRPC_debug('XMLRPC_parse', "<p>Returning the following parsed request:</p>" . XMLRPC_show($data, 'print_r', true));
-    }
-    return $data;
-}
-
-function & XMLRPC_prepare($data, $type = NULL){
-    if(is_array($data)){
-        $num_elements = count($data);
-        if((array_key_exists(0, $data) or !$num_elements) and $type != 'struct'){ #it's an array
-            if(!$num_elements){ #if the array is empty
-                $returnvalue =  array('array' => array('data' => NULL));
-            }else{
-                $returnvalue['array']['data']['value'] = array();
-                $temp = &$returnvalue['array']['data']['value'];
-                $count = count_numeric_items($data);
-                for($n=0; $n<$count; $n++){
-                    $type = NULL;
-                    if(array_key_exists("$n type", $data)){
-                        $type = $data["$n type"];
-                    }
-                    $temp[$n] = XMLRPC_prepare(&$data[$n], $type);
-                }
-            }
-        }else{ #it's a struct
-            if(!$num_elements){ #if the struct is empty
-                $returnvalue = array('struct' => NULL);
-            }else{
-                $returnvalue['struct']['member'] = array();
-                $temp = &$returnvalue['struct']['member'];
-                while(list($key, $value) = each($data)){
-                    if(substr($key, -5) != ' type'){ #if it's not a type specifier
-                        $type = NULL;
-                        if(array_key_exists("$key type", $data)){
-                            $type = $data["$key type"];
-                        }
-                        $temp[] = array('name' => $key, 'value' => XMLRPC_prepare(&$value, $type));
-                    }
-                }
-            }
-        }
-    }else{ #it's a scalar
-        if(!$type){
-            if(is_int($data)){
-                $returnvalue['int'] = $data;
-                return $returnvalue;
-            }elseif(is_float($data)){
-                $returnvalue['double'] = $data;
-                return $returnvalue;
-            }elseif(is_bool($data)){
-                $returnvalue['boolean'] = ($data ? 1 : 0);
-                return $returnvalue;
-            }elseif(preg_match('/^\d{8}T\d{2}:\d{2}:\d{2}$/', $data, $matches)){ #it's a date
-                $returnvalue['dateTime.iso8601'] = $data;
-                return $returnvalue;
-            }elseif(is_string($data)){
-                $returnvalue['string'] = htmlspecialchars($data);
-                return $returnvalue;
-            }
-        }else{
-            $returnvalue[$type] = htmlspecialchars($data);
-        }
-    }
-    return $returnvalue;
-}
-
-function & XMLRPC_adjustValue(&$current_node){
-    if(is_array($current_node)){
-        if(isset($current_node['array'])){
-            if(!is_array($current_node['array']['data'])){
-                #If there are no elements, return an empty array
-                return array();
-            }else{
-                #echo "Getting rid of array -> data -> value<br>\n";
-                $temp = &$current_node['array']['data']['value'];
-                if(is_array($temp) and array_key_exists(0, $temp)){
-                    $count = count($temp);
-                    for($n=0;$n<$count;$n++){
-                        $temp2[$n] = &XMLRPC_adjustValue(&$temp[$n]);
-                    }
-                    $temp = &$temp2;
-                }else{
-                    $temp2 = &XMLRPC_adjustValue(&$temp);
-                    $temp = array(&$temp2);
-                    #I do the temp assignment because it avoids copying,
-                    # since I can put a reference in the array
-                    #PHP's reference model is a bit silly, and I can't just say:
-                    # $temp = array(&XMLRPC_adjustValue(&$temp));
-                }
-            }
-        }elseif(isset($current_node['struct'])){
-            if(!is_array($current_node['struct'])){
-                #If there are no members, return an empty array
-                return array();
-            }else{
-                #echo "Getting rid of struct -> member<br>\n";
-                $temp = &$current_node['struct']['member'];
-                if(is_array($temp) and array_key_exists(0, $temp)){
-                    $count = count($temp);
-                    for($n=0;$n<$count;$n++){
-                        #echo "Passing name {$temp[$n][name]}. Value is: " . show($temp[$n][value], var_dump, true) . "<br>\n";
-                        $temp2[$temp[$n]['name']] = &XMLRPC_adjustValue(&$temp[$n]['value']);
-                        #echo "adjustValue(): After assigning, the value is " . show($temp2[$temp[$n]['name']], var_dump, true) . "<br>\n";
-                    }
-                }else{
-                    #echo "Passing name $temp[name]<br>\n";
-                    $temp2[$temp['name']] = &XMLRPC_adjustValue(&$temp['value']);
-                }
-                $temp = &$temp2;
-            }
-        }else{
-            $types = array('string', 'int', 'i4', 'double', 'dateTime.iso8601', 'base64', 'boolean');
-            $fell_through = true;
-            foreach($types as $type){
-                if(array_key_exists($type, $current_node)){
-                    #echo "Getting rid of '$type'<br>\n";
-                    $temp = &$current_node[$type];
-                    #echo "adjustValue(): The current node is set with a type of $type<br>\n";
-                    $fell_through = false;
-                    break;
-                }
-            }
-            if($fell_through){
-                $type = 'string';
-                #echo "Fell through! Type is $type<br>\n";
-            }
-            switch ($type){
-                case 'int': case 'i4': $temp = (int)$temp;    break;
-                case 'string':         $temp = (string)$temp; break;
-                case 'double':         $temp = (double)$temp; break;
-                case 'boolean':        $temp = (bool)$temp;   break;
-            }
-        }
-    }else{
-        $temp = (string)$current_node;
-    }
-    return $temp;
-}
-
-function XMLRPC_getParams($request){
-    if(!is_array($request['methodCall']['params'])){
-        #If there are no parameters, return an empty array
-        return array();
-    }else{
-        #echo "Getting rid of methodCall -> params -> param<br>\n";
-        $temp = &$request['methodCall']['params']['param'];
-        if(is_array($temp) and array_key_exists(0, $temp)){
-            $count = count($temp);
-            for($n = 0; $n < $count; $n++){
-                #echo "Serializing parameter $n<br>";
-                $temp2[$n] = &XMLRPC_adjustValue(&$temp[$n]['value']);
-            }
-        }else{
-            $temp2[0] = &XMLRPC_adjustValue($temp['value']);
-        }
-        $temp = &$temp2;
-        return $temp;
-    }
-}
-
-function XMLRPC_getMethodName($methodCall){
-    #returns the method name
-    return $methodCall['methodCall']['methodName'];
-}
-
-function XMLRPC_request($site, $location, $methodName, $params = NULL, $user_agent = NULL){
-    $site = explode(':', $site);
-    if(isset($site[1]) and is_numeric($site[1])){
-        $port = $site[1];
-    }else{
-        $port = 80;
-    }
-    $site = $site[0];
-
-    $data["methodCall"]["methodName"] = $methodName;
-    $param_count = count($params);
-    if(!$param_count){
-        $data["methodCall"]["params"] = NULL;
-    }else{
-        for($n = 0; $n<$param_count; $n++){
-            $data["methodCall"]["params"]["param"][$n]["value"] = $params[$n];
-        }
-    }
-    $data = XML_serialize($data);
-
-    if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
-        XMLRPC_debug('XMLRPC_request', "<p>Received the following parameter list to send:</p>" . XMLRPC_show($params, 'print_r', true));
-    }
-    $conn = fsockopen ($site, $port); #open the connection
-    if(!$conn){ #if the connection was not opened successfully
-        if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
-            XMLRPC_debug('XMLRPC_request', "<p>Connection failed: Couldn't make the connection to $site.</p>");
-        }
-        return array(false, array('faultCode'=>10532, 'faultString'=>"Connection failed: Couldn't make the connection to $site."));
-    }else{
-        $headers =
-            "POST $location HTTP/1.0\r\n" .
-            "Host: $site\r\n" .
-            "Connection: close\r\n" .
-            ($user_agent ? "User-Agent: $user_agent\r\n" : '') .
-            "Content-Type: text/xml\r\n" .
-            "Content-Length: " . strlen($data) . "\r\n\r\n";
-
-        fputs($conn, "$headers");
-        fputs($conn, $data);
-
-        if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
-            XMLRPC_debug('XMLRPC_request', "<p>Sent the following request:</p>\n\n" . XMLRPC_show($headers . $data, 'print_r', true));
-        }
-
-        #socket_set_blocking ($conn, false);
-        $response = "";
-        while(!feof($conn)){
-            $response .= fgets($conn, 1024);
-        }
-        fclose($conn);
-
-        #strip headers off of response
-
-        $responsesubstr = substr($response, strpos($response, "\r\n\r\n")+4);
-        $data = XML_unserialize($responsesubstr);
-
-        if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
-            XMLRPC_debug('XMLRPC_request', "<p>Received the following response:</p>\n\n" . XMLRPC_show($response, 'print_r', true) . "<p>Which was serialized into the following data:</p>\n\n" . XMLRPC_show($data, 'print_r', true));
-        }
-        if(isset($data['methodResponse']['fault'])){
-            $return =  array(false, XMLRPC_adjustValue(&$data['methodResponse']['fault']['value']));
-            if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
-                XMLRPC_debug('XMLRPC_request', "<p>Returning:</p>\n\n" . XMLRPC_show($return, 'var_dump', true));
-            }
-            return $return;
-        }else{
-            $return = array(true, XMLRPC_adjustValue(&$data['methodResponse']['params']['param']['value']));
-            if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
-                XMLRPC_debug('XMLRPC_request', "<p>Returning:</p>\n\n" . XMLRPC_show($return, 'var_dump', true));
-            }
-            return $return;
-        }
-    }
-}
-
-function XMLRPC_response($return_value, $server = NULL){
-    $data["methodResponse"]["params"]["param"]["value"] = &$return_value;
-    $return = XML_serialize(&$data);
-
-    if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
-        XMLRPC_debug('XMLRPC_response', "<p>Received the following data to return:</p>\n\n" . XMLRPC_show($return_value, 'print_r', true));
-    }
-
-    header("Connection: close");
-    header("Content-Length: " . strlen($return));
-    header("Content-Type: text/xml");
-    header("Date: " . date("r"));
-    if($server){
-        header("Server: $server");
-    }
-
-    if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
-        XMLRPC_debug('XMLRPC_response', "<p>Sent the following response:</p>\n\n" . XMLRPC_show($return, 'print_r', true));
-    }
-    echo $return;
-}
-
-function XMLRPC_error($faultCode, $faultString, $server = NULL){
-    $array["methodResponse"]["fault"]["value"]["struct"]["member"] = array();
-    $temp = &$array["methodResponse"]["fault"]["value"]["struct"]["member"];
-    $temp[0]["name"] = "faultCode";
-    $temp[0]["value"]["int"] = $faultCode;
-    $temp[1]["name"] = "faultString";
-    $temp[1]["value"]["string"] = $faultString;
-
-    $return = XML_serialize($array);
-
-    header("Connection: close");
-    header("Content-Length: " . strlen($return));
-    header("Content-Type: text/xml");
-    header("Date: " . date("r"));
-    if($server){
-        header("Server: $server");
-    }
-    if(defined('XMLRPC_DEBUG') and XMLRPC_DEBUG){
-        XMLRPC_debug('XMLRPC_error', "<p>Sent the following error response:</p>\n\n" . XMLRPC_show($return, 'print_r', true));
-    }
-    echo $return;
-}
-
-function XMLRPC_convert_timestamp_to_iso8601($timestamp){
-    #takes a unix timestamp and converts it to iso8601 required by XMLRPC
-    #an example iso8601 datetime is "20010822T03:14:33"
-    return date("Ymd\TH:i:s", $timestamp);
-}
-
-function XMLRPC_convert_iso8601_to_timestamp($iso8601){
-    return strtotime($iso8601);
-}
-
-function count_numeric_items(&$array){
-    return is_array($array) ? count(array_filter(array_keys($array), 'is_numeric')) : 0;
-}
-
-function XMLRPC_debug($function_name, $debug_message){
-    $GLOBALS['XMLRPC_DEBUG_INFO'][] = array($function_name, $debug_message);
-}
-
-function XMLRPC_debug_print(){
-    if($GLOBALS['XMLRPC_DEBUG_INFO']){
-        echo "<table border=\"1\" width=\"100%\">\n";
-        foreach($GLOBALS['XMLRPC_DEBUG_INFO'] as $debug){
-            echo "<tr><th style=\"vertical-align: top\">$debug[0]</th><td>$debug[1]</td></tr>\n";
-        }
-        echo "</table>\n";
-        unset($GLOBALS['XMLRPC_DEBUG_INFO']);
-    }else{
-        echo "<p>No debugging information available yet.</p>";
-    }
-}
-
-function XMLRPC_show($data, $func = "print_r", $return_str = false){
-    ob_start();
-    $func($data);
-    $output = ob_get_contents();
-    ob_end_clean();
-    if($return_str){
-        return "<pre>" . htmlspecialchars($output) . "</pre>\n";
-    }else{
-        echo "<pre>", htmlspecialchars($output), "</pre>\n";
-    }
-}
-
-?>

Modified: trunk/MgDev/Doc/samples/phpviewersample/plot/plot.php
===================================================================
--- trunk/MgDev/Doc/samples/phpviewersample/plot/plot.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpviewersample/plot/plot.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -35,15 +35,9 @@
     $siteConnection = new MgSiteConnection();
     $siteConnection->Open($userInfo);
 
-    $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);
+    $map = new MgMap($siteConnection);
+    $map->Open('Sheboygan');
 
-    // Create an instance of ResourceService and use that to open the
-    // current map instance stored in session state.
-
-    $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);
-    $map = new MgMap();
-    $map->Open($resourceService, 'Sheboygan');
-
     // Now create an instance of MappingService and use it to plot the
     // current view of the map.
 

Modified: trunk/MgDev/Doc/samples/phpviewersample/plot/plotmain.php
===================================================================
--- trunk/MgDev/Doc/samples/phpviewersample/plot/plotmain.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpviewersample/plot/plotmain.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -90,9 +90,8 @@
         // determine the current scale of the map for display on this
         // page.
 
-        $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);
-        $map = new MgMap();
-        $map->Open($resourceService, 'Sheboygan');
+        $map = new MgMap($siteConnection);
+        $map->Open('Sheboygan');
 
         $viewCenter = $map->GetViewCenter();
         $viewScale = $map->GetViewScale();

Modified: trunk/MgDev/Doc/samples/phpviewersample/query/classes/query.php
===================================================================
--- trunk/MgDev/Doc/samples/phpviewersample/query/classes/query.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpviewersample/query/classes/query.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -27,35 +27,33 @@
 
 class Query
 {
-	private $args = null;
-	private $site = null;
+    private $args = null;
+    private $site = null;
 
-	public $numOperators;
-	public $numExpressions;
-	public $strOperators;
-	public $strExpressions;
+    public $numOperators;
+    public $numExpressions;
+    public $strOperators;
+    public $strExpressions;
 
-	function __construct($args)
-	{
-		$this->args = $args;
-		$this->site = new MgSiteConnection();
-		$this->site->Open(new MgUserInformation($args['SESSION']));
+    function __construct($args)
+    {
+        $this->args = $args;
+        $this->site = new MgSiteConnection();
+        $this->site->Open(new MgUserInformation($args['SESSION']));
 
-		$this->numOperators = array('Equal to', 'Not equal to', 'Greater than', 'Greater than or equal to', 'Less than', 'Less than or equal to');
-		$this->numExpressions = array(' = %s', ' != %s', ' > %s', ' >= %s', ' < %s', ' <= %s');
+        $this->numOperators = array('Equal to', 'Not equal to', 'Greater than', 'Greater than or equal to', 'Less than', 'Less than or equal to');
+        $this->numExpressions = array(' = %s', ' != %s', ' > %s', ' >= %s', ' < %s', ' <= %s');
 
-		$this->strOperators = array('Begins with', 'Contains', 'Equal to');
-		$this->strExpressions = array(" like '%s%%'", " like '%%%s%%'", " = '%s'");
-	}
+        $this->strOperators = array('Begins with', 'Contains', 'Equal to');
+        $this->strExpressions = array(" like '%s%%'", " like '%%%s%%'", " = '%s'");
+    }
 
     function GetMapLayerNames()
     {
         $layerNames = array();
 
-		$resourceService = $this->site->CreateService(MgServiceType::ResourceService);
-
-		$map = new MgMap();
-		$map->Open($resourceService, $this->args['MAPNAME']);
+        $map = new MgMap($this->site);
+        $map->Open($this->args['MAPNAME']);
         $layers = $map->GetLayers();
 
         for ($i = 0; $i < $layers->GetCount(); $i++)
@@ -65,9 +63,9 @@
             //TODO: Exclude Raster and Drawing Layers???
 
             if((substr($layer->GetName(), 0, 1) != "_") && (substr(strtoupper($layer->GetFeatureSourceId()), 0, 7) != "SESSION"))
-		    {
-		        $layerNames[$layer->GetName()] = $layer->GetLegendLabel();
-		    }
+            {
+                $layerNames[$layer->GetName()] = $layer->GetLegendLabel();
+            }
         }
         asort($layerNames);
 
@@ -78,395 +76,382 @@
     {
         $properties = array();
 
-		$resourceService = $this->site->CreateService(MgServiceType::ResourceService);
-
-		$map = new MgMap();
-		$map->Open($resourceService, $this->args['MAPNAME']);
+        $map = new MgMap($this->site);
+        $map->Open($this->args['MAPNAME']);
         $layer = $map->GetLayers()->GetItem($this->args['LAYERNAME']);
 
-		$featureService = $this->site->CreateService(MgServiceType::FeatureService);
-        $resId = new MgResourceIdentifier($layer->GetFeatureSourceId());
-        $schemaClass = explode(':', $layer->GetFeatureClassName());
+        $classDef = $layer->GetClassDefinition();
+        $clsProps = $classDef->GetProperties();
 
-        $classDef = $featureService->GetClassDefinition($resId, $schemaClass[0], $schemaClass[1]);
-
-        for ($i = 0; $i < $classDef->GetProperties()->GetCount(); $i++)
+        for ($i = 0; $i < $clsProps->GetCount(); $i++)
         {
-            $propertyDef = $classDef->GetProperties()->GetItem($i);
+            $propertyDef = $clsProps->GetItem($i);
 
             if ($propertyDef->GetPropertyType() == MgFeaturePropertyType::DataProperty)
             {
-				$dataType = $propertyDef->GetDataType();
-				if ($this->IsValidDataType($dataType))
-				{
-	                array_push($properties, new Property($propertyDef->GetName(), $dataType == MgPropertyType::String));
-				}
+                $dataType = $propertyDef->GetDataType();
+                if ($this->IsValidDataType($dataType))
+                {
+                    array_push($properties, new Property($propertyDef->GetName(), $dataType == MgPropertyType::String));
+                }
             }
         }
         return $properties;
     }
 
-	function ToggleSpatialFilter()
-	{
-		$result = true;
+    function ToggleSpatialFilter()
+    {
+        $result = true;
 
-		$resourceService = $this->site->CreateService(MgServiceType::ResourceService);
+        $map = new MgMap($this->site);
+        $map->Open($this->args['MAPNAME']);
 
-		$map = new MgMap();
-		$map->Open($resourceService, $this->args['MAPNAME']);
+        $layers = $map->GetLayers();
+        if ($layers->Contains('_QuerySpatialFilter'))
+        {
+            $layer = $layers->GetItem('_QuerySpatialFilter');
+            if ($this->args['VISIBLE'] == 'true')
+                $layer->SetVisible(true);
+            else
+                $layer->SetVisible(false);
 
-		$layers = $map->GetLayers();
-		if ($layers->Contains('_QuerySpatialFilter'))
-		{
-			$layer = $layers->GetItem('_QuerySpatialFilter');
-			if ($this->args['VISIBLE'] == 'true')
-				$layer->SetVisible(true);
-			else
-				$layer->SetVisible(false);
+            $map->Save();
+        }
 
-			$map->Save($resourceService);
-		}
+        return $result;
+    }
 
-		return $result;
-	}
+    function ShowSpatialFilter()
+    {
+        $result = true;
 
-	function ShowSpatialFilter()
-	{
-		$result = true;
+        $sdfResId = new MgResourceIdentifier('Session:' . $this->args['SESSION'] . '//Filter.FeatureSource');
 
-		$sdfResId = new MgResourceIdentifier('Session:' . $this->args['SESSION'] . '//Filter.FeatureSource');
+        $resourceService = $this->site->CreateService(MgServiceType::ResourceService);
+        $featureService = $this->site->CreateService(MgServiceType::FeatureService);
 
-		$resourceService = $this->site->CreateService(MgServiceType::ResourceService);
-		$featureService = $this->site->CreateService(MgServiceType::FeatureService);
-
         $updateCommands = new MgFeatureCommandCollection();
 
-		$map = new MgMap();
-		$map->Open($resourceService, $this->args['MAPNAME']);
+        $map = new MgMap($this->site);
+        $map->Open($this->args['MAPNAME']);
 
-		$layer = null;
-		$layers = $map->GetLayers();
-		if ($layers->Contains('_QuerySpatialFilter'))
-		{
-			$layer = $layers->GetItem('_QuerySpatialFilter');
+        $layer = null;
+        $layers = $map->GetLayers();
+        if ($layers->Contains('_QuerySpatialFilter'))
+        {
+            $layer = $layers->GetItem('_QuerySpatialFilter');
             $updateCommands->Add(new MgDeleteFeatures('Filter', "ID like '%'"));
-		}
-		else
-		{
-			// Create the Feature Source (SDF)
+        }
+        else
+        {
+            // Create the Feature Source (SDF)
+            $sdfSchema = $this->CreateFilterSchema();
+            $sdfParams = new MgFileFeatureSourceParams('OSGeo.SDF', 'MAPCS', $map->GetMapSRS(), $sdfSchema);
+            $featureService->CreateFeatureSource($sdfResId, $sdfParams);
 
-			$sdfSchema = $this->CreateFilterSchema();
-			$sdfParams = new MgCreateSdfParams('MAPCS', $map->GetMapSRS(), $sdfSchema);
-			$featureService->CreateFeatureSource($sdfResId, $sdfParams);
+            // Create the Layer
 
-			// Create the Layer
+            $layerResId = new MgResourceIdentifier('Session:' . $this->args['SESSION'] . '//Filter.LayerDefinition');
 
-			$layerResId = new MgResourceIdentifier('Session:' . $this->args['SESSION'] . '//Filter.LayerDefinition');
+            $layerDefinition = file_get_contents("templates/filterlayerdefinition.xml");
+            $layerDefinition = sprintf($layerDefinition, $sdfResId->ToString());
 
-	        $layerDefinition = file_get_contents("templates/filterlayerdefinition.xml");
-    	    $layerDefinition = sprintf($layerDefinition, $sdfResId->ToString());
+            $byteSource = new MgByteSource($layerDefinition, strlen($layerDefinition));
+            $resourceService->SetResource($layerResId, $byteSource->GetReader(), null);
 
-			$byteSource = new MgByteSource($layerDefinition, strlen($layerDefinition));
-			$resourceService->SetResource($layerResId, $byteSource->GetReader(), null);
+            $layer = new MgLayer($layerResId, $resourceService);
 
-			$layer = new MgLayer($layerResId, $resourceService);
+            $layer->SetName('_QuerySpatialFilter');
+            $layer->SetLegendLabel('_QuerySpatialFilter');
+            $layer->SetDisplayInLegend(false);
+            $layer->SetSelectable(false);
 
-			$layer->SetName('_QuerySpatialFilter');
-			$layer->SetLegendLabel('_QuerySpatialFilter');
-			$layer->SetDisplayInLegend(false);
-			$layer->SetSelectable(false);
+            $layers->Insert(0, $layer);
+        }
 
-			$layers->Insert(0, $layer);
-		}
+        // Make the layer visible
 
-		// Make the layer visible
+        $layer->SetVisible(true);
+        $map->Save();
 
-		$layer->SetVisible(true);
-		$map->Save($resourceService);
+        // Add the geometry to the filter feature source
 
-		// Add the geometry to the filter feature source
+        $polygon = $this->CreatePolygonFromGeomText($this->args['GEOMTEXT']);
+        $agfWriter = new MgAgfReaderWriter();
+        $byteReader = $agfWriter->Write($polygon);
 
-		$polygon = $this->CreatePolygonFromGeomText($this->args['GEOMTEXT']);
-		$agfWriter = new MgAgfReaderWriter();
-		$byteReader = $agfWriter->Write($polygon);
+        $propertyValues = new MgPropertyCollection();
+        $propertyValues->Add(new MgGeometryProperty('Geometry', $byteReader));
 
-		$propertyValues = new MgPropertyCollection();
-		$propertyValues->Add(new MgGeometryProperty('Geometry', $byteReader));
+        $updateCommands->Add(new MgInsertFeatures('Filter', $propertyValues));
 
-		$updateCommands->Add(new MgInsertFeatures('Filter', $propertyValues));
+        $featureService->UpdateFeatures($sdfResId, $updateCommands, false);
 
-		$featureService->UpdateFeatures($sdfResId, $updateCommands, false);
+        return $result;
+    }
 
-		return $result;
-	}
+    function Execute()
+    {
+        $result = array();
 
-	function Execute()
-	{
-		$result = array();
-
-		$resourceService = $this->site->CreateService(MgServiceType::ResourceService);
-
-		$map = new MgMap();
-		$map->Open($resourceService, $this->args['MAPNAME']);
+        $map = new MgMap($this->site);
+        $map->Open($this->args['MAPNAME']);
         $layer = $map->GetLayers()->GetItem($this->args['LAYERNAME']);
 
-		$featureService = $this->site->CreateService(MgServiceType::FeatureService);
+        $featureService = $this->site->CreateService(MgServiceType::FeatureService);
         $resId = new MgResourceIdentifier($layer->GetFeatureSourceId());
-		$featureClass = $layer->GetFeatureClassName();
-		$featureGeometry = $layer->GetFeatureGeometryName();
+        $featureClass = $layer->GetFeatureClassName();
+        $featureGeometry = $layer->GetFeatureGeometryName();
 
-		// Initialize the coordinate system transform
+        // Initialize the coordinate system transform
 
-		$schemaAndClass = explode(":", $featureClass);
-		$classDef = $featureService->GetClassDefinition($resId, $schemaAndClass[0], $schemaAndClass[1]);
-		$geomProp = $classDef->GetProperties()->GetItem($featureGeometry);
-		$spatialContext = $geomProp->GetSpatialContextAssociation();
+        $schemaAndClass = explode(":", $featureClass);
+        $classDef = $featureService->GetClassDefinition($resId, $schemaAndClass[0], $schemaAndClass[1]);
+        $geomProp = $classDef->GetProperties()->GetItem($featureGeometry);
+        $spatialContext = $geomProp->GetSpatialContextAssociation();
 
-		$csTransform = null;
-		$csInverseTransform = null;
-		$coordSysFactory = new MgCoordinateSystemFactory();
+        $csTransform = null;
+        $csInverseTransform = null;
+        $coordSysFactory = new MgCoordinateSystemFactory();
 
-		$scReader = $featureService->GetSpatialContexts($resId, false);
-		while ($scReader->ReadNext() && $csTransform == null)
-		{
-			if ($scReader->GetName() == $spatialContext)
-			{
-				$source = $coordSysFactory->Create($scReader->GetCoordinateSystemWkt());
-				$target = $coordSysFactory->Create($map->GetMapSRS());
-				$csTransform = new MgCoordinateSystemTransform($source, $target);
-				$csInverseTransform = new MgCoordinateSystemTransform($target, $source);
-			}
-		}
-		$scReader->Close();
+        $scReader = $featureService->GetSpatialContexts($resId, false);
+        while ($scReader->ReadNext() && $csTransform == null)
+        {
+            if ($scReader->GetName() == $spatialContext)
+            {
+                $source = $coordSysFactory->Create($scReader->GetCoordinateSystemWkt());
+                $target = $coordSysFactory->Create($map->GetMapSRS());
+                $csTransform = $coordSysFactory->GetTransform($source, $target);
+                $csInverseTransform = $coordSysFactory->GetTransform($target, $source);
+            }
+        }
+        $scReader->Close();
 
-		// Execute the query
+        // Execute the query
 
-		$queryMax = (int) $this->args['QUERYMAX'];
-		$queryOptions = new MgFeatureQueryOptions();
+        $queryMax = (int) $this->args['QUERYMAX'];
+        $queryOptions = new MgFeatureQueryOptions();
 
-		if ($this->args['USEPROPERTYFILTER'] == 'true')
-		{
-			$propertyFilter = $this->args['PROPERTYNAME'];
-			if ($this->args['ISSTRING'] == 'true')
-				$propertyFilter .= sprintf($this->strExpressions[$this->args['OPERATOR']], $this->args['VALUE']);
-			else
-				$propertyFilter .= sprintf($this->numExpressions[$this->args['OPERATOR']], $this->args['VALUE']);
+        if ($this->args['USEPROPERTYFILTER'] == 'true')
+        {
+            $propertyFilter = $this->args['PROPERTYNAME'];
+            if ($this->args['ISSTRING'] == 'true')
+                $propertyFilter .= sprintf($this->strExpressions[$this->args['OPERATOR']], $this->args['VALUE']);
+            else
+                $propertyFilter .= sprintf($this->numExpressions[$this->args['OPERATOR']], $this->args['VALUE']);
 
-			$queryOptions->SetFilter($propertyFilter);
-		}
+            $queryOptions->SetFilter($propertyFilter);
+        }
 
-		if ($this->args['USESPATIALFILTER'] == 'true')
-		{
-			$polygon = $this->CreatePolygonFromGeomText($this->args['GEOMTEXT']);
-			$polygon = $polygon->Transform($csInverseTransform);
+        if ($this->args['USESPATIALFILTER'] == 'true')
+        {
+            $polygon = $this->CreatePolygonFromGeomText($this->args['GEOMTEXT']);
+            $polygon = $polygon->Transform($csInverseTransform);
 
-			$queryOptions->SetSpatialFilter($featureGeometry, $polygon, MgFeatureSpatialOperations::Intersects);
-		}
+            $queryOptions->SetSpatialFilter($featureGeometry, $polygon, MgFeatureSpatialOperations::Intersects);
+        }
 
-		$count = 0;
-		$geometryReaderWriter = new MgAgfReaderWriter();
-		$featureReader = $featureService->SelectFeatures($resId, $layer->GetFeatureClassName(), $queryOptions);
-		while ($featureReader->ReadNext() && ($queryMax <= 0 || $count < $queryMax))
-		{
-			$displayValue = $this->GetFeaturePropertyValue($featureReader, $this->args['OUTPUTPROPERTY']);
+        $count = 0;
+        $geometryReaderWriter = new MgAgfReaderWriter();
+        $featureReader = $featureService->SelectFeatures($resId, $layer->GetFeatureClassName(), $queryOptions);
+        while ($featureReader->ReadNext() && ($queryMax <= 0 || $count < $queryMax))
+        {
+            $displayValue = $this->GetFeaturePropertyValue($featureReader, $this->args['OUTPUTPROPERTY']);
 
-			$byteReader = $featureReader->GetGeometry($featureGeometry);
+            $byteReader = $featureReader->GetGeometry($featureGeometry);
             $geometry = $geometryReaderWriter->Read($byteReader);
             $centerPoint = $geometry->GetCentroid();
-			$centerPoint = $centerPoint->Transform($csTransform);
+            $centerPoint = $centerPoint->Transform($csTransform);
 
-			$idList = $this->GetFeatureIdList($map, $layer, $featureReader);
+            $idList = $this->GetFeatureIdList($map, $layer, $featureReader);
 
-			array_push($result, new Feature($displayValue, $centerPoint, $idList));
-			$count++;
-		}
+            array_push($result, new Feature($displayValue, $centerPoint, $idList));
+            $count++;
+        }
 
-		return $result;
-	}
+        return $result;
+    }
 
-	function GetSelectionXML()
-	{
-	    $json = new Services_JSON();
-		$resourceService = $this->site->CreateService(MgServiceType::ResourceService);
-		$featureService = $this->site->CreateService(MgServiceType::FeatureService);
+    function GetSelectionXML()
+    {
+        $json = new Services_JSON();
 
-		$map = new MgMap();
-		$map->Open($resourceService, $this->args['MAPNAME']);
-		$layer = $map->GetLayers()->GetItem($this->args['LAYERNAME']);
-        $resId = new MgResourceIdentifier($layer->GetFeatureSourceId());
-		$featureClass = $layer->GetFeatureClassName();
-		$schemaAndClass = explode(":", $featureClass);
-		$classDef = $featureService->GetClassDefinition($resId, $schemaAndClass[0], $schemaAndClass[1]);
+        $map = new MgMap($this->site);
+        $map->Open($this->args['MAPNAME']);
+        $layers = $map->GetLayers();
+        $layer = $layers->GetItem($this->args['LAYERNAME']);
+        $featureClass = $layer->GetFeatureClassName();
+        $classDef = $layer->GetClassDefinition();
 
-		$properties = new MgPropertyCollection();
-		$idList = $json->decode($this->args['IDLIST']);
+        $properties = new MgPropertyCollection();
+        $idList = $json->decode($this->args['IDLIST']);
 
-		foreach ($idList as $key => $value)
-		{
-			switch($classDef->GetProperties()->GetItem($key)->GetDataType())
-			{
-				case MgPropertyType::Boolean :
-					$properties->Add(new MgBooleanProperty($key, $value));
-					break;
+        foreach ($idList as $key => $value)
+        {
+            switch($classDef->GetProperties()->GetItem($key)->GetDataType())
+            {
+                case MgPropertyType::Boolean :
+                    $properties->Add(new MgBooleanProperty($key, $value));
+                    break;
 
-				case MgPropertyType::Byte :
-					$properties->Add(new MgByteProperty($key, $value));
-					break;
+                case MgPropertyType::Byte :
+                    $properties->Add(new MgByteProperty($key, $value));
+                    break;
 
-				case MgPropertyType::Single :
-					$properties->Add(new MgSingleProperty($key, $value));
-					break;
+                case MgPropertyType::Single :
+                    $properties->Add(new MgSingleProperty($key, $value));
+                    break;
 
-				case MgPropertyType::Double :
-					$properties->Add(new MgDoubleProperty($key, $value));
-					break;
+                case MgPropertyType::Double :
+                    $properties->Add(new MgDoubleProperty($key, $value));
+                    break;
 
-				case MgPropertyType::Int16 :
-					$properties->Add(new MgInt16Property($key, $value));
-					break;
+                case MgPropertyType::Int16 :
+                    $properties->Add(new MgInt16Property($key, $value));
+                    break;
 
-				case MgPropertyType::Int32 :
-					$properties->Add(new MgInt32Property($key, $value));
-					break;
+                case MgPropertyType::Int32 :
+                    $properties->Add(new MgInt32Property($key, $value));
+                    break;
 
-				case MgPropertyType::Int64 :
-					$properties->Add(new MgInt64Property($key, $value));
-					break;
+                case MgPropertyType::Int64 :
+                    $properties->Add(new MgInt64Property($key, $value));
+                    break;
 
-				case MgPropertyType::String :
-					$properties->Add(new MgStringProperty($key, $value));
-					break;
+                case MgPropertyType::String :
+                    $properties->Add(new MgStringProperty($key, $value));
+                    break;
 
-				case MgPropertyType::DateTime :
-					$properties->Add(new MgDateTimeProperty($key, $value));
-					break;
+                case MgPropertyType::DateTime :
+                    $properties->Add(new MgDateTimeProperty($key, $value));
+                    break;
 
-				case MgPropertyType::Null :
-				case MgPropertyType::Blob :
-				case MgPropertyType::Clob :
-				case MgPropertyType::Feature :
-				case MgPropertyType::Geometry :
-				case MgPropertyType::Raster :
-					break;
-			}
-		}
+                case MgPropertyType::Null :
+                case MgPropertyType::Blob :
+                case MgPropertyType::Clob :
+                case MgPropertyType::Feature :
+                case MgPropertyType::Geometry :
+                case MgPropertyType::Raster :
+                    break;
+            }
+        }
 
-		$selection = new MgSelection($map);
-		$selection->AddFeatureIds($layer, $featureClass, $properties);
+        $selection = new MgSelection($map);
+        $selection->AddFeatureIds($layer, $featureClass, $properties);
 
-		return $selection->ToXml();
-	}
+        return $selection->ToXml();
+    }
 
-	private function GetFeaturePropertyValue($featureReader, $name)
-	{
-		$value = '';
-		$propertyType = $featureReader->GetPropertyType($name);
-		switch($propertyType)
-		{
-			case MgPropertyType::Boolean :
-				$value = $featureReader->GetBoolean($name);
-				break;
+    private function GetFeaturePropertyValue($featureReader, $name)
+    {
+        $value = '';
+        $propertyType = $featureReader->GetPropertyType($name);
+        switch($propertyType)
+        {
+            case MgPropertyType::Boolean :
+                $value = $featureReader->GetBoolean($name);
+                break;
 
-			case MgPropertyType::Byte :
-				$value = $featureReader->GetByte($name);
-				break;
+            case MgPropertyType::Byte :
+                $value = $featureReader->GetByte($name);
+                break;
 
-			case MgPropertyType::Single :
-				$value = $featureReader->GetSingle($name);
-				break;
+            case MgPropertyType::Single :
+                $value = $featureReader->GetSingle($name);
+                break;
 
-			case MgPropertyType::Double :
-				$value = $featureReader->GetDouble($name);
-				break;
+            case MgPropertyType::Double :
+                $value = $featureReader->GetDouble($name);
+                break;
 
-			case MgPropertyType::Int16 :
-				$value = $featureReader->GetInt16($name);
-				break;
+            case MgPropertyType::Int16 :
+                $value = $featureReader->GetInt16($name);
+                break;
 
-			case MgPropertyType::Int32 :
-				$value = $featureReader->GetInt32($name);
-				break;
+            case MgPropertyType::Int32 :
+                $value = $featureReader->GetInt32($name);
+                break;
 
-			case MgPropertyType::Int64 :
-				$value = $featureReader->GetInt64($name);
-				break;
+            case MgPropertyType::Int64 :
+                $value = $featureReader->GetInt64($name);
+                break;
 
-			case MgPropertyType::String :
-				$value = $featureReader->GetString($name);
-				break;
+            case MgPropertyType::String :
+                $value = $featureReader->GetString($name);
+                break;
 
-			case MgPropertyType::DateTime :
-			case MgPropertyType::Null :
-			case MgPropertyType::Blob :
-			case MgPropertyType::Clob :
-			case MgPropertyType::Feature :
-			case MgPropertyType::Geometry :
-			case MgPropertyType::Raster :
-				$value = '[unsupported data type]';
-				break;
-		}
-		return $value;
-	}
+            case MgPropertyType::DateTime :
+            case MgPropertyType::Null :
+            case MgPropertyType::Blob :
+            case MgPropertyType::Clob :
+            case MgPropertyType::Feature :
+            case MgPropertyType::Geometry :
+            case MgPropertyType::Raster :
+                $value = '[unsupported data type]';
+                break;
+        }
+        return $value;
+    }
 
-	private function GetFeatureIdList($map, $layer, $featureReader)
-	{
-		$classDef = $featureReader->GetClassDefinition();
-		$idProps = $classDef->GetIdentityProperties();
-		$idList = array();
+    private function GetFeatureIdList($map, $layer, $featureReader)
+    {
+        $classDef = $featureReader->GetClassDefinition();
+        $idProps = $classDef->GetIdentityProperties();
+        $idList = array();
 
-		for ($i = 0; $i < $idProps->GetCount(); $i++)
-		{
-			$idProp = $idProps->GetItem($i);
+        for ($i = 0; $i < $idProps->GetCount(); $i++)
+        {
+            $idProp = $idProps->GetItem($i);
 
-			switch($idProp->GetDataType()) {
-				case MgPropertyType::Boolean :
-					$idList[$idProp->GetName()] = $featureReader->GetBoolean($idProp->GetName());
-					break;
+            switch($idProp->GetDataType()) {
+                case MgPropertyType::Boolean :
+                    $idList[$idProp->GetName()] = $featureReader->GetBoolean($idProp->GetName());
+                    break;
 
-				case MgPropertyType::Byte :
-					$idList[$idProp->GetName()] = $featureReader->GetByte($idProp->GetName());
-					break;
+                case MgPropertyType::Byte :
+                    $idList[$idProp->GetName()] = $featureReader->GetByte($idProp->GetName());
+                    break;
 
-				case MgPropertyType::Single :
-					$idList[$idProp->GetName()] = $featureReader->GetSingle($idProp->GetName());
-					break;
+                case MgPropertyType::Single :
+                    $idList[$idProp->GetName()] = $featureReader->GetSingle($idProp->GetName());
+                    break;
 
-				case MgPropertyType::Double :
-					$idList[$idProp->GetName()] = $featureReader->GetDouble($idProp->GetName());
-					break;
+                case MgPropertyType::Double :
+                    $idList[$idProp->GetName()] = $featureReader->GetDouble($idProp->GetName());
+                    break;
 
-				case MgPropertyType::Int16 :
-					$idList[$idProp->GetName()] = $featureReader->GetInt16($idProp->GetName());
-					break;
+                case MgPropertyType::Int16 :
+                    $idList[$idProp->GetName()] = $featureReader->GetInt16($idProp->GetName());
+                    break;
 
-				case MgPropertyType::Int32 :
-					$idList[$idProp->GetName()] = $featureReader->GetInt32($idProp->GetName());
-					break;
+                case MgPropertyType::Int32 :
+                    $idList[$idProp->GetName()] = $featureReader->GetInt32($idProp->GetName());
+                    break;
 
-				case MgPropertyType::Int64 :
-					$idList[$idProp->GetName()] = $featureReader->GetInt64($idProp->GetName());
-					break;
+                case MgPropertyType::Int64 :
+                    $idList[$idProp->GetName()] = $featureReader->GetInt64($idProp->GetName());
+                    break;
 
-				case MgPropertyType::String :
-					$idList[$idProp->GetName()] = $featureReader->GetString($idProp->GetName());
-					break;
+                case MgPropertyType::String :
+                    $idList[$idProp->GetName()] = $featureReader->GetString($idProp->GetName());
+                    break;
 
-				case MgPropertyType::DateTime :
-					$idList[$idProp->GetName()] = $featureReader->GetDateTime($idProp->GetName());
-					break;
+                case MgPropertyType::DateTime :
+                    $idList[$idProp->GetName()] = $featureReader->GetDateTime($idProp->GetName());
+                    break;
 
-				case MgPropertyType::Null :
-				case MgPropertyType::Blob :
-				case MgPropertyType::Clob :
-				case MgPropertyType::Feature :
-				case MgPropertyType::Geometry :
-				case MgPropertyType::Raster :
-					break;
-			}
-		}
+                case MgPropertyType::Null :
+                case MgPropertyType::Blob :
+                case MgPropertyType::Clob :
+                case MgPropertyType::Feature :
+                case MgPropertyType::Geometry :
+                case MgPropertyType::Raster :
+                    break;
+            }
+        }
 
-		return $idList;
-	}
+        return $idList;
+    }
 
     private function IsValidDataType($type)
     {
@@ -475,77 +460,77 @@
         switch($type)
         {
             case MgPropertyType::Blob:
-				$valid = false;
-				break;
+                $valid = false;
+                break;
             case MgPropertyType::Clob:
-				$valid = false;
-				break;
+                $valid = false;
+                break;
             case MgPropertyType::Byte:
-				$valid = false;
-				break;
+                $valid = false;
+                break;
             case MgPropertyType::Feature:
-				$valid = false;
-				break;
+                $valid = false;
+                break;
             case MgPropertyType::Geometry:
-				$valid = false;
-				break;
+                $valid = false;
+                break;
             case MgPropertyType::Null:
-				$valid = false;
-				break;
+                $valid = false;
+                break;
         }
         return $valid;
     }
 
-	private function CreateFilterSchema()
-	{
-		$filterSchema = new MgFeatureSchema();
-		$filterSchema->SetName('FilterSchema');
+    private function CreateFilterSchema()
+    {
+        $filterSchema = new MgFeatureSchema();
+        $filterSchema->SetName('FilterSchema');
 
-		$filterClass = new MgClassDefinition();
-		$filterClass->SetName('Filter');
-		$properties = $filterClass->GetProperties();
+        $filterClass = new MgClassDefinition();
+        $filterClass->SetName('Filter');
+        $properties = $filterClass->GetProperties();
 
-		$idProperty = new MgDataPropertyDefinition('ID');
-		$idProperty->SetDataType(MgPropertyType::Int32);
-		$idProperty->SetReadOnly(true);
-		$idProperty->SetNullable(false);
-		$idProperty->SetAutoGeneration(true);
-		$properties->Add($idProperty);
+        $idProperty = new MgDataPropertyDefinition('ID');
+        $idProperty->SetDataType(MgPropertyType::Int32);
+        $idProperty->SetReadOnly(true);
+        $idProperty->SetNullable(false);
+        $idProperty->SetAutoGeneration(true);
+        $properties->Add($idProperty);
 
-		$geometryProperty = new MgGeometricPropertyDefinition('Geometry');
-		$geometryProperty->SetGeometryTypes(MgFeatureGeometricType::Surface);
-		$geometryProperty->SetHasElevation(false);
-		$geometryProperty->SetHasMeasure(false);
-		$geometryProperty->SetReadOnly(false);
-		$geometryProperty->SetSpatialContextAssociation('MAPCS');
-		$properties->Add($geometryProperty);
+        $geometryProperty = new MgGeometricPropertyDefinition('Geometry');
+        $geometryProperty->SetGeometryTypes(MgFeatureGeometricType::Surface);
+        $geometryProperty->SetHasElevation(false);
+        $geometryProperty->SetHasMeasure(false);
+        $geometryProperty->SetReadOnly(false);
+        $geometryProperty->SetSpatialContextAssociation('MAPCS');
+        $properties->Add($geometryProperty);
 
-		$filterClass->GetIdentityProperties()->Add($idProperty);
-		$filterClass->SetDefaultGeometryPropertyName('Geometry');
+        $filterClass->GetIdentityProperties()->Add($idProperty);
+        $filterClass->SetDefaultGeometryPropertyName('Geometry');
 
-		$filterSchema->GetClasses()->Add($filterClass);
+        $filterSchema->GetClasses()->Add($filterClass);
 
-		return $filterSchema;
-	}
+        return $filterSchema;
+    }
 
-	private function CreatePolygonFromGeomText($geomText)
-	{
-		$geometryFactory = new MgGeometryFactory();
+    private function CreatePolygonFromGeomText($geomText)
+    {
+        $geometryFactory = new MgGeometryFactory();
 
-		$vertices = explode(',', $geomText);
-		$count = $vertices[0];
+        $vertices = explode(',', $geomText);
+        $count = $vertices[0];
 
-		$coords = new MgCoordinateCollection();
-		for ($i = 0; $i < $count; $i++)
-		{
-			$coord = $geometryFactory->CreateCoordinateXY((double) $vertices[($i * 2) + 1], (double) $vertices[($i * 2) + 2]);
-			$coords->Add($coord);
-		}
+        $coords = new MgCoordinateCollection();
+        for ($i = 0; $i < $count; $i++)
+        {
+            $coord = $geometryFactory->CreateCoordinateXY((double) $vertices[($i * 2) + 1], (double) $vertices[($i * 2) + 2]);
+            $coords->Add($coord);
+        }
 
-		$linearRing = $geometryFactory->CreateLinearRing($coords);
-		$polygon = $geometryFactory->CreatePolygon($linearRing, null);
+        $linearRing = $geometryFactory->CreateLinearRing($coords);
+        $polygon = $geometryFactory->CreatePolygon($linearRing, null);
 
-		return $polygon;
-	}
+        return $polygon;
+    }
 }
 ?>
\ No newline at end of file

Modified: trunk/MgDev/Doc/samples/phpviewersample/theme/classes/theme.php
===================================================================
--- trunk/MgDev/Doc/samples/phpviewersample/theme/classes/theme.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Doc/samples/phpviewersample/theme/classes/theme.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -27,49 +27,47 @@
 
 class Theme
 {
-	private $args = null;
-	private $site = null;
+    private $args = null;
+    private $site = null;
 
-	public $distNameArray = array("Individual", "Equal", "Standard Deviation", "Quantile", "Jenks (Natural Breaks)");
-	public $distValueArray = array("INDIV_DIST", "EQUAL_DIST", "STDEV_DIST", "QUANT_DIST", "JENK_DIST");
+    public $distNameArray = array("Individual", "Equal", "Standard Deviation", "Quantile", "Jenks (Natural Breaks)");
+    public $distValueArray = array("INDIV_DIST", "EQUAL_DIST", "STDEV_DIST", "QUANT_DIST", "JENK_DIST");
 
-	function __construct($args)
-	{
-		$this->args = $args;
-		$this->site = new MgSiteConnection();
-		$this->site->Open(new MgUserInformation($args['SESSION']));
-	}
+    function __construct($args)
+    {
+        $this->args = $args;
+        $this->site = new MgSiteConnection();
+        $this->site->Open(new MgUserInformation($args['SESSION']));
+    }
 
     function GetMapLayerNames()
     {
         $layerNames = array();
 
-		$resourceService = $this->site->CreateService(MgServiceType::ResourceService);
-		$featureService = $this->site->CreateService(MgServiceType::FeatureService);
-
-		$map = new MgMap();
-		$map->Open($resourceService, $this->args['MAPNAME']);
+        $map = new MgMap($this->site);
+        $map->Open($this->args['MAPNAME']);
         $layers = $map->GetLayers();
 
         for ($i = 0; $i < $layers->GetCount(); $i++)
         {
             $layer = $layers->GetItem($i);
             if((substr($layer->GetName(), 0, 1) != "_") && (substr(strtoupper($layer->GetFeatureSourceId()), 0, 7) != "SESSION"))
-		    {
-        	    $resId = new MgResourceIdentifier($layer->GetFeatureSourceId());
-			    $schemaClass = explode(':', $layer->GetFeatureClassName());
+            {
+                $resId = new MgResourceIdentifier($layer->GetFeatureSourceId());
+                $schemaClass = explode(':', $layer->GetFeatureClassName());
+                
+                $classDef = $layer->GetClassDefinition();
+                $clsProps = $classDef->GetProperties();
+                $propDef = $clsProps->GetItem($layer->GetFeatureGeometryName());
 
-			    $classDef = $featureService->GetClassDefinition($resId, $schemaClass[0], $schemaClass[1]);
-			    $propDef = $classDef->GetProperties()->GetItem($layer->GetFeatureGeometryName());
-
-			    if($propDef->GetPropertyType() == MgFeaturePropertyType::GeometricProperty)
-			    {
-					if ($propDef->GetGeometryTypes() == MgFeatureGeometricType::Surface)
-					{
-						$layerNames[$layer->GetName()] = $layer->GetLegendLabel();
-					}
-				}
-			}
+                if($propDef->GetPropertyType() == MgFeaturePropertyType::GeometricProperty)
+                {
+                    if ($propDef->GetGeometryTypes() == MgFeatureGeometricType::Surface)
+                    {
+                        $layerNames[$layer->GetName()] = $layer->GetLegendLabel();
+                    }
+                }
+            }
         }
         asort($layerNames);
 
@@ -79,76 +77,71 @@
     function GetLayerInfo()
     {
         $properties = array();
-		$scaleRanges = array();
+        $scaleRanges = array();
 
-		$resourceService = $this->site->CreateService(MgServiceType::ResourceService);
+        $resourceService = $this->site->CreateService(MgServiceType::ResourceService);
 
-		$map = new MgMap();
-		$map->Open($resourceService, $this->args['MAPNAME']);
-        $layer = $map->GetLayers()->GetItem($this->args['LAYERNAME']);
+        $map = new MgMap($this->site);
+        $map->Open($this->args['MAPNAME']);
+        $layers = $map->GetLayers();
+        $layer = $layers->GetItem($this->args['LAYERNAME']);
 
-		// First get a list of all of the Feature Class properties that can be used for theming.
+        // First get a list of all of the Feature Class properties that can be used for theming.
+        $classDef = $layer->GetClassDefinition();
 
-		$featureService = $this->site->CreateService(MgServiceType::FeatureService);
-        $resId = new MgResourceIdentifier($layer->GetFeatureSourceId());
-        $schemaClass = explode(':', $layer->GetFeatureClassName());
-
-        $classDef = $featureService->GetClassDefinition($resId, $schemaClass[0], $schemaClass[1]);
-
         for ($i = 0; $i < $classDef->GetProperties()->GetCount(); $i++)
         {
             $propertyDef = $classDef->GetProperties()->GetItem($i);
 
             if ($propertyDef->GetPropertyType() == MgFeaturePropertyType::DataProperty)
             {
-				$dataType = $propertyDef->GetDataType();
-				$distroTypes = $this->GetDistributionsForDataType($dataType);
-				if (count($distroTypes) > 0)
-				{
-	                array_push($properties, new Property($propertyDef->GetName(), $dataType, $distroTypes));
-				}
+                $dataType = $propertyDef->GetDataType();
+                $distroTypes = $this->GetDistributionsForDataType($dataType);
+                if (count($distroTypes) > 0)
+                {
+                    array_push($properties, new Property($propertyDef->GetName(), $dataType, $distroTypes));
+                }
             }
         }
 
-		// Next get a list of all of the layers scale ranges.
+        // Next get a list of all of the layers scale ranges.
 
-		$layerDefResId = $layer->GetLayerDefinition();
-		$byteReader = $resourceService->GetResourceContent($layerDefResId);
+        $layerDefResId = $layer->GetLayerDefinition();
+        $byteReader = $resourceService->GetResourceContent($layerDefResId);
 
-		$doc = DOMDocument::loadXML($byteReader->ToString());
-		$nodeList = $doc->getElementsByTagName('VectorScaleRange');
+        $doc = new DOMDocument();
+        $doc->loadXML($byteReader->ToString());
+        $nodeList = $doc->getElementsByTagName('VectorScaleRange');
 
-		foreach ($nodeList as $node)
-		{
-			$range = null;
+        foreach ($nodeList as $node)
+        {
+            $range = null;
 
-			$minNodeList = $node->getElementsByTagName('MinScale');
-			if ($minNodeList->length > 0)
-				$range = $minNodeList->item(0)->nodeValue;
-			else
-				$range = '0';
+            $minNodeList = $node->getElementsByTagName('MinScale');
+            if ($minNodeList->length > 0)
+                $range = $minNodeList->item(0)->nodeValue;
+            else
+                $range = '0';
 
-			$maxNodeList = $node->getElementsByTagName('MaxScale');
-			if ($maxNodeList->length > 0)
-				$range .= ' - ' . $maxNodeList->item(0)->nodeValue;
-			else
-				$range .= ' - Infinity';
+            $maxNodeList = $node->getElementsByTagName('MaxScale');
+            if ($maxNodeList->length > 0)
+                $range .= ' - ' . $maxNodeList->item(0)->nodeValue;
+            else
+                $range .= ' - Infinity';
 
-			array_push($scaleRanges, $range);
-		}
+            array_push($scaleRanges, $range);
+        }
 
         return new LayerInfo($properties, $scaleRanges);
     }
 
-	function GetPropertyMinMaxCount()
-	{
-		$resourceService = $this->site->CreateService(MgServiceType::ResourceService);
-
-		$map = new MgMap();
-		$map->Open($resourceService, $this->args['MAPNAME']);
+    function GetPropertyMinMaxCount()
+    {
+        $map = new MgMap($this->site);
+        $map->Open($this->args['MAPNAME']);
         $layer = $map->GetLayers()->GetItem($this->args['LAYERNAME']);
 
-		$featureService = $this->site->CreateService(MgServiceType::FeatureService);
+        $featureService = $this->site->CreateService(MgServiceType::FeatureService);
         $resId = new MgResourceIdentifier($layer->GetFeatureSourceId());
 
 // Note: Should be able to do this:
@@ -174,249 +167,250 @@
 //
 // However due to a bug, Min/Max do not work on string types, so we have to do this:
 
-		unset($minValue);
-		unset($maxValue);
-		$count = 0;
+        unset($minValue);
+        unset($maxValue);
+        $count = 0;
 
-		$queryOptions = new MgFeatureQueryOptions();
-		$queryOptions->AddFeatureProperty($this->args['PROPERTYNAME']);
+        $queryOptions = new MgFeatureQueryOptions();
+        $queryOptions->AddFeatureProperty($this->args['PROPERTYNAME']);
 
-		$featureReader = $featureService->SelectFeatures($resId, $layer->GetFeatureClassName(), $queryOptions);
+        $featureReader = $layer->SelectFeatures($queryOptions);
 
-		while($featureReader->ReadNext())
-		{
-			$value = $this->GetFeaturePropertyValue($featureReader, $this->args['PROPERTYNAME']);
-			if ($value != null)
-			{
-				if(!isset($maxValue) && !isset($minValue))
-				{
-					$maxValue = $value;
-					$minValue = $value;
-				}
-				if($value > $maxValue)
-					$maxValue = $value;
-				if($value < $minValue)
-					$minValue = $value;
-			}
-			$count++;
-		}
-		$featureReader->Close();
+        while($featureReader->ReadNext())
+        {
+            $value = $this->GetFeaturePropertyValue($featureReader, $this->args['PROPERTYNAME']);
+            if ($value != null)
+            {
+                if(!isset($maxValue) && !isset($minValue))
+                {
+                    $maxValue = $value;
+                    $minValue = $value;
+                }
+                if($value > $maxValue)
+                    $maxValue = $value;
+                if($value < $minValue)
+                    $minValue = $value;
+            }
+            $count++;
+        }
+        $featureReader->Close();
 
-		if(!isset($maxValue) && !isset($minValue))
-		{
-			$maxValue="";
-			$minValue="";
-		}
+        if(!isset($maxValue) && !isset($minValue))
+        {
+            $maxValue="";
+            $minValue="";
+        }
 
-		return array($minValue, $maxValue, $count);
-	}
+        return array($minValue, $maxValue, $count);
+    }
 
-	function ApplyTheme()
-	{
-		$resourceService = $this->site->CreateService(MgServiceType::ResourceService);
-		$featureService = $this->site->CreateService(MgServiceType::FeatureService);
+    function ApplyTheme()
+    {
+        $resourceService = $this->site->CreateService(MgServiceType::ResourceService);
 
-		$map = new MgMap();
-		$map->Open($resourceService, $this->args['MAPNAME']);
-		$layers = $map->GetLayers();
+        $map = new MgMap($this->site);
+        $map->Open($this->args['MAPNAME']);
+        $layers = $map->GetLayers();
         $layer = $layers->GetItem($this->args['LAYERNAME']);
 
-        $resId = new MgResourceIdentifier($layer->GetFeatureSourceId());
-		$layerDefResId = $layer->GetLayerDefinition();
-		$byteReader = $resourceService->GetResourceContent($layerDefResId);
+        $layerDefResId = $layer->GetLayerDefinition();
+        $byteReader = $resourceService->GetResourceContent($layerDefResId);
 
-		// Load the Layer Definition and Navigate to the specified <VectorScaleRange>
+        // Load the Layer Definition and Navigate to the specified <VectorScaleRange>
 
-		$doc = DOMDocument::loadXML($byteReader->ToString());
-		$nodeList = $doc->getElementsByTagName('VectorScaleRange');
+        $doc = new DOMDocument();
+        $doc->loadXML($byteReader->ToString());
+        $nodeList = $doc->getElementsByTagName('VectorScaleRange');
 
-		$vectorScaleRangecElement = $nodeList->item($this->args['SCALERANGEINDEX']);
-		$areaTypeStyle = $vectorScaleRangecElement->getElementsByTagName('AreaTypeStyle')->item(0);
+        $vectorScaleRangecElement = $nodeList->item($this->args['SCALERANGEINDEX']);
+        $areaTypeStyle = $vectorScaleRangecElement->getElementsByTagName('AreaTypeStyle')->item(0);
 
-		// Remove any existing <AreaRule> elements.
+        // Remove any existing <AreaRule> elements.
 
-		$areaRuleList = $areaTypeStyle->getElementsByTagName('AreaRule');
-		$ruleCount = $areaRuleList->length;
-		for($index = 0; $index < $ruleCount; $index++)
-		{
-			$areaTypeStyle->removeChild($areaRuleList->item(0));
-		}
+        $areaRuleList = $areaTypeStyle->getElementsByTagName('AreaRule');
+        $ruleCount = $areaRuleList->length;
+        for($index = 0; $index < $ruleCount; $index++)
+        {
+            $areaTypeStyle->removeChild($areaRuleList->item(0));
+        }
 
-		// Now create the new <AreaRule> elements.
+        // Now create the new <AreaRule> elements.
 
-		$areaRuleTemplate = file_get_contents("templates/arearuletemplate.xml");
-		$aggregateOptions = new MgFeatureAggregateOptions();
+        $areaRuleTemplate = file_get_contents("templates/arearuletemplate.xml");
+        $aggregateOptions = new MgFeatureAggregateOptions();
 
-		$portion = 0.0;
-		$increment = ($this->args['NUMRULES'] > 1) ? $increment = 1.0 / ($this->args['NUMRULES'] - 1) : 1.0;
+        $portion = 0.0;
+        $increment = ($this->args['NUMRULES'] > 1) ? $increment = 1.0 / ($this->args['NUMRULES'] - 1) : 1.0;
 
-		if ($this->args['DISTRO'] == 'INDIV_DIST')
-		{
-			$aggregateOptions->AddFeatureProperty($this->args['PROPERTYNAME']);
-			$aggregateOptions->SelectDistinct(true);
+        if ($this->args['DISTRO'] == 'INDIV_DIST')
+        {
+            $aggregateOptions->AddFeatureProperty($this->args['PROPERTYNAME']);
+            $aggregateOptions->SelectDistinct(true);
 
-			$dataReader = $featureService->SelectAggregate($resId, $layer->GetFeatureClassName(), $aggregateOptions);
-			while ($dataReader->ReadNext())
-			{
-				$value = $this->GetFeaturePropertyValue($dataReader, $this->args['PROPERTYNAME']);
+            $dataReader = $layer->SelectAggregate($aggregateOptions);
+            while ($dataReader->ReadNext())
+            {
+                $value = $this->GetFeaturePropertyValue($dataReader, $this->args['PROPERTYNAME']);
 
-				$filterText = '"' . $this->args['PROPERTYNAME'] . '" = ';
-				if ($this->args['DATATYPE'] == MgPropertyType::String)
-					$filterText .= "'" . $value . "'";
-				else
-					$filterText .= $value;
+                $filterText = '"' . $this->args['PROPERTYNAME'] . '" = ';
+                if ($this->args['DATATYPE'] == MgPropertyType::String)
+                    $filterText .= "'" . $value . "'";
+                else
+                    $filterText .= $value;
 
-	    	    $areaRuleXML = sprintf($areaRuleTemplate,
-					$this->args['PROPERTYNAME'] . ': ' . $value,
-					$filterText,
-					$this->InterpolateColor($portion, $this->args['FILLFROM'], $this->args['FILLTO'], $this->args['FILLTRANS']),
-					$this->InterpolateColor($portion, $this->args['LINEFROM'], $this->args['LINETO'], 0));
+                $areaRuleXML = sprintf($areaRuleTemplate,
+                    $this->args['PROPERTYNAME'] . ': ' . $value,
+                    $filterText,
+                    $this->InterpolateColor($portion, $this->args['FILLFROM'], $this->args['FILLTO'], $this->args['FILLTRANS']),
+                    $this->InterpolateColor($portion, $this->args['LINEFROM'], $this->args['LINETO'], 0));
 
-				$areaDoc = DOMDocument::loadXML($areaRuleXML);
-				$areaNode = $doc->importNode($areaDoc->documentElement, true);
-				$areaTypeStyle->appendChild($areaNode);
+                $areaDoc = new DOMDocument();
+                $areaDoc->loadXML($areaRuleXML);
+                $areaNode = $doc->importNode($areaDoc->documentElement, true);
+                $areaTypeStyle->appendChild($areaNode);
 
-				$portion += $increment;
-			}
-			$dataReader->Close();
-		}
-		else
-		{
-			$values = array();
+                $portion += $increment;
+            }
+            $dataReader->Close();
+        }
+        else
+        {
+            $values = array();
 
-			$aggregateOptions->AddComputedProperty('THEME_VALUE',
-				$this->args['DISTRO'] . '("' . $this->args['PROPERTYNAME'] . '",' . $this->args['NUMRULES'] . ',' . $this->args['MINVALUE'] . ',' . $this->args['MAXVALUE'] . ')');
+            $aggregateOptions->AddComputedProperty('THEME_VALUE',
+                $this->args['DISTRO'] . '("' . $this->args['PROPERTYNAME'] . '",' . $this->args['NUMRULES'] . ',' . $this->args['MINVALUE'] . ',' . $this->args['MAXVALUE'] . ')');
 
-			$dataReader = $featureService->SelectAggregate($resId, $layer->GetFeatureClassName(), $aggregateOptions);
-			while ($dataReader->ReadNext())
-			{
-				$value = $this->GetFeaturePropertyValue($dataReader, 'THEME_VALUE');
-				array_push($values, $value);
-			}
-			$dataReader->Close();
+            $dataReader = $layer->SelectAggregate($aggregateOptions);
+            while ($dataReader->ReadNext())
+            {
+                $value = $this->GetFeaturePropertyValue($dataReader, 'THEME_VALUE');
+                array_push($values, $value);
+            }
+            $dataReader->Close();
 
-			for ($i = 0; $i < count($values) - 1; $i++)
-			{
-				$filterText = '"' . $this->args['PROPERTYNAME'] . '" >= ' . $values[$i] . ' AND "' . $this->args['PROPERTYNAME'];
-				if ($i == count($values) - 1)
-					$filterText .= '" <= ' . $values[$i + 1];
-				else
-					$filterText .= '" < ' . $values[$i + 1];
+            for ($i = 0; $i < count($values) - 1; $i++)
+            {
+                $filterText = '"' . $this->args['PROPERTYNAME'] . '" >= ' . $values[$i] . ' AND "' . $this->args['PROPERTYNAME'];
+                if ($i == count($values) - 1)
+                    $filterText .= '" <= ' . $values[$i + 1];
+                else
+                    $filterText .= '" < ' . $values[$i + 1];
 
-	    	    $areaRuleXML = sprintf($areaRuleTemplate,
-					$this->args['PROPERTYNAME'] . ': ' . $values[$i] . ' - ' . $values[$i + 1],
-					$filterText,
-					$this->InterpolateColor($portion, $this->args['FILLFROM'], $this->args['FILLTO'], $this->args['FILLTRANS']),
-					$this->InterpolateColor($portion, $this->args['LINEFROM'], $this->args['LINETO'], 0));
+                $areaRuleXML = sprintf($areaRuleTemplate,
+                    $this->args['PROPERTYNAME'] . ': ' . $values[$i] . ' - ' . $values[$i + 1],
+                    $filterText,
+                    $this->InterpolateColor($portion, $this->args['FILLFROM'], $this->args['FILLTO'], $this->args['FILLTRANS']),
+                    $this->InterpolateColor($portion, $this->args['LINEFROM'], $this->args['LINETO'], 0));
 
-				$areaDoc = DOMDocument::loadXML($areaRuleXML);
-				$areaNode = $doc->importNode($areaDoc->documentElement, true);
-				$areaTypeStyle->appendChild($areaNode);
+                $areaDoc = new DOMDocument();
+                $areaDoc->loadXML($areaRuleXML);
+                $areaNode = $doc->importNode($areaDoc->documentElement, true);
+                $areaTypeStyle->appendChild($areaNode);
 
-				$portion += $increment;
-			}
+                $portion += $increment;
+            }
 
-		}
+        }
 
-		// Now save our new layer definition to the session and add it to the map.
+        // Now save our new layer definition to the session and add it to the map.
 
-		$layerDefinition = $doc->saveXML();
-		$uniqueName = $this->MakeUniqueLayerName($map, $this->args['LAYERNAME'], $this->args['THEMENAME']);
-		$legendLabel = $layer->GetLegendLabel();
-		if (strlen(trim($this->args['THEMENAME'])) > 0 )
-			$legendLabel .= ' (' . $this->args['THEMENAME'] . ')';
+        $layerDefinition = $doc->saveXML();
+        $uniqueName = $this->MakeUniqueLayerName($map, $this->args['LAYERNAME'], $this->args['THEMENAME']);
+        $legendLabel = $layer->GetLegendLabel();
+        if (strlen(trim($this->args['THEMENAME'])) > 0 )
+            $legendLabel .= ' (' . $this->args['THEMENAME'] . ')';
 
-		$layerResId = new MgResourceIdentifier('Session:' . $this->args['SESSION'] . '//' . $uniqueName . '.LayerDefinition');
+        $layerResId = new MgResourceIdentifier('Session:' . $this->args['SESSION'] . '//' . $uniqueName . '.LayerDefinition');
 
-		$byteSource = new MgByteSource($layerDefinition, strlen($layerDefinition));
-		$resourceService->SetResource($layerResId, $byteSource->GetReader(), null);
+        $byteSource = new MgByteSource($layerDefinition, strlen($layerDefinition));
+        $resourceService->SetResource($layerResId, $byteSource->GetReader(), null);
 
-		$newLayer = new MgLayer($layerResId, $resourceService);
-		$newLayer->SetName($uniqueName);
-		$newLayer->SetLegendLabel($legendLabel);
-		$newLayer->SetDisplayInLegend($layer->GetDisplayInLegend());
-		$newLayer->SetVisible(true);
-		$newLayer->SetSelectable($layer->GetLegendLabel());
-		$layers->Insert($layers->IndexOf($layer), $newLayer);
+        $newLayer = new MgLayer($layerResId, $resourceService);
+        $newLayer->SetName($uniqueName);
+        $newLayer->SetLegendLabel($legendLabel);
+        $newLayer->SetDisplayInLegend($layer->GetDisplayInLegend());
+        $newLayer->SetVisible(true);
+        $newLayer->SetSelectable($layer->GetLegendLabel());
+        $layers->Insert($layers->IndexOf($layer), $newLayer);
 
-		$map->Save($resourceService);
+        $map->Save();
 
-		return $uniqueName;
-	}
+        return $uniqueName;
+    }
 
 
-	private function InterpolateColor($portion, $startColor, $endColor, $percentTransparent)
-	{
-		$result = sprintf("%02x", 255 * (100 - $percentTransparent) / 100);
+    private function InterpolateColor($portion, $startColor, $endColor, $percentTransparent)
+    {
+        $result = sprintf("%02x", 255 * (100 - $percentTransparent) / 100);
 
-		if ($startColor == $endColor)
-			return $result . $startColor;
+        if ($startColor == $endColor)
+            return $result . $startColor;
 
-		$red = $this->CalculateRGB($portion, substr($startColor, 0, 2), substr($endColor, 0, 2));
-		$result = (strlen(dechex($red)) == 1) ? $result . "0" . dechex($red) : $result . dechex($red);
-		$green = $this->CalculateRGB($portion, substr($startColor, 2, 2), substr($endColor, 2, 2));
-		$result = (strlen(dechex($green)) == 1) ? $result . "0" . dechex($green) : $result . dechex($green);
-		$blue = $this->CalculateRGB($portion, substr($startColor, 4, 2), substr($endColor, 4, 2));
-		$result = (strlen(dechex($blue)) == 1) ? $result . "0" . dechex($blue) : $result . dechex($blue);
+        $red = $this->CalculateRGB($portion, substr($startColor, 0, 2), substr($endColor, 0, 2));
+        $result = (strlen(dechex($red)) == 1) ? $result . "0" . dechex($red) : $result . dechex($red);
+        $green = $this->CalculateRGB($portion, substr($startColor, 2, 2), substr($endColor, 2, 2));
+        $result = (strlen(dechex($green)) == 1) ? $result . "0" . dechex($green) : $result . dechex($green);
+        $blue = $this->CalculateRGB($portion, substr($startColor, 4, 2), substr($endColor, 4, 2));
+        $result = (strlen(dechex($blue)) == 1) ? $result . "0" . dechex($blue) : $result . dechex($blue);
 
-		return $result;
-	}
+        return $result;
+    }
 
-	private function CalculateRGB($portion, $startRGB, $endRGB)
-	{
-		return (hexdec($startRGB) + ($portion * (hexdec($endRGB) - hexdec($startRGB))));
-	}
+    private function CalculateRGB($portion, $startRGB, $endRGB)
+    {
+        return (hexdec($startRGB) + ($portion * (hexdec($endRGB) - hexdec($startRGB))));
+    }
 
-	private function GetFeaturePropertyValue($featureReader, $name)
-	{
-		$value = '';
-		$propertyType = $featureReader->GetPropertyType($name);
-		switch($propertyType)
-		{
-			case MgPropertyType::Boolean :
-				$value = $featureReader->GetBoolean($name);
-				break;
+    private function GetFeaturePropertyValue($featureReader, $name)
+    {
+        $value = '';
+        $propertyType = $featureReader->GetPropertyType($name);
+        switch($propertyType)
+        {
+            case MgPropertyType::Boolean :
+                $value = $featureReader->GetBoolean($name);
+                break;
 
-			case MgPropertyType::Byte :
-				$value = $featureReader->GetByte($name);
-				break;
+            case MgPropertyType::Byte :
+                $value = $featureReader->GetByte($name);
+                break;
 
-			case MgPropertyType::Single :
-				$value = $featureReader->GetSingle($name);
-				break;
+            case MgPropertyType::Single :
+                $value = $featureReader->GetSingle($name);
+                break;
 
-			case MgPropertyType::Double :
-				$value = $featureReader->GetDouble($name);
-				break;
+            case MgPropertyType::Double :
+                $value = $featureReader->GetDouble($name);
+                break;
 
-			case MgPropertyType::Int16 :
-				$value = $featureReader->GetInt16($name);
-				break;
+            case MgPropertyType::Int16 :
+                $value = $featureReader->GetInt16($name);
+                break;
 
-			case MgPropertyType::Int32 :
-				$value = $featureReader->GetInt32($name);
-				break;
+            case MgPropertyType::Int32 :
+                $value = $featureReader->GetInt32($name);
+                break;
 
-			case MgPropertyType::Int64 :
-				$value = $featureReader->GetInt64($name);
-				break;
+            case MgPropertyType::Int64 :
+                $value = $featureReader->GetInt64($name);
+                break;
 
-			case MgPropertyType::String :
-				$value = $featureReader->GetString($name);
-				break;
+            case MgPropertyType::String :
+                $value = $featureReader->GetString($name);
+                break;
 
-			case MgPropertyType::DateTime :
-			case MgPropertyType::Null :
-			case MgPropertyType::Blob :
-			case MgPropertyType::Clob :
-			case MgPropertyType::Feature :
-			case MgPropertyType::Geometry :
-			case MgPropertyType::Raster :
-				$value = '[unsupported data type]';
-				break;
-		}
-		return $value;
-	}
+            case MgPropertyType::DateTime :
+            case MgPropertyType::Null :
+            case MgPropertyType::Blob :
+            case MgPropertyType::Clob :
+            case MgPropertyType::Feature :
+            case MgPropertyType::Geometry :
+            case MgPropertyType::Raster :
+                $value = '[unsupported data type]';
+                break;
+        }
+        return $value;
+    }
 
     private function GetDistributionsForDataType($type)
     {
@@ -424,47 +418,47 @@
 
         switch($type)
         {
-			case MgPropertyType::String:
-				array_push($distros, 0);
-				break;
+            case MgPropertyType::String:
+                array_push($distros, 0);
+                break;
 
-			case MgPropertyType::Byte :
-			case MgPropertyType::Int16 :
-			case MgPropertyType::Int32 :
-			case MgPropertyType::Int64 :
-				array_push($distros, 0, 1, 2, 3, 4);
-				break;
+            case MgPropertyType::Byte :
+            case MgPropertyType::Int16 :
+            case MgPropertyType::Int32 :
+            case MgPropertyType::Int64 :
+                array_push($distros, 0, 1, 2, 3, 4);
+                break;
 
-			case MgPropertyType::Single :
-			case MgPropertyType::Double :
-				array_push($distros, 1, 2, 3, 4);
-				break;
+            case MgPropertyType::Single :
+            case MgPropertyType::Double :
+                array_push($distros, 1, 2, 3, 4);
+                break;
 
-			case MgPropertyType::Boolean:
-			case MgPropertyType::DateTime:
+            case MgPropertyType::Boolean:
+            case MgPropertyType::DateTime:
             case MgPropertyType::Blob:
             case MgPropertyType::Clob:
             case MgPropertyType::Byte:
             case MgPropertyType::Feature:
             case MgPropertyType::Geometry:
             case MgPropertyType::Null:
-				break;
+                break;
         }
         return $distros;
     }
 
-	private function MakeUniqueLayerName($map, $layerName, $themeName)
-	{
-		$desiredName = "_" . $layerName . $themeName;
-		$uniqueName = $desiredName;
-		$index = 1;
+    private function MakeUniqueLayerName($map, $layerName, $themeName)
+    {
+        $desiredName = "_" . $layerName . $themeName;
+        $uniqueName = $desiredName;
+        $index = 1;
 
-		while ($map->GetLayers()->Contains($uniqueName))
-		{
-			$uniqueName = $desiredName . $index;
-			$index++;
-		}
-		return $uniqueName;
-	}
+        while ($map->GetLayers()->Contains($uniqueName))
+        {
+            $uniqueName = $desiredName . $index;
+            $index++;
+        }
+        return $uniqueName;
+    }
 }
 ?>
\ No newline at end of file

Modified: trunk/MgDev/UnitTest/Common/DotNetWrappers/CollectionTest.cs
===================================================================
--- trunk/MgDev/UnitTest/Common/DotNetWrappers/CollectionTest.cs	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/UnitTest/Common/DotNetWrappers/CollectionTest.cs	2014-06-17 10:16:51 UTC (rev 8236)
@@ -448,15 +448,16 @@
         [Test]
         public void MapCollection()
         {
+            MgSiteConnection conn = new MgSiteConnection();
             string coordsys = "GEOGCS[\"LL84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]]";
             MgEnvelope env = new MgEnvelope(10,10,20,20);
-            MgMap map1 = new MgMap();
+            MgMap map1 = new MgMap(conn);
             map1.Create(coordsys, env, "map1");
-            MgMap map2 = new MgMap();
+            MgMap map2 = new MgMap(conn);
             map2.Create(coordsys, env, "map2");
-            MgMap map3 = new MgMap();
+            MgMap map3 = new MgMap(conn);
             map3.Create(coordsys, env, "map3");
-            MgMap map4 = new MgMap();
+            MgMap map4 = new MgMap(conn);
             map4.Create(coordsys, env, "map4");
 
             MgMapCollection coll = new MgMapCollection();
@@ -481,15 +482,16 @@
         [Test]
         public void MapPlotCollection()
         {
+            MgSiteConnection conn = new MgSiteConnection();
             string coordsys = "GEOGCS[\"LL84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",\"4326\"]]";
             MgEnvelope env = new MgEnvelope(10,10,20,20);
-            MgMap map1 = new MgMap();
+            MgMap map1 = new MgMap(conn);
             map1.Create(coordsys, env, "map1");
 
-            MgMap map2 = new MgMap();
+            MgMap map2 = new MgMap(conn);
             map2.Create(coordsys, env, "map2");
 
-            MgMap map3 = new MgMap();
+            MgMap map3 = new MgMap(conn);
             map3.Create(coordsys, env, "map3");
 
             MgPlotSpecification spec = new MgPlotSpecification((float)8.0, (float)11.0, "in", (float)0.0, (float)0.0, (float)5.0, (float)5.0);

Modified: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/MapGuideTestExecutorCollection.cs
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/MapGuideTestExecutorCollection.cs	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/MapGuideTestExecutorCollection.cs	2014-06-17 10:16:51 UTC (rev 8236)
@@ -43,7 +43,7 @@
             var admin = new MgServerAdmin();
             admin.Open(_userInfo);
             var wlCreator = new MgWebLayoutCreator(resSvc);
-            var creator = new MgMapCreator(resSvc);
+            var creator = new MgMapCreator(_conn, resSvc);
             var sessionCreator = new MgSessionCreator(_conn);
             var sessionApply = new MgApplySession(_userInfo);
             var session = new MgSession();
@@ -210,11 +210,13 @@
 
         class MgMapCreator : Operations.IMapCreator
         {
+            private MgSiteConnection _siteConn;
+            private MgMap _map;
             private MgResourceService _resSvc;
-            private MgMap _map;
 
-            public MgMapCreator(MgResourceService resSvc)
+            public MgMapCreator(MgSiteConnection siteConn, MgResourceService resSvc)
             {
+                _siteConn = siteConn;
                 _resSvc = resSvc;
             }
 
@@ -225,8 +227,8 @@
                 if (_map != null)
                     return _map;
 
-                _map = new MgMap();
-                _map.Create(_resSvc, resId, resId.GetName());
+                _map = new MgMap(_siteConn);
+                _map.Create(resId, resId.GetName());
                 return _map;
             }
 

Modified: trunk/MgDev/UnitTest/WebTier/Php/HtmlPrinter.php
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Php/HtmlPrinter.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/UnitTest/WebTier/Php/HtmlPrinter.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -23,7 +23,7 @@
 
 class HtmlPrinter
 {
-    public function PrintHtmlHeader($title)
+    public static function PrintHtmlHeader($title)
     {
         print ("<html>\n");
         print ("<head>\n");
@@ -33,7 +33,7 @@
         print("<h2>$title</h2>\n");
     }
 
-    public function PrintTestCases($testSuite, $dumpFilePath, $testType)
+    public static function PrintTestCases($testSuite, $dumpFilePath, $testType)
     {
         try
         {
@@ -72,21 +72,21 @@
         self::printTableEnd();
     }
 
-    public function PrintTestTableHeader($caption="", $c1="", $c2="", $c3="")
+    public static function PrintTestTableHeader($caption="", $c1="", $c2="", $c3="")
     {
         print("<table border=\"1\" cellpadding=\"5\">\n");
         print("<h3><b>$caption</b></h3>");
         print("<tr>\n");
-        printf("<td>&nbsp</td>\n<th>%s</th>\n<th>%s</th><th>%s</th>\n", $c1, $c2, $c3);
+        printf("<td>&nbsp</td>\n<th>%s</th>\n<th>%s</th><th>%s</th><th> </th>\n", $c1, $c2, $c3);
         print("</tr>\n");
     }
 
-    public function printTableEnd()
+    public static function printTableEnd()
     {
         print("</table><br />\n");
     }
 
-    public function PrintSelectTestMode()
+    public static function PrintSelectTestMode()
     {
         print("<h3>Select Test Mode</h3>\n");
         print("<p>\n");
@@ -97,7 +97,7 @@
         print("</p>\n");
     }
 
-    public function PrintSelectOutput()
+    public static function PrintSelectOutput()
     {
         print("<h3>Select Output</h3>\n");
         print("<p>\n");
@@ -108,25 +108,25 @@
         print("</p>\n");
     }
 
-    public function PrintHtmlFooter()
+    public static function PrintHtmlFooter()
     {
         print ("</body>\n");
         print ("</html>\n");
     }
 
-    public function PrintFormHeader($target)
+    public static function PrintFormHeader($target)
     {
         print ("<form name=\"input\" action=\"$target\" method=\"POST\" id=\"myform\">\n");
     }
 
-    public function PrintFormFooter($requestType, $action)
+    public static function PrintFormFooter($requestType, $action)
     {
         print("<td><input type=\"hidden\" name=\"requestType\" value=\"$requestType\"></td>\n");
         print ("<input type=\"submit\" value=\"$action\" ID=\"$action\" NAME=\"$action\"> <input type=\"reset\" ID=\"Reset1\" NAME=\"Reset1\">\n");
         print ("</form>\n");
     }
 
-    public function AddResultRow($operation, $outcome, $paramSet, $actualResult="", $expectedResult="")
+    public static function AddResultRow($operation, $outcome, $paramSet, $actualResult="", $expectedResult="")
     {
         $checkBox="<input type=\"checkbox\" name=$paramSet>";
         if ( $outcome=="fail")
@@ -141,16 +141,17 @@
         print("</tr>");
     }
 
-    public function PrintResultTableHeader($caption="")
+    public static function PrintResultTableHeader($caption="")
     {
         print("<table scroll=\"no\" border=\"1\" cellpadding=\"5\">\n");
         print("<h3><b>$caption</b></h3>");
+        print("<col width=10><col width=20><col width=40><col width=20><col width=180><col width=180><col>");
         print("<tr>\n");
         print("<td>&nbsp</td><th>Param Set</th><th>Operation</th>\n<th>Outcome</th>\n<th>Actual Result</th>\n<th>Expected Result</th>\n");
         print("</tr>\n");
     }
 
-    public function PrintGenerateFormHiddenFields()
+    public static function PrintGenerateFormHiddenFields()
     {
         $output = $_POST['output'];
         $testName = $_POST['testName'];

Modified: trunk/MgDev/UnitTest/WebTier/Php/MapLayerAPI.php
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Php/MapLayerAPI.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/UnitTest/WebTier/Php/MapLayerAPI.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -503,8 +503,8 @@
         }
 
         $mapDefId = new MgResourceIdentifier($mapName);
-        $this->map = new MgMap();
-        $this->map->Create($this->resSrvc, $mapDefId, $mapDefId->GetName());
+        $this->map = new MgMap($this->site);
+        $this->map->Create($mapDefId, $mapDefId->GetName());
     }
 }
 ?>

Modified: trunk/MgDev/UnitTest/WebTier/Php/Run.php
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Php/Run.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/UnitTest/WebTier/Php/Run.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -118,7 +118,7 @@
         }
         catch (MgException $e)
         {
-            print $e->GetExceptionMessage('en');
+            print $e->GetDetails();
             return false;
         }
         catch (SqliteException $s)

Modified: trunk/MgDev/UnitTest/WebTier/Php/RunTests.php
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Php/RunTests.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/UnitTest/WebTier/Php/RunTests.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -163,6 +163,7 @@
     catch (SqliteException $s)
     {
         print $s->GetExceptionMessage();
+        $s->Dispose();
         return 1;
     }
 }

Copied: trunk/MgDev/UnitTest/WebTier/Php/SQLiteEngine.php (from rev 8225, sandbox/jng/v30/UnitTest/WebTier/Php/SQLiteEngine.php)
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Php/SQLiteEngine.php	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Php/SQLiteEngine.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -0,0 +1,214 @@
+<?php
+
+// SQLiteEngine.php
+//
+// A PHP-based implementation of SqliteDB and SqliteVM class using PDO instead
+// of the internal SWIG-wrapped SQLite classes in Oem
+//
+// This avoids any access violation issues should our test runner happen to
+// be mis-using any classes in the SWIG wrapper.
+
+if (!defined('SQLITE_ROW')) {
+    define('SQLITE_ROW', 100);
+}
+
+if (!extension_loaded("SQLitePhpApi"))
+{
+    //echo "SQLitePhpApi not loaded. Using PHP implementation";
+
+    class SqliteException extends Exception
+    {
+    }
+
+    class CantOpenDbException extends SqliteException
+    {
+    }
+    
+    class SqliteDB
+    {
+        private $dbh;
+        private $dbName;
+
+        public function __construct()
+        {
+            $this->dbh = NULL;
+            $this->dbName = "";
+        }
+        
+        public function __destruct()
+        {
+            $this->Close();
+        }
+
+        public function Close()
+        {
+            if ($this->dbh != NULL)
+            {
+                $this->dbh = NULL;
+            }
+        }
+        
+        public function GetHandle() { return $this->dbh; }
+        
+        public function Open($dbName)
+        {
+            $this->Close();
+            $this->dbh = new PDO("sqlite:$dbName");
+            $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+            $this->dbName = $dbName;
+        }
+        
+        public function GetName() { return $this->dbName; }
+        
+        public function GenerateDatabase($dumpFilePath, $dbPath)
+        {
+            if (php_sapi_name() == 'cli')
+                echo "Generating database from dump: $dumpFilePath\n";
+            else
+                echo "Generating database from dump: $dumpFilePath<br/>";
+            $pdo = new PDO("sqlite:$dbPath");
+            $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+            $sql = file_get_contents($dumpFilePath);
+            $pdo->exec($sql);
+            $pdo = NULL;
+        }
+        
+        public function DumpDatabase($path)
+        {
+            throw new Exception("Creating database dumps not implemented. Please run this script with the php_SQLitePhpApi extension loaded");
+        }
+    }
+    
+    class SqliteVM
+    {
+        private $db;
+        private $currentStmt;
+        private $currentRow;
+        private $resultLOB;
+        
+        private $nameIndexMap;
+
+        public function __construct($db)
+        {
+            $this->db = $db->GetHandle();
+            $this->currentStmt = NULL;
+            $this->currentRow = NULL;
+            $this->nameIndexMap = array();
+        }
+        
+        public function Execute($query)
+        {
+            /*
+            if (php_sapi_name() == 'cli')
+                echo "Executing: $query\n";
+            else
+                echo "Executing: $query<br/>";
+            */
+            if ($this->currentStmt != NULL)
+            {
+                $this->currentStmt->closeCursor();
+                $this->currentStmt = NULL;
+            }
+            $this->nameIndexMap = array();
+            $this->currentStmt = $this->db->prepare($query);
+            try
+            {
+                if ($this->currentStmt === FALSE)
+                {
+                    if (php_sapi_name() == 'cli')
+                        echo "ERROR: Failed to prepare query: $query\n";
+                    else
+                        echo "ERROR: Failed to prepare query: $query<br/>";
+                    return -1;
+                }
+                if (!$this->currentStmt->execute())
+                {
+                    if (php_sapi_name() == 'cli')
+                        echo "ERROR: Failed to execute query: $query\n";
+                    else
+                        echo "ERROR: Failed to execute query: $query<br/>";
+                    return -1;
+                }
+            }
+            catch (PDOException $e)
+            {
+                return -1;
+            }
+            //Compile name index map for the purposes of column binding below
+            for ($i = 0; $i < $this->currentStmt->columnCount(); $i++)
+            {
+                try {
+                    $col = $this->currentStmt->getColumnMeta($i);
+                    if ($col === FALSE)
+                        continue;
+                } catch (PDOException $e) {
+                    continue;
+                }
+                if (array_key_exists("name", $col)) 
+                {
+                    $colName = $col["name"];
+                    $this->nameIndexMap[$colName] = $i;
+                }
+            }
+            
+            //Bind columns, paying special attention to bind Result as BLOB if found
+            $this->currentRow = array();
+            foreach ($this->nameIndexMap as $colName => $index)
+            {
+                if ($colName == "Result") {
+                    $this->currentStmt->bindColumn(($index+1), $this->currentRow[$colName], PDO::PARAM_LOB);
+                    //echo "Bound $colName as BLOB<br/>";
+                } else {
+                    $this->currentStmt->bindColumn(($index+1), $this->currentRow[$colName]);
+                }
+            }
+            
+            try
+            {
+                $res = $this->currentStmt->fetch();
+                if ($res === FALSE)
+                    return -1;
+            }
+            catch (PDOException $e)
+            {
+                return -1;
+            }
+            return SQLITE_ROW;
+        }
+        
+        public function GetString($name)
+        {
+            if (array_key_exists($name, $this->currentRow))
+                return $this->currentRow[$name];
+            return "";
+        }
+        
+        public function GetBlob($name)
+        {
+            $str = $this->currentRow[$name];
+            //SqliteBlob in C++ has a MgByteReader-style interface. Since
+            //in PHP if it quacks like a duck ... we'll give them an actual MgByteReader
+            $source = new MgByteSource($str, strlen($str));
+            return $source->GetReader();
+        }
+        
+        public function NextRow()
+        {
+            $this->currentRow = $this->currentStmt->fetch();
+            if ($this->currentRow === FALSE)
+                return -1;
+            return SQLITE_ROW;
+        }
+        
+        public function SqlFinalize()
+        {
+            if ($this->currentStmt != NULL)
+            {
+                $this->currentStmt->closeCursor();
+                $this->currentStmt = NULL;
+            }
+        }
+    }
+}
+
+?>
\ No newline at end of file

Copied: trunk/MgDev/UnitTest/WebTier/Php/UpdateDumpFiles.php (from rev 8225, sandbox/jng/v30/UnitTest/WebTier/Php/UpdateDumpFiles.php)
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Php/UpdateDumpFiles.php	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/Php/UpdateDumpFiles.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -0,0 +1,74 @@
+<?php
+
+//
+//  Copyright (C) 2004-2014 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+//Command line script that executes all tests in the given database files
+
+define('Run_MAIN_METHOD', true);
+require_once("sqlite_constants.php");
+require_once("Utils.php");
+main();
+
+function main()
+{
+    if (($_SERVER['argc'] >1) && ($_SERVER['argv'][1] == "-help"))
+    {
+        ShowUsage();
+        return 1;
+    }
+
+    $updatesFailed = 0;
+    $updatesFailed += UpdateDumpFile("../../TestData/ResourceService/ResourceServiceTest.db");
+    $updatesFailed += UpdateDumpFile("../../TestData/DrawingService/DrawingServiceTest.db");
+    $updatesFailed += UpdateDumpFile("../../TestData/FeatureService/FeatureServiceTest.db");
+    $updatesFailed += UpdateDumpFile("../../TestData/SiteService/SiteServiceTest.db");
+    $updatesFailed += UpdateDumpFile("../../TestData/MappingService/MappingServiceTest.db");
+    $updatesFailed += UpdateDumpFile("../../TestData/ServerAdmin/ServerAdminTest.db");
+    $updatesFailed += UpdateDumpFile("../../TestData/MapLayer/MapLayerTest.db");
+    $updatesFailed += UpdateDumpFile("../../TestData/WebLayout/WebLayoutTest.db");
+    $updatesFailed += UpdateDumpFile("../../TestData/Wfs/WfsTest.db");
+    $updatesFailed += UpdateDumpFile("../../TestData/Wms/WmsTest.db");
+    $updatesFailed += UpdateDumpFile("../../TestData/Unicode/UnicodeTest.db");
+    
+    exit($updatesFailed);
+}
+
+function UpdateDumpFile($dbName)
+{
+    echo "Checking $dbName\n";
+    $ret = 0;
+    $db = NULL;
+    try {
+        $dbPath = Utils::GetPath($dbName);
+        $db = new SqliteDB();
+        $db->Open($dbPath);
+        Utils::CreateDumpFile($db, true);
+    } catch (SqliteException $ex) {
+        echo $ex->GetExceptionMessage()."\n";
+        $ret = 1;
+    }
+    $db = NULL;
+    return $ret;
+}
+
+function ShowUsage()
+{
+    printf("Usage: php UpdateDumpFiles.php\n");
+}
+
+?>

Modified: trunk/MgDev/UnitTest/WebTier/Php/Utils.php
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Php/Utils.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/UnitTest/WebTier/Php/Utils.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -19,6 +19,8 @@
 
 //Class that defines static methods that are commonly used in the infrastructure
 
+require_once("SQLiteEngine.php");
+
 if (!defined('WEBCONFIGINI')) {
     if (array_key_exists("WEBCONFIGINI", $_SERVER)) {
         define("WEBCONFIGINI", $_SERVER["WEBCONFIGINI"]);
@@ -246,28 +248,51 @@
 
         return $dbPath;
     }
-
-    public static function CreateDumpFile($db)
+    
+    public static function CreateDumpFile($db, $overwrite = false)
     {
         $dbName = $db->GetName();
         $iniFileName = substr($dbName, 0, strpos($dbName, ".db")).".ini";
         $dumpFileName = substr($dbName, 0, strpos($dbName, ".db")).".dump";
 
-        //Clear the stat cache as filemtime may not work correctly
-        clearstatcache();
-
-        //Check if the file exists and is writable before updating it
-        if (!file_exists($dumpFileName) || (is_writable($dumpFileName)&&filemtime($db->GetName())>filemtime($dumpFileName)))
+        if ($overwrite)
         {
+            if (file_exists($dumpFileName))
+                unlink($dumpFileName);
+            
             $iniFileContent =".output ".$dumpFileName;
             file_put_contents($iniFileName, $iniFileContent);
             $db->DumpDatabase($iniFileName);
-            printf("<b>Updated dump file <i>%s</i></b>", $dumpFileName);
+            if (php_sapi_name() == 'cli')
+                printf("Updated dump file: %s\n", $dumpFileName);
+            else
+                printf("<b>Updated dump file <i>%s</i></b>", $dumpFileName);
             unlink($iniFileName);
         }
         else
         {
-            printf("<b>Dump file <i>%s</i> already exists and is read only or is newer than the database. File has not been updated</b>", $dumpFileName);
+            //Clear the stat cache as filemtime may not work correctly
+            clearstatcache();
+
+            //Check if the file exists and is writable before updating it
+            if (!file_exists($dumpFileName) || (is_writable($dumpFileName)&&filemtime($db->GetName())>filemtime($dumpFileName)))
+            {
+                $iniFileContent =".output ".$dumpFileName;
+                file_put_contents($iniFileName, $iniFileContent);
+                $db->DumpDatabase($iniFileName);
+                if (php_sapi_name() == 'cli')
+                    printf("Updated dump file: %s\n", $dumpFileName);
+                else
+                    printf("<b>Updated dump file <i>%s</i></b>", $dumpFileName);
+                unlink($iniFileName);
+            }
+            else
+            {
+                if (php_sapi_name() == 'cli')
+                    printf("Dump file %s already exists and is read only or is newer than the database. File has not been updated\n", $dumpFileName);
+                else
+                    printf("<b>Dump file <i>%s</i> already exists and is read only or is newer than the database. File has not been updated</b>", $dumpFileName);
+            }
         }
     }
 }

Modified: trunk/MgDev/UnitTest/WebTier/Php/Validate.php
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Php/Validate.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/UnitTest/WebTier/Php/Validate.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -57,6 +57,8 @@
         //Get the file extension that will be used for a dump
         $actualExtension = ValidateUtils::GetExtension($mimeType);
 
+        $bAlwaysPass = false;
+        $passReason = "";
         //If we have an ALWAYSPASS parameter defined for the operation then skip the whole validation process
         //This parameter should only be used for clean up operations that are no related with the tests
         if ($this->vm->Execute("Select ParamValue from Params where ParamName=\"ALWAYSPASS\" and ParamSet=$paramSet")!=SQLITE_ROW)
@@ -170,6 +172,11 @@
                 }
             }
         }
+        else
+        {
+            $bAlwaysPass = true;
+            $passReason = $this->vm->GetString("ParamValue");
+        }
 
         if ($_POST['output']=="html")
         {
@@ -181,7 +188,9 @@
             }
             else
             {
-                HtmlPrinter::AddResultRow($operation, $outcome, $paramSet);
+                HtmlPrinter::AddResultRow($operation, $outcome, $paramSet, $resultData, $expectedResult);
+                //$str = sprintf("\n****ACTUAL RESULT****\n%s\n****EXPECTED RESULT****\n%s\n********\n\n\n", $resultData, $expectedResult);
+                //fwrite($file, $str);
             }
         }
         else
@@ -193,6 +202,21 @@
                 echo $str;
                 fwrite($file, $str);
             }
+            else
+            {
+                /*
+                if ($bAlwaysPass)
+                {
+                    echo "Test (ParamSet: $paramSet) set to ALWAYSPASS: ".$passReason;
+                    if (php_sapi_name() == 'cli')
+                        echo "\n";
+                    else
+                        echo "<br/>";
+                }
+                */
+                //$str = sprintf("\n****ACTUAL RESULT****\n%s\n****EXPECTED RESULT****\n%s\n********\n\n\n", $resultData, $expectedResult);
+                //fwrite($file, $str);
+            }
         }
         return $exitStatus;
     }
@@ -215,6 +239,8 @@
         //Get the extension for the dump file based on the content type of the result
         $actualExtension = ValidateUtils::GetExtension($contentType);
 
+        $bAlwaysPass = false;
+        $passReason = "";
         //If ALWAYSPASS parameter is defined the the whole validation is skipped.
         //This parameter should only be used for clean up operations that are no related to the test
         if ($this->vm->Execute("Select ParamValue from Params where ParamName=\"ALWAYSPASS\" and ParamSet=$paramSet")!=SQLITE_ROW)
@@ -348,6 +374,11 @@
                 }
             }
         }
+        else
+        {
+            $bAlwaysPass = true;
+            $passReason = $this->vm->GetString("ParamValue");
+        }
 
         if ($_POST['output']=="html")
         {
@@ -360,6 +391,8 @@
             else
             {
                 HtmlPrinter::AddResultRow($operation, $outcome, $paramSet);
+                //$str = sprintf("\n****ACTUAL RESULT****\n%s\n****EXPECTED RESULT****\n%s\n********\n\n\n", $resultData, $expectedResult);
+                //fwrite($file, $str);
             }
         }
         else
@@ -371,6 +404,21 @@
                 echo $str;
                 fwrite($file, $str);
             }
+            else
+            {
+                /*
+                if ($bAlwaysPass)
+                {
+                    echo "Test (ParamSet: $paramSet) set to ALWAYSPASS: ".$passReason;
+                    if (php_sapi_name() == 'cli')
+                        echo "\n";
+                    else
+                        echo "<br/>";
+                }
+                */
+                //$str = sprintf("\n****ACTUAL RESULT****\n%s\n****EXPECTED RESULT****\n%s\n********\n\n\n", $resultData, $expectedResult);
+                //fwrite($file, $str);
+            }
         }
         return $exitStatus;
     }

Modified: trunk/MgDev/UnitTest/WebTier/Php/testAwSelection.php
===================================================================
--- trunk/MgDev/UnitTest/WebTier/Php/testAwSelection.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/UnitTest/WebTier/Php/testAwSelection.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -211,8 +211,8 @@
     $fsvc->UpdateFeatures($id, $cmdColl, false);
 
     $mapId = new MgResourceIdentifier("Library://TrevorWekel/NewSdf.MapDefinition");
-    $map = new MgMap();
-    $map->Create($rsvc, $mapId, "NewMap");
+    $map = new MgMap($site);
+    $map->Create($mapId, "NewMap");
 
     echo "Building Selection from Add()\n";
     $sel = new MgSelection($map);

Modified: trunk/MgDev/Web/src/mapadmin/performanceReport_GetResult.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/performanceReport_GetResult.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapadmin/performanceReport_GetResult.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -198,7 +198,6 @@
         $siteConn = new MgSiteConnection();
         $siteConn->Open($userInfo);
 
-        $resourceService = $siteConn->CreateService(MgServiceType::ResourceService);
         $profilingService = $siteConn->CreateService(MgServiceType::ProfilingService);
 
         //the profiling result is saved as xml file, the file name is unique
@@ -207,8 +206,8 @@
 
         $resourceID = new MgResourceIdentifier($mapResourceId);
         // Get a runtime map from a map definition
-        $map = new MgMap();
-        $map->Create($resourceService, $resourceID, $newXmlFileId);
+        $map = new MgMap($siteConn);
+        $map->Create($resourceID, $newXmlFileId);
 
         //The result will not show base layers
         RemoveBaseLayers($map);

Modified: trunk/MgDev/Web/src/mapviewerjava/buffer.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/buffer.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewerjava/buffer.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -101,8 +101,8 @@
 
         //load the map runtime state
         //
-        MgMap map = new MgMap();
-        map.Open(resourceSrvc, mapName);
+        MgMap map = new MgMap(site);
+        map.Open(mapName);
 
         //locate the buffer layer in the map. It might or might not already exist
         //
@@ -351,7 +351,7 @@
         // Save the new map state
         //
         layer.ForceRefresh();
-        map.Save(resourceSrvc);
+        map.Save();
 
         //build report message
         String title = MgLocalizer.GetString("BUFFERREPORTTITLE", locale);

Modified: trunk/MgDev/Web/src/mapviewerjava/legend.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/legend.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewerjava/legend.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -100,8 +100,8 @@
 
     //Load the map runtime state.
     //
-    MgMap map = new MgMap();
-    map.Open(resourceSrvc, mapName);
+    MgMap map = new MgMap(site);
+    map.Open(mapName);
 
     int updateType = -1;
 

Modified: trunk/MgDev/Web/src/mapviewerjava/mapframe.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/mapframe.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewerjava/mapframe.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -98,10 +98,10 @@
 
         MgResourceService resourceSrvc = (MgResourceService)site.CreateService(MgServiceType.ResourceService);
 
-        MgMap map = new MgMap();
+        MgMap map = new MgMap(site);
         MgResourceIdentifier resId = new MgResourceIdentifier(mapDefinition);
         String mapName = resId.GetName();
-        map.Create(resourceSrvc, resId, mapName);
+        map.Create(resId, mapName);
 
         //create an empty selection object and store it in the session repository
         MgSelection sel = new MgSelection(map);

Modified: trunk/MgDev/Web/src/mapviewerjava/measure.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/measure.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewerjava/measure.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -96,8 +96,8 @@
 
         //load the map runtime state and locate the measure layer
         //
-        MgMap map = new MgMap();
-        map.Open(resourceSrvc, mapName);
+        MgMap map = new MgMap(site);
+        map.Open(mapName);
         MgLayerCollection layers = map.GetLayers();
         srs = GetMapSrs(map);
 
@@ -242,7 +242,7 @@
 
         if(layer != null)
             layer.ForceRefresh();
-        map.Save(resourceSrvc);
+        map.Save();
     }
     catch(MgException exc)
     {

Modified: trunk/MgDev/Web/src/mapviewerjava/quickplotgeneratepicture.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/quickplotgeneratepicture.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewerjava/quickplotgeneratepicture.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -110,11 +110,10 @@
     MgUserInformation userInfo = new MgUserInformation(sessionId);
     MgSiteConnection siteConnection = new MgSiteConnection();
     siteConnection.Open(userInfo);
-    MgResourceService resourceService = (MgResourceService) siteConnection.CreateService(MgServiceType.ResourceService);
     MgRenderingService renderingService = (MgRenderingService) siteConnection.CreateService(MgServiceType.RenderingService);
 
-    MgMap map = new MgMap();
-    map.Open(resourceService, mapName);
+    MgMap map = new MgMap(siteConnection);
+    map.Open(mapName);
 
     MgSelection selection = new MgSelection(map);
 

Modified: trunk/MgDev/Web/src/mapviewerjava/search.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/search.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewerjava/search.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -87,13 +87,11 @@
         //connect to the site and get a feature service and a resource service instances
         MgSiteConnection site = new MgSiteConnection();
         site.Open(cred);
-        MgFeatureService featureSrvc = (MgFeatureService)site.CreateService(MgServiceType.FeatureService);
-        MgResourceService resourceSrvc = (MgResourceService)site.CreateService(MgServiceType.ResourceService);
 
         //Create a temporary map runtime object, locate the layer
         //
-        MgMap map = new MgMap();
-        map.Open(resourceSrvc, mapName);
+        MgMap map = new MgMap(site);
+        map.Open(mapName);
         MgLayerCollection layers = map.GetLayers();
         int i, j;
         MgLayer layer = null;
@@ -119,8 +117,7 @@
         MgFeatureQueryOptions opts = new MgFeatureQueryOptions();
         opts.SetFilter(filter);
         String featureClassName = layer.GetFeatureClassName();
-        MgResourceIdentifier srcId = new MgResourceIdentifier(layer.GetFeatureSourceId());
-        features = featureSrvc.SelectFeatures(srcId, featureClassName, opts);
+        features = layer.SelectFeatures( opts);
         boolean hasResult = features.ReadNext();
 
         if(hasResult)

Modified: trunk/MgDev/Web/src/mapviewerjava/selectwithin.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/selectwithin.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewerjava/selectwithin.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -52,12 +52,11 @@
         site.Open(cred);
         MgFeatureService featureSrvc = (MgFeatureService)site.CreateService(MgServiceType.FeatureService);
         MgRenderingService renderingSrvc = (MgRenderingService)site.CreateService(MgServiceType.RenderingService);
-        MgResourceService resourceSrvc = (MgResourceService)site.CreateService(MgServiceType.ResourceService);
 
         //load the map runtime state
         //
-        MgMap map = new MgMap();
-        map.Open(resourceSrvc, mapName);
+        MgMap map = new MgMap(site);
+        map.Open(mapName);
 
         String[] layersList = layers.split(",");
         if(layersList.length > 0)

Modified: trunk/MgDev/Web/src/mapviewerjava/setselection.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/setselection.jsp	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewerjava/setselection.jsp	2014-06-17 10:16:51 UTC (rev 8236)
@@ -59,8 +59,8 @@
 
     //load the map runtime state
     //
-    MgMap map = new MgMap();
-    map.Open(resourceSrvc, mapName);
+    MgMap map = new MgMap(site);
+    map.Open(mapName);
 
     // Create the selection set and save it
     MgSelection sel = new MgSelection(map);

Modified: trunk/MgDev/Web/src/mapviewernet/buffer.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/buffer.aspx	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewernet/buffer.aspx	2014-06-17 10:16:51 UTC (rev 8236)
@@ -79,8 +79,8 @@
 
         //load the map runtime state
         //
-        MgMap map = new MgMap();
-        map.Open(resourceSrvc, mapName);
+        MgMap map = new MgMap(site);
+        map.Open(mapName);
 
         //locate the buffer layer in the map. It might or might not already exist
         //
@@ -333,7 +333,7 @@
         // Save the new map state
         //
         layer.ForceRefresh();
-        map.Save(resourceSrvc);
+        map.Save();
 
         //build report message
         String title = MgLocalizer.GetString("BUFFERREPORTTITLE", locale);

Modified: trunk/MgDev/Web/src/mapviewernet/legend.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/legend.aspx	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewernet/legend.aspx	2014-06-17 10:16:51 UTC (rev 8236)
@@ -93,8 +93,8 @@
 
         //Load the map runtime state.
         //
-        MgMap map = new MgMap();
-        map.Open(resourceSrvc, mapName);
+        MgMap map = new MgMap(site);
+        map.Open(mapName);
 
         int updateType = -1;
 

Modified: trunk/MgDev/Web/src/mapviewernet/mapframe.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/mapframe.aspx	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewernet/mapframe.aspx	2014-06-17 10:16:51 UTC (rev 8236)
@@ -103,10 +103,10 @@
 
             MgResourceService resourceSrvc = (MgResourceService)site.CreateService(MgServiceType.ResourceService);
 
-            MgMap map = new MgMap();
+            MgMap map = new MgMap(site);
             MgResourceIdentifier resId = new MgResourceIdentifier(mapDefinition);
             String mapName = resId.GetName();
-            map.Create(resourceSrvc, resId, mapName);
+            map.Create(resId, mapName);
 
             //create an empty selection object and store it in the session repository
             MgSelection sel = new MgSelection(map);

Modified: trunk/MgDev/Web/src/mapviewernet/measure.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/measure.aspx	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewernet/measure.aspx	2014-06-17 10:16:51 UTC (rev 8236)
@@ -74,8 +74,8 @@
 
             //load the map runtime state and locate the measure layer
             //
-            MgMap map = new MgMap();
-            map.Open(resourceSrvc, mapName);
+            MgMap map = new MgMap(site);
+            map.Open(mapName);
             MgLayerCollection layers = map.GetLayers();
             srs = GetMapSrs(map);
 
@@ -221,7 +221,7 @@
 
             if (layer != null)
                 layer.ForceRefresh();
-            map.Save(resourceSrvc);
+            map.Save();
         }
         catch (MgException exc)
         {

Modified: trunk/MgDev/Web/src/mapviewernet/quickplotgeneratepicture.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/quickplotgeneratepicture.aspx	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewernet/quickplotgeneratepicture.aspx	2014-06-17 10:16:51 UTC (rev 8236)
@@ -109,11 +109,10 @@
     MgUserInformation userInfo = new MgUserInformation(sessionID);
     MgSiteConnection siteConnection = new MgSiteConnection();
     siteConnection.Open(userInfo);
-    MgResourceService resourceService = siteConnection.CreateService(MgServiceType.ResourceService) as MgResourceService;
     MgRenderingService renderingService = siteConnection.CreateService(MgServiceType.RenderingService) as MgRenderingService;
 
-    MgMap map = new MgMap();
-    map.Open(resourceService, mapName);
+    MgMap map = new MgMap(siteConnection);
+    map.Open(mapName);
 
     MgSelection selection = new MgSelection(map);
 

Modified: trunk/MgDev/Web/src/mapviewernet/search.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/search.aspx	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewernet/search.aspx	2014-06-17 10:16:51 UTC (rev 8236)
@@ -75,12 +75,10 @@
             //connect to the site and get a feature service and a resource service instances
             MgSiteConnection site = new MgSiteConnection();
             site.Open(cred);
-            MgFeatureService featureSrvc = site.CreateService(MgServiceType.FeatureService) as MgFeatureService;
-            MgResourceService resourceSrvc = site.CreateService(MgServiceType.ResourceService) as MgResourceService;
 
             //Create a temporary map runtime object, locate the layer
-            MgMap map = new MgMap();
-            map.Open(resourceSrvc, mapName);
+            MgMap map = new MgMap(site);
+            map.Open(mapName);
             MgLayerCollection layers = map.GetLayers();
             int i = 0;
             MgLayer layer = null;
@@ -108,8 +106,7 @@
             MgFeatureQueryOptions opts = new MgFeatureQueryOptions();
             opts.SetFilter(filter);
             String featureClassName = layer.GetFeatureClassName();
-            MgResourceIdentifier srcId = new MgResourceIdentifier(layer.GetFeatureSourceId());
-            features = featureSrvc.SelectFeatures(srcId, featureClassName, opts);
+            features = layer.SelectFeatures(opts);
             bool hasResult = features.ReadNext();
 
             if (hasResult)

Modified: trunk/MgDev/Web/src/mapviewernet/selectwithin.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/selectwithin.aspx	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewernet/selectwithin.aspx	2014-06-17 10:16:51 UTC (rev 8236)
@@ -50,12 +50,11 @@
         site.Open(cred);
         MgFeatureService featureSrvc = site.CreateService(MgServiceType.FeatureService) as MgFeatureService;
         MgRenderingService renderingSrvc = site.CreateService(MgServiceType.RenderingService) as MgRenderingService;
-        MgResourceService resourceSrvc = site.CreateService(MgServiceType.ResourceService) as MgResourceService;
 
         //load the map runtime state
         //
-        MgMap map = new MgMap();
-        map.Open(resourceSrvc, mapName);
+        MgMap map = new MgMap(site);
+        map.Open(mapName);
 
         String [] layersList = layers.Split(',');
         if(layersList.Length > 0)

Modified: trunk/MgDev/Web/src/mapviewernet/setselection.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/setselection.aspx	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewernet/setselection.aspx	2014-06-17 10:16:51 UTC (rev 8236)
@@ -52,8 +52,8 @@
 
         //load the map runtime state
         //
-        MgMap map = new MgMap();
-        map.Open(resourceSrvc, mapName);
+        MgMap map = new MgMap(site);
+        map.Open(mapName);
 
         // Create the selection set and save it
         MgSelection sel = new MgSelection(map);

Modified: trunk/MgDev/Web/src/mapviewerphp/buffer.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/buffer.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewerphp/buffer.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -69,8 +69,8 @@
 
         //load the map runtime state
         //
-        $map = new MgMap();
-        $map->Open($resourceSrvc, $mapName);
+        $map = new MgMap($site);
+        $map->Open($mapName);
 
         //locate the buffer layer in the map. It might or might not already exist
         //
@@ -317,7 +317,7 @@
         // Save the new map state
         //
         $layer->ForceRefresh();
-        $map->Save($resourceSrvc);
+        $map->Save();
 
         //build report message
         $title = GetLocalizedString( "BUFFERREPORTTITLE", $locale );

Modified: trunk/MgDev/Web/src/mapviewerphp/legend.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/legend.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewerphp/legend.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -79,8 +79,8 @@
 
         //Load the map runtime state.
         //
-        $map = new MgMap();
-        $map->Open($resourceSrvc, $mapName);
+        $map = new MgMap($site);
+        $map->Open($mapName);
 
         $layerMap = null;
         $tree = BuildLayerTree($map, $resourceSrvc);

Modified: trunk/MgDev/Web/src/mapviewerphp/mapframe.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/mapframe.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewerphp/mapframe.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -82,10 +82,10 @@
 
         $resourceSrvc = $site->CreateService(MgServiceType::ResourceService);
 
-        $map = new MgMap();
+        $map = new MgMap($site);
         $resId = new MgResourceIdentifier($mapDefinition);
         $mapName = $resId->GetName();
-        $map->Create($resourceSrvc, $resId, $mapName);
+        $map->Create($resId, $mapName);
 
         //create an empty selection object and store it in the session repository
         $sel = new MgSelection($map);

Modified: trunk/MgDev/Web/src/mapviewerphp/measure.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/measure.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewerphp/measure.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -65,8 +65,8 @@
 
         //load the map runtime state and locate the measure layer
         //
-        $map = new MgMap();
-        $map->Open($resourceSrvc, $mapName);
+        $map = new MgMap($site);
+        $map->Open($mapName);
         $layers = $map->GetLayers();
         $srs = GetMapSrs($map);
 
@@ -209,7 +209,7 @@
 
         if($layer != null)
             $layer->ForceRefresh();
-        $map->Save($resourceSrvc);
+        $map->Save();
     }
     catch(MgException $e)
     {

Modified: trunk/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -84,11 +84,10 @@
         $userInfo         = new MgUserInformation($sessionID);
         $siteConnection   = new MgSiteConnection();
         $siteConnection->Open($userInfo);
-        $resourceService  = $siteConnection->CreateService(MgServiceType::ResourceService);
         $renderingService = $siteConnection->CreateService(MgServiceType::RenderingService);
 
-        $map = new MgMap();
-        $map->Open($resourceService, $mapName);
+        $map = new MgMap($siteConnection);
+        $map->Open($mapName);
 
         $selection        = new MgSelection($map);
 


Property changes on: trunk/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/2.4/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php:6738-6741,6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/sandbox/adsk/2.4jbeta2/Web/src/mapviewerphp/quickplotgeneratepicture.php:6334-6374
/sandbox/jng/createruntimemap/Web/src/mapviewerphp/quickplotgeneratepicture.php:7486-7555
/sandbox/jng/webtier_upgrade_v2/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php:7817-7861
/sandbox/rfc94/Web/src/mapviewerphp/quickplotgeneratepicture.php:5099-5163
   + /branches/2.4/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php:6738-6741,6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/sandbox/adsk/2.4jbeta2/Web/src/mapviewerphp/quickplotgeneratepicture.php:6334-6374
/sandbox/jng/createruntimemap/Web/src/mapviewerphp/quickplotgeneratepicture.php:7486-7555
/sandbox/jng/v30/Web/src/mapviewerphp/quickplotgeneratepicture.php:8220-8221
/sandbox/jng/webtier_upgrade_v2/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php:7817-7861
/sandbox/rfc94/Web/src/mapviewerphp/quickplotgeneratepicture.php:5099-5163

Modified: trunk/MgDev/Web/src/mapviewerphp/search.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/search.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewerphp/search.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -60,11 +60,10 @@
         $site = new MgSiteConnection();
         $site->Open($cred);
         $featureSrvc = $site->CreateService(MgServiceType::FeatureService);
-        $resourceSrvc = $site->CreateService(MgServiceType::ResourceService);
 
         //Create a temporary map runtime object, locate the layer
-        $map = new MgMap();
-        $map->Open($resourceSrvc, $mapName);
+        $map = new MgMap($site);
+        $map->Open($mapName);
         $layers = $map->GetLayers();
         $layer = null;
         for($i = 0; $i < $layers->GetCount(); $i++)
@@ -107,8 +106,7 @@
         $opts = new MgFeatureQueryOptions();
         $opts->SetFilter($filter);
         $featureClassName = $layer->GetFeatureClassName();
-        $srcId = new MgResourceIdentifier($layer->GetFeatureSourceId());
-        $features = $featureSrvc->SelectFeatures($srcId, $featureClassName, $opts);
+        $features = $layer->SelectFeatures($opts);
         $hasResult = $features->ReadNext();
 
         if($hasResult)

Modified: trunk/MgDev/Web/src/mapviewerphp/selectwithin.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/selectwithin.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewerphp/selectwithin.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -42,12 +42,11 @@
         $site->Open($cred);
         $featureSrvc = $site->CreateService(MgServiceType::FeatureService);
         $renderingSrvc = $site->CreateService(MgServiceType::RenderingService);
-        $resourceSrvc = $site->CreateService(MgServiceType::ResourceService);
 
         //load the map runtime state
         //
-        $map = new MgMap();
-        $map->Open($resourceSrvc, $mapName);
+        $map = new MgMap($site);
+        $map->Open($mapName);
 
         $layers = explode(",", $layers);
         if(count($layers) > 0)

Modified: trunk/MgDev/Web/src/mapviewerphp/setselection.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/setselection.php	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/Web/src/mapviewerphp/setselection.php	2014-06-17 10:16:51 UTC (rev 8236)
@@ -43,8 +43,8 @@
 
         //load the map runtime state
         //
-        $map = new MgMap();
-        $map->Open($resourceSrvc, $mapName);
+        $map = new MgMap($site);
+        $map->Open($mapName);
 
         // Create the selection set and save it
         $sel = new MgSelection($map);

Modified: trunk/MgDev/run_tests.bat
===================================================================
--- trunk/MgDev/run_tests.bat	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/run_tests.bat	2014-06-17 10:16:51 UTC (rev 8236)
@@ -77,7 +77,7 @@
 :start_php_webserver
 if "%START_WEBSERVER%" == "1" (
     echo [test]: Starting PHP web server. Waiting %MGSERVER_WAIT%s
-    start php -n -d display_errors=Off -d upload_max_filesize=20M -d extension_dir="%PHP_EXT_DIR%" -d extension=php_mbstring.dll -d extension=php_curl.dll -d extension=php_MapGuideApi.dll -d extension=php_SQLitePhpApi.dll -S %SERVER_ADDR%:%SERVER_PORT% -t %CD%\UnitTest\WebTier\MapAgent\MapAgentForms %CD%\UnitTest\WebTier\Php\MapAgentShim\index.php
+    start php -n -d display_errors=Off -d upload_max_filesize=20M -d extension_dir="%PHP_EXT_DIR%" -d extension=php_mbstring.dll -d extension=php_curl.dll -d extension=php_MapGuideApi.dll -S %SERVER_ADDR%:%SERVER_PORT% -t %CD%\UnitTest\WebTier\MapAgent\MapAgentForms %CD%\UnitTest\WebTier\Php\MapAgentShim\index.php
     ping -n %MGSERVER_WAIT% 127.0.0.1 > NUL
 )
 :test_php
@@ -98,7 +98,7 @@
     if exist ResourceService\ResourceServiceTest.db del /F ResourceService\ResourceServiceTest.db
     popd
     pushd UnitTest\WebTier\Php
-    php.exe -n -d display_errors=Off -d extension_dir="%PHP_EXT_DIR%" -d extension=php_mbstring.dll -d extension=php_curl.dll -d extension=php_MapGuideApi.dll -d extension=php_SQLitePhpApi.dll RunTests.php
+    php.exe -n -d display_errors=Off -d extension_dir="%PHP_EXT_DIR%" -d extension=php_mbstring.dll -d extension=php_curl.dll -d extension=php_MapGuideApi.dll -d extension=php_pdo_sqlite.dll RunTests.php
     popd
 )
 :test_dotnet

Modified: trunk/MgDev/updateversion.vbs
===================================================================
--- trunk/MgDev/updateversion.vbs	2014-06-17 05:53:52 UTC (rev 8235)
+++ trunk/MgDev/updateversion.vbs	2014-06-17 10:16:51 UTC (rev 8236)
@@ -247,6 +247,7 @@
   "/Common/PlatformBase/PlatformBase.rc", _
   "/Common/Renderers/Renderers.rc", _
   "/Common/Stylization/Stylization.rc", _
+  "/Desktop/DesktopUnmanagedApi/JavaApiEx/JavaApiEx.rc", _
   "/Server/src/Common/Base/ServerBase.rc", _
   "/Server/src/Common/Cache/ServerCache.rc", _
   "/Server/src/Common/Manager/ServerManager.rc", _
@@ -259,6 +260,7 @@
   "/Server/src/Services/Feature/ServerFeatureService.rc", _
   "/Server/src/Services/Kml/ServerKmlService.rc", _
   "/Server/src/Services/Mapping/ServerMappingService.rc", _
+  "/Server/src/Services/Profiling/ServerProfilingService.rc", _
   "/Server/src/Services/Rendering/ServerRenderingService.rc", _
   "/Server/src/Services/Resource/ServerResourceService.rc", _
   "/Server/src/Services/ServerAdmin/ServerAdminService.rc", _
@@ -276,6 +278,7 @@
   "/Web/src/HttpHandler/HttpHandler.rc", _
   "/Web/src/IsapiAgent/IsapiAgent.rc", _
   "/Web/src/JavaApi/JavaApi.rc", _
+  "/Web/src/JavaApiEx/JavaApiEx.rc", _
   "/Web/src/PhpApi/PhpApi.rc", _
   "/Web/src/WebApp/WebApp.rc" _
   )



More information about the mapguide-commits mailing list