Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Foellmann <foellmann@foe-services.de>2014-07-28 14:13:10 +0400
committerChristian Foellmann <foellmann@foe-services.de>2014-07-28 14:13:10 +0400
commit276394119dfbe117acd411a3862de597ba35a2ad (patch)
tree3dc394a15f459d6324e3452e15e9446e47fe3bd0 /libraries/gis
parentc8c2e72886de1b71f5abcaa295075da9666096b5 (diff)
UPDATE phpmyadmin 4.2.6 multilanguage
Diffstat (limited to 'libraries/gis')
-rw-r--r--libraries/gis/GIS_Factory.class.php (renamed from libraries/gis/pma_gis_factory.php)6
-rw-r--r--libraries/gis/GIS_Geometry.class.php (renamed from libraries/gis/pma_gis_geometry.php)8
-rw-r--r--libraries/gis/GIS_Geometrycollection.class.php (renamed from libraries/gis/pma_gis_geometrycollection.php)10
-rw-r--r--libraries/gis/GIS_Linestring.class.php (renamed from libraries/gis/pma_gis_linestring.php)14
-rw-r--r--libraries/gis/GIS_Multilinestring.class.php (renamed from libraries/gis/pma_gis_multilinestring.php)12
-rw-r--r--libraries/gis/GIS_Multipoint.class.php (renamed from libraries/gis/pma_gis_multipoint.php)12
-rw-r--r--libraries/gis/GIS_Multipolygon.class.php (renamed from libraries/gis/pma_gis_multipolygon.php)87
-rw-r--r--libraries/gis/GIS_Point.class.php (renamed from libraries/gis/pma_gis_point.php)14
-rw-r--r--libraries/gis/GIS_Polygon.class.php (renamed from libraries/gis/pma_gis_polygon.php)50
-rw-r--r--libraries/gis/GIS_Visualization.class.php (renamed from libraries/gis/pma_gis_visualization.php)18
10 files changed, 123 insertions, 108 deletions
diff --git a/libraries/gis/pma_gis_factory.php b/libraries/gis/GIS_Factory.class.php
index a8f8b3777f..b2d01c11a3 100644
--- a/libraries/gis/pma_gis_factory.php
+++ b/libraries/gis/GIS_Factory.class.php
@@ -30,13 +30,13 @@ class PMA_GIS_Factory
*/
public static function factory($type)
{
- include_once './libraries/gis/pma_gis_geometry.php';
+ include_once './libraries/gis/GIS_Geometry.class.php';
$type_lower = strtolower($type);
- if (! file_exists('./libraries/gis/pma_gis_' . $type_lower . '.php')) {
+ if (! file_exists('./libraries/gis/GIS_' . ucfirst($type_lower) . '.class.php')) {
return false;
}
- if (include_once './libraries/gis/pma_gis_' . $type_lower . '.php') {
+ if (include_once './libraries/gis/GIS_' . ucfirst($type_lower) . '.class.php') {
switch(strtoupper($type)) {
case 'MULTIPOLYGON' :
return PMA_GIS_Multipolygon::singleton();
diff --git a/libraries/gis/pma_gis_geometry.php b/libraries/gis/GIS_Geometry.class.php
index b457db53cd..4e265975c5 100644
--- a/libraries/gis/pma_gis_geometry.php
+++ b/libraries/gis/GIS_Geometry.class.php
@@ -189,9 +189,9 @@ abstract class PMA_GIS_Geometry
/**
* Extracts points, scales and returns them as an array.
*
- * @param string $point_set string of comma sperated points
- * @param array $scale_data data related to scaling
- * @param boolean $linear if true, as a 1D array, else as a 2D array
+ * @param string $point_set string of comma sperated points
+ * @param null|array $scale_data data related to scaling
+ * @param boolean $linear if true, as a 1D array, else as a 2D array
*
* @return array scaled points
* @access protected
@@ -210,7 +210,7 @@ abstract class PMA_GIS_Geometry
if (isset($cordinates[0]) && trim($cordinates[0]) != ''
&& isset($cordinates[1]) && trim($cordinates[1]) != ''
) {
- if ($scale_data != null) {
+ if ($scale_data !== null) {
$x = ($cordinates[0] - $scale_data['x']) * $scale_data['scale'];
$y = $scale_data['height']
- ($cordinates[1] - $scale_data['y']) * $scale_data['scale'];
diff --git a/libraries/gis/pma_gis_geometrycollection.php b/libraries/gis/GIS_Geometrycollection.class.php
index 09b04ed404..ff57e5e5a6 100644
--- a/libraries/gis/pma_gis_geometrycollection.php
+++ b/libraries/gis/GIS_Geometrycollection.class.php
@@ -100,11 +100,11 @@ class PMA_GIS_Geometrycollection extends PMA_GIS_Geometry
/**
* Adds to the PNG image object, the data related to a row in the GIS dataset.
*
- * @param string $spatial GIS GEOMETRYCOLLECTION object
- * @param string $label label for the GIS GEOMETRYCOLLECTION object
- * @param string $color color for the GIS GEOMETRYCOLLECTION object
- * @param array $scale_data array containing data related to scaling
- * @param object $image image object
+ * @param string $spatial GIS GEOMETRYCOLLECTION object
+ * @param string $label label for the GIS GEOMETRYCOLLECTION object
+ * @param string $color color for the GIS GEOMETRYCOLLECTION object
+ * @param array $scale_data array containing data related to scaling
+ * @param resource $image image object
*
* @return resource the modified image object
* @access public
diff --git a/libraries/gis/pma_gis_linestring.php b/libraries/gis/GIS_Linestring.class.php
index 306e88bca4..0298a8b9a7 100644
--- a/libraries/gis/pma_gis_linestring.php
+++ b/libraries/gis/GIS_Linestring.class.php
@@ -63,11 +63,11 @@ class PMA_GIS_Linestring extends PMA_GIS_Geometry
/**
* Adds to the PNG image object, the data related to a row in the GIS dataset.
*
- * @param string $spatial GIS LINESTRING object
- * @param string $label Label for the GIS LINESTRING object
- * @param string $line_color Color for the GIS LINESTRING object
- * @param array $scale_data Array containing data related to scaling
- * @param object $image Image object
+ * @param string $spatial GIS LINESTRING object
+ * @param string $label Label for the GIS LINESTRING object
+ * @param string $line_color Color for the GIS LINESTRING object
+ * @param array $scale_data Array containing data related to scaling
+ * @param resource $image Image object
*
* @return resource the modified image object
* @access public
@@ -252,7 +252,7 @@ class PMA_GIS_Linestring extends PMA_GIS_Geometry
? $gis_data[$index]['LINESTRING'][$i]['x'] : $empty)
. ' ' . ((isset($gis_data[$index]['LINESTRING'][$i]['y'])
&& trim($gis_data[$index]['LINESTRING'][$i]['y']) != '')
- ? $gis_data[$index]['LINESTRING'][$i]['y'] : $empty) .',';
+ ? $gis_data[$index]['LINESTRING'][$i]['y'] : $empty) . ',';
}
$wkt = substr($wkt, 0, strlen($wkt) - 1);
$wkt .= ')';
@@ -270,9 +270,9 @@ class PMA_GIS_Linestring extends PMA_GIS_Geometry
*/
public function generateParams($value, $index = -1)
{
+ $params = array();
if ($index == -1) {
$index = 0;
- $params = array();
$data = PMA_GIS_Geometry::generateParams($value);
$params['srid'] = $data['srid'];
$wkt = $data['wkt'];
diff --git a/libraries/gis/pma_gis_multilinestring.php b/libraries/gis/GIS_Multilinestring.class.php
index f6e85639c2..6f604c0b19 100644
--- a/libraries/gis/pma_gis_multilinestring.php
+++ b/libraries/gis/GIS_Multilinestring.class.php
@@ -72,11 +72,11 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
/**
* Adds to the PNG image object, the data related to a row in the GIS dataset.
*
- * @param string $spatial GIS MULTILINESTRING object
- * @param string $label Label for the GIS MULTILINESTRING object
- * @param string $line_color Color for the GIS MULTILINESTRING object
- * @param array $scale_data Array containing data related to scaling
- * @param object $image Image object
+ * @param string $spatial GIS MULTILINESTRING object
+ * @param string $label Label for the GIS MULTILINESTRING object
+ * @param string $line_color Color for the GIS MULTILINESTRING object
+ * @param array $scale_data Array containing data related to scaling
+ * @param resource $image Image object
*
* @return object the modified image object
* @access public
@@ -336,9 +336,9 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
*/
public function generateParams($value, $index = -1)
{
+ $params = array();
if ($index == -1) {
$index = 0;
- $params = array();
$data = PMA_GIS_Geometry::generateParams($value);
$params['srid'] = $data['srid'];
$wkt = $data['wkt'];
diff --git a/libraries/gis/pma_gis_multipoint.php b/libraries/gis/GIS_Multipoint.class.php
index 6ef57ddec7..d3882a6b1f 100644
--- a/libraries/gis/pma_gis_multipoint.php
+++ b/libraries/gis/GIS_Multipoint.class.php
@@ -63,11 +63,11 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry
/**
* Adds to the PNG image object, the data related to a row in the GIS dataset.
*
- * @param string $spatial GIS MULTIPOINT object
- * @param string $label Label for the GIS MULTIPOINT object
- * @param string $point_color Color for the GIS MULTIPOINT object
- * @param array $scale_data Array containing data related to scaling
- * @param object $image Image object
+ * @param string $spatial GIS MULTIPOINT object
+ * @param string $label Label for the GIS MULTIPOINT object
+ * @param string $point_color Color for the GIS MULTIPOINT object
+ * @param array $scale_data Array containing data related to scaling
+ * @param resource $image Image object
*
* @return object the modified image object
* @access public
@@ -289,9 +289,9 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry
*/
public function generateParams($value, $index = -1)
{
+ $params = array();
if ($index == -1) {
$index = 0;
- $params = array();
$data = PMA_GIS_Geometry::generateParams($value);
$params['srid'] = $data['srid'];
$wkt = $data['wkt'];
diff --git a/libraries/gis/pma_gis_multipolygon.php b/libraries/gis/GIS_Multipolygon.class.php
index 7afbff386e..369d01a13b 100644
--- a/libraries/gis/pma_gis_multipolygon.php
+++ b/libraries/gis/GIS_Multipolygon.class.php
@@ -80,11 +80,11 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
/**
* Adds to the PNG image object, the data related to a row in the GIS dataset.
*
- * @param string $spatial GIS MULTIPOLYGON object
- * @param string $label Label for the GIS MULTIPOLYGON object
- * @param string $fill_color Color for the GIS MULTIPOLYGON object
- * @param array $scale_data Array containing data related to scaling
- * @param object $image Image object
+ * @param string $spatial GIS MULTIPOLYGON object
+ * @param string $label Label for the GIS MULTIPOLYGON object
+ * @param string $fill_color Color for the GIS MULTIPOLYGON object
+ * @param array $scale_data Array containing data related to scaling
+ * @param resource $image Image object
*
* @return object the modified image object
* @access public
@@ -367,7 +367,7 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
? $data_row[$k][$i][$j]['x'] : $empty)
. ' ' . ((isset($data_row[$k][$i][$j]['y'])
&& trim($data_row[$k][$i][$j]['y']) != '')
- ? $data_row[$k][$i][$j]['y'] : $empty) .',';
+ ? $data_row[$k][$i][$j]['y'] : $empty) . ',';
}
$wkt = substr($wkt, 0, strlen($wkt) - 1);
$wkt .= '),';
@@ -393,7 +393,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/GIS_Polygon.class.php';
foreach ($row_data['parts'] as $i => $ring) {
$row_data['parts'][$i]['isOuter']
= PMA_GIS_Polygon::isOuterRing($ring['points']);
@@ -409,20 +409,23 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
// Classify inner rings to their respective outer rings.
foreach ($row_data['parts'] as $j => $ring1) {
- 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 (! isset($ring2['inner'])) {
- $row_data['parts'][$k]['inner'] = array();
- }
- $row_data['parts'][$k]['inner'][] = $j;
- }
+ if ($ring1['isOuter']) {
+ continue;
+ }
+ foreach ($row_data['parts'] as $k => $ring2) {
+ if (!$ring2['isOuter']) {
+ continue;
+ }
+
+ // 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();
}
+ $row_data['parts'][$k]['inner'][] = $j;
}
}
}
@@ -430,30 +433,32 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
$wkt = 'MULTIPOLYGON(';
// for each polygon
foreach ($row_data['parts'] as $ring) {
- if ($ring['isOuter']) {
- $wkt .= '('; // start of polygon
+ if (!$ring['isOuter']) {
+ continue;
+ }
- $wkt .= '('; // start of outer ring
- foreach ($ring['points'] as $point) {
- $wkt .= $point['x'] . ' ' . $point['y'] . ',';
- }
- $wkt = substr($wkt, 0, strlen($wkt) - 1);
- $wkt .= ')'; // end of outer ring
-
- // inner rings if any
- if (isset($ring['inner'])) {
- foreach ($ring['inner'] as $j) {
- $wkt .= ',('; // start of inner ring
- foreach ($row_data['parts'][$j]['points'] as $innerPoint) {
- $wkt .= $innerPoint['x'] . ' ' . $innerPoint['y'] . ',';
- }
- $wkt = substr($wkt, 0, strlen($wkt) - 1);
- $wkt .= ')'; // end of inner ring
+ $wkt .= '('; // start of polygon
+
+ $wkt .= '('; // start of outer ring
+ foreach ($ring['points'] as $point) {
+ $wkt .= $point['x'] . ' ' . $point['y'] . ',';
+ }
+ $wkt = substr($wkt, 0, strlen($wkt) - 1);
+ $wkt .= ')'; // end of outer ring
+
+ // inner rings if any
+ if (isset($ring['inner'])) {
+ foreach ($ring['inner'] as $j) {
+ $wkt .= ',('; // start of inner ring
+ foreach ($row_data['parts'][$j]['points'] as $innerPoint) {
+ $wkt .= $innerPoint['x'] . ' ' . $innerPoint['y'] . ',';
}
+ $wkt = substr($wkt, 0, strlen($wkt) - 1);
+ $wkt .= ')'; // end of inner ring
}
-
- $wkt .= '),'; // end of polygon
}
+
+ $wkt .= '),'; // end of polygon
}
$wkt = substr($wkt, 0, strlen($wkt) - 1);
@@ -472,9 +477,9 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
*/
public function generateParams($value, $index = -1)
{
+ $params = array();
if ($index == -1) {
$index = 0;
- $params = array();
$data = PMA_GIS_Geometry::generateParams($value);
$params['srid'] = $data['srid'];
$wkt = $data['wkt'];
diff --git a/libraries/gis/pma_gis_point.php b/libraries/gis/GIS_Point.class.php
index e434e0c26c..bcd8517bde 100644
--- a/libraries/gis/pma_gis_point.php
+++ b/libraries/gis/GIS_Point.class.php
@@ -63,11 +63,11 @@ class PMA_GIS_Point extends PMA_GIS_Geometry
/**
* Adds to the PNG image object, the data related to a row in the GIS dataset.
*
- * @param string $spatial GIS POINT object
- * @param string $label Label for the GIS POINT object
- * @param string $point_color Color for the GIS POINT object
- * @param array $scale_data Array containing data related to scaling
- * @param object $image Image object
+ * @param string $spatial GIS POINT object
+ * @param string $label Label for the GIS POINT object
+ * @param string $point_color Color for the GIS POINT object
+ * @param array $scale_data Array containing data related to scaling
+ * @param resource $image Image object
*
* @return object the modified image object
* @access public
@@ -217,7 +217,7 @@ class PMA_GIS_Point extends PMA_GIS_Geometry
if ($points_arr[0][0] != '' && $points_arr[0][1] != '') {
$result .= 'vectorLayer.addFeatures(new OpenLayers.Feature.Vector('
- . $this->getPointForOpenLayers($points_arr[0], $srid). ', null, '
+ . $this->getPointForOpenLayers($points_arr[0], $srid) . ', null, '
. json_encode($style_options) . '));';
}
return $result;
@@ -270,9 +270,9 @@ class PMA_GIS_Point extends PMA_GIS_Geometry
*/
public function generateParams($value, $index = -1)
{
+ $params = array();
if ($index == -1) {
$index = 0;
- $params = array();
$data = PMA_GIS_Geometry::generateParams($value);
$params['srid'] = $data['srid'];
$wkt = $data['wkt'];
diff --git a/libraries/gis/pma_gis_polygon.php b/libraries/gis/GIS_Polygon.class.php
index 215625e13e..51521da618 100644
--- a/libraries/gis/pma_gis_polygon.php
+++ b/libraries/gis/GIS_Polygon.class.php
@@ -72,11 +72,11 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry
/**
* Adds to the PNG image object, the data related to a row in the GIS dataset.
*
- * @param string $spatial GIS POLYGON object
- * @param string $label Label for the GIS POLYGON object
- * @param string $fill_color Color for the GIS POLYGON object
- * @param array $scale_data Array containing data related to scaling
- * @param object $image Image object
+ * @param string $spatial GIS POLYGON object
+ * @param string $label Label for the GIS POLYGON object
+ * @param string $fill_color Color for the GIS POLYGON object
+ * @param array $scale_data Array containing data related to scaling
+ * @param resource $image Image object
*
* @return object the modified image object
* @access public
@@ -321,7 +321,7 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry
? $gis_data[$index]['POLYGON'][$i][$j]['x'] : $empty)
. ' ' . ((isset($gis_data[$index]['POLYGON'][$i][$j]['y'])
&& trim($gis_data[$index]['POLYGON'][$i][$j]['y']) != '')
- ? $gis_data[$index]['POLYGON'][$i][$j]['y'] : $empty) .',';
+ ? $gis_data[$index]['POLYGON'][$i][$j]['y'] : $empty) . ',';
}
$wkt = substr($wkt, 0, strlen($wkt) - 1);
$wkt .= '),';
@@ -415,20 +415,30 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry
$p1 = $polygon[0];
for ($i = 1; $i <= $no_of_points; $i++) {
$p2 = $polygon[$i % $no_of_points];
- if ($point['y'] > min(array($p1['y'], $p2['y']))) {
- if ($point['y'] <= max(array($p1['y'], $p2['y']))) {
- if ($point['x'] <= max(array($p1['x'], $p2['x']))) {
- if ($p1['y'] != $p2['y']) {
- $xinters = ($point['y'] - $p1['y'])
- * ($p2['x'] - $p1['x'])
- / ($p2['y'] - $p1['y']) + $p1['x'];
- if ($p1['x'] == $p2['x'] || $point['x'] <= $xinters) {
- $counter++;
- }
- }
- }
+ if ($point['y'] <= min(array($p1['y'], $p2['y']))) {
+ $p1 = $p2;
+ continue;
+ }
+
+ if ($point['y'] > max(array($p1['y'], $p2['y']))) {
+ $p1 = $p2;
+ continue;
+ }
+
+ if ($point['x'] > max(array($p1['x'], $p2['x']))) {
+ $p1 = $p2;
+ continue;
+ }
+
+ if ($p1['y'] != $p2['y']) {
+ $xinters = ($point['y'] - $p1['y'])
+ * ($p2['x'] - $p1['x'])
+ / ($p2['y'] - $p1['y']) + $p1['x'];
+ if ($p1['x'] == $p2['x'] || $point['x'] <= $xinters) {
+ $counter++;
}
}
+
$p1 = $p2;
}
@@ -452,7 +462,7 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry
public static function getPointOnSurface($ring)
{
// Find two consecutive distinct points.
- for ($i = 0; $i < count($ring) - 1; $i++) {
+ for ($i = 0, $nb = count($ring) - 1; $i < $nb; $i++) {
if ($ring[$i]['y'] != $ring[$i + 1]['y']) {
$x0 = $ring[$i]['x'];
$x1 = $ring[$i + 1]['x'];
@@ -515,9 +525,9 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry
*/
public function generateParams($value, $index = -1)
{
+ $params = array();
if ($index == -1) {
$index = 0;
- $params = array();
$data = PMA_GIS_Geometry::generateParams($value);
$params['srid'] = $data['srid'];
$wkt = $data['wkt'];
diff --git a/libraries/gis/pma_gis_visualization.php b/libraries/gis/GIS_Visualization.class.php
index 85f0e289bf..f86f451c22 100644
--- a/libraries/gis/pma_gis_visualization.php
+++ b/libraries/gis/GIS_Visualization.class.php
@@ -173,7 +173,7 @@ class PMA_GIS_Visualization
$output .= '<g id="groupPanel">';
$scale_data = $this->_scaleDataSet($this->_data);
- $output .= $this->_prepareDataSet($this->_data, $scale_data, 'svg', '');
+ $output .= $this->_prepareDataSet($this->_data, $scale_data, 'svg');
$output .= '</g>';
$output .= '</svg>';
@@ -256,7 +256,7 @@ class PMA_GIS_Visualization
// base64 encode
$encoded = base64_encode($output);
- return '<img src="data:image/png;base64,'. $encoded .'" />';
+ return '<img src="data:image/png;base64,' . $encoded . '" />';
}
/**
@@ -305,7 +305,7 @@ class PMA_GIS_Visualization
. 'map.addLayers([layerMapnik,layerCycleMap,layerNone]);'
. 'var vectorLayer = new OpenLayers.Layer.Vector("Data");'
. 'var bound;';
- $output .= $this->_prepareDataSet($this->_data, $scale_data, 'ol', '');
+ $output .= $this->_prepareDataSet($this->_data, $scale_data, 'ol');
$output .=
'map.addLayer(vectorLayer);'
. 'map.zoomToExtent(bound);'
@@ -441,16 +441,16 @@ class PMA_GIS_Visualization
/**
* Prepares and return the dataset as needed by the visualization.
*
- * @param array $data Raw data
- * @param array $scale_data Data related to scaling
- * @param string $format Format of the visulaization
- * @param object $results Image object in the case of png
- * TCPDF object in the case of pdf
+ * @param array $data Raw data
+ * @param array $scale_data Data related to scaling
+ * @param string $format Format of the visulaization
+ * @param null|object $results Image object in the case of png
+ * TCPDF object in the case of pdf
*
* @return mixed the formatted array of data
* @access private
*/
- private function _prepareDataSet($data, $scale_data, $format, $results)
+ private function _prepareDataSet($data, $scale_data, $format, $results = null)
{
$color_number = 0;