[mapguide-commits] r6380 - in trunk/MgDev/Doc/samples/dotnetsamples: . digitizing_features

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Dec 29 07:13:31 EST 2011


Author: jng
Date: 2011-12-29 04:13:31 -0800 (Thu, 29 Dec 2011)
New Revision: 6380

Added:
   trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/
   trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/clear_lines.aspx
   trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/draw_line.aspx
   trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/task_pane.aspx
   trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/task_pane_digitizing.aspx
   trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/task_pane_redlining.aspx
Log:
Dev Guide: Add digitizing/redlining example (.net)


Added: trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/clear_lines.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/clear_lines.aspx	                        (rev 0)
+++ trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/clear_lines.aspx	2011-12-29 12:13:31 UTC (rev 6380)
@@ -0,0 +1,81 @@
+<!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" %>
+<%@ Import Namespace="System.Collections.Specialized" %>
+<%@ Import Namespace="System.IO" %>
+<%@ Import Namespace="OSGeo.MapGuide" %>
+<!-- #Include File="../common/common.aspx" -->
+<script runat="server">
+    String sessionId;
+    String mapName;
+</script>
+<html>
+  <head>
+    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
+    <title>Clear Lines</title>
+
+    <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">
+    <meta http-equiv="content-script-type" content="text/javascript">
+    <script language="javascript" type="text/javascript">
+      function OnPageLoad()
+      {
+        parent.mapFrame.Refresh();
+      }
+    </script>
+  </head>
+
+  <body onLoad="OnPageLoad()">
+    <%
+      try
+      {
+        // --------------------------------------------------//
+        // Basic initialization
+        MapGuideApi.MgInitializeWebTier(Constants.WebConfigPath);
+
+        // Get the information passed from the viewer
+        sessionId = Request.Params["SESSION"];
+        mapName = Request.Params["MAPNAME"];
+
+        // Get the user information using the session id
+        // and set up a connection to the site server
+        MgUserInformation userInfo = new MgUserInformation(sessionId);
+        MgSiteConnection siteConnection = new MgSiteConnection();
+        siteConnection.Open(userInfo);
+
+        // Get an instance of the required service(s)
+        MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
+
+        // --------------------------------------------------//
+        String featureSourceName = "Session:" + sessionId + "//TemporaryLines.FeatureSource";
+        MgResourceIdentifier resourceID = new MgResourceIdentifier(featureSourceName);
+
+        resourceService.DeleteResource(resourceID);
+      }
+      catch (MgException e)
+      {
+        Response.Write("<script language=\"javascript\" type=\"text/javascript\"> \n");
+        Response.Write("    alert(\" " + e.GetExceptionMessage() + " \"); \n");
+        Response.Write("</script> \n");
+      }
+    %>
+  </body>
+</html>
\ No newline at end of file

