Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
86ca019e3d
@ -270,26 +270,28 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
|
||||
*/
|
||||
public function generateWkt($gis_data, $index, $empty = '')
|
||||
{
|
||||
$no_of_lines = isset($gis_data[$index]['MULTILINESTRING']['no_of_lines'])
|
||||
? $gis_data[$index]['MULTILINESTRING']['no_of_lines'] : 1;
|
||||
$data_row = $gis_data[$index]['MULTILINESTRING'];
|
||||
|
||||
$no_of_lines = isset($data_row['no_of_lines'])
|
||||
? $data_row['no_of_lines'] : 1;
|
||||
if ($no_of_lines < 1) {
|
||||
$no_of_lines = 1;
|
||||
}
|
||||
$wkt = 'MULTILINESTRING(';
|
||||
for ($i = 0; $i < $no_of_lines; $i++) {
|
||||
$no_of_points = isset($gis_data[$index]['MULTILINESTRING'][$i]['no_of_points'])
|
||||
? $gis_data[$index]['MULTILINESTRING'][$i]['no_of_points'] : 2;
|
||||
$no_of_points = isset($data_row[$i]['no_of_points'])
|
||||
? $data_row[$i]['no_of_points'] : 2;
|
||||
if ($no_of_points < 2) {
|
||||
$no_of_points = 2;
|
||||
}
|
||||
$wkt .= '(';
|
||||
for ($j = 0; $j < $no_of_points; $j++) {
|
||||
$wkt .= ((isset($gis_data[$index]['MULTILINESTRING'][$i][$j]['x'])
|
||||
&& trim($gis_data[$index]['MULTILINESTRING'][$i][$j]['x']) != '')
|
||||
? $gis_data[$index]['MULTILINESTRING'][$i][$j]['x'] : $empty)
|
||||
. ' ' . ((isset($gis_data[$index]['MULTILINESTRING'][$i][$j]['y'])
|
||||
&& trim($gis_data[$index]['MULTILINESTRING'][$i][$j]['y']) != '')
|
||||
? $gis_data[$index]['MULTILINESTRING'][$i][$j]['y'] : $empty) . ',';
|
||||
$wkt .= ((isset($data_row[$i][$j]['x'])
|
||||
&& trim($data_row[$i][$j]['x']) != '')
|
||||
? $data_row[$i][$j]['x'] : $empty)
|
||||
. ' ' . ((isset($data_row[$i][$j]['y'])
|
||||
&& trim($data_row[$i][$j]['y']) != '')
|
||||
? $data_row[$i][$j]['y'] : $empty) . ',';
|
||||
}
|
||||
$wkt = substr($wkt, 0, strlen($wkt) - 1);
|
||||
$wkt .= '),';
|
||||
|
||||
@ -338,33 +338,36 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
|
||||
*/
|
||||
public function generateWkt($gis_data, $index, $empty = '')
|
||||
{
|
||||
$no_of_polygons = isset($gis_data[$index]['MULTIPOLYGON']['no_of_polygons'])
|
||||
? $gis_data[$index]['MULTIPOLYGON']['no_of_polygons'] : 1;
|
||||
$data_row = $gis_data[$index]['MULTIPOLYGON'];
|
||||
|
||||
$no_of_polygons = isset($data_row['no_of_polygons'])
|
||||
? $data_row['no_of_polygons'] : 1;
|
||||
if ($no_of_polygons < 1) {
|
||||
$no_of_polygons = 1;
|
||||
}
|
||||
|
||||
$wkt = 'MULTIPOLYGON(';
|
||||
for ($k = 0; $k < $no_of_polygons; $k++) {
|
||||
$no_of_lines = isset($gis_data[$index]['MULTIPOLYGON'][$k]['no_of_lines'])
|
||||
? $gis_data[$index]['MULTIPOLYGON'][$k]['no_of_lines'] : 1;
|
||||
$no_of_lines = isset($data_row[$k]['no_of_lines'])
|
||||
? $data_row[$k]['no_of_lines'] : 1;
|
||||
if ($no_of_lines < 1) {
|
||||
$no_of_lines = 1;
|
||||
}
|
||||
$wkt .= '(';
|
||||
for ($i = 0; $i < $no_of_lines; $i++) {
|
||||
$no_of_points = isset($gis_data[$index]['MULTIPOLYGON'][$k][$i]['no_of_points'])
|
||||
? $gis_data[$index]['MULTIPOLYGON'][$k][$i]['no_of_points'] : 4;
|
||||
$no_of_points = isset($data_row[$k][$i]['no_of_points'])
|
||||
? $data_row[$k][$i]['no_of_points'] : 4;
|
||||
if ($no_of_points < 4) {
|
||||
$no_of_points = 4;
|
||||
}
|
||||
$wkt .= '(';
|
||||
for ($j = 0; $j < $no_of_points; $j++) {
|
||||
$wkt .= ((isset($gis_data[$index]['MULTIPOLYGON'][$k][$i][$j]['x'])
|
||||
&& trim($gis_data[$index]['MULTIPOLYGON'][$k][$i][$j]['x']) != '')
|
||||
? $gis_data[$index]['MULTIPOLYGON'][$k][$i][$j]['x'] : $empty)
|
||||
. ' ' . ((isset($gis_data[$index]['MULTIPOLYGON'][$k][$i][$j]['y'])
|
||||
&& trim($gis_data[$index]['MULTIPOLYGON'][$k][$i][$j]['y']) != '')
|
||||
? $gis_data[$index]['MULTIPOLYGON'][$k][$i][$j]['y'] : $empty) .',';
|
||||
$wkt .= ((isset($data_row[$k][$i][$j]['x'])
|
||||
&& trim($data_row[$k][$i][$j]['x']) != '')
|
||||
? $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) .',';
|
||||
}
|
||||
$wkt = substr($wkt, 0, strlen($wkt) - 1);
|
||||
$wkt .= '),';
|
||||
@ -484,32 +487,34 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
|
||||
$multipolygon = substr($wkt, 15, (strlen($wkt) - 18));
|
||||
// Seperate each polygon
|
||||
$polygons = explode(")),((", $multipolygon);
|
||||
$params[$index]['MULTIPOLYGON']['no_of_polygons'] = count($polygons);
|
||||
|
||||
$param_row =& $params[$index]['MULTIPOLYGON'];
|
||||
$param_row['no_of_polygons'] = count($polygons);
|
||||
|
||||
$k = 0;
|
||||
foreach ($polygons as $polygon) {
|
||||
// If the polygon doesnt have an inner polygon
|
||||
if (strpos($polygon, "),(") === false) {
|
||||
$params[$index]['MULTIPOLYGON'][$k]['no_of_lines'] = 1;
|
||||
$param_row[$k]['no_of_lines'] = 1;
|
||||
$points_arr = $this->extractPoints($polygon, null);
|
||||
$no_of_points = count($points_arr);
|
||||
$params[$index]['MULTIPOLYGON'][$k][0]['no_of_points'] = $no_of_points;
|
||||
$param_row[$k][0]['no_of_points'] = $no_of_points;
|
||||
for ($i = 0; $i < $no_of_points; $i++) {
|
||||
$params[$index]['MULTIPOLYGON'][$k][0][$i]['x'] = $points_arr[$i][0];
|
||||
$params[$index]['MULTIPOLYGON'][$k][0][$i]['y'] = $points_arr[$i][1];
|
||||
$param_row[$k][0][$i]['x'] = $points_arr[$i][0];
|
||||
$param_row[$k][0][$i]['y'] = $points_arr[$i][1];
|
||||
}
|
||||
} else {
|
||||
// Seperate outer and inner polygons
|
||||
$parts = explode("),(", $polygon);
|
||||
$params[$index]['MULTIPOLYGON'][$k]['no_of_lines'] = count($parts);
|
||||
$param_row[$k]['no_of_lines'] = count($parts);
|
||||
$j = 0;
|
||||
foreach ($parts as $ring) {
|
||||
$points_arr = $this->extractPoints($ring, null);
|
||||
$no_of_points = count($points_arr);
|
||||
$params[$index]['MULTIPOLYGON'][$k][$j]['no_of_points'] = $no_of_points;
|
||||
$param_row[$k][$j]['no_of_points'] = $no_of_points;
|
||||
for ($i = 0; $i < $no_of_points; $i++) {
|
||||
$params[$index]['MULTIPOLYGON'][$k][$j][$i]['x'] = $points_arr[$i][0];
|
||||
$params[$index]['MULTIPOLYGON'][$k][$j][$i]['y'] = $points_arr[$i][1];
|
||||
$param_row[$k][$j][$i]['x'] = $points_arr[$i][0];
|
||||
$param_row[$k][$j][$i]['y'] = $points_arr[$i][1];
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
|
||||
@ -451,9 +451,9 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry
|
||||
*/
|
||||
public static function getPointOnSurface($ring)
|
||||
{
|
||||
|
||||
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
|
||||
|
||||
// Find two consecutive distinct points.
|
||||
for ($i = 0; $i < count($ring) - 1; $i++) {
|
||||
if ($ring[$i]['y'] != $ring[$i + 1]['y']) {
|
||||
@ -475,7 +475,10 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry
|
||||
|
||||
// Always keep $epsilon < 1 to go with the reduction logic down here
|
||||
$epsilon = 0.1;
|
||||
$denominator = sqrt($common_functions->pow(($y1 - $y0), 2) + $common_functions->pow(($x0 - $x1), 2));
|
||||
$denominator = sqrt(
|
||||
$common_functions->pow(($y1 - $y0), 2)
|
||||
+ $common_functions->pow(($x0 - $x1), 2)
|
||||
);
|
||||
$pointA = array(); $pointB = array();
|
||||
|
||||
while (true) {
|
||||
|
||||
@ -295,15 +295,19 @@ class PMA_GIS_Visualization
|
||||
. 'units: "m",'
|
||||
. 'numZoomLevels: 18,'
|
||||
. 'maxResolution: 156543.0339,'
|
||||
. 'maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508),'
|
||||
. 'restrictedExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508)'
|
||||
. 'maxExtent: new OpenLayers.Bounds('
|
||||
. '-20037508, -20037508, 20037508, 20037508),'
|
||||
. 'restrictedExtent: new OpenLayers.Bounds('
|
||||
. '-20037508, -20037508, 20037508, 20037508)'
|
||||
. '};'
|
||||
. 'var map = new OpenLayers.Map("openlayersmap", options);'
|
||||
. 'var layerNone = new OpenLayers.Layer.Boxes("None", {isBaseLayer: true});'
|
||||
. 'var layerNone = new OpenLayers.Layer.Boxes('
|
||||
. '"None", {isBaseLayer: true});'
|
||||
. 'var layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");'
|
||||
. 'var layerOsmarender = new OpenLayers.Layer.OSM.Osmarender("Osmarender");'
|
||||
. 'var layerOsmarender = new OpenLayers.Layer.OSM.Osmarender('
|
||||
. '"Osmarender");'
|
||||
. 'var layerCycleMap = new OpenLayers.Layer.OSM.CycleMap("CycleMap");'
|
||||
. 'map.addLayers([layerMapnik, layerOsmarender, layerCycleMap, layerNone]);'
|
||||
. 'map.addLayers([layerMapnik,layerOsmarender,layerCycleMap,layerNone]);'
|
||||
. 'var vectorLayer = new OpenLayers.Layer.Vector("Data");'
|
||||
. 'var bound;';
|
||||
$output .= $this->_prepareDataSet($this->_data, $scale_data, 'ol', '');
|
||||
|
||||
@ -705,7 +705,7 @@ function PMA_getValueColumn($column, $backup_field, $column_name_appendix,
|
||||
}
|
||||
|
||||
if (in_array($column['pma_type'], $gis_data_types)) {
|
||||
$html_output .= PMA_getHTMLforGisDataTypes($current_row, $column);
|
||||
$html_output .= PMA_getHTMLforGisDataTypes();
|
||||
}
|
||||
|
||||
return $html_output;
|
||||
@ -1190,7 +1190,7 @@ function PMA_getSelectOptionForUpload($vkey, $column)
|
||||
$files = PMA_getFileSelectOptions(
|
||||
PMA_CommonFunctions::getInstance()->userDir($GLOBALS['cfg']['UploadDir'])
|
||||
);
|
||||
|
||||
|
||||
if ($files === false) {
|
||||
return '<font color="red">' . __('Error') . '</font><br />' . "\n"
|
||||
. __('The directory you set for upload work cannot be reached') . "\n";
|
||||
@ -1357,27 +1357,11 @@ function PMA_getColumnSize($column, $extracted_columnspec)
|
||||
/**
|
||||
* Get HTML for gis data types
|
||||
*
|
||||
* @param string $current_row row description
|
||||
* @param array $column description of column in given table
|
||||
*
|
||||
* @return string an html snippet
|
||||
* @return string an html snippet
|
||||
*/
|
||||
function PMA_getHTMLforGisDataTypes($current_row, $column)
|
||||
function PMA_getHTMLforGisDataTypes()
|
||||
{
|
||||
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
$data_val = isset($current_row[$column['Field']])
|
||||
? $current_row[$column['Field']]
|
||||
: '';
|
||||
|
||||
$_url_params = array(
|
||||
'field' => $column['Field_title'],
|
||||
'value' => $data_val,
|
||||
);
|
||||
if ($column['pma_type'] != 'geometry') {
|
||||
$_url_params = $_url_params
|
||||
+ array('gis_data[gis_type]' => strtoupper($column['pma_type']));
|
||||
}
|
||||
$edit_str = $common_functions->getIcon('b_edit.png', __('Edit/Insert'));
|
||||
return '<span class="open_gis_editor">'
|
||||
. $common_functions->linkOrButton(
|
||||
@ -1629,7 +1613,7 @@ function PMA_getSpecialCharsAndBackupFieldForExistingRow(
|
||||
$current_row, $column, $extracted_columnspec,
|
||||
$real_null_value, $gis_data_types, $column_name_appendix
|
||||
) {
|
||||
|
||||
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
$special_chars_encoded = '';
|
||||
// (we are editing)
|
||||
@ -1639,7 +1623,7 @@ function PMA_getSpecialCharsAndBackupFieldForExistingRow(
|
||||
$special_chars = '';
|
||||
$data = $current_row[$column['Field']];
|
||||
} elseif ($column['True_Type'] == 'bit') {
|
||||
$special_chars = PMA_printable_bit_value(
|
||||
$special_chars = $common_functions->printableBitValue(
|
||||
$current_row[$column['Field']], $extracted_columnspec['spec_in_brackets']
|
||||
);
|
||||
} elseif (in_array($column['True_Type'], $gis_data_types)) {
|
||||
@ -1806,12 +1790,12 @@ function PMA_isInsertRow()
|
||||
*/
|
||||
function PMA_setSessionForEditNext($one_where_clause)
|
||||
{
|
||||
|
||||
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
$local_query = 'SELECT * FROM ' . $common_functions->backquote($GLOBALS['db'])
|
||||
. '.' . $common_functions->backquote($GLOBALS['table']) . ' WHERE '
|
||||
. str_replace('` =', '` >', $one_where_clause) . ' LIMIT 1;';
|
||||
|
||||
|
||||
$res = PMA_DBI_query($local_query);
|
||||
$row = PMA_DBI_fetch_row($res);
|
||||
$meta = PMA_DBI_get_fields_meta($res);
|
||||
@ -2007,9 +1991,9 @@ function PMA_getWarningMessages()
|
||||
function PMA_getDisplayValueForForeignTableColumn($where_comparison,
|
||||
$relation_field_value, $map, $relation_field
|
||||
) {
|
||||
|
||||
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
|
||||
|
||||
$display_field = PMA_getDisplayField(
|
||||
$map[$relation_field]['foreign_db'],
|
||||
$map[$relation_field]['foreign_table']
|
||||
@ -2046,9 +2030,9 @@ function PMA_getDisplayValueForForeignTableColumn($where_comparison,
|
||||
function PMA_getLinkForRelationalDisplayField($map, $relation_field,
|
||||
$where_comparison, $dispval, $relation_field_value
|
||||
) {
|
||||
|
||||
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
|
||||
|
||||
if ('K' == $_SESSION['tmp_user_values']['relational_display']) {
|
||||
// user chose "relational key" in the display options, so
|
||||
// the title contains the display field
|
||||
@ -2200,9 +2184,9 @@ function PMA_getQueryValuesForInsertAndUpdateInMultipleEdit($multi_edit_columns_
|
||||
$multi_edit_funcs,$is_insert, $query_values, $query_fields,
|
||||
$current_value_as_an_array, $value_sets, $key, $multi_edit_columns_null_prev
|
||||
) {
|
||||
|
||||
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
|
||||
|
||||
// i n s e r t
|
||||
if ($is_insert) {
|
||||
// no need to add column into the valuelist
|
||||
@ -2266,9 +2250,9 @@ function PMA_getCurrentValueForDifferentTypes($possibly_uploaded_val, $key,
|
||||
$rownumber, $multi_edit_columns_name, $multi_edit_columns_null,
|
||||
$multi_edit_columns_null_prev, $is_insert, $using_key, $where_clause, $table
|
||||
) {
|
||||
|
||||
|
||||
$common_functions = PMA_CommonFunctions::getInstance();
|
||||
|
||||
|
||||
// Fetch the current values of a row to use in case we have a protected field
|
||||
if ($is_insert
|
||||
&& $using_key && isset($multi_edit_columns_type)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user