[mapguide-commits] r6381 - in trunk/MgDev/Doc/samples: dotnetsamples dotnetsamples/common dotnetsamples/custom_output phpsamples/custom_output

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Dec 29 08:40:20 EST 2011


Author: jng
Date: 2011-12-29 05:40:20 -0800 (Thu, 29 Dec 2011)
New Revision: 6381

Added:
   trunk/MgDev/Doc/samples/dotnetsamples/custom_output/
   trunk/MgDev/Doc/samples/dotnetsamples/custom_output/createmapimage.aspx
   trunk/MgDev/Doc/samples/dotnetsamples/custom_output/eplot.aspx
   trunk/MgDev/Doc/samples/dotnetsamples/custom_output/multiplot.aspx
   trunk/MgDev/Doc/samples/dotnetsamples/custom_output/property_report.aspx
   trunk/MgDev/Doc/samples/dotnetsamples/custom_output/task_pane.aspx
Removed:
   trunk/MgDev/Doc/samples/phpsamples/custom_output/emap.php
Modified:
   trunk/MgDev/Doc/samples/dotnetsamples/common/common.aspx
   trunk/MgDev/Doc/samples/phpsamples/custom_output/task_pane.php
Log:
Dev Guide: Complete the .net devguide samples. Also remove the eMap example as that has long since been deprecated


Modified: trunk/MgDev/Doc/samples/dotnetsamples/common/common.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetsamples/common/common.aspx	2011-12-29 12:13:31 UTC (rev 6380)
+++ trunk/MgDev/Doc/samples/dotnetsamples/common/common.aspx	2011-12-29 13:40:20 UTC (rev 6381)
@@ -85,4 +85,22 @@
     }
 }
 
+public class Utility
+{
+    public static void OutputReaderContent(MgByteReader byteReader, HttpResponse response)
+    {
+        MemoryStream memBuf = new MemoryStream();
+        byte[] byteBuffer = new byte[1024];
+        int numBytes = byteReader.Read(byteBuffer, 1024);
+        while (numBytes > 0)
+        {
+            memBuf.Write(byteBuffer, 0, numBytes);
+            numBytes = byteReader.Read(byteBuffer, 1024);
+        }
+        response.ContentType = byteReader.GetMimeType();
+        byte[] content = memBuf.ToArray();
+        response.OutputStream.Write(content, 0, content.Length);
+    }
+}
+
 </script>