Added: trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/draw_line.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/draw_line.aspx	                        (rev 0)
+++ trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/draw_line.aspx	2011-12-29 12:13:31 UTC (rev 6380)
@@ -0,0 +1,250 @@
+<!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" %>
+<%@ Import Namespace="System.Collections.Specialized" %>
+<%@ Import Namespace="System.IO" %>
+<%@ Import Namespace="OSGeo.MapGuide" %>
+<!-- #Include File="../modifying_maps_and_layers/layer_functions.aspx" -->
+<script runat="server">
+    String sessionId;
+    String mapName;
+
+    ///////////////////////////////////////////////////////////////////////////////////
+    static MgPropertyCollection MakeLine(String name, String x0, String y0, String x1, String y1)
+    {
+        MgPropertyCollection propertyCollection = new MgPropertyCollection();
+        MgStringProperty nameProperty = new MgStringProperty("NAME", name);
+        propertyCollection.Add(nameProperty);
+
+        MgWktReaderWriter wktReaderWriter = new MgWktReaderWriter();
+        MgAgfReaderWriter agfReaderWriter = new MgAgfReaderWriter();
+
+        MgGeometry geometry = wktReaderWriter.Read(String.Format("LINESTRING XY ({0} {1}, {2} {3})", x0, y0, x1, y1));
+        MgByteReader geometryByteReader = agfReaderWriter.Write(geometry);
+        MgGeometryProperty geometryProperty = new MgGeometryProperty("SHPGEOM", geometryByteReader);
+        propertyCollection.Add(geometryProperty);
+
+        return propertyCollection;
+    }
+
+    ///////////////////////////////////////////////////////////////////////////////////
+    static bool DoesResourceExist(MgResourceIdentifier resourceIdentifier, MgResourceService resourceService)
+    // Returns true if the resource already exists, or false otherwise
+    {
+        return resourceService.ResourceExists(resourceIdentifier);
+    }
+
+    ///////////////////////////////////////////////////////////////////////////////////
+    static bool DoesLayerExist(String layerName, MgMap map)
+    // Returns true if the layer already exists, or false otherwise
+    {
+        MgLayerCollection layerCollection = map.GetLayers();
+        return (layerCollection.Contains(layerName) ? true : false);
+    }
+
+    ///////////////////////////////////////////////////////////////////////////////////
+</script>
+<html>
+<head>
+  <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
+  <title>Draw a Line</title>
+
+  <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">
+  <meta http-equiv="content-script-type" content="text/javascript">
+  <script language="javascript" type="text/javascript">
+    function OnPageLoad()
+    {
+      parent.mapFrame.Refresh();
+    }
+  </script>
+</head>
+
+<body onLoad="OnPageLoad()">
+    <%
+  
+  // Get the parameters passed in from the task pane
+  String x0 = Request.Params["x0"];
+  String y0 = Request.Params["y0"];
+  String x1 = Request.Params["x1"];
+  String y1 = Request.Params["y1"];
+  sessionId = Request.Params["SESSION"];
+  mapName = Request.Params["MAPNAME"];
+
+  try
+  {
+    // --------------------------------------------------//
+    // Basic initialization needs to be done every time.
+    MapGuideApi.MgInitializeWebTier(Constants.WebConfigPath);
+
+    // Get the user information using the session id,
+    // and set up a connection to the site server.
+    MgUserInformation userInfo = new MgUserInformation(sessionId);
+    MgSiteConnection siteConnection = new MgSiteConnection();
+    siteConnection.Open(userInfo);
+
+    // Get an instance of the required service(s).
+    MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
+    MgFeatureService featureService = (MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService);
+
+    //---------------------------------------------------//
+    // Open the map
+    MgMap map = new MgMap(siteConnection);
+    map.Open(mapName);
+
+    String layerName = "Lines";
+    String layerLegendLabel = "New Lines";
+    String groupName = "Analysis";
+    String groupLegendLabel = "Analysis";
+
+    //---------------------------------------------------//
+    // Does the temporary feature source already exist?
+    // If not, create it
+    String featureSourceName = "Session:" + sessionId + "//TemporaryLines.FeatureSource";
+    MgResourceIdentifier resourceIdentifier = new MgResourceIdentifier(featureSourceName);
+
+    bool featureSourceExists = DoesResourceExist(resourceIdentifier, resourceService);
+    if (! featureSourceExists)
+    {
+      // Create a temporary feature source to draw the lines on
+
+      // Create a feature class definition for the new feature
+      // source
+      MgClassDefinition classDefinition = new MgClassDefinition();
+      classDefinition.SetName("Lines");
+      classDefinition.SetDescription("Lines to display.");
+      String geometryPropertyName="SHPGEOM";
+      classDefinition.SetDefaultGeometryPropertyName( geometryPropertyName);
+
+      // Create an identify property
+      MgDataPropertyDefinition identityProperty = new MgDataPropertyDefinition("KEY");
+      identityProperty.SetDataType(MgPropertyType.Int32);
+      identityProperty.SetAutoGeneration(true);
+      identityProperty.SetReadOnly(true);
+      // Add the identity property to the class definition
+      classDefinition.GetIdentityProperties().Add(identityProperty);
+      classDefinition.GetProperties().Add(identityProperty);
+
+      // Create a name property
+      MgDataPropertyDefinition nameProperty = new MgDataPropertyDefinition("NAME");
+      nameProperty.SetDataType(MgPropertyType.String);
+      // Add the name property to the class definition
+      classDefinition.GetProperties().Add(nameProperty);
+
+      // Create a geometry property
+      MgGeometricPropertyDefinition geometryProperty = new MgGeometricPropertyDefinition(geometryPropertyName);
+      geometryProperty.SetGeometryTypes(MgFeatureGeometricType.Surface);
+      // Add the geometry property to the class definition
+      classDefinition.GetProperties().Add(geometryProperty);
+
+      // Create a feature schema
+      MgFeatureSchema featureSchema = new MgFeatureSchema("SHP_Schema", "Line schema");
+      // Add the feature schema to the class definition
+      featureSchema.GetClasses().Add(classDefinition);
+
+      // Create the feature source
+      String wkt = map.GetMapSRS();
+      MgCreateSdfParams sdfParams = new MgCreateSdfParams("spatial context", wkt, featureSchema);
+      featureService.CreateFeatureSource(resourceIdentifier, sdfParams);
+    }
+
+    // Add the line to the feature source
+    MgBatchPropertyCollection batchPropertyCollection = new MgBatchPropertyCollection();
+    MgPropertyCollection propertyCollection = MakeLine("Line A", x0, y0, x1, y1);
+    batchPropertyCollection.Add(propertyCollection);
+
+    // Add the batch property collection to the feature source
+    MgInsertFeatures cmd = new MgInsertFeatures(layerName, batchPropertyCollection);
+    MgFeatureCommandCollection featureCommandCollection = new MgFeatureCommandCollection();
+    featureCommandCollection.Add(cmd);
+
+    // Execute the "add" commands
+    featureService.UpdateFeatures(resourceIdentifier, featureCommandCollection, false);
+
+    //---------------------------------------------------//
+    bool layerExists = DoesLayerExist(layerName, map);
+    if (! layerExists )
+    {
+      // Create a new layer which uses that feature source
+
+      // Create a line rule to stylize the lines
+      String ruleLegendLabel = "Lines Rule";
+      String filter = "";
+      String color = "FF0000FF";
+      LayerDefinitionFactory factory = new LayerDefinitionFactory(Server);
+      String lineRule = factory.CreateLineRule(ruleLegendLabel, filter, color);
+
+      // Create a line type style
+      String lineTypeStyle = factory.CreateLineTypeStyle(lineRule);
+
+      // Create a scale range
+      String minScale = "0";
+      String maxScale = "1000000000000";
+      String lineScaleRange = factory.CreateScaleRange(minScale, maxScale, lineTypeStyle);
+
+      // Create the layer definiton
+      String featureName = "SHP_Schema:Lines";
+      String geometry = "SHPGEOM";
+      String layerDefinition = factory.CreateLayerDefinition(featureSourceName, featureName, geometry, lineScaleRange);
+
+      //---------------------------------------------------//
+      // Add the layer to the map
+      XmlDocument doc = new XmlDocument();
+      doc.LoadXml(layerDefinition);
+      MgLayer newLayer = LayerFunctions.AddLayerDefinitionToMap(doc, layerName, layerLegendLabel, sessionId, resourceService, map);
+      // Add the layer to a layer group
+      LayerFunctions.AddLayerToGroup(newLayer,groupName, groupLegendLabel, map);
+    }
+
+    // --------------------------------------------------//
+    // Turn on the visibility of this layer.
+    // (If the layer does not already exist in the map, it will be visible by default when it is added.
+    // But if the user has already run this script, he or she may have set the layer to be invisible.)
+    MgLayerCollection layerCollection = map.GetLayers();
+    if (layerCollection.Contains(layerName))
+    {
+      MgLayer linesLayer = (MgLayer)layerCollection.GetItem(layerName);
+      linesLayer.SetVisible(true);
+    }
+
+    MgLayerGroupCollection groupCollection = map.GetLayerGroups();
+    if (groupCollection.Contains(groupName))
+    {
+      MgLayerGroup analysisGroup =groupCollection.GetItem(groupName);
+      analysisGroup.SetVisible(true);
+    }
+
+    //---------------------------------------------------//
+    //  Save the map back to the session repository
+    map.Save();
+
+    //---------------------------------------------------//
+
+  }
+  catch (MgException e)
+  {
+    Response.Write( "<script language=\"javascript\" type=\"text/javascript\"> \n");
+    Response.Write("    alert(\" " + e.GetExceptionMessage() + " \"); \n");
+    Response.Write("</script> \n");
+  }
+    %>
+  </body>
+</html>
\ No newline at end of file

