Coding style improvements

This commit is contained in:
Madhura Jayaratne 2011-08-23 19:20:22 +05:30
parent 624a742054
commit b0465744fb

View File

@ -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);