[mapguide-commits] r5229 - trunk/MgDev/Web/src/mapviewerjava

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sat Oct 2 02:01:25 EDT 2010


Author: waltweltonlair
Date: 2010-10-02 06:01:25 +0000 (Sat, 02 Oct 2010)
New Revision: 5229

Modified:
   trunk/MgDev/Web/src/mapviewerjava/buffer.jsp
   trunk/MgDev/Web/src/mapviewerjava/common.jsp
   trunk/MgDev/Web/src/mapviewerjava/getselectedfeatures.jsp
   trunk/MgDev/Web/src/mapviewerjava/quickplotgeneratepicture.jsp
   trunk/MgDev/Web/src/mapviewerjava/quickplotpanel.jsp
   trunk/MgDev/Web/src/mapviewerjava/quickplotpreviewinner.jsp
   trunk/MgDev/Web/src/mapviewerjava/taskframe.jsp
Log:
Just run my regular tab/cleanup script...

Modified: trunk/MgDev/Web/src/mapviewerjava/buffer.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/buffer.jsp	2010-10-02 05:53:53 UTC (rev 5228)
+++ trunk/MgDev/Web/src/mapviewerjava/buffer.jsp	2010-10-02 06:01:25 UTC (rev 5229)
@@ -403,7 +403,7 @@
     distance = GetLocalizedDoubleParameter(request, "DISTANCE", locale);
     if(IsParameter(request, "MERGE"))
          merge = 1;
-    
+
     bufferName = GetParameter(request, "BUFFER");
     layersParam = GetParameter(request, "LAYERS");
     units = GetParameter(request, "UNITS");