Added: trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/task_pane.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/task_pane.aspx	                        (rev 0)
+++ trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/task_pane.aspx	2011-12-29 12:13:31 UTC (rev 6380)
@@ -0,0 +1,76 @@
+<!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" %>
+<%@ Import Namespace="System.Collections.Specialized" %>
+<%@ Import Namespace="System.IO" %>
+<%@ Import Namespace="OSGeo.MapGuide" %>
+
+<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 src="../common/pageLoadFunctions.js" type="text/javascript" language="JavaScript">
+    </script>
+	</head>
+	<body class="AppFrame">		
+		<%
+		sessionId = Request.Params["SESSION"];
+        mapName = Request.Params["MAPNAME"];
+		%>				
+		<h1 class="AppHeading">Digitizing &amp; Redlining</h1>	
+		<ul>
+			<li>
+				<a href="task_pane_digitizing.aspx?SESSION=<%= sessionId %>&MAPNAME=<%= mapName %>">Digitizing Sample</a>
+        <br/>Show digitizing functions.
+        <br/>
+        <%
+        fullPath = Server.MapPath("task_pane_digitizing.aspx");
+        %>
+        <a target="_blank" href="../common/viewsource.aspx?FILENAME=<%= fullPath %>" >View source</a>
+			</li>
+			<li>
+				<a href="task_pane_redlining.aspx?SESSION=<%= sessionId %>&MAPNAME=<%= mapName %>">Redlining Sample</a>
+        <br/>Draw lines on the map.
+        <br/>
+        <%
+        fullPath = Server.MapPath("task_pane_redlining.aspx");
+        %>
+        <a target="_blank" href="../common/viewsource.aspx?FILENAME=<%= fullPath %>" >View source</a>
+			</li>
+		</ul>
+    <p>View source for support files:</p>
+    <%
+        fullPath = Server.MapPath("draw_line.aspx");
+        String fullPath2 = Server.MapPath("clear_lines.aspx");    
+    %>
+    <ul>
+      <li><a target="_blank" href="../common/viewsource.aspx?FILENAME=<%= fullPath %>">draw_line.aspx</a></li>
+      <li><a target="_blank" href="../common/viewsource.aspx?FILENAME=<%= fullPath2 %>">clear_lines.aspx</a></li>
+    </ul>
+	</body>
+</html>

