[OpenMap Users] Bug in ImageServer

From: Mariusz Chmielewski <mchmielewski_at_wat.edu.pl>
Date: Mon, 20 Sep 2010 01:39:38 +0200

Accidentally I have found a bug in class ImageServer - when using a
WMSPlugin - there is a problem in this code fragment:

 

 

Problem code:

if (showLayers != null) {

            for (int j = size - 1; j >= 0; j--) {

                for (int i = layers.length - 1; i >= 0; i--) {

                    String layerName = (String) showLayers.get(j);

                    Layer layer = layers[i];

                    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");

        }

 

Correct code:

if (showLayers != null) {

         for (int j = size - 1; j >= 0; j--) {

             for (int i = layers.length - 1; i >= 0; i--) {

                 String layerName = (String) showLayers.get(j);

                 Layer layer = layers[i];

                 String prefix = layer.getPropertyPrefix();

                 if (prefix==null){

                   if (layer instanceof PlugInLayer)

                   prefix =
((PlugInLayer)layer).getPlugIn().getPropertyPrefix();

                 }

                   

                   

                   

                 if (layerName.equals(prefix)) {

                     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");

     }

 

The problem is that PlugInLayer do not store the prefix and You have to
call the plugin itself to ask for it.

 

Regards,

                       

Capt. M. Sc. Mariusz Chmielewski

Email: <mailto:mchmielewsk_at_wat.edu.pl> mchmielewski_at_wat.edu.pl

 

Computer Science Institute,

Cybernetics Faculty,

Military University of Technology,

Warsaw,

Poland

 



--
[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 Sun Sep 19 2010 - 20:15:32 EDT

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