Merge remote-tracking branch 'origin/master'

This commit is contained in:
Michal Čihař 2012-05-06 11:33:36 +02:00
commit e8d610d955
11 changed files with 226 additions and 82 deletions

View File

@ -1,5 +1,11 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Contains the factory class that handles the creation of geometric objects
*
* @package PhpMyAdmin-GIS
*/
if (! defined('PHPMYADMIN')) {
exit;
}
@ -29,7 +35,7 @@ class PMA_GIS_Factory
return false;
}
if (include_once './libraries/gis/pma_gis_' . $type_lower . '.php') {
switch($type) {
switch(strtoupper($type)) {
case 'MULTIPOLYGON' :
return PMA_GIS_Multipolygon::singleton();
case 'POLYGON' :

View File

@ -1,5 +1,11 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Base class for all GIS data type classes
*
* @package PhpMyAdmin-GIS
*/
if (! defined('PHPMYADMIN')) {
exit;
}
@ -36,7 +42,9 @@ abstract class PMA_GIS_Geometry
* @return object the modified image object
* @access public
*/
public abstract function prepareRowAsPng($spatial, $label, $color, $scale_data, $image);
public abstract function prepareRowAsPng($spatial, $label, $color,
$scale_data, $image
);
/**
* Adds to the TCPDF instance, the data related to a row in the GIS dataset.
@ -50,7 +58,9 @@ abstract class PMA_GIS_Geometry
* @return object the modified TCPDF instance
* @access public
*/
public abstract function prepareRowAsPdf($spatial, $label, $color, $scale_data, $pdf);
public abstract function prepareRowAsPdf($spatial, $label, $color,
$scale_data, $pdf
);
/**
* Prepares the JavaScript related to a row in the GIS dataset
@ -65,7 +75,9 @@ abstract class PMA_GIS_Geometry
* @return string the JavaScript related to a row in the GIS dataset
* @access public
*/
public abstract function prepareRowAsOl($spatial, $srid, $label, $color, $scale_data);
public abstract function prepareRowAsOl($spatial, $srid, $label,
$color, $scale_data
);
/**
* Scales each row.
@ -160,7 +172,8 @@ abstract class PMA_GIS_Geometry
*/
protected function generateParams($value)
{
$geom_types = '(POINT|MULTIPOINT|LINESTRING|MULTILINESTRING|POLYGON|MULTIPOLYGON|GEOMETRYCOLLECTION)';
$geom_types = '(POINT|MULTIPOINT|LINESTRING|MULTILINESTRING'
. '|POLYGON|MULTIPOLYGON|GEOMETRYCOLLECTION)';
$srid = 0;
$wkt = '';
if (preg_match("/^'" . $geom_types . "\(.*\)',[0-9]*$/i", $value)) {
@ -199,7 +212,8 @@ abstract class PMA_GIS_Geometry
) {
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'];
$y = $scale_data['height']
- ($cordinates[1] - $scale_data['y']) * $scale_data['scale'];
} else {
$x = trim($cordinates[0]);
$y = trim($cordinates[1]);
@ -271,12 +285,16 @@ abstract class PMA_GIS_Geometry
* or LineRing to OpenLayers
* @access protected
*/
protected function getLineArrayForOpenLayers($lines, $srid, $is_line_string = true)
{
protected function getLineArrayForOpenLayers($lines, $srid,
$is_line_string = true
) {
$ol_array = 'new Array(';
foreach ($lines as $line) {
$points_arr = $this->extractPoints($line, null);
$ol_array .= $this->getLineForOpenLayers($points_arr, $srid, $is_line_string) . ', ';
$ol_array .= $this->getLineForOpenLayers(
$points_arr, $srid, $is_line_string
);
$ol_array .= ', ';
}
$ol_array = substr($ol_array, 0, strlen($ol_array) - 2);
$ol_array .= ')';
@ -294,8 +312,9 @@ abstract class PMA_GIS_Geometry
* @return string JavaScript for adding a LineString or LineRing to OpenLayers
* @access protected
*/
protected function getLineForOpenLayers($points_arr, $srid, $is_line_string = true)
{
protected function getLineForOpenLayers($points_arr, $srid,
$is_line_string = true
) {
return 'new OpenLayers.Geometry.'
. ($is_line_string ? 'LineString' : 'LinearRing') . '('
. $this->getPointsArrayForOpenLayers($points_arr, $srid)
@ -334,8 +353,9 @@ abstract class PMA_GIS_Geometry
*/
protected function getPointForOpenLayers($point, $srid)
{
return '(new OpenLayers.Geometry.Point(' . $point[0] . ', ' . $point[1] . '))'
. '.transform(new OpenLayers.Projection("EPSG:' . $srid . '"), map.getProjectionObject())';
return '(new OpenLayers.Geometry.Point(' . $point[0] . ',' . $point[1] . '))'
. '.transform(new OpenLayers.Projection("EPSG:'
. $srid . '"), map.getProjectionObject())';
}
}
?>

View File

@ -1,11 +1,17 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Handles actions related to GIS GEOMETRYCOLLECTION objects
*
* @package PhpMyAdmin-GIS
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Handles the visualization of GIS GEOMETRYCOLLECTION objects.
* Handles actions related to GIS GEOMETRYCOLLECTION objects
*
* @package PhpMyAdmin-GIS
*/
@ -118,7 +124,9 @@ class PMA_GIS_Geometrycollection extends PMA_GIS_Geometry
if (! $gis_obj) {
continue;
}
$image = $gis_obj->prepareRowAsPng($sub_part, $label, $color, $scale_data, $image);
$image = $gis_obj->prepareRowAsPng(
$sub_part, $label, $color, $scale_data, $image
);
}
return $image;
}
@ -150,7 +158,9 @@ class PMA_GIS_Geometrycollection extends PMA_GIS_Geometry
if (! $gis_obj) {
continue;
}
$pdf = $gis_obj->prepareRowAsPdf($sub_part, $label, $color, $scale_data, $pdf);
$pdf = $gis_obj->prepareRowAsPdf(
$sub_part, $label, $color, $scale_data, $pdf
);
}
return $pdf;
}
@ -183,7 +193,9 @@ class PMA_GIS_Geometrycollection extends PMA_GIS_Geometry
if (! $gis_obj) {
continue;
}
$row .= $gis_obj->prepareRowAsSvg($sub_part, $label, $color, $scale_data);
$row .= $gis_obj->prepareRowAsSvg(
$sub_part, $label, $color, $scale_data
);
}
return $row;
}
@ -218,7 +230,9 @@ class PMA_GIS_Geometrycollection extends PMA_GIS_Geometry
if (! $gis_obj) {
continue;
}
$row .= $gis_obj->prepareRowAsOl($sub_part, $srid, $label, $color, $scale_data);
$row .= $gis_obj->prepareRowAsOl(
$sub_part, $srid, $label, $color, $scale_data
);
}
return $row;
}

