[OpenMap Users] FW: No layers displayed by ImageServer

From: Joe Reger, Jr. <joe_at_joereger.com>
Date: Wed, 23 Mar 2005 10:47:19 -0500

Thanks Don!

>>Don Dietrick, dietrick_at_bbn.com writes:
>>
>>I'd put
>>
>>Debug.init();
>>Debug.put("imageserver");
>>
>>in your init() method, and see if the layers are being called to make
>>the images.

I put the Debug() statements into my init() method and my doGet() method
(latest code at bottom). Here's what I got:

ImageServer: using the new ProjectionPainter interface! createImage with
layer mask.
ImageServer.createGraphics: graphics is cool
ImageServer: considering 2 for image...
ImageServer: image request adding layer graphics from : Graticule Layer
ImageServer: image request adding layer graphics from : Political Solid
ImageServer: ready to create formatted image.
ImageServer: using full scale image (unscaled).

It looks like I don't get much logging in the init() method, but once the
doGet() method is called I get the above log entries on each request. It
seems to say that it's adding the layers properly but I still get a blank
white image. Is there a higher debug level that I should turn on?

Thanks,

Joe


package reger.geo;

import java.io.IOException;
import java.util.Properties;
import java.util.Vector;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import com.bbn.openmap.Layer;
import com.bbn.openmap.util.ComponentFactory;
import com.bbn.openmap.util.Debug;
import com.bbn.openmap.image.*;
import com.bbn.openmap.proj.Projection;
import com.bbn.openmap.proj.ProjectionFactory;

public class MapServlet extends HttpServlet {

    public static Layer polLayer;
    public static Layer gratLayer;
    public static Layer[] layers;
    public static ImageServer imageServer;
    public static AcmeJPEGFormatter formatter = new AcmeJPEGFormatter();
    public static Properties configProperties;
    public static Projection defaultProjection;

    public void init(ServletConfig conf) throws ServletException {
        super.init(conf);

        Debug.init();
        Debug.put("imageserver");

        //Political Boundaries Layer
        if (polLayer==null){
            Properties shapeLayerProps = new Properties();
            shapeLayerProps.put("prettyName", "Political Solid");
            shapeLayerProps.put("lineColor", "000000");
            shapeLayerProps.put("fillColor", "BDDE83");
            shapeLayerProps.put("shapeFile",
"C:/SuperFly/Tomcat/webapps/geo/data/shape/cntry02/cntry02.shp");
            shapeLayerProps.put("spatialIndex",
"C:/SuperFly/Tomcat/webapps/geo/data/shape/cntry02/cntry02.ssx");
            polLayer =
(Layer)ComponentFactory.create("com.bbn.openmap.layer.shape.ShapeLayer",
shapeLayerProps);
                    System.out.println("polLayer created: " +
polLayer.toString());
        }

        //Graticule Layer
        if (gratLayer==null){
            Properties gratLayerProps = new Properties();
            gratLayerProps.put("prettyName", "Graticule Layer");
            gratLayerProps.put("showRuler", "true");
            gratLayerProps.put("show1And5Lines", "true");
            gratLayerProps.put("threshold", "2");
            gratLayerProps.put("10DegreeColor", "99000000");
            gratLayerProps.put("5DegreeColor", "99009900");
            gratLayerProps.put("1DegreeColor", "99003300");
            gratLayerProps.put("equatorColor", "99FF0000");
            gratLayerProps.put("specialLineColor", "99000000");
            gratLayerProps.put("textColor", "99000000");
            gratLayer =
(Layer)ComponentFactory.create("com.bbn.openmap.layer.GraticuleLayer",
gratLayerProps);
                    System.out.println("gratLayer created: " +
gratLayer.toString());
        }

        //Store the layers in an array
        if (layers==null){
                    layers = new Layer[2];
                    layers[0] = polLayer;
                    layers[1] = gratLayer;
        }

        //Initialize the projection
        if (defaultProjection==null){
            defaultProjection =
ProjectionFactory.makeProjection(ProjectionFactory.getProjClassForName("com.
bbn.openmap.proj.Mercator"), 0f, -90f, 1000000000f, 640, 480);
            System.out.println("defaultProjection created: " +
defaultProjection.getName());
        }

        //Initialize the imageServer
        if (imageServer==null){

            imageServer = new ImageServer(layers, formatter);
            System.out.println("ImageServer created: " +
imageServer.toString());
        }
    }

        public void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException {
        Debug.init();
        Debug.put("imageserver");
        //Create the image using the ImageServer and the projection
        byte[] image = imageServer.createImage(defaultProjection);
        //Send the image to the client
        response.setContentType("image/jpeg");
        response.setContentLength(image.length);
        response.getOutputStream().write(image);
    }
}


--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Wed Mar 23 2005 - 12:18:11 EST

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:06 EDT