[OpenMap Users] ImageServer/MapRequestHandler (Newbie Question)

From: Monte Philip V NPRI <MontePV_at_Npt.NUWC.Navy.Mil>
Date: Wed, 12 Jul 2006 13:44:20 -0400

I am trying to take advantage of the existing SimpleHttpImageServer for generating map images on a server (that get sent to a client application). I am trying to add the customization of land and border color. So, I extended MapRequestHandler and overrode createImage (listed below) to change the layer properties doe fillColor and lineColor. I does not seem to work unless the projection is changed via a zoom/pan. So, if I make a request for a new map, it gets returned with the same colors, but once I zoom/pan I see the change. Is there something else I can do to the layer to force the projection to be regenerated inturn displaying the new color(s)? What am I missing here?
public byte[] createImage(Projection proj, int scaledWidth,
                              int scaledHeight, Vector showLayers, String landColor, String borderColor) {
                "ImageServer: using the new ProjectionPainter interface! createImage with layer string array. ");
        if (formatter == null) {
            Debug.error("ImageServer.createImage: no formatter set! Can't create image.");
            return new byte[0];
        ImageFormatter imageFormatter = formatter.makeClone();
        java.awt.Graphics graphics = createGraphics(imageFormatter,
        if (graphics == null) {
            return new byte[0];
        ((Proj) proj).drawBackground((Graphics2D) graphics, background);
        int size = showLayers.size();
        if (showLayers != null) {
            for (int j = size - 1; j >= 0; j--) {
                for (int i = layers.length - 1; i >= 0; i--) {
                    String layerName = (String) showLayers.elementAt(j);
                    Layer layer = layers[i];
                    //Set the land and border color
                    Properties p = new Properties();
                    p.setProperty("shapePolitical.fillColor", landColor);
                    p.setProperty("shapePolitical.lineColor", borderColor);

                    if (layerName.equals(layer.getPropertyPrefix())) {
                        layer.renderDataForProjection(proj, graphics);
                        if (Debug.debugging("imageserver")) {
                            Debug.output("ImageServer: image request adding layer graphics from : "
                                    + layer.getName());
        } else if (Debug.debugging("imageserver")) {
            Debug.output("ImageServer: no layers available for image");
        byte[] formattedImage = getFormattedImage(imageFormatter,
        return formattedImage;

Philip V. Monte

Software Engineer
Code 2514, Warfare Interoperability Branch
NAVSEA Warfare Centers Division Newport
(401) 832-5325



[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 Jul 12 2006 - 14:32:09 EDT

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