[fusion-commits] r2756 - trunk/widgets/QuickPlot
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Thu Aug 1 22:10:46 PDT 2013
Author: jng
Date: 2013-08-01 22:10:45 -0700 (Thu, 01 Aug 2013)
New Revision: 2756
Modified:
trunk/widgets/QuickPlot/GenerateLegend.php
trunk/widgets/QuickPlot/PlotAsPDF.php
Log:
#584: Although our GenerateLegend.php produces a more readable legend, it suffers from localization problems. If the layer/group labels aren't english it will probably be gibberish. So introduce a new LegendType parameter in PlotAsPDF.php that lets us use the GETMAPLEGENDIMAGE operation in place of GenerateLegend.php if LegendType is "original".
Modified: trunk/widgets/QuickPlot/GenerateLegend.php
===================================================================
--- trunk/widgets/QuickPlot/GenerateLegend.php 2013-08-01 01:23:36 UTC (rev 2755)
+++ trunk/widgets/QuickPlot/GenerateLegend.php 2013-08-02 05:10:45 UTC (rev 2756)
@@ -5,6 +5,14 @@
$fusionMGpath = '../../layers/MapGuide/php/';
include $fusionMGpath . 'Common.php';
+ //FIXME:
+ //
+ //There are 2 major problems at the moment
+ // 1. This is not localizable (we're using imagestring() to draw text). Non-english text will probably be gibberish.
+ // 2. We're using imagestring() to draw text because imagettftext() requires knowing the actual font file path! And how exactly can we do that in a cross-platform manner!?
+ //
+ //The true fix is to make GETMAPLEGENDIMAGE not so terrible
+
$sessionID = "";
$mapName = "";
$width = 0;
Modified: trunk/widgets/QuickPlot/PlotAsPDF.php
===================================================================
--- trunk/widgets/QuickPlot/PlotAsPDF.php 2013-08-01 01:23:36 UTC (rev 2755)
+++ trunk/widgets/QuickPlot/PlotAsPDF.php 2013-08-02 05:10:45 UTC (rev 2756)
@@ -9,10 +9,28 @@
$generatePage = "/GeneratePicture.php?";
$generateLegend = "/GenerateLegend.php?";
$pathString = implode('/',explode('/', $path,-1));
+ $legendPathString = "";
$showLegend = array_key_exists("ShowLegend", $_POST) && $_POST["ShowLegend"] === "on";
$showNorthArrow = array_key_exists("ShowNorthArrow", $_POST) && $_POST["ShowNorthArrow"] === "on";
$showCoordinates = array_key_exists("ShowCoordinates", $_POST) && $_POST["ShowCoordinates"] === "on";
$showScaleBar = array_key_exists("ShowScaleBar", $_POST) && $_POST["ShowScaleBar"] === "on";
+ $legendType = array_key_exists("LegendType", $_POST) ? $_POST["LegendType"] : "original";
+ if (strcmp($legendType, "original") == 0) {
+ // /mapguide
+ $components = explode('/', $path, -1);
+ for ($i = 0; $i < count($components); $i++) {
+ if (strlen($components[$i]) == 0) {
+ continue;
+ } else {
+ $legendPathString = "/" . $components[$i];
+ break;
+ }
+ }
+ $legendPathString .= "/mapagent";
+ $generateLegend = "/mapagent.fcgi?";
+ } else {
+ $legendPathString = $pathString;
+ }
$legendWidth = 0; //Width of legend in inches
// POST params
@@ -92,7 +110,11 @@
// Construct the querystring which can be used to generate the legend
if ($showLegend) {
- $legend_query_string = "session_id=".$_POST['sessionId']."&map_name=".$_POST['mapName']."&width=".InToPx($legendWidth, $printDpi)."&height=".InToPx($printSize->height, $printDpi);
+ if (strcmp($legendType, "original") == 0) {
+ $legend_query_string = "OPERATION=GETMAPLEGENDIMAGE&VERSION=1.0.0&FORMAT=PNG&SESSION=".$_POST["sessionId"]."&MAPNAME=".$_POST["mapName"]."&WIDTH=".InToPx($legendWidth, $printDpi)."&HEIGHT=".InToPx($printSize->height, $printDpi);
+ } else {
+ $legend_query_string = "session_id=".$_POST['sessionId']."&map_name=".$_POST['mapName']."&width=".InToPx($legendWidth, $printDpi)."&height=".InToPx($printSize->height, $printDpi);
+ }
}
$filelocation = "";
@@ -102,13 +124,13 @@
{
$filelocation = $protocol.$host.$pathString.$generatePage.$query_string;
if ($showLegend)
- $legendfilelocation = $protocol.$host.$pathString.$generateLegend.$legend_query_string;
+ $legendfilelocation = $protocol.$host.$legendPathString.$generateLegend.$legend_query_string;
}
else
{
$filelocation = $protocol.$host.":".$port.$pathString.$generatePage.$query_string;
if ($showLegend)
- $legendfilelocation = $protocol.$host.":".$port.$pathString.$generateLegend.$legend_query_string;
+ $legendfilelocation = $protocol.$host.":".$port.$legendPathString.$generateLegend.$legend_query_string;
}
//Uncomment to see the legend and map image urls
More information about the fusion-commits
mailing list