Added: trunk/MgDev/Doc/samples/dotnetsamples/custom_output/createmapimage.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetsamples/custom_output/createmapimage.aspx	                        (rev 0)
+++ trunk/MgDev/Doc/samples/dotnetsamples/custom_output/createmapimage.aspx	2011-12-29 13:40:20 UTC (rev 6381)
@@ -0,0 +1,103 @@
+<!-- #Include File="../common/common.aspx" -->
+<%@ Page language="c#" ValidateRequest="false" %>
+<%@ Import Namespace="System" %>
+<%@ Import Namespace="System.Collections.Specialized" %>
+<%@ Import Namespace="System.IO" %>
+<%@ Import Namespace="OSGeo.MapGuide" %>
+<script runat="server">
+String sessionId;
+String mapName;
+</script>
+<%
+
+//
+//  Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+sessionId = Request.Params["SESSION"];
+String xmlSelection = HttpUtility.UrlDecode(Request.Params["SELECTION"]);
+mapName = Request.Params["MAPNAME"];
+double mapScale = Convert.ToDouble(Request.Params["SCALE"]);
+int imageHeight = Convert.ToInt32(Request.Params["HEIGHT"]);
+int imageWidth = Convert.ToInt32(Request.Params["WIDTH"]);
+double mapCenterX = Convert.ToDouble(Request.Params["CENTERX"]);
+double mapCenterY = Convert.ToDouble(Request.Params["CENTERY"]);
+
+try
+{
+  // Initialize the Web Extensions and connect to the Server using
+  // the Web Extensions session identifier stored in PHP session state.
+
+  MapGuideApi.MgInitializeWebTier (Constants.WebConfigPath);
+
+  MgUserInformation userInfo = new MgUserInformation(sessionId);
+
+  MgSiteConnection siteConnection = new MgSiteConnection();
+  siteConnection.Open(userInfo);
+
+  // Create the necessary services.
+
+  MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
+  MgRenderingService renderingService = (MgRenderingService)siteConnection.CreateService(MgServiceType.RenderingService);
+
+  // Open the map and get its SRS
+
+  MgMap map = new MgMap(siteConnection);
+  map.Open(mapName);
+  String srsWkt = map.GetMapSRS();
+  MgCoordinateSystemFactory coordinateSystemFactory = new MgCoordinateSystemFactory();
+  MgCoordinateSystem srs = coordinateSystemFactory.Create(srsWkt);
+
+  MgSelection selection = null;
+  if (!string.IsNullOrEmpty(xmlSelection))
+  {
+      selection = new MgSelection(map, xmlSelection);
+  }
+  else
+  {
+      selection = new MgSelection(map);
+  }
+
+  MgColor color = new MgColor(205, 189, 156);
+
+  MgGeometryFactory geometryFactory = new MgGeometryFactory();
+  MgCoordinate mapCenterCoordinate = geometryFactory.CreateCoordinateXY(mapCenterX, mapCenterY);
+
+  // Convert the height in pixels to map units.
+  // Create an envelope that contains the image area to display.
+
+  double displayInInches = imageHeight / 96;
+  double displayInMeters = displayInInches * .0254;
+  double mapHeightInMeters = displayInMeters * mapScale;
+  double mapHeightInMapUnits = srs.ConvertMetersToCoordinateSystemUnits(mapHeightInMeters);
+  double envelopeOffsetY = mapHeightInMapUnits / 2;
+  double envelopeOffsetX = imageWidth / imageHeight * envelopeOffsetY;
+  MgEnvelope envelope = new MgEnvelope(mapCenterX - envelopeOffsetX,
+    mapCenterY - envelopeOffsetY, mapCenterX + envelopeOffsetX,
+    mapCenterY + envelopeOffsetY);
+
+  // Render the image and send it to the browser.
+
+  MgByteReader byteReader = renderingService.RenderMap(map, selection, envelope, imageWidth, imageHeight, color, "PNG");
+  Utility.OutputReaderContent(byteReader, Response);
+}
+catch (MgException e)
+{
+  Response.Write("<p>" + e.GetExceptionMessage() + "</p>");
+  Response.Write("<p>" + e.GetDetails() + "</p>");
+}
+
+%>