View File

@ -1,11 +1,17 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Handles actions related to GIS LINESTRING objects
*
* @package PhpMyAdmin-GIS
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Handles the visualization of GIS LINESTRING objects.
* Handles actions related to GIS LINESTRING objects
*
* @package PhpMyAdmin-GIS
*/
@ -66,8 +72,9 @@ class PMA_GIS_Linestring extends PMA_GIS_Geometry
* @return object the modified image object
* @access public
*/
public function prepareRowAsPng($spatial, $label, $line_color, $scale_data, $image)
{
public function prepareRowAsPng($spatial, $label, $line_color,
$scale_data, $image
) {
// allocate colors
$black = imagecolorallocate($image, 0, 0, 0);
$red = hexdec(substr($line_color, 1, 2));
@ -84,13 +91,19 @@ class PMA_GIS_Linestring extends PMA_GIS_Geometry
$temp_point = $point;
} else {
// draw line section
imageline($image, $temp_point[0], $temp_point[1], $point[0], $point[1], $color);
imageline(
$image, $temp_point[0], $temp_point[1],
$point[0], $point[1], $color
);
$temp_point = $point;
}
}
// print label if applicable
if (isset($label) && trim($label) != '') {
imagestring($image, 1, $points_arr[1][0], $points_arr[1][1], trim($label), $black);
imagestring(
$image, 1, $points_arr[1][0],
$points_arr[1][1], trim($label), $black
);
}
return $image;
}
@ -124,7 +137,10 @@ class PMA_GIS_Linestring extends PMA_GIS_Geometry
$temp_point = $point;
} else {
// draw line section
$pdf->Line($temp_point[0], $temp_point[1], $point[0], $point[1], $line);
$pdf->Line(
$temp_point[0], $temp_point[1],
$point[0], $point[1], $line
);
$temp_point = $point;
}
}

