[Mapserver-users] SWF multiple output, ElementSelected when a layer is off

Pierre GIRAUD bluecarto at free.fr
Fri Jul 30 03:08:53 PDT 2004


Hello all,

I'm just trying to implement the flash output and I gotta some problems 
using the multiple one.

1 - Imagine you've got a mapfile with two layers :

-----------------------
LAYER
 NAME layer1
 TYPE POLYGON
 DATA "layer1.shp"
 CLASS
   ...
 END
 METADATA
   "SWFDUMPATTRIBUTES" "LAYER1_FIELD"
 END
END

LAYER
 NAME layer2
 TYPE POLYGON
 DATA "layer2.shp"
 CLASS
   ...
 END
 METADATA
   "SWFDUMPATTRIBUTES" "LAYER2_FIELD"
 END
END
---------------------

If I use the multiple output, Mapserver renders a main swf movie 
(file_name.swf)
that contains a mapObj object with many variables in it, and a movie for 
each
layer (file_name_layer_0.swf, file_name_layer_1.swf). I am developping an
interface that can return infos when the mouse rolls over elements 
(shapes). This works well in this configuration.
mapObj.layers contains 2 objects, one for each layer with variables like 
fullname, name, relativename, etc ...

2 - Now imagine you add a MAXSCALE to the first one (layer1) that 
prevent it to be rendered.
Mapserver generates the parent movie (file_name.swf) and only one child 
movie (file_name_layer_0.swf).
Here is the mapObj object returned (in the parent movie) :
----------------
mapObj
 .layers
   .0
     .fullname : "/var/www/.../file_name_layer_0.swf"
     .name : "layer1"
     .relativename : "file_name_layer_0.swf"
     .type : "2"
 .name : "MYMAP"
 .numlayers : 2
---------------
First of all, this may not be correct. There are 2 layers in the mapfile.
Logicaly only one is rendered. But the one that is included in mapObj is 
not the
right one.
Following would probably be better :
----------------
mapObj
 .layers
   .0
     .fullname : undefined
     .name : "layer1"
     .relativename : undefined
     .type : "2"
   .1
     .fullname : "/var/www/.../file_name_layer_0.swf"
     .name : "layer2"
     .relativename : "file_name_layer_0.swf"
     .type : "2"
 .name : "MYMAP"
 .numlayers : 2
---------------

3 -The main problem rise up when trying to use the AScript 
"ElementSelected" function. Its first argument returned is the 
"layerId". It corresponds to the layer order in the mapfile. In the 
second example, when rolling over a shape of layer2 (the only one 
visible), "layerId" is equal to "1" (second layer in the mapfile). But 
there is no data relative to it in "mapObj.layers".

The example of maxscale value is one among many others. The problem 
obviously
appears as well when layer status is dynamically set to off.

4 - Is this a bug ? Is there any other way to get the attributes 
corresponding to the layer the mouse is rolling over ? Am I missing 
something ?

Regards

Pierre GIRAUD




More information about the MapServer-users mailing list