[mapguide-commits] r5228 - trunk/MgDev/Web/src/mapviewernet
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sat Oct 2 01:53:54 EDT 2010
Author: waltweltonlair
Date: 2010-10-02 05:53:53 +0000 (Sat, 02 Oct 2010)
New Revision: 5228
Modified:
trunk/MgDev/Web/src/mapviewernet/common.aspx
trunk/MgDev/Web/src/mapviewernet/getselectedfeatures.aspx
trunk/MgDev/Web/src/mapviewernet/quickplotgeneratepicture.aspx
trunk/MgDev/Web/src/mapviewernet/quickplotpreviewinner.aspx
trunk/MgDev/Web/src/mapviewernet/taskframe.aspx
Log:
Just run my regular tab/cleanup script...
Modified: trunk/MgDev/Web/src/mapviewernet/common.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/common.aspx 2010-10-01 04:36:11 UTC (rev 5227)
+++ trunk/MgDev/Web/src/mapviewernet/common.aspx 2010-10-02 05:53:53 UTC (rev 5228)
@@ -191,7 +191,7 @@
{
// 00000000-0000-0000-0000-000000000000_aa_00000000000000000000
String validSessionId = "";
- if(proposedSessionId != null && System.Text.RegularExpressions.Regex.IsMatch(proposedSessionId,
+ if(proposedSessionId != null && System.Text.RegularExpressions.Regex.IsMatch(proposedSessionId,
"^[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}_[A-Za-z]{2}_[A-Fa-f0-9]{20}$"))
{
validSessionId = proposedSessionId;
@@ -203,7 +203,7 @@
{
// aa or aa-aa
String validLocaleString = GetDefaultLocale(); // Default
- if(proposedLocaleString != null && (System.Text.RegularExpressions.Regex.IsMatch(proposedLocaleString, "^[A-Za-z]{2}$") ||
+ if(proposedLocaleString != null && (System.Text.RegularExpressions.Regex.IsMatch(proposedLocaleString, "^[A-Za-z]{2}$") ||
System.Text.RegularExpressions.Regex.IsMatch(proposedLocaleString, "^[A-Za-z]{2}-[A-Za-z]{2}$")))
{
validLocaleString = proposedLocaleString;
@@ -241,7 +241,7 @@
{
validNumberString = proposedNumberString;
}
- return validNumberString;
+ return validNumberString;
}
String ValidateResourceId(String proposedResourceId)
@@ -272,7 +272,7 @@
String ValidateColorString(String proposedColorString)
{
String validColorString = "000000";
- if (proposedColorString != null &&
+ if (proposedColorString != null &&
System.Text.RegularExpressions.Regex.IsMatch(proposedColorString, "^[A-Fa-f0-9]{6}$"))
{
validColorString = proposedColorString;
Modified: trunk/MgDev/Web/src/mapviewernet/getselectedfeatures.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/getselectedfeatures.aspx 2010-10-01 04:36:11 UTC (rev 5227)
+++ trunk/MgDev/Web/src/mapviewernet/getselectedfeatures.aspx 2010-10-02 05:53:53 UTC (rev 5228)
@@ -1,4 +1,4 @@
-<%@ Page Language="C#" %>
+<%@ Page Language="C#" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Collections.Generic" %>
@@ -9,7 +9,7 @@
<!-- #include File="common.aspx" -->
<script runat="server">
-
+
class SelectionSet
{
private Dictionary<string, List<Feature>> _layers;
@@ -76,7 +76,7 @@
return new List<FeatureProperty>(_properties.Values).ToArray();
}
}
-
+
String mapName;
String sessionId;
String locale;
@@ -98,7 +98,7 @@
}
return mappings;
}
-
+
String GetPropertyValueFromFeatureReader(MgFeatureReader reader, MgAgfReaderWriter agfRw, int propType, String propName)
{
String value = "";
@@ -109,7 +109,7 @@
break;
case MgPropertyType.Byte:
value = String.Format(culture, "{0:d}", reader.GetByte(propName));
- break;
+ break;
case MgPropertyType.DateTime:
value = GetDateTimeString(reader.GetDateTime(propName)); // yyyy-mm-dd is enforced regardless of locale
break;
@@ -135,14 +135,14 @@
value = "";
break;
}
- return value;
+ return value;
}
static String GetDateTimeString(MgDateTime value)
{
return String.Format("{0}-{1}-{2}", value.Year, value.Month, value.Day);
}
-
+
void GetParameters(NameValueCollection param)
{
mapName = param["MAPNAME"];
@@ -157,12 +157,12 @@
else
GetParameters(Request.QueryString);
}
-
+
String JsonEscape(String str)
{
return EscapeForHtml(str).Replace("\\", "\\\\");
}
-
+
String JsonifyError(Exception ex)
{
return "{\"Error\":{\"Message\":\"" + JsonEscape(ex.Message) + "\",\"StackTrace\":\"" + JsonEscape(ex.StackTrace) + "\"}}";
@@ -172,33 +172,33 @@
{
/*
A sample of the JSON output this method will produce:
-
-
+
+
{
- "Layer1" : [
- {
- 'values' { "name" : "name1" , "value" : "value1" },
- 'zoom' : { x: num1, y: num2 }
- } ,
+ "Layer1" : [
+ {
+ 'values' { "name" : "name1" , "value" : "value1" },
+ 'zoom' : { x: num1, y: num2 }
+ } ,
..,
..,
..,
],
- "Layer2" : [
- {
- 'values' { "name" : "name2" , "value" : "value2" },
- 'zoom' : { x: num1, y: num2 }
- } ,
+ "Layer2" : [
+ {
+ 'values' { "name" : "name2" , "value" : "value2" },
+ 'zoom' : { x: num1, y: num2 }
+ } ,
..,
..,
..,
]
}
*/
-
+
if (set == null)
return "";
-
+
StringBuilder sb = new StringBuilder();
//Begin selection set
sb.Append("{");
@@ -244,22 +244,22 @@
sb.Append("}");
return sb.ToString();
}
-
+
</script>
-<%
+<%
mapName = "";
sessionId = "";
locale = "";
GetRequestParameters();
-
+
if (String.IsNullOrEmpty(locale))
locale = GetDefaultLocale();
-
+
culture = CultureInfo.GetCultureInfo(locale);
-
- //HACK: The default locale (en) resolves to a neutral culture, .net forbids the use of
+
+ //HACK: The default locale (en) resolves to a neutral culture, .net forbids the use of
//neutral cultures for formatting purposes, so default to InvariantCulture if the resolved
//culture is not neutral.
if (culture.IsNeutralCulture)
@@ -275,7 +275,7 @@
site.Open(cred);
MgResourceService resSvc = (MgResourceService)site.CreateService(MgServiceType.ResourceService);
-
+
MgMap map = new MgMap(site);
map.Open(mapName);
@@ -378,10 +378,10 @@
Response.Write(JsonifyError(ex));
}
catch (Exception ex)
- {
+ {
Response.AddHeader("Content-Type", "application/json");
Response.AddHeader("X-JSON", "true");
Response.Write(JsonifyError(ex));
}
-
-%>
\ No newline at end of file
+
+%>
Modified: trunk/MgDev/Web/src/mapviewernet/quickplotgeneratepicture.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/quickplotgeneratepicture.aspx 2010-10-01 04:36:11 UTC (rev 5227)
+++ trunk/MgDev/Web/src/mapviewernet/quickplotgeneratepicture.aspx 2010-10-02 05:53:53 UTC (rev 5228)
@@ -61,16 +61,16 @@
mapName = ValidateMapName(GetParameter(parameters, "map_name"));
rotation = GetDoubleParameter(parameters, "rotation");
printDpi = GetIntParameter(parameters, "print_dpi");
-
+
scaleDenominator = GetIntParameter(parameters, "scale_denominator");
-
+
string[] a = parameters["paper_size"].Split(',');
paperSize = new SizeF(float.Parse(a[0]), float.Parse(a[1]));
printSize = new Size((int) (paperSize.Width / 25.4 * printDpi), (int) (paperSize.Height / 25.4 * printDpi));
-
+
a = parameters["box"].Split(',');
captureBox = CreatePolygon(a);
-
+
a = parameters["normalized_box"].Split(',');
normalizedCapture = CreatePolygon(a);
}
@@ -79,15 +79,15 @@
{
MgGeometryFactory geometryFactory = new MgGeometryFactory();
MgCoordinateCollection coordinateCollection = new MgCoordinateCollection();
-
+
for (int i = 0; i < coordinates.Length; ++i)
{
coordinateCollection.Add(geometryFactory.CreateCoordinateXY(double.Parse(coordinates[i]), double.Parse(coordinates[++i])));
}
-
+
coordinateCollection.Add(geometryFactory.CreateCoordinateXY(double.Parse(coordinates[0]), double.Parse(coordinates[1])));
MgLinearRing linearRing = geometryFactory.CreateLinearRing(coordinateCollection);
-
+
return geometryFactory.CreatePolygon(linearRing, null);
}
@@ -98,12 +98,12 @@
siteConnection.Open(userInfo);
MgResourceService resourceService = siteConnection.CreateService(MgServiceType.ResourceService) as MgResourceService;
MgRenderingService renderingService = siteConnection.CreateService(MgServiceType.RenderingService) as MgRenderingService;
-
+
MgMap map = new MgMap();
map.Open(resourceService, mapName);
-
+
MgSelection selection = new MgSelection(map);
-
+
// Calculate the generated picture size
MgEnvelope envelope = captureBox.Envelope();
MgEnvelope normalizedE = normalizedCapture.Envelope();
@@ -112,13 +112,13 @@
SizeF toSize = new SizeF(size1.Width / size2.Width * size.Width, size1.Height / size2.Height * size.Height);
MgCoordinate center = captureBox.GetCentroid().GetCoordinate();
-
+
// Get the map agent url
// Get the correct http protocol
StringBuilder mapAgent = new StringBuilder(Request.IsSecureConnection ? "https://" : "http://");
// Get the correct port number
// Just use the 127.0.0.1 specificly to point to localhost. Because the WebExtension will
- // be always on the same server with map agent.
+ // be always on the same server with map agent.
mapAgent.Append("127.0.0.1").Append(":").Append(Request.ServerVariables["SERVER_PORT"]);
// Get the correct virtual directory
@@ -156,9 +156,9 @@
graphics.DrawImage(image, -image.Width / 2, -image.Height / 2);
}
}
-
+
DrawNorthArrow(result);
-
+
using (MemoryStream stream = new MemoryStream())
{
result.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
@@ -184,7 +184,7 @@
{
float scaleFactor = (float) printDpi / naDpi;
RectangleF rec = new RectangleF(new PointF(0.0f, 0.0f), new SizeF(na.Width * scaleFactor, na.Height * scaleFactor));
-
+
if (Math.Abs(rotation) > double.Epsilon)
{
GraphicsUnit pixelUnit = GraphicsUnit.Pixel;
@@ -195,7 +195,7 @@
region.Transform(matrix);
rec = region.GetBounds(graphics);
}
-
+
using (System.Drawing.Image rotatedNA = new Bitmap((int) Math.Ceiling(rec.Width), (int) Math.Ceiling(rec.Height)))
{
using (Graphics nag = Graphics.FromImage(rotatedNA))
@@ -205,7 +205,7 @@
nag.ScaleTransform(scaleFactor, scaleFactor);
nag.DrawImage(na, -na.Width / 2, -na.Height / 2);
}
-
+
double x = image.Width - rotatedNA.Width - naMargin / 25.4 * printDpi;
double y = image.Height - rotatedNA.Height - naMargin / 25.4 * printDpi;
graphics.DrawImage(rotatedNA, new PointF((float)x, (float)y));
Modified: trunk/MgDev/Web/src/mapviewernet/quickplotpreviewinner.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/quickplotpreviewinner.aspx 2010-10-01 04:36:11 UTC (rev 5227)
+++ trunk/MgDev/Web/src/mapviewernet/quickplotpreviewinner.aspx 2010-10-02 05:53:53 UTC (rev 5228)
@@ -55,7 +55,7 @@
String mask = Regex.Match(templ, pattern).Result("${mask}");
templ = Regex.Replace(templ, pattern, DateTime.Now.ToString(mask));
// The scale annotation
-
+
String jsPath = "../viewerfiles/";
String[] vals = {jsPath};
@@ -80,7 +80,7 @@
us = GetIntParameter(parameters, "US");
scaleDenominator = GetIntParameter(parameters, "SCALE_DENOMINATOR");
mapName = ValidateMapName(GetParameter(parameters, "MAPNAME"));
-
+
// The parameters whose name matches this pattern will be treated as annotation
String pattern = @"^\{field:.+\}$";
foreach (String key in parameters.AllKeys)
@@ -90,7 +90,7 @@
annotations.Add(key, HttpUtility.HtmlEncode(parameters[key]));
}
}
-
+
annotations.Add("{scale}", String.Format("1 : {0}", scaleDenominator));
}
Modified: trunk/MgDev/Web/src/mapviewernet/taskframe.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/taskframe.aspx 2010-10-01 04:36:11 UTC (rev 5227)
+++ trunk/MgDev/Web/src/mapviewernet/taskframe.aspx 2010-10-02 05:53:53 UTC (rev 5228)
@@ -47,7 +47,7 @@
//connect to the site and get a feature service and a resource service instances
MgSiteConnection site = new MgSiteConnection();
site.Open(cred);
-
+
//Get the MgWebLayout object
MgResourceService resourceSrvc = (MgResourceService)site.CreateService(MgServiceType.ResourceService);
MgResourceIdentifier webLayoutResId = new MgResourceIdentifier(webLayoutId);
More information about the mapguide-commits
mailing list