View File

@ -1,11 +1,17 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Handles actions related to GIS MULTILINESTRING objects
*
* @package PhpMyAdmin-GIS
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Handles the visualization of GIS MULTILINESTRING objects.
* Handles actions related to GIS MULTILINESTRING objects
*
* @package PhpMyAdmin-GIS
*/
@ -75,8 +81,9 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
* @return object the modified image object
* @access public
*/
public function prepareRowAsPng($spatial, $label, $line_color, $scale_data, $image)
{
public function prepareRowAsPng($spatial, $label, $line_color,
$scale_data, $image
) {
// allocate colors
$black = imagecolorallocate($image, 0, 0, 0);
$red = hexdec(substr($line_color, 1, 2));
@ -97,14 +104,20 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
$temp_point = $point;
} else {
// draw line section
imageline($image, $temp_point[0], $temp_point[1], $point[0], $point[1], $color);
imageline(
$image, $temp_point[0], $temp_point[1],
$point[0], $point[1], $color
);
$temp_point = $point;
}
}
unset($temp_point);
// print label if applicable
if (isset($label) && trim($label) != '' && $first_line) {
imagestring($image, 1, $points_arr[1][0], $points_arr[1][1], trim($label), $black);
imagestring(
$image, 1, $points_arr[1][0],
$points_arr[1][1], trim($label), $black
);
}
$first_line = false;
}
@ -144,7 +157,9 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
$temp_point = $point;
} else {
// draw line section
$pdf->Line($temp_point[0], $temp_point[1], $point[0], $point[1], $line);
$pdf->Line(
$temp_point[0], $temp_point[1], $point[0], $point[1], $line
);
$temp_point = $point;
}
}

View File

