Re: [OpenMap Users] Bug in ImageServer

From: Don Dietrick <dfdietrick_at_gmail.com>
Date: Mon, 20 Sep 2010 17:00:50 -0400

Thanks Mariusz!

- Don

On Sun, Sep 19, 2010 at 7:39 PM, Mariusz Chmielewski
<mchmielewski_at_wat.edu.pl> wrote:
> 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: 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 Mon Sep 20 2010 - 17:02:25 EDT

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