[ka-Map-users] Opacity control in legend

Paul Spencer pspencer at dmsolutions.ca
Thu Jun 23 14:18:03 EDT 2005


there are a couple of tricks to getting it working.  You need to call 
SET_DHTML while the page is loading, then you can use ADD_DHTML to add 
div objects (that are dynamically created) at any point.

Jacob Delfos wrote:
> Hi Paul,
>  
> thanks for the suggestions. The walterzom library is quite impressive. 
> But I'm not sure if it was designed to function in the way kamap loads, 
> with content being written on-the-fly by javascript. I get the slidebar 
> images to show in the legend (written out dynamically in kaLegend.js), 
> but they don't slide. There's no javascript errors, though.
>  
> The library seems not to find the objects that get written dynamically 
> (the slidebar images). I tried placing the javascript functions to 
> invoke the drag-functionality in different spots. I even wrote out the 
> javascript dynamically with javascript (that sometimes works), but 
> Firefox crashed on that.
>  
> I better leave it for a day where I have strong coffee at hand.
>  
> Jacob
>  
>  
> -----Original Message-----
> From: Paul Spencer [mailto:pspencer at dmsolutions.ca]
> Sent: 22 June 2005 21:17
> To: Jacob Delfos
> Cc: ka-map-users at lists.maptools.org <mailto:ka-map-users at lists.maptools.org>
> Subject: Re: [ka-Map-users] Opacity control in legend
>  
> compress=no should work, I use it all the time for debugging.
> Alternately you can map a web path to the scripts directory and load
> them directly.  There is no real need to use getcjs.php other than to
> provide (hopefully) optimal performance.
>  
> I've had pretty good luck figuring stuff like this out.  We've been
> using wz_dragdrop.js from walterzorn.com and have a zoom control
> working.  An opacity slider shouldn't be too much different.
>  
> Cheers
>  
> Paul
>  
> Jacob Delfos wrote:
>  > Hi Paul,
>  > 
>  > I gave it a try, but it's pretty hard. I actually tried to implement the
>  > sliding bar solution on
>  > http://www.howtocreate.co.uk/jslibs/otherdemo.html#scc
>  > 
>  > It looks like a good solution, and it has a "slider stopfunction", which
>  > could invoke the setLayerOpacity function.
>  > 
>  > Problem I ran into is.... The content of the cells in the legend is
>  > written to it dynamically. I'm having a hard time getting the functions
>  > of the slider library to write a sliding bar into that legend cell. I
>  > assigned an ID to the legendcell, like:
>  > 
>  >         td.name=layer_name;
>  >         td.id=layer_name;
>  > 
>  > Then I pass the name of the cell into the function that builds the
>  > slider, which I modified, to write to the object of which the name was
>  > parsed using innerHTML (rather than to document.write). But it doesn't
>  > work, and firefox won't tell me why. It's probably a bit too complex.
>  > I'm not exactly a DOM expert, either.
>  > 
>  > By the way, the getcjs.php functionality makes it really hard to debug
>  > (everything occurs on line 1!). Can it have a parameter that makes it do
>  > nothing to the .js file, for debugging purposes? The "compress=no"
>  > option doesn't seem to do it....
>  > 
>  > 
>  > 
>  > 
>  > -----Original Message-----
>  > From: Paul Spencer [mailto:pspencer at dmsolutions.ca]
>  > Sent: 15 June 2005 20:32
>  > To: Delfos, Jacob
>  > Cc: ka-map-users at lists.maptools.org 
> <mailto:ka-map-users at lists.maptools.org> 
> <mailto:ka-map-users at lists.maptools.org>
>  > Subject: Re: [ka-Map-users] Opacity control in legend
>  > 
>  > Jacob,
>  > 
>  > I've actually changed the CVS version to use a legend that is built
>  > entirely on the client side (it looks and works the same but is much
>  > better performance so far).  In the process, I took out the opacity
>  > control from the layers in the legend because I don't think this is a
>  > generally useful function ... in its place, I've set it up to read
>  > opacity from the metadata of the first layer in each group and use that
>  > to set the opacity of each group of layers.
>  > 
>  > It would be reasonably easy to modify kaLegend.js to add back in some
>  > form of layer opacity control.  Ideally, it would be some sort of slider
>  > I guess ...  I've played around with the Walter Zorn libraries for
>  > drawing and dragging, they work well.
>  > 
>  > If you have a real need for this, you could probably add an opacity
>  > control reasonably easily by modifying kaLegend.js to build the
>  > additional images and event handlers to replicate the original way that
>  > I had implemented this.
>  > 
>  > I may have time to add some sort of sliding opacity controller as an
>  > option while at MUM3 ... in between a few beers, I suspect ;)
>  > 
>  > Cheers
>  > 
>  > Paul
>  > 
>  > Delfos, Jacob wrote:
>  >  > Hi all,
>  >  >
>  >  > I'm trying to put together a site that makes use of the opacity 
> setting
>  >  > in the legend, but it seems that the CVS version is not configured to
>  >  > make use if it by default. I'm having some trouble figuring out how it
>  >  > all fits together. The transparency sits in legend_template.php, which
>  >  > uses legend_template.html. But how do I get the site to use it? I 
> tried
>  >  > modifying kaLegend.js, but that didn't do the trick.
>  >  >
>  >  > Paul.... How did you do it? :)
>  >  >
>  >  > Regards,
>  >  >
>  >  > Jacob
>  >  >
>  >  >
>  >  > *JACOB DELFOS
>  >  > SPATIAL INFORMATION ANALYST
>  >  > *Maunsell Australia Pty Ltd
>  >  > 629 Newcastle Street, Leederville, WA 6007
>  >  > PO Box 81, Leederville, WA 6902
>  >  > Western Australia
>  >  > ABN 20 093 846 925
>  >  >
>  >  > Tel     + 61 8 9281 6185
>  >  > Fax    + 61 8 9281 6297
>  >  > _jacob.delfos at maunsell.com <mailto:_jacob.delfos at maunsell.com> 
> <mailto:_jacob.delfos at maunsell.com>_
>  >  >
>  >  >
>  >  > 
> ------------------------------------------------------------------------
>  >  >
>  >  > _______________________________________________
>  >  > ka-Map-users mailing list
>  >  > ka-Map-users at lists.maptools.org 
> <mailto:ka-Map-users at lists.maptools.org> 
> <mailto:ka-Map-users at lists.maptools.org>
>  >  > http://lists.maptools.org/mailman/listinfo/ka-map-users
>  > 
>  > --
>  > +-----------------------------------------------------------------+
>  > |Paul Spencer                           pspencer at dmsolutions.ca 
> <mailto:pspencer at dmsolutions.ca>
>  > <mailto:pspencer at dmsolutions.ca>   |
>  > +-----------------------------------------------------------------+
>  > |Applications & Software Development                              |
>  > |DM Solutions Group Inc                 http://www.dmsolutions.ca/|
>  > +-----------------------------------------------------------------+
>  > <mailto:jacob.delfos at maunsell.com>
>  >
>  >
>  > ------------------------------------------------------------------------
>  >
>  > _______________________________________________
>  > ka-Map-users mailing list
>  > ka-Map-users at lists.maptools.org <mailto:ka-Map-users at lists.maptools.org>
>  > http://lists.maptools.org/mailman/listinfo/ka-map-users
>  
> -- 
> +-----------------------------------------------------------------+
> |Paul Spencer                           pspencer at dmsolutions.ca 
> <mailto:pspencer at dmsolutions.ca>   |
> +-----------------------------------------------------------------+
> |Applications & Software Development                              |
> |DM Solutions Group Inc                 http://www.dmsolutions.ca/|
> +-----------------------------------------------------------------+
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/ka-map-users

-- 
+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+


More information about the ka-Map-users mailing list