[mapguide-commits] r6865 - branches/2.4/MgDev/Web/src/mapviewernet
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Jul 6 08:11:54 PDT 2012
Author: jng
Date: 2012-07-06 08:11:54 -0700 (Fri, 06 Jul 2012)
New Revision: 6865
Modified:
branches/2.4/MgDev/Web/src/mapviewernet/measure.aspx
branches/2.4/MgDev/Web/src/mapviewernet/measureui.aspx
Log:
#1834: Add support for specifying units for measurement. This submission is the .net viewer files
Modified: branches/2.4/MgDev/Web/src/mapviewernet/measure.aspx
===================================================================
--- branches/2.4/MgDev/Web/src/mapviewernet/measure.aspx 2012-07-06 15:11:38 UTC (rev 6864)
+++ branches/2.4/MgDev/Web/src/mapviewernet/measure.aspx 2012-07-06 15:11:54 UTC (rev 6865)
@@ -35,7 +35,7 @@
double y2 = 0;
double total = 0;
String srs = "";
-int us = 0;
+String units = "";
int segId = 1;
String error = "";
double distance = 0;
@@ -102,10 +102,10 @@
distance = srsMap.ConvertCoordinateSystemUnitsToMeters(distance);
- if (0 == us)
- distance *= 0.001; //get kilometers
- else
- distance *= 0.000621371192; //get miles
+ if (units == "mi") distance *= 0.000621371192; //get miles
+ if (units == "km") distance *= 0.001; //get kilometers
+ if (units == "ft") distance *= 3.2808399; //get feet
+ if (units == "usft") distance *= 3.2808333; //get US survey feet
total += distance;
@@ -164,7 +164,14 @@
featureSrvc.CreateFeatureSource(dataSourceId, parameters);
//build map tip
- String unitText = (us == 1) ? "Miles" : "Kilometers";
+ String unitText = "";
+ if (units == "mi") unitText = "DISTANCEMILES";
+ if (units == "km") unitText = "DISTANCEKILOMETERS";
+ if (units == "ft") unitText = "DISTANCEFEET";
+ if (units == "usft") unitText = "DISTANCEUSFEET";
+ if (units == "m") unitText = "DISTANCEMETERS";
+ unitText = MgLocalizer.GetString(unitText, locale);
+
String tip = String.Format("Concat(Concat(Concat('" + MgLocalizer.GetString("MEASUREPARTIAL", locale) + ": ', PARTIAL), Concat(', " + MgLocalizer.GetString("MEASURETOTAL", locale) + ": ', TOTAL)), ' ({0})')", unitText);
//Create the layer definition
@@ -239,6 +246,7 @@
total.ToString(NumberFormatInfo.InvariantInfo),
distance.ToString(NumberFormatInfo.InvariantInfo),
"1",
+ units,
vpath + "measure.aspx",
vpath + "measure.aspx"
};
@@ -266,6 +274,7 @@
mapName = ValidateMapName(GetParameter(parameters, "MAPNAME"));
target = GetIntParameter(parameters, "TGT");
popup = GetIntParameter(parameters, "POPUP");
+ units = GetParameter(parameters, "UNITS");
if(IsParameter(parameters, "CLEAR"))
clear = true;
else
@@ -275,7 +284,6 @@
x2 = GetDoubleParameter(parameters, "X2");
y2 = GetDoubleParameter(parameters, "Y2");
total = GetDoubleParameter(parameters, "TOTAL");
- us = GetIntParameter(parameters, "US");
segId = GetIntParameter(parameters, "SEGID");
}
}
Modified: branches/2.4/MgDev/Web/src/mapviewernet/measureui.aspx
===================================================================
--- branches/2.4/MgDev/Web/src/mapviewernet/measureui.aspx 2012-07-06 15:11:38 UTC (rev 6864)
+++ branches/2.4/MgDev/Web/src/mapviewernet/measureui.aspx 2012-07-06 15:11:54 UTC (rev 6865)
@@ -30,6 +30,7 @@
int cmdIndex = -1;
String mapName = "";
String sessionId = "";
+String units = "";
double total = 0;
</script>
@@ -53,6 +54,7 @@
total.ToString(NumberFormatInfo.InvariantInfo),
"0",
"0",
+ units,
vpath + "measure.aspx",
vpath + "measure.aspx"
};
@@ -77,6 +79,7 @@
popup = GetIntParameter(parameters, "POPUP");
cmdIndex = GetIntParameter(parameters, "CMDINDEX");
total = GetDoubleParameter(parameters, "TOTAL");
+ units = GetParameter(parameters, "UNITS");
}
</script>
More information about the mapguide-commits
mailing list