Modified: trunk/MgDev/Web/src/mapviewerjava/common.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/common.jsp	2010-10-02 05:53:53 UTC (rev 5228)
+++ trunk/MgDev/Web/src/mapviewerjava/common.jsp	2010-10-02 06:01:25 UTC (rev 5229)
@@ -199,7 +199,7 @@
 {
     // 00000000-0000-0000-0000-000000000000_aa_00000000000000000000
     String validSessionId = "";
-    if(proposedSessionId != null && 
+    if(proposedSessionId != null &&
         Pattern.matches("^[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}$", proposedSessionId))
     {
         validSessionId = proposedSessionId;
@@ -211,7 +211,7 @@
 {
     // aa or aa-aa
     String validLocaleString = GetDefaultLocale(); // Default
-    if(proposedLocaleString != null && 
+    if(proposedLocaleString != null &&
         (Pattern.matches("^[A-Za-z]{2}$", proposedLocaleString) || Pattern.matches("^[A-Za-z]{2}-[A-Za-z]{2}$", proposedLocaleString)))
     {
         validLocaleString = proposedLocaleString;
@@ -249,7 +249,7 @@
     {
         validNumberString = proposedNumberString;
     }
-    return validNumberString;    
+    return validNumberString;
 }
 
 String ValidateResourceId(String proposedResourceId)
@@ -280,7 +280,7 @@
 String ValidateColorString(String proposedColorString)
 {
     String validColorString = "000000";
-    if (proposedColorString != null && 
+    if (proposedColorString != null &&
         Pattern.matches("^[A-Fa-f0-9]{6}$", proposedColorString))
     {
         validColorString = proposedColorString;

Modified: trunk/MgDev/Web/src/mapviewerjava/getselectedfeatures.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/getselectedfeatures.jsp	2010-10-02 05:53:53 UTC (rev 5228)
+++ trunk/MgDev/Web/src/mapviewerjava/getselectedfeatures.jsp	2010-10-02 06:01:25 UTC (rev 5229)
@@ -42,7 +42,7 @@
         {
             String[] layers = new String[_layers.keySet().size()];
             _layers.keySet().toArray(layers);
-            
+
             return layers;
         }
 
@@ -98,7 +98,7 @@
             return props;
         }
     }
-    
+
     static String getTextValue(Element el, String tagName)
     {
         String textVal = null;
@@ -110,34 +110,34 @@
         }
         return textVal;
     }
-    
+
     static HashMap<String, String> GetLayerPropertyMappings(MgResourceService resSvc, MgLayerBase layer) throws Exception
     {
         HashMap<String, String> mappings = new HashMap<String, String>();
-        
+
         MgByteReader content = resSvc.GetResourceContent(layer.GetLayerDefinition());
         ByteArrayInputStream contentReader = new ByteArrayInputStream(content.ToString().getBytes("UTF-8"));
-        
+
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         DocumentBuilder db = dbf.newDocumentBuilder();
         Document doc = db.parse(contentReader);
-        
+
         doc.getDocumentElement().normalize();
         NodeList propNodes = doc.getElementsByTagName("PropertyMapping");
-        
+
         for (int i = 0; i < propNodes.getLength(); i++)
         {
             Element propEl = (Element)propNodes.item(i);
             String name = getTextValue(propEl, "Name");
             String value = getTextValue(propEl, "Value");
-            
+
             if (name != null && value != null)
                 mappings.put(name, value);
         }
-        
+
         return mappings;
     }
-    
+
     String GetPropertyValueFromFeatureReader(MgFeatureReader reader, MgAgfReaderWriter agfRw, int propType, String propName) throws Exception
     {
         String value = "";
@@ -148,7 +148,7 @@
                 break;
             case MgPropertyType.Byte:
                 value = String.format(locale, "%d", reader.GetByte(propName));
-                break; 
+                break;
             case MgPropertyType.DateTime:
                 value = GetDateTimeString(reader.GetDateTime(propName)); // yyyy-mm-dd is enforced regardless of locale
                 break;
@@ -174,26 +174,26 @@
                 value = "";
                 break;
         }
-        return value;   
+        return value;
     }
 
     static String GetDateTimeString(MgDateTime value) throws MgException
     {
         return value.GetYear() + "-" + value.GetMonth() + "-" + value.GetDay();
     }
-    
+
     void GetParameters(HttpServletRequest request)
     {
         mapName = GetParameter(request, "MAPNAME");
         sessionId = GetParameter(request, "SESSION");
         localeCode = GetParameter(request, "LOCALE");
     }
-    
+
     String JsonEscape(String str)
     {
         return EscapeForHtml(str).replace("\\", "\\\\");
     }
-    
+
     String JsonifyError(Exception ex)
     {
         if (ex == null)
@@ -206,7 +206,7 @@
             }
         }
         */
-        
+
         StringBuffer sb = new StringBuffer();
         //Use exception message or type name if no message found
         String msg = ex.getMessage();
@@ -229,38 +229,38 @@
         sb.append("}}");
         return sb.toString();
     }
-    
+
     static String GetJson(SelectionSet set)
     {
         /*
         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 "";
-        
+
         StringBuffer sb = new StringBuffer();
         //Begin selection set
         sb.append("{");
@@ -313,10 +313,10 @@
     localeCode = "";
 
     GetParameters(request);
-    
+
     if (null == localeCode || localeCode.length() == 0)
         localeCode = GetDefaultLocale();
-        
+
     locale = new Locale(localeCode);
 
     try
@@ -329,7 +329,7 @@
         site.Open(cred);
 
         MgResourceService resSvc = (MgResourceService)site.CreateService(MgServiceType.ResourceService);
-        
+
         MgMap map = new MgMap(site);
         map.Open(mapName);
 
@@ -438,4 +438,4 @@
         response.addHeader("X-JSON", "true");
         response.getWriter().write(JsonifyError(ex));
     }
-%>
\ No newline at end of file
+%>

Modified: trunk/MgDev/Web/src/mapviewerjava/quickplotgeneratepicture.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/quickplotgeneratepicture.jsp	2010-10-02 05:53:53 UTC (rev 5228)
+++ trunk/MgDev/Web/src/mapviewerjava/quickplotgeneratepicture.jsp	2010-10-02 06:01:25 UTC (rev 5229)
@@ -46,7 +46,7 @@
 %>
 
 <%
-    
+
     GetRequestParameters(request);
     response.setContentType("image/png");
     ImageIO.write(GenerateMap(printSize), "png", response.getOutputStream());
@@ -61,17 +61,17 @@
     rotation  = GetDoubleParameter(request, "rotation");
     printDpi  = GetIntParameter(request, "print_dpi");
     scaleDenominator = GetIntParameter(request, "scale_denominator");
-    
+
     String[] a = GetParameter(request, "paper_size").split(",");
     paperSize  = new Size<Double>(Double.parseDouble(a[0]), Double.parseDouble(a[1]));
     printSize  = new Size<Integer>((int) (paperSize.width / 25.4 * printDpi), (int) (paperSize.height / 25.4 * printDpi));
-    
+
     a = GetParameter(request, "box").split(",");
     captureBox = CreatePolygon(a);
-    
+
     a = GetParameter(request, "normalized_box").split(",");
     normalizedCapture = CreatePolygon(a);
-    
+
     mapAgentPath = GetMapAgentPath(request);
     naPath = getServletContext().getRealPath("viewerfiles/quickplotnortharrow.png");
 }
@@ -80,15 +80,15 @@
 {
     MgGeometryFactory geometryFactory = new MgGeometryFactory();
     MgCoordinateCollection coordinateCollection = new MgCoordinateCollection();
-    
+
     for (int i = 0; i < coordinates.length; ++i)
     {
         coordinateCollection.Add(geometryFactory.CreateCoordinateXY(Double.parseDouble(coordinates[i]), Double.parseDouble(coordinates[++i])));
     }
-    
+
     coordinateCollection.Add(geometryFactory.CreateCoordinateXY(Double.parseDouble(coordinates[0]), Double.parseDouble(coordinates[1])));
     MgLinearRing linearRing = geometryFactory.CreateLinearRing(coordinateCollection);
-    
+
     return geometryFactory.CreatePolygon(linearRing, null);
 }
 
@@ -99,21 +99,21 @@
     siteConnection.Open(userInfo);
     MgResourceService resourceService = (MgResourceService) siteConnection.CreateService(MgServiceType.ResourceService);
     MgRenderingService renderingService = (MgRenderingService) siteConnection.CreateService(MgServiceType.RenderingService);
-    
+
     MgMap map = new MgMap();
     map.Open(resourceService, mapName);
-    
+
     MgSelection selection = new MgSelection(map);
-    
+
     // Caculate the generated picture size
     MgEnvelope envelope = captureBox.Envelope();
     MgEnvelope normalizedE = normalizedCapture.Envelope();
     Size<Double> size1 = new Size<Double>(envelope.GetWidth(), envelope.GetHeight());
     Size<Double> size2 = new Size<Double>(normalizedE.GetWidth(), normalizedE.GetHeight());
-    
+
     Size<Double> toSize = new Size<Double>(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(mapAgentPath);
@@ -128,11 +128,11 @@
             .append("&SETDISPLAYWIDTH=").append(String.valueOf(toSize.width))
             .append("&SETDISPLAYHEIGHT=").append(String.valueOf(toSize.height))
             .append("&CLIP=0");
-            
+
     BufferedImage image  = ImageIO.read(new URL(mapAgent.toString()));
     BufferedImage result = Math.abs(rotation) > Double.MIN_VALUE ? new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB) : image;
     Graphics2D graphics  = result.createGraphics();
-    
+
     if (Math.abs(rotation) > Double.MIN_VALUE)
     {
         graphics.translate(size.width / 2, size.height / 2);
@@ -141,9 +141,9 @@
     }
 
     graphics.dispose();
-    
+
     DrawNorthArrow(result);
-    
+
     return result;
 }
 
@@ -158,7 +158,7 @@
     BufferedImage na  = ImageIO.read(new File(naPath));
     Rectangle2D rec = new Rectangle2D.Double();
     rec.setRect(0.0, 0.0, na.getWidth(), na.getHeight());
-    
+
     Path2D.Double path = new Path2D.Double();
     path.moveTo(0, 0);
     path.lineTo(na.getWidth(), 0);
@@ -169,7 +169,7 @@
     transform.rotate(rotation * Math.PI / 180, (double) na.getWidth() / 2, (double) na.getHeight() / 2);
     transform.scale(scaleFactor, scaleFactor);
     path.transform(transform);
-    
+
     rec = path.getBounds2D();
 
     BufferedImage rotatedNA = na;
@@ -186,10 +186,10 @@
         nag.drawImage(na, new AffineTransformOp(new AffineTransform(), AffineTransformOp.TYPE_BICUBIC), (int) Math.ceil(-na.getWidth() / 2), (int) Math.ceil(-na.getHeight() / 2));
         nag.dispose();
     }
-    
+
     int x = (int) Math.ceil(image.getWidth() - rotatedNA.getWidth() - naMargin / 25.4 * printDpi);;
     int y = (int) Math.ceil(image.getHeight() - rotatedNA.getHeight() - naMargin / 25.4 * printDpi);
-    
+
     Graphics2D graphics = image.createGraphics();
     graphics.drawImage(rotatedNA, new AffineTransformOp(new AffineTransform(), AffineTransformOp.TYPE_BICUBIC), x, y);
     graphics.dispose();
@@ -202,14 +202,14 @@
     StringBuilder mapAgent = new StringBuilder(request.getScheme());
     mapAgent.append("://");
     // 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(":");
     // Get the correct port number;
     mapAgent.append(request.getServerPort());
     // Get the correct virtual directory
     mapAgent.append(request.getContextPath());
     mapAgent.append("/mapagent/mapagent.fcgi");
-    
+
     return mapAgent.toString();
 }
 %>
@@ -219,11 +219,11 @@
     {
         public T width;
         public T height;
-        
+
         public Size(T width, T height)
         {
             this.width  = width;
             this.height = height;
         }
     }
-%>
\ No newline at end of file
+%>

Modified: trunk/MgDev/Web/src/mapviewerjava/quickplotpanel.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/quickplotpanel.jsp	2010-10-02 05:53:53 UTC (rev 5228)
+++ trunk/MgDev/Web/src/mapviewerjava/quickplotpanel.jsp	2010-10-02 06:01:25 UTC (rev 5229)
@@ -42,9 +42,9 @@
     GetRequestParameters(request);
 
     String vpath = GetSurroundVirtualPath(request);
-	String jsPath = "../viewerfiles/";
+    String jsPath = "../viewerfiles/";
     String templ = MgLocalizer.Localize(LoadTemplate("/viewerfiles/quickplotpanel.templ"), locale, GetClientOS(request));
-    String[] vals = { 
+    String[] vals = {
                       jsPath,
                       jsPath,
                       String.valueOf(targetType),

Modified: trunk/MgDev/Web/src/mapviewerjava/quickplotpreviewinner.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/quickplotpreviewinner.jsp	2010-10-02 05:53:53 UTC (rev 5228)
+++ trunk/MgDev/Web/src/mapviewerjava/quickplotpreviewinner.jsp	2010-10-02 06:01:25 UTC (rev 5229)
@@ -46,9 +46,9 @@
     MgLocalizer.SetLocalizedFilesPath(getServletContext().getRealPath("/") + "localized/");
     GetRequestParameters(request);
 
-	String jsPath = "../viewerfiles/";
+    String jsPath = "../viewerfiles/";
     String templ = MgLocalizer.Localize(LoadTemplate("/viewerfiles/quickplotpreviewinner.templ"), locale, GetClientOS(request));
-    
+
     for (Enumeration<String> keys = annotations.keys();
          keys.hasMoreElements();)
     {
@@ -64,7 +64,7 @@
     {
         formatString = matcher.group(1);
     }
-    
+
     templ = templ.replaceAll(pattern.toString(), String.format(formatString, Calendar.getInstance()));
     String[] vals = {jsPath};
 
@@ -79,7 +79,7 @@
     mapName = ValidateMapName(GetParameter(request, "MAPNAME"));
     targetType = GetIntParameter(request, "TARGETTYPE");
     us = GetIntParameter(request, "US");
-    
+
     // The parameters whose name matches this pattern will be treated as annotation
     String pattern = "^\\{field:.+\\}$";
     for (Enumeration<String> names = request.getParameterNames();
@@ -92,7 +92,7 @@
             annotations.put(name, EscapeForHtml(request.getParameter(name)));
         }
      }
-    
+
     annotations.put("{scale}", "1 : " + GetParameter(request, "scale_denominator"));
 }
 %>

Modified: trunk/MgDev/Web/src/mapviewerjava/taskframe.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/taskframe.jsp	2010-10-02 05:53:53 UTC (rev 5228)
+++ trunk/MgDev/Web/src/mapviewerjava/taskframe.jsp	2010-10-02 06:01:25 UTC (rev 5229)
@@ -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