Added: trunk/MgDev/Doc/samples/dotnetsamples/custom_output/eplot.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetsamples/custom_output/eplot.aspx	                        (rev 0)
+++ trunk/MgDev/Doc/samples/dotnetsamples/custom_output/eplot.aspx	2011-12-29 13:40:20 UTC (rev 6381)
@@ -0,0 +1,75 @@
+<!-- #Include File="../common/common.aspx" -->
+<%@ Page language="c#" %>
+<%@ Import Namespace="System" %>
+<%@ Import Namespace="System.Collections.Specialized" %>
+<%@ Import Namespace="System.IO" %>
+<%@ Import Namespace="OSGeo.MapGuide" %>
+<script runat="server">
+String sessionId;
+String mapName;
+</script>
+<%
+
+//
+//  Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+sessionId = Request.Params["SESSION"];
+mapName = Request.Params["MAPNAME"];
+
+try
+{
+  // Initialize the Web Extensions and connect to the server using
+  // the Web Extensions session identifier stored in PHP session state+
+
+  MapGuideApi.MgInitializeWebTier (Constants.WebConfigPath);
+
+  MgUserInformation userInfo = new MgUserInformation(sessionId);
+  MgSiteConnection siteConnection = new MgSiteConnection();
+  siteConnection.Open(userInfo);
+
+  // Create an instance of ResourceService and use that to open the
+  // current map instance stored in session state+
+
+  MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
+  MgMap map = new MgMap(siteConnection);
+  map.Open(mapName);
+
+  MgMappingService mappingService = (MgMappingService)siteConnection.CreateService(MgServiceType.MappingService);
+
+  MgDwfVersion dwfVersion = new MgDwfVersion("6.01", "1.2");
+
+  MgPlotSpecification plotSpec = new MgPlotSpecification(8.5f, 11.0f, MgPageUnitsType.Inches, 0.5f, 0.5f, 0.5f, 0.5f);
+
+  MgResourceIdentifier layoutRes = new MgResourceIdentifier("Library://Samples/Sheboygan/Layouts/SheboyganMap.PrintLayout");
+  MgLayout layout =  new MgLayout(layoutRes, "City of Sheboygan", MgPageUnitsType.Inches);
+
+  MgByteReader byteReader = mappingService.GeneratePlot(map, plotSpec, layout, dwfVersion);
+
+  // Now output the resulting DWF
+  Utility.OutputReaderContent(byteReader, Response);
+
+}
+catch (MgException e)
+{
+  String result = e.GetExceptionMessage() + "<br><br>" + e.GetDetails();
+
+  Response.ContentType = "text/html";
+  Response.Headers.Add("Content-Length", result.Length.ToString());
+  Response.Write(result);
+}
+
+%>

Added: trunk/MgDev/Doc/samples/dotnetsamples/custom_output/multiplot.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetsamples/custom_output/multiplot.aspx	                        (rev 0)
+++ trunk/MgDev/Doc/samples/dotnetsamples/custom_output/multiplot.aspx	2011-12-29 13:40:20 UTC (rev 6381)
@@ -0,0 +1,91 @@
+<!-- #Include File="../common/common.aspx" -->
+<%@ Page language="c#" %>
+<%@ Import Namespace="System" %>
+<%@ Import Namespace="System.Collections.Specialized" %>
+<%@ Import Namespace="System.IO" %>
+<%@ Import Namespace="OSGeo.MapGuide" %>
+<script runat="server">
+String sessionId;
+String mapName;
+</script>
+<%
+
+//
+//  Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+sessionId = Request.Params["SESSION"];
+mapName = Request.Params["MAPNAME"];
+
+try
+{
+  // Initialize the Web Extensions and connect to the server using
+  // the Web Extensions session identifier stored in PHP session state.
+
+  MapGuideApi.MgInitializeWebTier (Constants.WebConfigPath);
+
+  MgUserInformation userInfo = new MgUserInformation(sessionId);
+  MgSiteConnection siteConnection = new MgSiteConnection();
+  siteConnection.Open(userInfo);
+
+  // Create an instance of ResourceService and use that to open the
+  // current map instance stored in session state.
+
+  MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
+  MgMap map = new MgMap(siteConnection);
+  map.Open(mapName);
+
+  MgMappingService mappingService = (MgMappingService)siteConnection.CreateService(MgServiceType.MappingService);
+
+  MgDwfVersion dwfVersion = new MgDwfVersion("6.01", "1.2");
+
+  MgPlotSpecification plotSpec = new MgPlotSpecification(8.5f, 11.0f, MgPageUnitsType.Inches, 0.5f, 0.5f, 0.5f, 0.5f);
+
+  MgResourceIdentifier layoutRes = new MgResourceIdentifier("Library://Samples/Sheboygan/Layouts/SheboyganMap.PrintLayout");
+  MgLayout layout =  new MgLayout(layoutRes, "City of Sheboygan", MgPageUnitsType.Inches);
+
+  MgMapPlotCollection plotCollection = new MgMapPlotCollection();
+
+  MgMapPlot plot1 = new MgMapPlot(map, plotSpec, layout);
+  plot1.SetCenterAndScale(map.GetViewCenter().GetCoordinate(), map.GetViewScale() * 2);
+  plotCollection.Add(plot1);
+
+  // Create a second map for the second sheet in the DWF. This second sheet uses the print layout
+  // to display a page title and legend.
+
+  MgMap map2 = new MgMap(siteConnection);
+  map2.Create(map.GetMapDefinition(), "Sheet 2");
+  MgMapPlot plot2 = new MgMapPlot(map2, plotSpec, layout);
+  plot2.SetCenterAndScale(map.GetViewCenter().GetCoordinate(), map.GetViewScale());
+  // plot2 = new MgMapPlot(map2, map.GetViewCenter().GetCoordinate(), map.GetViewScale(), plotSpec, layout);
+  plotCollection.Add(plot2);
+
+  MgByteReader byteReader = mappingService.GenerateMultiPlot(plotCollection, dwfVersion);
+
+  // Now output the resulting DWF.
+  Utility.OutputReaderContent(byteReader, Response);
+
+}
+catch (MgException e)
+{
+  String result = e.GetExceptionMessage() + "<br><br>" + e.GetDetails();
+
+  Response.ContentType = "text/html";
+  Response.Headers.Add("Content-Length", result.Length.ToString());
+  Response.Write(result);
+}
+
+%>

