[fusion-commits] r2026 - trunk/widgets/SelectWithin

svn_fusion at osgeo.org svn_fusion at osgeo.org
Mon Dec 21 03:33:24 EST 2009


Author: liuar
Date: 2009-12-21 03:33:20 -0500 (Mon, 21 Dec 2009)
New Revision: 2026

Modified:
   trunk/widgets/SelectWithin/SelectWithin.php
Log:
Fixed ticket http://trac.osgeo.org/fusion/ticket/337
Fusion: Select Within doesn't work.

Comments from Buddy who fixed a similar defect in MapGuide:
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/widgets/SelectWithin/SelectWithin.php
===================================================================
--- trunk/widgets/SelectWithin/SelectWithin.php	2009-12-21 08:04:46 UTC (rev 2025)
+++ trunk/widgets/SelectWithin/SelectWithin.php	2009-12-21 08:33:20 UTC (rev 2026)
@@ -148,7 +148,7 @@
     }
     $geomColl = new MgGeometryCollection();
     $agfRW = new MgAgfReaderWriter();
-    $polyOnly = true;
+    $simplyPolygonOnly = true;
 
     for($i = 0; $i < $selLayers->GetCount(); $i++)
     {
@@ -162,23 +162,18 @@
         {
             $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);
             }
             $features->Close();
@@ -188,7 +183,7 @@
         return null;
 
     $gf = new MgGeometryFactory();
-    if($polyOnly)
+    if($simplyPolygonOnly)
     {
         $polyColl = new MgPolygonCollection();
         for($i = 0; $i < $geomColl->GetCount(); $i++)



More information about the fusion-commits mailing list