<%@ page import="e2edm.classes.ElementValues, e2edm.map.MapBuilder, e2edm.objects.GeographicBoundingBox, java.io.File, java.util.ArrayList, java.util.TreeSet" %> <%@ page import="java.util.Vector" %> <%@ page contentType="text/html; charset=WINDOWS-1251" %> <%String path1 = "http://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";%> <%String path2 = this.getServletConfig().getServletContext().getRealPath("\\");%> <%String sizex = request.getParameter("sizex");%> <%sizex = (sizex != null ? sizex : "566");%> <%String sizey = request.getParameter("sizey");%> <%sizey = (sizey != null ? sizey : "364");%> <%String showall = request.getParameter("showall");%> <%showall = (showall != null ? showall : "no");%> <%String backlink = request.getParameter("backlink");%> <%backlink = (backlink != null ? backlink : "no");%> <% MapBuilder mapBuilder; mapBuilder = (MapBuilder) session.getAttribute("mapBuilderResult"); if (showall.equals("yes")) { TreeSet x = new TreeSet(); TreeSet y = new TreeSet(); Vector coord = new Vector(); ArrayList geoData = new ArrayList(); geoData = (ArrayList) session.getAttribute("geo"); if (geoData != null) { for (int i = 0; i < geoData.size(); i++) { GeographicBoundingBox boundingBox = (GeographicBoundingBox) geoData.get(i); if (boundingBox != null) { if (boundingBox.getWestBoundLongitude() != null) { x.add(boundingBox.getWestBoundLongitude()); } if (boundingBox.getEastBoundLongitude() != null) { x.add(boundingBox.getEastBoundLongitude()); } if (boundingBox.getNorthBoundLatitude() != null) { y.add(boundingBox.getNorthBoundLatitude()); } if (boundingBox.getSouthBoundLatitude() != null) { y.add(boundingBox.getSouthBoundLatitude()); } } } if (mapBuilder == null) { mapBuilder = new MapBuilder(request, sizex, sizey, path1, path2, backlink); session.setAttribute("mapBuilderResult", mapBuilder); coord = mapBuilder.getExtentCoord(x, y); mapBuilder.extent(coord, path2); } for (int i = 0; i < geoData.size(); i++) { GeographicBoundingBox boundingBox = (GeographicBoundingBox) geoData.get(i); if (boundingBox != null) { String type = (String) boundingBox.getGeographicObjectType(); Float x1 = null; Float y1 = null; Float x2 = null; Float y2 = null; if (type.equals(ElementValues.GEOGRAPHIC_OBJECT_TYPE_POINT)) { if (boundingBox.getWestBoundLongitude() != null || boundingBox.getEastBoundLongitude() != null) { String lon = boundingBox.getWestBoundLongitude().toString(); if (lon == null) lon = boundingBox.getEastBoundLongitude().toString(); x1 = new Float(lon); } if (boundingBox.getNorthBoundLatitude() != null || boundingBox.getSouthBoundLatitude() != null) { String lat = boundingBox.getNorthBoundLatitude().toString(); if (lat == null) lat = boundingBox.getSouthBoundLatitude().toString(); y1 = new Float(lat); } if (x1 != null && y1 != null) mapBuilder.drawPoint(x1.floatValue(), y1.floatValue(), "''", path2); } if (type.equals(ElementValues.GEOGRAPHIC_OBJECT_TYPE_TRACK)) { if (boundingBox.getWestBoundLongitude() != null && boundingBox.getEastBoundLongitude() != null) { String lon_min = boundingBox.getWestBoundLongitude().toString(); String lon_max = boundingBox.getEastBoundLongitude().toString(); x1 = new Float(lon_min); x2 = new Float(lon_max); } if (boundingBox.getNorthBoundLatitude() != null && boundingBox.getSouthBoundLatitude() != null) { String lat_min = boundingBox.getSouthBoundLatitude().toString(); String lat_max = boundingBox.getNorthBoundLatitude().toString(); y1 = new Float(lat_max); y2 = new Float(lat_min); } if (x1 != null && y1 != null && x2 != null && y2 != null) mapBuilder.drawTrack(x1.floatValue(), y1.floatValue(), x2.floatValue(), y2.floatValue(), "''", path2); } if (type.equals(ElementValues.GEOGRAPHIC_OBJECT_TYPE_AREA)) { if (boundingBox.getWestBoundLongitude() != null && boundingBox.getEastBoundLongitude() != null) { String lon_min = boundingBox.getWestBoundLongitude().toString(); String lon_max = boundingBox.getEastBoundLongitude().toString(); x1 = new Float(lon_min); x2 = new Float(lon_max); } if (boundingBox.getNorthBoundLatitude() != null && boundingBox.getSouthBoundLatitude() != null) { String lat_min = boundingBox.getSouthBoundLatitude().toString(); String lat_max = boundingBox.getNorthBoundLatitude().toString(); y1 = new Float(lat_max); y2 = new Float(lat_min); } if (x1 != null && y1 != null && x2 != null && y2 != null) mapBuilder.drawArea(x1.floatValue(), y1.floatValue(), x2.floatValue(), y2.floatValue(), "''", path2); } } } } else { if (mapBuilder == null) { mapBuilder = new MapBuilder(request, sizex, sizey, path1, path2, backlink); session.setAttribute("mapBuilderResult", mapBuilder); } } } else { session.removeAttribute("mapBuilderResult"); mapBuilder = (MapBuilder) session.getAttribute("mapBuilder"); if (mapBuilder == null) { mapBuilder = new MapBuilder(request, sizex, sizey, path1, path2, backlink); session.setAttribute("mapBuilder", mapBuilder); } } String mapfileName = mapBuilder.getConfigFileName() + ".map"; File mapF = new File(mapfileName); if (! mapF.exists()) { mapBuilder = new MapBuilder(request, sizex, sizey, path1, path2, backlink); session.setAttribute("mapBuilderResult", mapBuilder); mapfileName = mapBuilder.getConfigFileName() + ".map"; } %>