[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_2-17001-g136921c
Madhura Jayaratne
madhuracj at users.sourceforge.net
Wed Aug 24 06:33:07 CEST 2011
The branch, master has been updated
via 136921c9cd6deb049de02868a2d0231f9652a788 (commit)
via 361544ecf7eb0bc988c8e5808ed65fc5f4d9dfed (commit)
via 98a770b415007e5320b3972b73c76aae26e69aa8 (commit)
via 936461597eb279034f01143b635260e2eb1c51ca (commit)
via 9b007f992029e37e8e2ac1e0bd4f239f54961c07 (commit)
from 9e566cdd350cd2516447f1a453a7e3bbca53f223 (commit)
- Log -----------------------------------------------------------------
commit 136921c9cd6deb049de02868a2d0231f9652a788
Merge: 361544e 9e566cd
Author: Madhura Jayaratne <madhura.cj at gmail.com>
Date: Wed Aug 24 10:01:46 2011 +0530
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit 361544ecf7eb0bc988c8e5808ed65fc5f4d9dfed
Author: Madhura Jayaratne <madhura.cj at gmail.com>
Date: Wed Aug 24 10:00:35 2011 +0530
Take common code to PMA_GIS_GeomTest class
commit 98a770b415007e5320b3972b73c76aae26e69aa8
Author: Madhura Jayaratne <madhura.cj at gmail.com>
Date: Wed Aug 24 09:58:00 2011 +0530
More tests for scaleRow method
commit 936461597eb279034f01143b635260e2eb1c51ca
Author: Madhura Jayaratne <madhura.cj at gmail.com>
Date: Wed Aug 24 09:51:44 2011 +0530
tests for scaleRow method
commit 9b007f992029e37e8e2ac1e0bd4f239f54961c07
Author: Madhura Jayaratne <madhura.cj at gmail.com>
Date: Wed Aug 24 09:40:08 2011 +0530
Min-max calculation for polygons needs not consider inner rings
-----------------------------------------------------------------------
Summary of changes:
libraries/gis/pma_gis_multipolygon.php | 18 ++++--------
libraries/gis/pma_gis_polygon.php | 19 +++----------
test/classes/gis/PMA_GIS_Geom_test.php | 14 ++++++++++
test/classes/gis/PMA_GIS_Linestring_test.php | 14 ----------
test/classes/gis/PMA_GIS_Multilinestring_test.php | 20 ++++++++++++++
test/classes/gis/PMA_GIS_Multipoint_test.php | 20 ++++++++++++++
test/classes/gis/PMA_GIS_Multipolygon_test.php | 20 ++++++++++++++
test/classes/gis/PMA_GIS_Point_test.php | 20 ++++++++++++++
test/classes/gis/PMA_GIS_Polygon_test.php | 29 +++++++++++++++++++++
9 files changed, 134 insertions(+), 40 deletions(-)
diff --git a/libraries/gis/pma_gis_multipolygon.php b/libraries/gis/pma_gis_multipolygon.php
index d04ccde..4932eb5 100644
--- a/libraries/gis/pma_gis_multipolygon.php
+++ b/libraries/gis/pma_gis_multipolygon.php
@@ -48,21 +48,15 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
$polygons = explode(")),((", $multipolygon);
foreach ($polygons as $polygon) {
- // If the polygon doesnt have an inner polygon
+ // If the polygon doesn't have an inner ring, use polygon itself
if (strpos($polygon, "),(") === false) {
- $min_max = $this->setMinMax($polygon, $min_max);
+ $ring = $polygon;
} else {
- // Seperate outer and inner polygons
+ // Seperate outer ring and use it to determin min-max
$parts = explode("),(", $polygon);
- $outer = $parts[0];
- $inner = array_slice($parts, 1);
-
- $min_max = $this->setMinMax($outer, $min_max);
-
- foreach ($inner as $inner_poly) {
- $min_max = $this->setMinMax($inner_poly, $min_max);
- }
+ $ring = $parts[0];
}
+ $min_max = $this->setMinMax($ring, $min_max);
}
return $min_max;
@@ -374,7 +368,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.
- include_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']);
}
diff --git a/libraries/gis/pma_gis_polygon.php b/libraries/gis/pma_gis_polygon.php
index 8f461ad..b8594aa 100644
--- a/libraries/gis/pma_gis_polygon.php
+++ b/libraries/gis/pma_gis_polygon.php
@@ -40,27 +40,18 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry
*/
public function scaleRow($spatial)
{
- $min_max = array();
-
// Trim to remove leading 'POLYGON((' and trailing '))'
$polygon = substr($spatial, 9, (strlen($spatial) - 11));
- // If the polygon doesnt have an inner polygon
+ // If the polygon doesn't have an inner ring, use polygon itself
if (strpos($polygon, "),(") === false) {
- $min_max = $this->setMinMax($polygon, $min_max);
+ $ring = $polygon;
} else {
- // Seperate outer and inner polygons
+ // Seperate outer ring and use it to determin min-max
$parts = explode("),(", $polygon);
- $outer = $parts[0];
- $inner = array_slice($parts, 1);
-
- $min_max = $this->setMinMax($outer, $min_max);
-
- foreach ($inner as $inner_poly) {
- $min_max = $this->setMinMax($inner_poly, $min_max);
- }
+ $ring = $parts[0];
}
- return $min_max;
+ return $this->setMinMax($ring, array());
}
/**
diff --git a/test/classes/gis/PMA_GIS_Geom_test.php b/test/classes/gis/PMA_GIS_Geom_test.php
index d7637eb..8176a92 100644
--- a/test/classes/gis/PMA_GIS_Geom_test.php
+++ b/test/classes/gis/PMA_GIS_Geom_test.php
@@ -56,5 +56,19 @@ abstract class PMA_GIS_GeomTest extends PHPUnit_Framework_TestCase
);
}
}
+
+ /**
+ * test scaleRow method
+ *
+ * @param string $spatial spatial data of a row
+ * @param array $min_max expected results
+ *
+ * @dataProvider providerForTestScaleRow
+ * @return nothing
+ */
+ public function testScaleRow($spatial, $min_max)
+ {
+ $this->assertEquals($this->object->scaleRow($spatial), $min_max);
+ }
}
?>
\ No newline at end of file
diff --git a/test/classes/gis/PMA_GIS_Linestring_test.php b/test/classes/gis/PMA_GIS_Linestring_test.php
index 05413e1..76bfe05 100644
--- a/test/classes/gis/PMA_GIS_Linestring_test.php
+++ b/test/classes/gis/PMA_GIS_Linestring_test.php
@@ -140,20 +140,6 @@ class PMA_GIS_LinestringTest extends PMA_GIS_GeomTest
}
/**
- * test scaleRow method
- *
- * @param string $spatial spatial data of a row
- * @param array $min_max expected results
- *
- * @dataProvider providerForTestScaleRow
- * @return nothing
- */
- public function testScaleRow($spatial, $min_max)
- {
- $this->assertEquals($this->object->scaleRow($spatial), $min_max);
- }
-
- /**
* data provider for testScaleRow
*
* @return data for testScaleRow
diff --git a/test/classes/gis/PMA_GIS_Multilinestring_test.php b/test/classes/gis/PMA_GIS_Multilinestring_test.php
index a0ab50f..636c028 100644
--- a/test/classes/gis/PMA_GIS_Multilinestring_test.php
+++ b/test/classes/gis/PMA_GIS_Multilinestring_test.php
@@ -198,5 +198,25 @@ class PMA_GIS_MultilinestringTest extends PMA_GIS_GeomTest
)
);
}
+
+ /**
+ * data provider for testScaleRow
+ *
+ * @return data for testScaleRow
+ */
+ public function providerForTestScaleRow()
+ {
+ return array(
+ array(
+ 'MULTILINESTRING((36 14,47 23,62 75),(36 10,17 23,178 53))',
+ array(
+ 'minX' => 17,
+ 'maxX' => 178,
+ 'minY' => 10,
+ 'maxY' => 75
+ )
+ )
+ );
+ }
}
?>
\ No newline at end of file
diff --git a/test/classes/gis/PMA_GIS_Multipoint_test.php b/test/classes/gis/PMA_GIS_Multipoint_test.php
index 1d5fcdf..57b7594 100644
--- a/test/classes/gis/PMA_GIS_Multipoint_test.php
+++ b/test/classes/gis/PMA_GIS_Multipoint_test.php
@@ -142,5 +142,25 @@ class PMA_GIS_MultipointTest extends PMA_GIS_GeomTest
)
);
}
+
+ /**
+ * data provider for testScaleRow
+ *
+ * @return data for testScaleRow
+ */
+ public function providerForTestScaleRow()
+ {
+ return array(
+ array(
+ 'MULTIPOINT(12 35,48 75,69 23,25 45,14 53,35 78)',
+ array(
+ 'minX' => 12,
+ 'maxX' => 69,
+ 'minY' => 23,
+ 'maxY' => 78
+ )
+ )
+ );
+ }
}
?>
\ No newline at end of file
diff --git a/test/classes/gis/PMA_GIS_Multipolygon_test.php b/test/classes/gis/PMA_GIS_Multipolygon_test.php
index 1589f9d..6e92e86 100644
--- a/test/classes/gis/PMA_GIS_Multipolygon_test.php
+++ b/test/classes/gis/PMA_GIS_Multipolygon_test.php
@@ -226,5 +226,25 @@ class PMA_GIS_MultipolygonTest extends PMA_GIS_GeomTest
)
);
}
+
+ /**
+ * data provider for testScaleRow
+ *
+ * @return data for testScaleRow
+ */
+ public function providerForTestScaleRow()
+ {
+ return array(
+ array(
+ 'MULTIPOLYGON(((136 40,147 83,16 75,136 40)),((105 0,56 20,78 73,105 0)))',
+ array(
+ 'minX' => 16,
+ 'maxX' => 147,
+ 'minY' => 0,
+ 'maxY' => 83
+ )
+ )
+ );
+ }
}
?>
diff --git a/test/classes/gis/PMA_GIS_Point_test.php b/test/classes/gis/PMA_GIS_Point_test.php
index 9f9ef21..bca1e4c 100644
--- a/test/classes/gis/PMA_GIS_Point_test.php
+++ b/test/classes/gis/PMA_GIS_Point_test.php
@@ -144,5 +144,25 @@ class PMA_GIS_PointTest extends PMA_GIS_GeomTest
)
);
}
+
+ /**
+ * data provider for testScaleRow
+ *
+ * @return data for testScaleRow
+ */
+ public function providerForTestScaleRow()
+ {
+ return array(
+ array(
+ 'POINT(12 35)',
+ array(
+ 'minX' => 12,
+ 'maxX' => 12,
+ 'minY' => 35,
+ 'maxY' => 35,
+ )
+ )
+ );
+ }
}
?>
\ No newline at end of file
diff --git a/test/classes/gis/PMA_GIS_Polygon_test.php b/test/classes/gis/PMA_GIS_Polygon_test.php
index e4941d3..0686295 100644
--- a/test/classes/gis/PMA_GIS_Polygon_test.php
+++ b/test/classes/gis/PMA_GIS_Polygon_test.php
@@ -315,5 +315,34 @@ class PMA_GIS_PolygonTest extends PMA_GIS_GeomTest
)
);
}
+
+ /**
+ * data provider for testScaleRow
+ *
+ * @return data for testScaleRow
+ */
+ public function providerForTestScaleRow()
+ {
+ return array(
+ array(
+ 'POLYGON((123 0,23 30,17 63,123 0))',
+ array(
+ 'minX' => 17,
+ 'maxX' => 123,
+ 'minY' => 0,
+ 'maxY' => 63,
+ )
+ ),
+ array(
+ 'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 32,30 20,20 30)))',
+ array(
+ 'minX' => 10,
+ 'maxX' => 45,
+ 'minY' => 10,
+ 'maxY' => 45
+ )
+ ),
+ );
+ }
}
?>
\ No newline at end of file
hooks/post-receive
--
phpMyAdmin
More information about the Git
mailing list