Labels for visualizations with OpenStreetMaps. New icon for the 'Visualize GIS data' link.

This commit is contained in:
Madhura Jayaratne 2011-06-14 18:49:32 +05:30
parent 28a9b971bf
commit 9f4c4c91cf
9 changed files with 42 additions and 24 deletions

View File

@ -187,16 +187,18 @@ $(document).ready(function() {
+ '.geometrycollection').live('mousemove', function(event) {
contents = $(this).attr('name');
$("#tooltip").remove();
$('<div id="tooltip">' + contents + '</div>').css({
position : 'absolute',
display : 'none',
top : event.pageY + 10,
left : event.pageX + 10,
border : '1px solid #fdd',
padding : '2px',
'background-color' : '#fee',
opacity : 0.80
}).appendTo("body").fadeIn(200);
if (contents != '') {
$('<div id="tooltip">' + contents + '</div>').css({
position : 'absolute',
display : 'none',
top : event.pageY + 10,
left : event.pageX + 10,
border : '1px solid #fdd',
padding : '2px',
'background-color' : '#fee',
opacity : 0.80
}).appendTo("body").fadeIn(200);
}
});
/**

View File

@ -2460,7 +2460,7 @@ function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql) {
if ($geometry_found) {
echo PMA_linkOrButton(
'tbl_gis_visualization.php' . PMA_generate_common_url($_url_params),
PMA_getIcon('b_chart.png', __('Visualize GIS data'), false, true),
PMA_getIcon('b_globe.gif', __('Visualize GIS data'), false, true),
'', true, true, '') . "\n";
}
}

View File

@ -168,6 +168,8 @@ class PMA_GIS_Linestring extends PMA_GIS_Geometry
$style_options = array(
'strokeColor' => $line_color,
'strokeWidth' => 2,
'label' => $label,
'fontSize' => 10,
);
if ($srid == 0) {
$srid = 4326;

View File

@ -193,6 +193,8 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
$style_options = array(
'strokeColor' => $line_color,
'strokeWidth' => 2,
'label' => $label,
'fontSize' => 10,
);
if ($srid == 0) {
$srid = 4326;

View File

@ -155,10 +155,13 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry
public function prepareRowAsOl($spatial, $srid, $label, $point_color)
{
$style_options = array(
'pointRadius' => 3,
'fillColor' => '#ffffff',
'strokeColor' => $point_color,
'strokeWidth' => 2,
'pointRadius' => 3,
'fillColor' => '#ffffff',
'strokeColor' => $point_color,
'strokeWidth' => 2,
'label' => $label,
'labelYOffset' => -8,
'fontSize' => 10,
);
if ($srid == 0) {
$srid = 4326;

View File

@ -239,6 +239,8 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
'strokeWidth' => 0.5,
'fillColor' => $fill_color,
'fillOpacity' => 0.8,
'label' => $label,
'fontSize' => 10,
);
if ($srid == 0) {
$srid = 4326;

View File

@ -148,10 +148,13 @@ class PMA_GIS_Point extends PMA_GIS_Geometry
public function prepareRowAsOl($spatial, $srid, $label, $point_color)
{
$style_options = array(
'pointRadius' => 3,
'fillColor' => '#ffffff',
'strokeColor' => $point_color,
'strokeWidth' => 2,
'pointRadius' => 3,
'fillColor' => '#ffffff',
'strokeColor' => $point_color,
'strokeWidth' => 2,
'label' => $label,
'labelYOffset' => -8,
'fontSize' => 10,
);
if ($srid == 0) {
$srid = 4326;

View File

@ -222,6 +222,8 @@ class PMA_GIS_Polygon extends PMA_GIS_Geometry
'strokeWidth' => 0.5,
'fillColor' => $fill_color,
'fillOpacity' => 0.8,
'label' => $label,
'fontSize' => 10,
);
if ($srid == 0) {
$srid = 4326;

View File

@ -54,7 +54,7 @@ if (PMA_isValid($_REQUEST['visualizationSettings'], 'array')) {
// If label column is not set, use first non-geometric colum as label column
if (! isset($visualizationSettings['labelColumn']) && isset($labelCandidates[0])) {
$visualizationSettings['labelColumn'] = $labelCandidates[0];
$visualizationSettings['labelColumn'] = '';
}
// If spatial column is not set, use first geometric colum as spatial column
@ -119,7 +119,7 @@ if ($format == 'svg') {
</script>
<script type="text/javascript" src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>
<script type="text/javascript" src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>
<script language="javascript" type="text/javascript">
function drawOpenLayers() {
var options = {
@ -134,10 +134,11 @@ if ($format == 'svg') {
var map = new OpenLayers.Map('openlayersmap', options);
// create OSM layer
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 layerCycleMap = new OpenLayers.Layer.OSM.CycleMap("CycleMap");
map.addLayers([layerMapnik, layerOsmarender, layerCycleMap]);
map.addLayers([layerMapnik, layerOsmarender, layerCycleMap, layerNone]);
// create a vector layer
var vectorLayer = new OpenLayers.Layer.Vector("Data");
@ -165,6 +166,7 @@ if ($format == 'svg') {
<tr><td><label for="labelColumn"><?php echo __("Label column"); ?></label></td>
<td><select name="visualizationSettings[labelColumn]" id="labelColumn">
<option value=""><?php echo __("-- None --"); ?></option>
<?php
foreach ($labelCandidates as $labelCandidate) {
echo('<option value="' . htmlspecialchars($labelCandidate) . '"');
@ -190,7 +192,7 @@ if ($format == 'svg') {
?>
</select></td>
</tr>
<tr><td class="choice">
<tr><td class="choice" colspan="2">
<input type="checkbox" name="visualizationSettings[choice]" id="choice" value="useBaseLayer"
<?php
if (isset($visualizationSettings['choice'])) {
@ -198,7 +200,7 @@ if ($format == 'svg') {
}
?>
/>
<label for="choice"><?php echo __("Use base layer"); ?></label>
<label for="choice"><?php echo __("Use OpenStreetMaps as Base Layer"); ?></label>
</td></tr>
<tr><td></td>
<td class="button"><input type="submit" name="displayVisualization" value="<?php echo __('Redraw'); ?>" /></td>