Added: trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/task_pane_digitizing.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/task_pane_digitizing.aspx	                        (rev 0)
+++ trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/task_pane_digitizing.aspx	2011-12-29 12:13:31 UTC (rev 6380)
@@ -0,0 +1,119 @@
+<!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
+-->
+<html>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+    <title>Digitizing</title>
+    
+    <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">
+    <meta http-equiv="content-script-type" content="text/javascript">     
+    <script  language="javascript" type="text/javascript">
+      function DigitizePoint() {
+          // ShowResults("");
+          parent.parent.mapFrame.DigitizePoint(OnPointDigitized);
+      }
+      function OnPointDigitized(point) {
+          ShowResults("X: " + point.X + ", Y: " + point.Y);
+      }
+      function DigitizeLine() {
+          ShowResults("");
+          parent.parent.mapFrame.DigitizeLine(OnLineDigitized);
+      }
+      function OnLineDigitized(line) {
+          ShowResults(FormatLineResults(line));
+      }
+      function DigitizeMultiLine() {
+          ShowResults("");
+          parent.parent.mapFrame.DigitizeMultiLine(OnMultiLineDigitized);
+      }     
+      function DigitizeLineString() {
+          ShowResults("");
+          parent.parent.mapFrame.DigitizeLineString(OnDigitizeLineString);
+      }
+      function OnDigitizeLineString(line) {
+          ShowResults(FormatLineResults(line));
+      }
+          
+      function DigitizeCircle() {
+          ShowResults("");
+          parent.parent.mapFrame.DigitizeCircle(OnCircleDigitized);
+      }
+      function OnCircleDigitized(circle) {
+          ShowResults("Center X: " + circle.Center.X + ", Y: " + circle.Center.Y + "\nRadius: " + circle.Radius);
+      }
+      function DigitizeRectangle() {
+          ShowResults("");
+          parent.parent.mapFrame.DigitizeRectangle(OnRectangleDigitized);
+      }
+      function OnRectangleDigitized(rect) {
+          str = "X1: " + rect.Point1.X + ", Y1: " + rect.Point1.Y + "\n";
+          str += "X2: " + rect.Point2.X + ", Y1: " + rect.Point2.Y + "\n";
+          
+          ShowResults(str);
+      }
+      function DigitizePolygon() {
+          ShowResults("");
+          parent.parent.mapFrame.DigitizePolygon(OnPolygonDigitized);
+      }
+      function OnPolygonDigitized(poly) {
+          ShowResults(FormatLineResults(poly));
+      }
+      function FormatLineResults(line) {
+          str = "Points: " + line.Count + "\n";
+          for(var i = 0; i < line.Count; i++) {
+              pt = line.Point(i);
+              str += "X" + i + ": " + pt.X + ", Y" + i + ": " + pt.Y + "\n";
+          }
+          return str;
+      }
+      function ShowResults(res)  {
+          document.getElementById("res").value = res;
+      }
+    </script>
+  </head>
+  <body class="AppFrame">   
+    <h1 class="AppHeading">Digitizing</h1>  
+    <p>
+    Click button then click on map: 
+    </p>
+    <input type="button" value=" Point " onclick="DigitizePoint();">
+    <br>
+    <input type="button" value=" LineString " onclick="DigitizeLineString();">    
+    <br>
+    <input type="button" value=" Polygon " onclick="DigitizePolygon();">
+    <hr>
+    
+    <p>Click button then drag on map: 
+    </p>
+    <input type="button" value=" Line " onclick="DigitizeLine();">
+    <br>
+    <input type="button" value=" Rectangle " onclick="DigitizeRectangle();">
+    <br>
+    <input type="button" value=" Circle " onclick="DigitizeCircle();">
+    
+    <hr>
+    Result:<br>
+    <textarea id="res" rows="10" cols="32" name="results">
+    </textarea>
+    
+    <hr>
+      
+  </body>
+</html>
\ No newline at end of file