@ -1,11 +1,17 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Handles actions related to GIS MULTIPOINT objects
*
* @package PhpMyAdmin-GIS
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Handles the visualization of GIS MULTIPOINT objects.
* Handles actions related to GIS MULTIPOINT objects
*
* @package PhpMyAdmin-GIS
*/
@ -66,8 +72,9 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry
* @return object the modified image object
* @access public
*/
public function prepareRowAsPng($spatial, $label, $point_color, $scale_data, $image)
{
public function prepareRowAsPng($spatial, $label, $point_color,
$scale_data, $image
) {
// allocate colors
$black = imagecolorallocate($image, 0, 0, 0);
$red = hexdec(substr($point_color, 1, 2));
@ -89,7 +96,9 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry
if ((isset($label) && trim($label) != '')
&& ($points_arr[0][0] != '' && $points_arr[0][1] != '')
) {
imagestring($image, 1, $points_arr[0][0], $points_arr[0][1], trim($label), $black);
imagestring(
$image, 1, $points_arr[0][0], $points_arr[0][1], trim($label), $black
);
}
return $image;
}
@ -106,8 +115,9 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry
* @return object the modified TCPDF instance
* @access public
*/
public function prepareRowAsPdf($spatial, $label, $point_color, $scale_data, $pdf)
{
public function prepareRowAsPdf($spatial, $label, $point_color,
$scale_data, $pdf
) {
// allocate colors
$red = hexdec(substr($point_color, 1, 2));
$green = hexdec(substr($point_color, 3, 2));
@ -163,7 +173,8 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry
$row = '';
foreach ($points_arr as $point) {
if ($point[0] != '' && $point[1] != '') {
$row .= '<circle cx="' . $point[0] . '" cy="' . $point[1] . '" r="3"';
$row .= '<circle cx="' . $point[0] . '" cy="'
. $point[1] . '" r="3"';
$point_options['id'] = $label . rand();
foreach ($point_options as $option => $val) {
$row .= ' ' . $option . '="' . trim($val) . '"';
@ -188,8 +199,9 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry
* @return string JavaScript related to a row in the GIS dataset
* @access public
*/
public function prepareRowAsOl($spatial, $srid, $label, $point_color, $scale_data)
{
public function prepareRowAsOl($spatial, $srid, $label,
$point_color, $scale_data
) {
$style_options = array(
'pointRadius' => 3,
'fillColor' => '#ffffff',
@ -258,7 +270,8 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry
{
$wkt = 'MULTIPOINT(';
for ($i = 0; $i < $row_data['numpoints']; $i++) {
$wkt .= $row_data['points'][$i]['x'] . ' ' . $row_data['points'][$i]['y'] . ',';
$wkt .= $row_data['points'][$i]['x'] . ' '
. $row_data['points'][$i]['y'] . ',';
}
$wkt = substr($wkt, 0, strlen($wkt) - 1);
$wkt .= ')';

View File

@ -1,11 +1,17 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Handles actions related to GIS MULTIPOLYGON objects
*
* @package PhpMyAdmin-GIS
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Handles the visualization of GIS MULTIPOLYGON objects.
* Handles actions related to GIS MULTIPOLYGON objects
*
* @package PhpMyAdmin-GIS
*/
@ -83,8 +89,9 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
* @return object the modified image object
* @access public
*/
public function prepareRowAsPng($spatial, $label, $fill_color, $scale_data, $image)
{
public function prepareRowAsPng($spatial, $label, $fill_color,
$scale_data, $image
) {
// allocate colors
$black = imagecolorallocate($image, 0, 0, 0);
$red = hexdec(substr($fill_color, 1, 2));
@ -112,7 +119,8 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
foreach ($inner as $inner_poly) {
$points_arr = array_merge(
$points_arr, $this->extractPoints($inner_poly, $scale_data, true)
$points_arr,
$this->extractPoints($inner_poly, $scale_data, true)
);
}
}
@ -126,7 +134,9 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
}
// print label if applicable
if (isset($label_point)) {
imagestring($image, 1, $points_arr[2], $points_arr[3], trim($label), $black);
imagestring(
$image, 1, $points_arr[2], $points_arr[3], trim($label), $black
);
}
return $image;
}
@ -382,7 +392,8 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
// correctly classify inner rings to their respective outer rings.
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']);
$row_data['parts'][$i]['isOuter']
= PMA_GIS_Polygon::isOuterRing($ring['points']);
}
// Find points on surface for inner rings

View File

@ -1,11 +1,17 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Handles actions related to GIS POINT objects
*
* @package PhpMyAdmin-GIS
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Handles the visualization of GIS POINT objects.
* Handles actions related to GIS POINT objects
*
* @package PhpMyAdmin-GIS
*/
@ -66,8 +72,9 @@ class PMA_GIS_Point extends PMA_GIS_Geometry
* @return object the modified image object
* @access public
*/
public function prepareRowAsPng($spatial, $label, $point_color, $scale_data, $image)
{
public function prepareRowAsPng($spatial, $label, $point_color,
$scale_data, $image
) {
// allocate colors
$black = imagecolorallocate($image, 0, 0, 0);
$red = hexdec(substr($point_color, 1, 2));
@ -81,10 +88,15 @@ class PMA_GIS_Point extends PMA_GIS_Geometry
// draw a small circle to mark the point
if ($points_arr[0][0] != '' && $points_arr[0][1] != '') {
imagearc($image, $points_arr[0][0], $points_arr[0][1], 7, 7, 0, 360, $color);
imagearc(
$image, $points_arr[0][0], $points_arr[0][1], 7, 7, 0, 360, $color
);
// print label if applicable
if (isset($label) && trim($label) != '') {
imagestring($image, 1, $points_arr[0][0], $points_arr[0][1], trim($label), $black);
imagestring(
$image, 1, $points_arr[0][0],
$points_arr[0][1], trim($label), $black
);
}
}
return $image;
@ -102,8 +114,9 @@ class PMA_GIS_Point extends PMA_GIS_Geometry
* @return object the modified TCPDF instance
* @access public
*/
public function prepareRowAsPdf($spatial, $label, $point_color, $scale_data, $pdf)
{
public function prepareRowAsPdf($spatial, $label, $point_color,
$scale_data, $pdf
) {
// allocate colors
$red = hexdec(substr($point_color, 1, 2));
$green = hexdec(substr($point_color, 3, 2));
@ -116,7 +129,9 @@ class PMA_GIS_Point extends PMA_GIS_Geometry
// draw a small circle to mark the point
if ($points_arr[0][0] != '' && $points_arr[0][1] != '') {
$pdf->Circle($points_arr[0][0], $points_arr[0][1], 2, 0, 360, 'D', $line);
$pdf->Circle(
$points_arr[0][0], $points_arr[0][1], 2, 0, 360, 'D', $line
);
// print label if applicable
if (isset($label) && trim($label) != '') {
$pdf->SetXY($points_arr[0][0], $points_arr[0][1]);
@ -155,7 +170,8 @@ class PMA_GIS_Point extends PMA_GIS_Geometry
$row = '';
if ($points_arr[0][0] != '' && $points_arr[0][1] != '') {
$row .= '<circle cx="' . $points_arr[0][0] . '" cy="' . $points_arr[0][1] . '" r="3"';
$row .= '<circle cx="' . $points_arr[0][0]
. '" cy="' . $points_arr[0][1] . '" r="3"';
foreach ($point_options as $option => $val) {
$row .= ' ' . $option . '="' . trim($val) . '"';
}
@ -178,8 +194,9 @@ class PMA_GIS_Point extends PMA_GIS_Geometry
* @return string JavaScript related to a row in the GIS dataset
* @access public
*/
public function prepareRowAsOl($spatial, $srid, $label, $point_color, $scale_data)
{
public function prepareRowAsOl($spatial, $srid, $label,
$point_color, $scale_data
) {
$style_options = array(
'pointRadius' => 3,
'fillColor' => '#ffffff',
@ -219,9 +236,12 @@ class PMA_GIS_Point extends PMA_GIS_Geometry
public function generateWkt($gis_data, $index, $empty = '')
{
return 'POINT('
. ((isset($gis_data[$index]['POINT']['x']) && trim($gis_data[$index]['POINT']['x']) != '')
? $gis_data[$index]['POINT']['x'] : '') . ' '
. ((isset($gis_data[$index]['POINT']['y']) && trim($gis_data[$index]['POINT']['y']) != '')
. ((isset($gis_data[$index]['POINT']['x'])
&& trim($gis_data[$index]['POINT']['x']) != '')
? $gis_data[$index]['POINT']['x'] : '')
. ' '
. ((isset($gis_data[$index]['POINT']['y'])
&& trim($gis_data[$index]['POINT']['y']) != '')
? $gis_data[$index]['POINT']['y'] : '') . ')';
}

View File

@ -1,11 +1,17 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Handles actions related to GIS POLYGON objects
*
* @package PhpMyAdmin-GIS
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Handles the visualization of GIS POLYGON objects.
* Handles actions related to GIS POLYGON objects
*
* @package PhpMyAdmin-GIS
*/
@ -75,8 +81,9 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry
* @return object the modified image object
* @access public
*/
public function prepareRowAsPng($spatial, $label, $fill_color, $scale_data, $image)
{
public function prepareRowAsPng($spatial, $label, $fill_color,
$scale_data, $image
) {
// allocate colors
$black = imagecolorallocate($image, 0, 0, 0);
$red = hexdec(substr($fill_color, 1, 2));
@ -109,7 +116,9 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry
imagefilledpolygon($image, $points_arr, sizeof($points_arr) / 2, $color);
// print label if applicable
if (isset($label) && trim($label) != '') {
imagestring($image, 1, $points_arr[2], $points_arr[3], trim($label), $black);
imagestring(
$image, 1, $points_arr[2], $points_arr[3], trim($label), $black
);
}
return $image;
}

View File

@ -1,11 +1,17 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Handles visualization of GIS data
*
* @package PhpMyAdmin-GIS
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Generates the JavaScripts needed to visualize GIS data.
* Handles visualization of GIS data
*
* @package PhpMyAdmin-GIS
*/
@ -100,7 +106,10 @@ class PMA_GIS_Visualization
private function _handleOptions()
{
if (! is_null($this->_userSpecifiedSettings)) {
$this->_settings = array_merge($this->_settings, $this->_userSpecifiedSettings);
$this->_settings = array_merge(
$this->_settings,
$this->_userSpecifiedSettings
);
}
}
@ -120,7 +129,9 @@ class PMA_GIS_Visualization
// Check if the user already added extension;
// get the substring where the extension would be if it was included
$extension_start_pos = strlen($file_name) - strlen($ext) - 1;
$user_extension = substr($file_name, $extension_start_pos, strlen($file_name));
$user_extension = substr(
$file_name, $extension_start_pos, strlen($file_name)
);
$required_extension = "." . $ext;
if (strtolower($user_extension) != $required_extension) {
$file_name .= $required_extension;
@ -159,7 +170,8 @@ class PMA_GIS_Visualization
$output = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . "\n";
$output .= '<svg version="1.1" xmlns:svg="http://www.w3.org/2000/svg"'
. ' xmlns="http://www.w3.org/2000/svg" width="' . $this->_settings['width'] . '"'
. ' xmlns="http://www.w3.org/2000/svg"'
. ' width="' . $this->_settings['width'] . '"'
. ' height="' . $this->_settings['height'] . '">';
$output .= '<g id="groupPanel">';
@ -210,7 +222,10 @@ class PMA_GIS_Visualization
$this->init();
// create image
$image = imagecreatetruecolor($this->_settings['width'], $this->_settings['height']);
$image = imagecreatetruecolor(
$this->_settings['width'],
$this->_settings['height']
);
// fill the background
$bg = imagecolorallocate($image, 229, 229, 229);
@ -318,7 +333,9 @@ class PMA_GIS_Visualization
include_once './libraries/tcpdf/tcpdf.php';
// create pdf
$pdf = new TCPDF('', 'pt', $GLOBALS['cfg']['PDFDefaultPageSize'], true, 'UTF-8', false);
$pdf = new TCPDF(
'', 'pt', $GLOBALS['cfg']['PDFDefaultPageSize'], true, 'UTF-8', false
);
// disable header and footer
$pdf->setPrintHeader(false);
@ -367,7 +384,9 @@ class PMA_GIS_Visualization
if (! $gis_obj) {
continue;
}
$scale_data = $gis_obj->scaleRow($row[$this->_settings['spatialColumn']]);
$scale_data = $gis_obj->scaleRow(
$row[$this->_settings['spatialColumn']]
);
// Upadate minimum/maximum values for x and y cordinates.
$c_maxX = (float) $scale_data['maxX'];

View File

@ -75,7 +75,7 @@ if (isset($plugin_list)) {
/**
* Returns whether the 'dbase' extension is loaded
*
* @return whether the 'dbase' extension is loaded
* @return boolean whether the 'dbase' extension is loaded
*/
function _isDbaseLoaded()
{
@ -384,31 +384,25 @@ if (isset($plugin_list)) {
31 => 'MultiPatch',
);
include_once './libraries/gis/pma_gis_geometry.php';
switch ($shp->shapeType) {
// ESRI Null Shape
case 0:
$gis_obj = null;
break;
// ESRI Point
case 1:
include_once './libraries/gis/pma_gis_point.php';
$gis_obj = PMA_GIS_Point::singleton();
$gis_type = 'point';
break;
// ESRI PolyLine
case 3:
include_once './libraries/gis/pma_gis_multilinestring.php';
$gis_obj = PMA_GIS_Multilinestring::singleton();
$gis_type = 'multilinestring';
break;
// ESRI Polygon
case 5:
include_once './libraries/gis/pma_gis_multipolygon.php';
$gis_obj = PMA_GIS_Multipolygon::singleton();
$gis_type = 'multipolygon';
break;
// ESRI MultiPoint
case 8:
include_once './libraries/gis/pma_gis_multipoint.php';
$gis_obj = PMA_GIS_Multipoint::singleton();
$gis_type = 'multipoint';
break;
default:
$error = true;
@ -421,6 +415,13 @@ if (isset($plugin_list)) {
return;
}
if (isset($gis_type)) {
include_once './libraries/gis/pma_gis_factory.php';
$gis_obj = PMA_GIS_Factory::factory($gis_type);
} else {
$gis_obj = null;
}
$num_rows = count($shp->records);
// If .dbf file is loaded, the number of extra data columns
$num_data_cols = isset($shp->DBFHeader) ? count($shp->DBFHeader) : 0;