[Mapproxy-java] SF.net SVN: mapproxy:[41]
Brought to you by:
pborissow
From: <pbo...@us...> - 2012-03-29 15:10:19
|
Revision: 41 http://mapproxy.svn.sourceforge.net/mapproxy/?rev=41&view=rev Author: pborissow Date: 2012-03-29 15:10:10 +0000 (Thu, 29 Mar 2012) Log Message: ----------- - Temporarily commented out logic in the mapproxy.core.Layer.getImage() method to check whether a requested bounding box falls outside of the max extents. In recent testing, the intersection test was returning incorrect values resulting in empty tiles. Something is not right! - Updated the HttpServlet to use the new javaxt-server library. - Added new class to track version number. - Commented out a couple debug print statements. - Added default values for "cache.max_tile_limit" and "image.resampling_method" in the Config class. Modified Paths: -------------- Main.java config/Config.java core/HttpServlet.java core/Layer.java core/ServiceResponse.java core/image/TiledImage.java core/request/BaseRequest.java wms/client/WMSClient.java Added Paths: ----------- core/Version.java Modified: Main.java =================================================================== --- Main.java 2012-01-11 12:13:48 UTC (rev 40) +++ Main.java 2012-03-29 15:10:10 UTC (rev 41) @@ -1,4 +1,5 @@ package mapproxy; +import mapproxy.core.HttpServlet; import mapproxy.wms.request.*; import mapproxy.wms.client.*; import mapproxy.core.grid.*; @@ -299,10 +300,11 @@ Config.load(getConfig(args)); int numThreads = Config.base_config().get("threads").toInteger(); int port = Config.base_config().get("port").toInteger(); + Service service = ((mapproxy.core.Service) Config.base_config().get("mapproxy").toObject()); //Start the server try { - javaxt.http.Server mapserver = new javaxt.http.Server(port, numThreads, new HttpServlet()); + javaxt.http.Server mapserver = new javaxt.http.Server(port, numThreads, new HttpServlet(service)); mapserver.start(); } catch (Exception e) { Modified: config/Config.java =================================================================== --- config/Config.java 2012-01-11 12:13:48 UTC (rev 40) +++ config/Config.java 2012-03-29 15:10:10 UTC (rev 41) @@ -18,7 +18,8 @@ public static Options base_config(){ if (options==null){ options = new Options(); - options.set("version", "1.0"); + options.set("cache.max_tile_limit", 500); + options.set("image.resampling_method", "bicubic"); } return options; } Modified: core/HttpServlet.java =================================================================== --- core/HttpServlet.java 2012-01-11 12:13:48 UTC (rev 40) +++ core/HttpServlet.java 2012-03-29 15:10:10 UTC (rev 41) @@ -11,18 +11,19 @@ * ******************************************************************************/ -public class HttpServlet implements javaxt.http.servlet.HttpServlet { +public class HttpServlet extends javaxt.http.servlet.HttpServlet { private static ConcurrentHashMap<String, String> httpCache; - private static String serverName; + private static String serverName = "MapProxy Server " + Version.ID; + private Service service; //************************************************************************** //** Constructor //************************************************************************** /** Creates a new instance of HttpServlet. */ - public HttpServlet() { - serverName = "MapProxy Server " + mapproxy.config.Config.base_config().get("version").toString(); + public HttpServlet(mapproxy.core.Service service) { + this.service = service; httpCache = new ConcurrentHashMap<String, String>(); } @@ -32,17 +33,18 @@ //************************************************************************** /** Used to process http get and post requests. */ - public void processRequest(HttpServletRequest request, HttpServletResponse response) { + public void processRequest(HttpServletRequest request, HttpServletResponse response) + throws java.io.IOException { //long startTime = new java.util.Date().getTime(); //long initResponse = 0; //long initCache = 0; try{ - Service service = ((mapproxy.core.Service) mapproxy.config.Config.base_config().get("mapproxy").toObject()); ServiceResponse map = service.getResponse(request.getURL().toString(), new String(request.getBody(), "UTF-8")); javaxt.utils.Date date = map.getDate(); String key = map.getID(); //initResponse = new java.util.Date().getTime()-startTime; boolean useCache = useCache(request, key); + //initCache = new java.util.Date().getTime()-(initResponse+startTime); if (useCache){ @@ -79,7 +81,7 @@ } } catch(Exception e){ - +e.printStackTrace(); //Return Error response.setStatus(500); response.setHeader("Server", serverName); Modified: core/Layer.java =================================================================== --- core/Layer.java 2012-01-11 12:13:48 UTC (rev 40) +++ core/Layer.java 2012-03-29 15:10:10 UTC (rev 41) @@ -313,7 +313,7 @@ * @param srs Spatial reference system associated with the bbox (e.g. EPSG:4326). */ public javaxt.io.Image getImage(int width, int height, String format, String bbox, String srs){ - + FileCache fileCache = (FileCache) this.getParam("cache"); TileGrid grid = (TileGrid) this.getParam("grid"); @@ -331,6 +331,8 @@ //Check whether we should use/create a map cache boolean useCache = (fileCache!=null); + //System.out.println(this.getBBox().intersects(new BBox(bbox, srs))); + /* if (useCache) { if (!this.getBBox().intersects(new BBox(bbox, srs))) { // return the blank tile, no need to call the WMS @@ -346,8 +348,8 @@ return image; } } +*/ - //if (format.equalsIgnoreCase("image/PNG24")) format = "jpeg"; //<-- This is crazy! If I return a 24 bit PNG, ArcMap doesn't display anything. If I return a JPEG, works like a champ if (!format.toLowerCase().startsWith("image/")) format = "image/" + format; if (format.equalsIgnoreCase("image/jpg")) format = "image/jpeg"; @@ -380,7 +382,7 @@ image = cache.image(req.params.bbox(), new SRS(req.params.srs()), req.params.size()); } catch (Exception e) { - + e.printStackTrace(); } return image; } Modified: core/ServiceResponse.java =================================================================== --- core/ServiceResponse.java 2012-01-11 12:13:48 UTC (rev 40) +++ core/ServiceResponse.java 2012-03-29 15:10:10 UTC (rev 41) @@ -58,7 +58,7 @@ } } - + this.url = new javaxt.utils.URL(url.toString()); if (requestBody!=null){ @@ -407,7 +407,7 @@ //Create unique key key = bbox + "|" + layers + "|" + contentType + "|" + width + "|" + height + "|" + srs; - + //Exit method as needed if (!getBytes) return; @@ -440,11 +440,6 @@ //Convert the image into a byte array if (format.toLowerCase().endsWith("png24")) format = "image/png"; rsp = image.getByteArray(format); - - - //rsp = new javaxt.io.File("/temp/ArcGIS/ExportImage.png").getBytes().toByteArray(); - //rsp = new javaxt.io.Image("/temp/ArcGIS/ExportImage.png").getByteArray("png"); - } Added: core/Version.java =================================================================== --- core/Version.java (rev 0) +++ core/Version.java 2012-03-29 15:10:10 UTC (rev 41) @@ -0,0 +1,13 @@ +package mapproxy.core; + +public class Version { + + + private Version(){} + + public static final String ID = "0.8.1 RC4"; + + + public String toString(){ return ID; } + +} Modified: core/image/TiledImage.java =================================================================== --- core/image/TiledImage.java 2012-01-11 12:13:48 UTC (rev 40) +++ core/image/TiledImage.java 2012-03-29 15:10:10 UTC (rev 41) @@ -1,6 +1,5 @@ package mapproxy.core.image; import mapproxy.core.SRS; -import mapproxy.core.Python; //****************************************************************************** //** TiledImage Class Modified: core/request/BaseRequest.java =================================================================== --- core/request/BaseRequest.java 2012-01-11 12:13:48 UTC (rev 40) +++ core/request/BaseRequest.java 2012-03-29 15:10:10 UTC (rev 41) @@ -84,7 +84,7 @@ if (this.url.contains("?")) delimiter = "&"; if (this.url.endsWith("?")) delimiter = ""; - System.out.println(this.url + delimiter + this.query_string()); + //System.out.println(this.url + delimiter + this.query_string()); return this.url + delimiter + this.query_string(); } Modified: wms/client/WMSClient.java =================================================================== --- wms/client/WMSClient.java 2012-01-11 12:13:48 UTC (rev 40) +++ wms/client/WMSClient.java 2012-03-29 15:10:10 UTC (rev 41) @@ -41,7 +41,7 @@ public javaxt.io.Image get_map(WMSRequest request){ - //return new javaxt.http.Request(_map_url(request)).getResponse().getImage(); + //System.out.println(_map_url(request)); javaxt.io.Image image = new javaxt.http.Request(_map_url(request)).getResponse().getImage(); if (image.getBufferedImage()!=null){ return image; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |