[fusion-commits] r2750 - in trunk: text widgets/QuickPlot
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Wed Jul 24 22:29:23 PDT 2013
Author: jng
Date: 2013-07-24 22:29:23 -0700 (Wed, 24 Jul 2013)
New Revision: 2750
Modified:
trunk/text/en
trunk/widgets/QuickPlot/GeneratePicture.php
trunk/widgets/QuickPlot/PlotAsPDF.php
trunk/widgets/QuickPlot/QuickPlotPanel.templ
Log:
#584: Make the following QuickPlot elements also toggle-able:
- North Arrow
- Coordinate labels
- Scale bar
Modified: trunk/text/en
===================================================================
--- trunk/text/en 2013-07-25 05:01:34 UTC (rev 2749)
+++ trunk/text/en 2013-07-25 05:29:23 UTC (rev 2750)
@@ -460,7 +460,11 @@
QUICKPLOT_ORIENTATION_P = Portrait Orientation
QUICKPLOT_ORIENTATION_L = Landscape Orientation
QUICKPLOT_GENERATE = Generate
-QUICKPLOT_SHOWLEGEND = Show Legend
+QUICKPLOT_SHOWELEMENTS = Show Elements
+QUICKPLOT_SHOWLEGEND = Legend
+QUICKPLOT_SHOWNORTHARROW = North Arrow
+QUICKPLOT_SHOWCOORDINTES = Coordinates
+QUICKPLOT_SHOWSCALEBAR = Scale Bar
QUICKPLOT_ADVANCED_OPTIONS = Advanced options
QUICKPLOT_PREVIEW_ERROR = The application resources required to generate the plot exceed the settings defined by the administrator
QUICKPLOT_RESOLUTION_WARNING = The current settings exceed the map resolution. Zooming out or increasing the scaling will help create a more legible plot
Modified: trunk/widgets/QuickPlot/GeneratePicture.php
===================================================================
--- trunk/widgets/QuickPlot/GeneratePicture.php 2013-07-25 05:01:34 UTC (rev 2749)
+++ trunk/widgets/QuickPlot/GeneratePicture.php 2013-07-25 05:29:23 UTC (rev 2750)
@@ -14,6 +14,7 @@
$normalizedCapture;
$printSize_pixel;
$printSize;
+ $drawNorthArrow = false;
try
{
@@ -37,7 +38,7 @@
function GetParameters()
{
- global $sessionID, $mapName, $printDpi, $rotation, $printSize, $printSize_pixel, $captureBox, $scaleDenominator, $normalizedCapture;
+ global $sessionID, $mapName, $printDpi, $rotation, $printSize, $printSize_pixel, $captureBox, $scaleDenominator, $normalizedCapture, $drawNorthArrow;
$args = $_GET;
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
@@ -52,6 +53,11 @@
$scaleDenominator = intval($args["scale_denominator"]);
+ $drawNorthArrow = array_key_exists("northarrow", $args) &&
+ (strcmp($args["northarrow"], "1") == 0 ||
+ strcmp($args["northarrow"], "true") == 0);
+
+
$array = explode(",", $args["print_size"]);
$printSize = new Size(ParseLocaleDouble($array[0]), ParseLocaleDouble($array[1]));
$printSize_pixel = new Size($printSize->width / 25.4 * $printDpi, $printSize->height / 25.4 * $printDpi);
@@ -84,7 +90,7 @@
function GenerateMap($size)//print_size
{
- global $sessionID, $mapName, $captureBox, $printSize, $normalizedCapture, $rotation, $scaleDenominator, $printDpi;
+ global $sessionID, $mapName, $captureBox, $printSize, $normalizedCapture, $rotation, $scaleDenominator, $printDpi, $drawNorthArrow;
$userInfo = new MgUserInformation($sessionID);
$siteConnection = new MgSiteConnection();
$siteConnection->Open($userInfo);
@@ -135,11 +141,24 @@
imagecopy($croppedImg, $normalizedImg, 0, 0, (imagesx($normalizedImg) - $size->width) / 2, (imagesy($normalizedImg) - $size->height) / 2, $size->width, $size->height);
// Free the normalized image
imagedestroy($normalizedImg);
- // Draw the north arrow on the map
- DrawNorthArrow($croppedImg);
-
+ if ($drawNorthArrow) {
+ // Draw the north arrow on the map
+ DrawNorthArrow($croppedImg);
+ }
header ("Content-type: image/png");
imagepng($croppedImg);
+
+ //Uncomment to see what PHP-isms get spewed out that may be tripping up rendering
+ //Also replace instances of "////print_r" with "//print_r" to insta-uncomment all debugging calls
+ /*
+ ob_start();
+ imagepng($croppedImg);
+ $im = base64_encode(ob_get_contents());
+ ob_end_clean();
+ header("Content-type: text/html", true);
+ echo "<img src='data:image/png;base64,".$im."' alt='legend image'></img>";
+ */
+
imagedestroy($croppedImg);
}
Modified: trunk/widgets/QuickPlot/PlotAsPDF.php
===================================================================
--- trunk/widgets/QuickPlot/PlotAsPDF.php 2013-07-25 05:01:34 UTC (rev 2749)
+++ trunk/widgets/QuickPlot/PlotAsPDF.php 2013-07-25 05:29:23 UTC (rev 2750)
@@ -10,6 +10,9 @@
$generateLegend = "/GenerateLegend.php?";
$pathString = implode('/',explode('/', $path,-1));
$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";
$legendWidth = 0; //Width of legend in inches
// POST params
@@ -85,7 +88,7 @@
// Construct the querysting which can be used to generate the Map image
$query_string = "session_id=".$_POST['sessionId']."&map_name=".$_POST['mapName']."&print_size=".$printSize->width.",".$printSize->height.
"&print_dpi=".$_POST['dpi']."&box=".$_POST['box']."&normalized_box=".$_POST['normalizedBox'].
- "&scale_denominator=".$_POST['scaleDenominator']."&rotation=".$_POST['rotation'];
+ "&scale_denominator=".$_POST['scaleDenominator']."&rotation=".$_POST['rotation']."&northarrow=".($showNorthArrow ? "1" : "0");
// Construct the querystring which can be used to generate the legend
if ($showLegend) {
@@ -108,7 +111,8 @@
$legendfilelocation = $protocol.$host.":".$port.$pathString.$generateLegend.$legend_query_string;
}
- //Uncomment to see the legend image url
+ //Uncomment to see the legend and map image urls
+ //var_dump($filelocation);
//var_dump($legendfilelocation);
//die;
@@ -142,12 +146,16 @@
// Draw Title
DrawTitle();
- // Draw Extent coordinates
- DrawExtentCS();
+ if ($showCoordinates) {
+ // Draw Extent coordinates
+ DrawExtentCS();
+ }
- // Draw Scale
- DrawScale();
-
+ if ($showScaleBar) {
+ // Draw Scale
+ DrawScale();
+ }
+
// Draw declaration
DrawDeclaration();
Modified: trunk/widgets/QuickPlot/QuickPlotPanel.templ
===================================================================
--- trunk/widgets/QuickPlot/QuickPlotPanel.templ 2013-07-25 05:01:34 UTC (rev 2749)
+++ trunk/widgets/QuickPlot/QuickPlotPanel.templ 2013-07-25 05:29:23 UTC (rev 2750)
@@ -122,14 +122,41 @@
<div class="HPlaceholder5px"></div>
<div class="HPlaceholder5px"></div>
<div class="HPlaceholder5px"></div>
- <div class="Label">
- <table cellspacing="0" cellpadding="0">
- <tr>
- <td><input type="checkbox" id="ShowLegendCheckBox" name="ShowLegend" /></td>
- <td><label for="ShowLegendCheckBox">__#QUICKPLOT_SHOWLEGEND#__</label></td>
- </tr>
- </table>
- </div>
+ <fieldset>
+ <legend>__#QUICKPLOT_SHOWELEMENTS#__</legend>
+ <div class="Label">
+ <table cellspacing="0" cellpadding="0">
+ <tr>
+ <td><input type="checkbox" id="ShowLegendCheckBox" name="ShowLegend" /></td>
+ <td><label for="ShowLegendCheckBox">__#QUICKPLOT_SHOWLEGEND#__</label></td>
+ </tr>
+ </table>
+ </div>
+ <div class="Label">
+ <table cellspacing="0" cellpadding="0">
+ <tr>
+ <td><input type="checkbox" id="ShowNorthArrowCheckBox" name="ShowNorthArrow" /></td>
+ <td><label for="ShowNorthArrowCheckBox">__#QUICKPLOT_SHOWNORTHARROW#__</label></td>
+ </tr>
+ </table>
+ </div>
+ <div class="Label">
+ <table cellspacing="0" cellpadding="0">
+ <tr>
+ <td><input type="checkbox" id="ShowCoordinatesCheckBox" name="ShowCoordinates" /></td>
+ <td><label for="ShowCoordinatesCheckBox">__#QUICKPLOT_SHOWCOORDINTES#__</label></td>
+ </tr>
+ </table>
+ </div>
+ <div class="Label">
+ <table cellspacing="0" cellpadding="0">
+ <tr>
+ <td><input type="checkbox" id="ShowScaleBarCheckBox" name="ShowScaleBar" /></td>
+ <td><label for="ShowScaleBarCheckBox">__#QUICKPLOT_SHOWSCALEBAR#__</label></td>
+ </tr>
+ </table>
+ </div>
+ </fieldset>
<div class="HPlaceholder5px"></div>
<div class="HPlaceholder5px"></div>
<div class="HPlaceholder5px"></div>
More information about the fusion-commits
mailing list