Opened 20 years ago

Closed 20 years ago

#648 closed enhancement (fixed)

template processor: grey out scale dependent layers which are out of scale

Reported by: bartvde@… Owned by: jmckenna@…
Priority: high Milestone: 4.4 release
Component: MapServer C Library Version: 4.3
Severity: minor Keywords:
Cc: jmckenna@…, pspencer@…

Description

We need a way with the template processor to be able to grey out (i.e. make 
italic with a grey color) scale dependent layers which are in the MAP but which 
are out of scale.

e-mail excerpt:

Paul Spencer wrote:
Scale dependent layers being greyed out requires changes to MapServer (the 
legend template processor) 
which needs to be done by Daniel or Assefa, again I will have to check with 
them for time availability. 
This would likely be implemented as an additional keyword for use in the [if] 
blocks of an HTML legend 
template and would thus require no changes in Chameleon ...

-- 
I agree that it would be best to implement this as a new variable that can be 
used in an HTML legend [if] block.  Since you are already familiar with the 
MapServer bugzilla, I would recommend that you file a bug there describing what 
you need when you're ready, and then contact me via direct email to tell me 
that this bug should be handled under your support contract.
 
This has the benefit that there will be a trace of the request and its 
resolution, and any discussion that may be required with the other developers 
will take place in the bug and you'll be able to follow them.
 
Since this is a fairly small change (or should be anyway), I don't expect any 
problem doing it between now and the MUM.
 
Daniel

Change History (22)

comment:1 by bartvde@…, 20 years ago

Hi Daniel, are you still on schedule for doing this one before the MUM?

comment:2 by dmorissette, 20 years ago

Cc: mckenna@… added
Milestone: 4.4 release
Status: newassigned
It's implemented in V4.3 (CVS):

- Added "layer_visible" variable for use in [if] tags inside [leg_layer_html],
[leg_group_html] and [leg_class_html].  Value is 1 if layer is visible and 0 if
not visible.
- Visibility is based on current scale and layer status.
- In the case of groups, the visibility is based on the first layer in the group.

Here is an example of a class-based legend using that new parameter:

[leg_class_html opt_flag=15]
 [if name=layer_visible oper=eq value=1]
  <img src=[leg_icon]> [leg_class_name]<br>
 [/if]
 [if name=layer_visible oper=eq value=0]
  n/a  ([leg_class_name])<br>
 [/if]
[/leg_class_html]

There is a live example using that legend template at
http://www2.dmsolutions.ca/msapps/itasca_legend/demo_init.html
(select legend #8)

--
ToDo: Update HTML Legend HOWTO to document this parameter and to show this new
example.

comment:3 by dmorissette, 20 years ago

Cc: spencer@… morissette@… added
Owner: changed from morissette@… to mckenna@…
Status: assignednew
Reassigned to Jeff to update the HTML Legend HOWTO (V4.3/4.4).

comment:4 by bartvde@…, 20 years ago

Hi Daniel, great, thanks for the quick work. Is it possible for you to provide a
new Mapscript Windows binary?

comment:5 by dmorissette, 20 years ago

There's a new binary with this included on maptools.org.  What's left is
updating the docs (Jeff).

comment:6 by bartvde@…, 20 years ago

Cc: assefa@… added
Hi Daniel,

I am trying this right now with the binary from Assefa, php_mapscript_43.dll,
from 14/06/04. I changed the config of Chameleon to point to this php_mapscript
version. It is not working though. Is my template wrong, or is the support not
compiled in?

I use the following template:

[leg_layer_html opt_flag=15]
[if name=layer_type oper=neq value=4]
[if name=layer_name oper=eq value=ExpressionBuilderAnnotation]
  <tr>
    <td><input type="hidden" name="legendlayername[]" value="[leg_layer_name]">
    </td>
  </tr>[/if]
[if name=layer_name oper=neq value=ExpressionBuilderAnnotation]
  <tr>
    <td><input type="radio" name="my_legend"
onclick="CWCSelectLayer('[leg_layer_name]', true)"[if name=selected oper=eq
value=1] CHECKED[/if] ></td>
    <td><input type="checkbox" name="legendlayername[]"
value="[leg_layer_name]"[if name=layer_status oper=eq value=1] CHECKED[/if]></td>
    <td width="75%">
    [if name=layer_visible oper=eq value=1]
    <font face="Arial, Helvetica, sans-serif" size="1">
    [/if]
    [if name=layer_visible oper=eq value=0]
      <font face="Arial italic, Helvetica, sans-serif" size="2">
    [/if]
    [metadata name=wms_title][if name=wms_title
oper=isnull][leg_layer_name][/if]</font></td>
  </tr>
[/if]
[/if]
[/leg_layer_html]

This is one row of the generated HTML:
 <tr>
    <td><input type="radio" name="my_legend"
onclick="CWCSelectLayer('Rijkswateren', true)"[if name=selected oper=eq value=1]
CHECKED[/if] ></td>

    <td><input type="checkbox" name="legendlayername[]" value="Rijkswateren"
CHECKED></td>
    <td width="75%">
    [if name=layer_visible oper=eq value=1]
    <font face="Arial, Helvetica, sans-serif" size="1">
    [/if]
    [if name=layer_visible oper=eq value=0]
      <font face="Arial italic, Helvetica, sans-serif" size="2">
    [/if]
    Rijkswateren</font></td>
  </tr>

BTW: The selected part ([if name=selected oper=eq value=1]) has never been
interpreted.

This is my Chameleon config:

    <context-param>
        <param-name>mapscript_module</param-name>
        <param-value>php_mapscript_43.dll</param-value>
        <description>Mapscript module name (i.e. php_mapscript_40.dll for
Windows installations or php_mapscript_40.so for Unix installations).</description>
    </context-param>

comment:7 by dmorissette, 20 years ago

I tried using your legend template in my itasca_legend test application and it
works. The only thing that's not processed is the [if selected...] but that's
normal since "selected" is not defined as a legend symbol with the CGI.

Perhaps your build dates from before June 5th?  Assefa: is the maptools build
really more recent than June 5th?


Here is what I get for one row of the Itasca legend using your template:

  <tr>
    <td><input type="radio" name="my_legend" onclick="CWCSelectLayer('airports',
true)"[if name=selected oper=eq value=1] CHECKED[/if] ></td>
    <td><input type="checkbox" name="legendlayername[]" value="airports"></td>
 <td width="75%">
    
    
      <font face="Arial italic, Helvetica, sans-serif" size="2">
    
    Airports</font></td>

  </tr>

