The branch, master has been updated
       via  b072a8d47cc80e346c31ccd8d6e6c0e58f39d390 (commit)
       via  b0465744fb17798c30ff552a508ee44af667c02a (commit)
       via  624a742054f7b2484c3c1e28f13757234377c710 (commit)
      from  a8be4eb8c7a55ba6d3731c6fc6f3b65609ddec3d (commit)


- Log -----------------------------------------------------------------
commit b072a8d47cc80e346c31ccd8d6e6c0e58f39d390
Merge: b046574 a8be4eb
Author: Madhura Jayaratne <[email protected]>
Date:   Tue Aug 23 19:37:07 2011 +0530

    Merge branch 'master' of 
ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin

commit b0465744fb17798c30ff552a508ee44af667c02a
Author: Madhura Jayaratne <[email protected]>
Date:   Tue Aug 23 19:20:22 2011 +0530

    Coding style improvements

commit 624a742054f7b2484c3c1e28f13757234377c710
Author: Madhura Jayaratne <[email protected]>
Date:   Tue Aug 23 19:13:55 2011 +0530

    Test case for PMA_GIS_Multipolygon::getShape()

-----------------------------------------------------------------------

Summary of changes:
 libraries/gis/pma_gis_multipolygon.php         |   14 ++++--
 test/classes/gis/PMA_GIS_Multipolygon_test.php |   58 ++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 5 deletions(-)

diff --git a/libraries/gis/pma_gis_multipolygon.php 
b/libraries/gis/pma_gis_multipolygon.php
index b5765ef..d04ccde 100644
--- a/libraries/gis/pma_gis_multipolygon.php
+++ b/libraries/gis/pma_gis_multipolygon.php
@@ -374,7 +374,7 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
         // Determines whether each line ring is an inner ring or an outer ring.
         // If it's an inner ring get a point on the surface which can be used 
to
         // correctly classify inner rings to their respective outer rings.
-        require_once './libraries/gis/pma_gis_polygon.php';
+        include_once './libraries/gis/pma_gis_polygon.php';
         foreach ($row_data['parts'] as $i => $ring) {
             $row_data['parts'][$i]['isOuter'] = 
PMA_GIS_Polygon::isOuterRing($ring['points']);
         }
@@ -382,7 +382,8 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
         // Find points on surface for inner rings
         foreach ($row_data['parts'] as $i => $ring) {
             if (! $ring['isOuter']) {
-                $row_data['parts'][$i]['pointOnSurface'] = 
PMA_GIS_Polygon::getPointOnSurface($ring['points']);
+                $row_data['parts'][$i]['pointOnSurface']
+                    = PMA_GIS_Polygon::getPointOnSurface($ring['points']);
             }
         }
 
@@ -391,8 +392,11 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
             if (! $ring1['isOuter']) {
                 foreach ($row_data['parts'] as $k => $ring2) {
                     if ($ring2['isOuter']) {
-                        // If the pointOnSurface of the inner ring is also 
inside the outer ring
-                        if 
(PMA_GIS_Polygon::isPointInsidePolygon($ring1['pointOnSurface'], 
$ring2['points'])) {
+                        // If the pointOnSurface of the inner ring
+                        // is also inside the outer ring
+                        if (PMA_GIS_Polygon::isPointInsidePolygon(
+                            $ring1['pointOnSurface'], $ring2['points']
+                        )) {
                             if (! isset($ring2['inner'])) {
                                 $row_data['parts'][$k]['inner'] = array();
                             }
@@ -410,7 +414,7 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
                 $wkt .= '('; // start of polygon
 
                 $wkt .= '('; // start of outer ring
-                foreach($ring['points'] as $point) {
+                foreach ($ring['points'] as $point) {
                     $wkt .= $point['x'] . ' ' . $point['y'] . ',';
                 }
                 $wkt = substr($wkt, 0, strlen($wkt) - 1);
diff --git a/test/classes/gis/PMA_GIS_Multipolygon_test.php 
b/test/classes/gis/PMA_GIS_Multipolygon_test.php
index 3281b4f..500cbae 100644
--- a/test/classes/gis/PMA_GIS_Multipolygon_test.php
+++ b/test/classes/gis/PMA_GIS_Multipolygon_test.php
@@ -168,5 +168,63 @@ class PMA_GIS_MultipolygonTest extends PMA_GIS_GeometryTest
             )
         );
     }
+
+    /**
+     * test getShape method
+     *
+     * @param array  $row_data array of GIS data
+     * @param string $shape    expected shape in WKT
+     *
+     * @dataProvider providerForTestGetShape
+     * @return nothing
+     */
+    public function testGetShape($row_data, $shape)
+    {
+        $this->assertEquals($this->object->getShape($row_data), $shape);
+    }
+
+    /**
+     * data provider for testGetShape
+     *
+     * @return data for testGetShape
+     */
+    public function providerForTestGetShape()
+    {
+        return array(
+            array(
+                array(
+                    'parts' => array(
+                        0 => array(
+                            'points' => array(
+                                0 => array('x' => 10, 'y' => 10),
+                                1 => array('x' => 10, 'y' => 40),
+                                2 => array('x' => 50, 'y' => 40),
+                                3 => array('x' => 50, 'y' => 10),
+                                4 => array('x' => 10, 'y' => 10),
+                            ),
+                        ),
+                        1 => array(
+                            'points' => array(
+                                0 => array('x' => 60, 'y' => 40),
+                                1 => array('x' => 75, 'y' => 65),
+                                2 => array('x' => 90, 'y' => 40),
+                                3 => array('x' => 60, 'y' => 40),
+                            ),
+                        ),
+                        2 => array(
+                            'points' => array(
+                                0 => array('x' => 20, 'y' => 20),
+                                1 => array('x' => 40, 'y' => 20),
+                                2 => array('x' => 25, 'y' => 30),
+                                3 => array('x' => 20, 'y' => 20),
+                            ),
+                        ),
+                    ),
+                ),
+                'MULTIPOLYGON(((10 10,10 40,50 40,50 10,10 10),(20 20,40 20,25 
30'
+                    . ',20 20)),((60 40,75 65,90 40,60 40)))'
+            )
+        );
+    }
 }
 ?>


hooks/post-receive
-- 
phpMyAdmin

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Phpmyadmin-git mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/phpmyadmin-git

Reply via email to