Added: trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/task_pane_redlining.aspx
===================================================================
--- trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/task_pane_redlining.aspx	                        (rev 0)
+++ trunk/MgDev/Doc/samples/dotnetsamples/digitizing_features/task_pane_redlining.aspx	2011-12-29 12:13:31 UTC (rev 6380)
@@ -0,0 +1,76 @@
+<!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" %>
+<%@ Import Namespace="System.Collections.Specialized" %>
+<%@ Import Namespace="System.IO" %>
+
+<script runat="server">
+    String sessionId;
+    String mapName;
+</script>
+<html>
+  <head>
+    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
+    <title>Redlining</title>
+    
+    <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">
+    <meta http-equiv="content-script-type" content="text/javascript">
+    <% 
+    sessionId = Request.Params["SESSION"];
+    mapName = Request.Params["MAPNAME"];
+    %>
+    <script language="javascript" type="text/javascript">       
+      function DigitizeLine() {
+        parent.parent.mapFrame.DigitizeLine(OnLineDigitized);
+      }
+      function OnLineDigitized(line) {          
+        // Send the Javascript variables to 'draw_line.aspx', 
+        // via the form frame
+        var params = new Array("x0", line.Point(0).X,
+        	"y0", line.Point(0).Y,
+        	"x1", line.Point(1).X,
+        	"y1", line.Point(1).Y,
+        	"SESSION", "<%= sessionId %>",
+        	"MAPNAME", "<%= mapName %>");
+        parent.parent.formFrame.Submit("/mapguide/dotnetsamples/digitizing_features/draw_line.aspx", params, "scriptFrame");
+      }
+    </script>   
+  </head>
+  <body class="AppFrame">
+    
+    <h1 class="AppHeading">Redlining</h1>
+    
+    <!-- "Draw a Line" button --> 
+    <p>Click the button, and then drag a line on the map.</p>
+    <input type="button" value="Draw a Line" onclick="DigitizeLine();" /> 
+    <p>To draw another line, click the button again and drag another line.</p>
+    
+    <!-- "Clear Lines" button -->
+    <hr>
+    <form target="scriptFrame" action="clear_lines.aspx" method="post">
+      <input type="submit" value="Clear Lines" />
+      <input type="hidden" name="SESSION" value="<%= sessionId %>" />
+      <input type="hidden" name="MAPNAME" value="<%= mapName %>" />          
+    </form>                     
+          
+  </body>
+</html>



More information about the mapguide-commits mailing list