comment:8 by bartvde@…, 20 years ago

I rechecked the whole thing and found the problem.

I had php_mapscript_43 in Chameleon config (cwc2.xml) which is good.

But I also loaded the php_mapscript_42 in my php.ini file so this one came first 
probably.

extension=php_mapscript_42.dll

Maybe something for the Chameleon docs?

comment:9 by dmorissette, 20 years ago

Um... that's odd. You should have received errors about duplicate symbols if you
did that.  Anyway, if you think a note about this should go somewhere in
chameleon docs then you should probably file a bug in the chameleon bugzilla.

comment:10 by jmckenna@…, 20 years ago

I am probably gonna look like an idiot, but: i have set up a test itasca app and
i cannot seem to get the [IF] block parsed...it always shows up:

[leg_class_html opt_flag=15]
 [if name=layer_visible oper=eq value=1]
  <img src=[leg_icon]> [leg_class_name]<br>
 [/if]
 [if name=layer_visible oper=eq value=0]
  n/a  ([leg_class_name])<br>
 [/if]
[/leg_class_html]

am i doing something wrong?  This is the same way on Xcalibur's 'itasca_legend' app.


comment:11 by dmorissette, 20 years ago

Are you using a recent 4.3 build from after June 5th.

comment:12 by jmckenna@…, 20 years ago

yes, i saw your earlier note...I upgraded to june 21st build.  Note that this
also is repeated on Xcalibur.



comment:13 by jmckenna@…, 20 years ago

Bart, did u test with the "June 25th" development version from MapTools? 
(http://www.maptools.org/dl/mapserver-4.3-win32-php4.3.7.zip)  

I upgraded to php4.3.7, and installed this build...and cannot get the  [if
name=layer_visible.... parsed.  I also tested this build on 2 different machines
and got the same results....??????



comment:14 by bartvde@…, 20 years ago

Jeff, I used the June 14th binaries.

comment:15 by jmckenna@…, 20 years ago

i'm ready to give up.  I cannot get ANY [IF] blocks to be parsed.  I've now
tested with both CGI and phpmapscript (v43, built June 24th).  I'm obviously
doing something stupid.  :(




comment:16 by dmorissette, 20 years ago

Something has been broken in the [if] tag processing between June 5th and today.
Looking into this now.

comment:17 by dmorissette, 20 years ago

The problem was introduced in maptemplate.c's getTagArgs() function by Sean's
recent changes to the hashTableObj. I have fixed it in 4.3 CVS and verified that
the test legend works again for me at
http://www2.dmsolutions.ca/msapps/itasca_legend/demo_init.html
(select legend #8)

Jeff: you'll need to get a new windows build from Assefa.

comment:18 by jmckenna@…, 20 years ago

verified that the [if] problem is fixed..updating the doc

comment:19 by jmckenna@…, 20 years ago

Resolution: fixed
Status: newclosed
updated docs in all doc-cvs branches.



comment:20 by dmorissette, 20 years ago

Resolution: fixed
Status: closedreopened
Updated docs in all branches?  This was added only in 4.3 (to be released as
4.4)... this doesn't apply to 4.2.

comment:21 by jmckenna@…, 20 years ago

it's been too long..yes correcting that now :(

comment:22 by jmckenna@…, 20 years ago

Resolution: fixed
Status: reopenedclosed
only in main tree now
Note: See TracTickets for help on using tickets.