[mapguide-commits] r4452 - in trunk/MgDev/Web/src: mapviewerjava mapviewernet mapviewerphp

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Dec 21 02:33:03 EST 2009


Author: christinebao
Date: 2009-12-21 02:33:01 -0500 (Mon, 21 Dec 2009)
New Revision: 4452

Modified:
   trunk/MgDev/Web/src/mapviewerjava/selectwithin.jsp
   trunk/MgDev/Web/src/mapviewernet/selectwithin.aspx
   trunk/MgDev/Web/src/mapviewerphp/selectwithin.php
Log:
Submit on behalf of Buddy Hu.
This submission fix the Ticket #1193: Select Within cause a 500 error in the browser.

In this patch, I check the type for each feature. And create a multipolygon if there are only polygon. If there are unsupported types, continue and go to the next one. For mixed supported types, create a multi-geometry. 

BTW, the MG Server, the render service doesn't support QueryFeatures for the multi-geometry. So If we create a multi-polygoemetry, QueryFeatures. will return null, and everything in the map will be cleared.  

We need address another defect for this issue.


Modified: trunk/MgDev/Web/src/mapviewerjava/selectwithin.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/selectwithin.jsp	2009-12-21 07:31:37 UTC (rev 4451)
+++ trunk/MgDev/Web/src/mapviewerjava/selectwithin.jsp	2009-12-21 07:33:01 UTC (rev 4452)
@@ -110,7 +110,7 @@
         return null;
     MgGeometryCollection geomColl = new MgGeometryCollection();
     MgAgfReaderWriter agfRW = new MgAgfReaderWriter();
-    boolean polyOnly = true;
+    boolean simplyPolygonOnly = true;
 
     for(int i = 0; i < selLayers.GetCount(); i++)
     {
@@ -126,25 +126,19 @@
         {
             MgClassDefinition classDef = features.GetClassDefinition();
             String geomPropName = classDef.GetDefaultGeometryPropertyName();
-            int j = 0;
-            boolean isPoly = true;
             while(features.ReadNext())
             {
                 MgByteReader geomReader = features.GetGeometry(geomPropName);
                 MgGeometry geom = agfRW.Read(geomReader);
-                if(j++ == 0)
+                int type = geom.GetGeometryType();
+                if(type == MgGeometryType.MultiPolygon || type == MgGeometryType.CurvePolygon || type == MgGeometryType.MultiCurvePolygon)
                 {
-                    int type = geom.GetGeometryType();
-                    if(type == MgGeometryType.MultiPolygon || type == MgGeometryType.CurvePolygon || type == MgGeometryType.MultiCurvePolygon)
-                    {
-                        isPoly = false;
-                        polyOnly = false;
-                    }
-                    else if(type != MgGeometryType.Polygon)
-                    {
-                        break;
-                    }
+                    simplyPolygonOnly = false;
                 }
+                else if(type != MgGeometryType.Polygon)
+                {
+                    continue;
+                }
                 geomColl.Add(geom);
             }
             features.Close();
@@ -157,7 +151,7 @@
     }
 
     MgGeometryFactory gf = new MgGeometryFactory();
-    if(polyOnly)
+    if(simplyPolygonOnly)
     {
         MgPolygonCollection polyColl = new MgPolygonCollection();
         for(int j = 0; j < geomColl.GetCount(); j++)

Modified: trunk/MgDev/Web/src/mapviewernet/selectwithin.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/selectwithin.aspx	2009-12-21 07:31:37 UTC (rev 4451)
+++ trunk/MgDev/Web/src/mapviewernet/selectwithin.aspx	2009-12-21 07:33:01 UTC (rev 4452)
@@ -108,7 +108,7 @@
         return null;
     MgGeometryCollection geomColl = new MgGeometryCollection();
     MgAgfReaderWriter agfRW = new MgAgfReaderWriter();
-    bool polyOnly = true;
+    bool simplyPolygonOnly = true;
 
     for(int i = 0; i < selLayers.GetCount(); i++)
     {
@@ -124,25 +124,19 @@
         {
             MgClassDefinition classDef = features.GetClassDefinition();
             String geomPropName = classDef.GetDefaultGeometryPropertyName();
-            int j = 0;
-            bool isPoly = true;
             while(features.ReadNext())
             {
                 MgByteReader geomReader = features.GetGeometry(geomPropName);
                 MgGeometry geom = agfRW.Read(geomReader);
-                if(j++ == 0)
+                int type = geom.GetGeometryType();
+                if(type == MgGeometryType.MultiPolygon || type == MgGeometryType.CurvePolygon || type == MgGeometryType.MultiCurvePolygon)
                 {
-                    int type = geom.GetGeometryType();
-                    if(type == MgGeometryType.MultiPolygon || type == MgGeometryType.CurvePolygon || type == MgGeometryType.MultiCurvePolygon)
-                    {
-                        isPoly = false;
-                        polyOnly = false;
-                    }
-                    else if(type != MgGeometryType.Polygon)
-                    {
-                        break;
-                    }
+                    simplyPolygonOnly = false;
                 }
+                else if(type != MgGeometryType.Polygon)
+                {
+                    continue;
+                }
                 geomColl.Add(geom);
             }
             features.Close();
@@ -155,7 +149,7 @@
     }
 
     MgGeometryFactory gf = new MgGeometryFactory();
-    if(polyOnly)
+    if(simplyPolygonOnly)
     {
         MgPolygonCollection polyColl = new MgPolygonCollection();
         for(int j = 0; j < geomColl.GetCount(); j++)

Modified: trunk/MgDev/Web/src/mapviewerphp/selectwithin.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/selectwithin.php	2009-12-21 07:31:37 UTC (rev 4451)
+++ trunk/MgDev/Web/src/mapviewerphp/selectwithin.php	2009-12-21 07:33:01 UTC (rev 4452)
@@ -94,7 +94,7 @@
     $selLayers = $sel->GetLayers();
     $geomColl = new MgGeometryCollection();
     $agfRW = new MgAgfReaderWriter();
-    $polyOnly = true;
+    $simplyPolygonOnly = true;
 
     for($i = 0; $i < $selLayers->GetCount(); $i++)
     {
@@ -109,22 +109,19 @@
             $classDef = $features->GetClassDefinition();
             $geomPropName = $classDef->GetDefaultGeometryPropertyName();
             $j = 0;
-            $isPoly = true;
             while($features->ReadNext())
             {
                 $geomReader = $features->GetGeometry($geomPropName);
                 $geom = $agfRW->Read($geomReader);
-                if($j ++ == 0)
+
+                $type = $geom->GetGeometryType();
+                if($type == MgGeometryType::MultiPolygon || $type == MgGeometryType::CurvePolygon || $type == MgGeometryType::MultiCurvePolygon)
                 {
-                    $type = $geom->GetGeometryType();
-                    if($type == MgGeometryType::MultiPolygon || $type == MgGeometryType::CurvePolygon || $type == MgGeometryType::MultiCurvePolygon)
-                    {
-                        $isPoly = false;
-                        $polyOnly = false;
-                    }
-                    else if($type != MgGeometryType::Polygon)
-                        break;
+                    $simplyPolygonOnly = false;
                 }
+                else if($type != MgGeometryType::Polygon)
+                    continue;
+
                 $geomColl->Add($geom);
             }
         }
@@ -133,7 +130,7 @@
         return null;
 
     $gf = new MgGeometryFactory();
-    if($polyOnly)
+    if($simplyPolygonOnly)
     {
         $polyColl = new MgPolygonCollection();
         for($i = 0; $i < $geomColl->GetCount(); $i++)



More information about the mapguide-commits mailing list