[mapguide-commits] r6866 - branches/2.4/MgDev/Web/src/mapviewerjava
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Jul 6 08:12:07 PDT 2012
Author: jng
Date: 2012-07-06 08:12:07 -0700 (Fri, 06 Jul 2012)
New Revision: 6866
Modified:
branches/2.4/MgDev/Web/src/mapviewerjava/measure.jsp
branches/2.4/MgDev/Web/src/mapviewerjava/measureui.jsp
Log:
#1834: Add support for specifying units for measurement. This submission is the Java viewer files
Modified: branches/2.4/MgDev/Web/src/mapviewerjava/measure.jsp
===================================================================
--- branches/2.4/MgDev/Web/src/mapviewerjava/measure.jsp 2012-07-06 15:11:54 UTC (rev 6865)
+++ branches/2.4/MgDev/Web/src/mapviewerjava/measure.jsp 2012-07-06 15:12:07 UTC (rev 6866)
@@ -37,7 +37,7 @@
double y2;
double total;
String srs;
-int us;
+String units;
int segId;
String error;
double distance;
@@ -59,7 +59,7 @@
y2 = 0;
total = 0;
srs = "";
- us = 0;
+ units = "";
segId = 1;
error = "";
distance = 0;
@@ -124,10 +124,10 @@
distance = srsMap.ConvertCoordinateSystemUnitsToMeters(distance);
- if(0 == us)
- distance *= 0.001; //get kilometers
- else
- distance *= 0.000621371192; //get miles
+ if (units.equals("mi")) distance *= 0.000621371192; //get miles
+ if (units.equals("km")) distance *= 0.001; //get kilometers
+ if (units.equals("ft")) distance *= 3.2808399; //get feet
+ if (units.equals("usft")) distance *= 3.2808333; //get US survey feet
total += distance;
@@ -186,7 +186,14 @@
featureSrvc.CreateFeatureSource(dataSourceId, parameters);
//build map tip
- String unitText = (us==1)? "Miles": "Kilometers";
+ String unitText = "";
+ if (units.equals("mi")) unitText = "DISTANCEMILES";
+ if (units.equals("km")) unitText = "DISTANCEKILOMETERS";
+ if (units.equals("ft")) unitText = "DISTANCEFEET";
+ if (units.equals("usft")) unitText = "DISTANCEUSFEET";
+ if (units.equals("m")) unitText = "DISTANCEMETERS";
+ unitText = MgLocalizer.GetString(unitText, locale);
+
String tip = "Concat(Concat(Concat('" + MgLocalizer.GetString("MEASUREPARTIAL", locale) + ": ', PARTIAL), Concat(', " + MgLocalizer.GetString("MEASURETOTAL", locale) + ": ', TOTAL)), ' (" + unitText + ")')";
//Create the layer definition
@@ -262,6 +269,7 @@
String.valueOf(total),
String.valueOf(distance),
"1",
+ units,
vpath + "measure.jsp",
vpath + "measure.jsp"
};
@@ -276,6 +284,7 @@
mapName = ValidateMapName(GetParameter(request, "MAPNAME"));
target = GetIntParameter(request, "TGT");
popup = GetIntParameter(request, "POPUP");
+ units = GetParameter(request, "UNITS");
if(IsParameter(request, "CLEAR"))
{
clear = true;
@@ -288,7 +297,6 @@
x2 = GetDoubleParameter(request, "X2");
y2 = GetDoubleParameter(request, "Y2");
total = GetDoubleParameter(request, "TOTAL");
- us = GetIntParameter(request, "US");
segId = GetIntParameter(request, "SEGID");
}
}
Modified: branches/2.4/MgDev/Web/src/mapviewerjava/measureui.jsp
===================================================================
--- branches/2.4/MgDev/Web/src/mapviewerjava/measureui.jsp 2012-07-06 15:11:54 UTC (rev 6865)
+++ branches/2.4/MgDev/Web/src/mapviewerjava/measureui.jsp 2012-07-06 15:12:07 UTC (rev 6866)
@@ -31,6 +31,7 @@
int cmdIndex = -1;
String mapName = "";
String sessionId = "";
+String units = "";
double total = 0;
%>
@@ -54,6 +55,7 @@
String.valueOf(total),
"0",
"0",
+ units,
vpath + "measure.jsp",
vpath + "measure.jsp"
};
@@ -70,5 +72,6 @@
cmdIndex = GetIntParameter(request, "CMDINDEX");
mapName = ValidateMapName(GetParameter(request, "MAPNAME"));
total = GetDoubleParameter(request, "TOTAL");
+ units = GetParameter(request, "UNITS");
}
%>
More information about the mapguide-commits
mailing list