Added: trunk/MgDev/Doc/samples/dotnetsamples/custom_output/property_report.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetsamples/custom_output/property_report.aspx	                        (rev 0)
+++ trunk/MgDev/Doc/samples/dotnetsamples/custom_output/property_report.aspx	2011-12-29 13:40:20 UTC (rev 6381)
@@ -0,0 +1,152 @@
+<!-- #Include File="../common/common.aspx" -->
+<%@ Page language="c#" %>
+<%@ Import Namespace="System" %>
+<%@ Import Namespace="System.Collections.Specialized" %>
+<%@ Import Namespace="System.IO" %>
+<%@ Import Namespace="OSGeo.MapGuide" %>
+<script runat="server">
+String sessionId;
+String mapName;
+</script>
+<%
+
+//
+//  Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+sessionId = Request.Params["SESSION"];
+String xmlSelection = HttpUtility.UrlDecode(Request.Params["SELECTION"]);
+mapName = Request.Params["MAPNAME"];
+double mapScale = Convert.ToDouble(Request.Params["SCALE"]);
+int imageHeight = Convert.ToInt32(Request.Params["HEIGHT"]);
+int imageWidth = Convert.ToInt32(Request.Params["WIDTH"]);
+double mapCenterX = Convert.ToDouble(Request.Params["CENTERX"]);
+double mapCenterY = Convert.ToDouble(Request.Params["CENTERY"]);
+
+String owner = "";
+String address = "";
+String billingAddress = "";
+String description = "";
+ 
+try
+{
+  // Initialize the Web Extensions and connect to the Server using
+  // the Web Extensions session identifier stored in PHP session state.
+
+  MapGuideApi.MgInitializeWebTier (Constants.WebConfigPath);
+
+  MgUserInformation userInfo = new MgUserInformation(sessionId);
+
+  MgSiteConnection siteConnection = new MgSiteConnection();
+  siteConnection.Open(userInfo);
+
+  // If any parcels have been selected, recenter the image on the first selected parcel.
+  if (!string.IsNullOrEmpty(xmlSelection))
+  {
+    MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
+    MgFeatureService featureService = (MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService);
+    MgFeatureQueryOptions queryOptions = new MgFeatureQueryOptions();
+
+    MgMap map = new MgMap(siteConnection);
+    map.Open(mapName);
+
+    MgSelection selection = new MgSelection(map, xmlSelection);
+    MgReadOnlyLayerCollection layers = selection.GetLayers();
+
+    if (layers != null)
+    {
+      for (int i = 0; i < layers.GetCount(); i++)
+      {
+        // Only check selected features in the Parcels layer.
+        MgLayer layer = (MgLayer)layers.GetItem(i);
+        if (layer != null && layer.GetName() == "Parcels")
+        {
+          // Create a filter containing the IDs of the selected features on this layer
+          String layerClassName = layer.GetFeatureClassName();
+          String selectionString = selection.GenerateFilter(layer, layerClassName);
+
+          // Get the feature resource for the selected layer
+
+          String layerFeatureId = layer.GetFeatureSourceId();
+          MgResourceIdentifier layerFeatureResource = new MgResourceIdentifier(layerFeatureId);
+
+          // Apply the filter to the feature resource for the selected layer. This returns
+          // an MgFeatureReader of all the selected features.
+
+          queryOptions.SetFilter(selectionString);
+          MgFeatureReader featureReader = featureService.SelectFeatures(layerFeatureResource, layerClassName, queryOptions);
+
+          // Create the report details using the first selected parcel. Position the image so the
+          // centroid of the selected parcel is in the center of the map.
+
+          featureReader.ReadNext();
+          MgByteReader featureAgfGeometry = featureReader.GetGeometry("SHPGEOM");
+          MgAgfReaderWriter agfReaderWriter = new MgAgfReaderWriter();
+          MgGeometry featureGeometry = agfReaderWriter.Read(featureAgfGeometry);
+          MgPoint centroid = featureGeometry.GetCentroid();
+          mapCenterX = centroid.GetCoordinate().GetX();
+          mapCenterY = centroid.GetCoordinate().GetY();
+
+          owner = featureReader.GetString("RNAME");
+          address = featureReader.GetString("RPROPAD");
+          billingAddress = featureReader.GetString("RBILAD");
+          description = featureReader.GetString("RLDESCR1") + "<br/>" + featureReader.GetString("RLDESCR2") + "<br/>" + featureReader.GetString("RLDESCR3") + "<br/>";
+
+        }
+      }
+    }
+  }
+
+}
+catch (MgException e)
+{
+  Response.Write("<p>" + e.GetExceptionMessage() + "</p>");
+  Response.Write("<p>" + e.GetDetails() + "</p>");
+}
+String selectionEncoded = HttpUtility.UrlEncode(xmlSelection);
+String imageUrl = "createmapimage.aspx?SESSION=" + sessionId + "&SELECTION=" + selectionEncoded + "&MAPNAME=" + mapName + "&SCALE=" + mapScale + "&HEIGHT=" + imageHeight + "&WIDTH=" + imageWidth + "&CENTERX=" + mapCenterX + "&CENTERY=" + mapCenterY;
+
+%>
+<html>
+  <head>
+    <title>Property Report</title>
+    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
+    <meta http-equiv="content-script-type" content="text/javascript">
+    <meta http-equiv="content-style-type" content="text/css">
+    <link href="../styles/globalStyles.css" rel="stylesheet" type="text/css">
+    <style>
+      img {float: left; margin-right: 10px; border: 1px solid #999; padding: 4px}
+    </style>
+  </head>
+  <body>
+    <h1>Property Report</h1>
+  <p><img id="propertyImage" src="<%= imageUrl %>" width="<%=imageWidth%>" height="<%= imageHeight %>" />
+    <%
+    if (string.IsNullOrEmpty(xmlSelection))
+    {
+      Response.Write("No properties selected.");
+    }
+    else
+    {
+      Response.Write("Owner: " + owner + "<br/>\n");
+      Response.Write("Address: " + address + "<br/>\n");
+      Response.Write("Billing Address: " + billingAddress + "<br/>\n");
+      Response.Write("Description: " + description + "<br/>\n");
+    }
+    %>
+  </p>
+</body>
+</html>
\ No newline at end of file

Added: trunk/MgDev/Doc/samples/dotnetsamples/custom_output/task_pane.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetsamples/custom_output/task_pane.aspx	                        (rev 0)
+++ trunk/MgDev/Doc/samples/dotnetsamples/custom_output/task_pane.aspx	2011-12-29 13:40:20 UTC (rev 6381)
@@ -0,0 +1,115 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--
+//  Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+-->
+<%@ Page language="c#" %>
+<%@ Import Namespace="System" %>
+<script runat="server">
+String sessionId;
+String mapName;
+String fullPath;
+</script>
+<html>
+  <head>
+    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
+    <meta http-equiv="content-script-type" content="text/javascript">
+    <meta http-equiv="content-style-type" content="text/css">
+    <link href="../styles/globalStyles.css" rel="stylesheet" type="text/css">
+    <link href="../styles/otherStyles.css" rel="stylesheet" type="text/css">
+    <script language=javascript>
+      function submitRequest(pageUrl)
+      {
+        xmlSel = parent.parent.mapFrame.GetSelectionXML();
+        mapScale = parent.parent.mapFrame.GetScale();
+        mapHeight = 300;
+        mapWidth = 300;
+        mapCenter = parent.parent.mapFrame.GetCenter();
+        params = new Array("SESSION", parent.parent.mapFrame.GetSessionId(),
+          "MAPNAME", parent.parent.mapFrame.GetMapName(),
+          "SELECTION", encodeURIComponent(xmlSel),
+          "SCALE", mapScale,
+          "HEIGHT", mapHeight,
+          "WIDTH", mapWidth,
+          "CENTERX", mapCenter.X,
+          "CENTERY", mapCenter.Y
+          );
+        parent.parent.formFrame.Submit(pageUrl, params, "_blank");
+      }
+      
+     function OnPageLoad()
+     {
+         parent.parent.mapFrame.Refresh();
+         parent.parent.mapFrame.ZoomToScale(9999);
+     }
+    </script>
+  </head>
+  <body onLoad="OnPageLoad()" class="AppFrame">
+    <h1 class="AppHeading">Custom Output</h1>
+    <%
+	    sessionId = Request.Params["SESSION"];
+	    mapName = Request.Params["MAPNAME"];
+    %>
+    <ul>
+      <li>
+      	(Select one parcel and then click the link below.)<BR>
+        <a href="#" onClick="submitRequest('/mapguide/dotnetsamples/custom_output/property_report.aspx'); return false;">
+        Property report</a>
+        <br/>Create a printable page with an inset image of the selected property.
+        <br/>
+        <%
+        fullPath = Server.MapPath("property_report.aspx");
+        %>
+        <a target="_blank" href="../common/viewsource.aspx?FILENAME=<%= fullPath %>" >View source</a>
+      </li>
+
+      <li>
+        <a target="_blank" href="eplot.aspx?SESSION=<%= sessionId %>&MAPNAME=<%= mapName %>" >
+        ePlot</a>
+        <br/>Create and display an ePlot. Requires Autodesk DWF Viewer or Autodesk Design Review on the client system.
+        <br/>
+        <%
+        fullPath = Server.MapPath("eplot.aspx");
+        %>
+        <a target="_blank" href="../common/viewsource.aspx?FILENAME=<%= fullPath %>" >View source</a>
+      </li>
+
+      <li>
+        <a target="_blank" href="multiplot.aspx?SESSION=<%= sessionId %>&MAPNAME=<%= mapName %>" >
+        Multi-plot</a>
+        <br/>Create and display a multi-plot ePlot. Requires Autodesk DWF Viewer or Autodesk Design Review on the client system.
+        <br/>
+        <%
+        fullPath = Server.MapPath("multiplot.aspx");
+        %>
+        <a target="_blank" href="../common/viewsource.aspx?FILENAME=<%= fullPath %>" >View source</a>
+      </li>
+
+    </ul>
+
+    <p>View source for support files:</p>
+    <ul>
+      <%
+      fullPath = Server.MapPath("createmapimage.aspx");
+      %>
+      <li><a target="_blank" href="../common/viewsource.aspx?FILENAME=<%= fullPath %>" >createmapimage.aspx</a></li>
+      <%
+      fullPath = Server.MapPath("task_pane.aspx");
+      %>
+      <li><a target="_blank" href="../common/viewsource.aspx?FILENAME=<%= fullPath %>" >task_pane.aspx</a></li>
+    </ul>
+
+  </body>
+</html>

Deleted: trunk/MgDev/Doc/samples/phpsamples/custom_output/emap.php
===================================================================
--- trunk/MgDev/Doc/samples/phpsamples/custom_output/emap.php	2011-12-29 12:13:31 UTC (rev 6380)
+++ trunk/MgDev/Doc/samples/phpsamples/custom_output/emap.php	2011-12-29 13:40:20 UTC (rev 6381)
@@ -1,73 +0,0 @@
-<?php
-
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-include '../common/common.php';
-
-$args = ($_SERVER['REQUEST_METHOD'] == 'POST') ? $_POST : $_GET;
-$sessionId = $args['SESSION'];
-$mapName = $args['MAPNAME'];
-
-try
-{
-  // Initialize the Web Extensions and connect to the server using
-  // the Web Extensions session identifier stored in PHP session state.
-
-  MgInitializeWebTier ($webconfigFilePath);
-
-  $userInfo = new MgUserInformation($sessionId);
-  $siteConnection = new MgSiteConnection();
-  $siteConnection->Open($userInfo);
-
-  // Create an instance of ResourceService and use that to open the
-  // current map instance stored in session state.
-
-  $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService);
-  $map = new MgMap();
-  $map->Open($resourceService, $mapName);
-
-  $dwfVersion = new MgDwfVersion("6.01", "1.2");
-
-  $mappingService = $siteConnection->CreateService(MgServiceType::MappingService);
-
-  $mapAgentUri = 'http://' . $_SERVER['HTTP_HOST'] . '/mapguide/mapagent/mapagent.fcgi';
-  $byteReader = $mappingService->GenerateMap($map, $mapAgentUri, $dwfVersion);
-
-  // Now output the resulting DWF.
-
-  $outputBuffer = '';
-  $buffer = '';
-  while ($byteReader->Read($buffer, 50000) != 0)
-  {
-    $outputBuffer .= $buffer;
-  }
-  header('Content-Type: ' . $byteReader->GetMimeType());
-  header('Content-Length: ' . strlen($outputBuffer));
-  echo $outputBuffer;
-
-}
-catch (MgException $e)
-{
-  $result = $e->GetExceptionMessage() . "<br><br>" . $e->GetDetails();
-
-  header('Content-Type: text/html');
-  header('Content-Length: ' . strlen($result));
-  echo $result;
-}
-
-?>

Modified: trunk/MgDev/Doc/samples/phpsamples/custom_output/task_pane.php
===================================================================
--- trunk/MgDev/Doc/samples/phpsamples/custom_output/task_pane.php	2011-12-29 12:13:31 UTC (rev 6380)
+++ trunk/MgDev/Doc/samples/phpsamples/custom_output/task_pane.php	2011-12-29 13:40:20 UTC (rev 6381)
@@ -73,19 +73,6 @@
       </li>
 
       <li>
-        <a target="_blank" href="emap.php?SESSION=<?= $sessionId ?>&MAPNAME=<?= $mapName ?>" >
-        eMap</a>
-        <br/>Create and display an eMap. Requires Autodesk&reg; DWF&trade; Viewer or Autodesk Design Review on the client system.
-        <br/>
-        <?php
-        $fileName = 'emap.php';
-        $dir = getcwd();
-        $fullPath = urlencode($dir . '/' . $fileName);
-        ?>
-        <a target="_blank" href="../common/viewsource.php?FILENAME=<?= $fullPath ?>" >View source</a>
-      </li>
-
-      <li>
         <a target="_blank" href="eplot.php?SESSION=<?= $sessionId ?>&MAPNAME=<?= $mapName ?>" >
         ePlot</a>
         <br/>Create and display an ePlot. Requires Autodesk DWF Viewer or Autodesk Design Review on the client system.



More information about the mapguide-commits mailing list