MapTools.org

[Chameleon] Context file and Tree Legend

Paul Spencer spencer@dmsolutions.ca
Tue, 27 Jan 2004 22:13:38 -0500
Dave,

you are correct, the XMLThemeLegend is only in the alpha version.  You 
can probably use this widget with minor modifications in your existing 
version ... if you look in a couple of widget files, you'll notice a 
couple of lines at the bottom of every file ... you need to replicate 
those lines in the XMLThemeLegend file with the appropriate changes to 
make it work.  XMLThemeLegend also depends on a couple of files from the 
alpha version, one is TemplateProcessor.php from the htdocs directory, 
and the other is XMLThemeParser.php ... and you'll need 
XMLThemeLegendInfo.phtml as well.

Cheers,

Paul

Dave Astolfo wrote:

> Paul,
> 
> Thanks for the pointers.  With regard to the XMLThemeLegend widget, it
> seems that my version of Chameleon does not know what that widget is?  I
> noticed that it is included in the newer Alpha version. 
> I am running Chameleon 1.0.4  Is it possible to import or use this
> widget in my version? Or do I have to install the Alpha (1.1)?
> 
> Thanks,
> 
> Dave
> 
> -----Original Message-----
> From: chameleon-admin@lists.maptools.org
> [mailto:chameleon-admin@lists.maptools.org] On Behalf Of Paul Spencer
> Sent: Tuesday, January 27, 2004 11:51 AM
> To: Kralidis,Tom [Burlington]
> Cc: 'Dave Astolfo'; Chameleon@lists.maptools.org
> Subject: Re: [Chameleon] Context file and Tree Legend
> 
> 
> Dave,
> 
> as Tom has indicated, probably a great starting point would be the 
> XMLThemeLegend widget.  In fact, you may be able to use this widget 
> almost as is.  The widget uses two input files called the theme file and
> 
> the renderer file.
> 
> The theme file associates layers into groups and then groups into 
> themes, and provides styling options for them
> 
> The renderer file is used to convert the themes/groups/layers into HTML.
> 
>   The renderer file is simply an HTML file that is included into the 
> application at the point of the widget.  There is some processing done 
> on the renderer file to replace specific tags with results from the 
> current set of layers (as structured by the instructions contained in 
> the theme file).
> 
> A carefully crafted renderer file could output sufficient javascript to 
> initialize a javascript/DHTML based treemenu (for instance).  It is very
> 
> flexible.
> 
> You may need to modify the XMLThemeLegend widget because right now it 
> doesn't provide details down to the layer level (although you can fake 
> it by creating one group per layer).
> 
> Importing of context documents is done by mapserver internally, 
> chameleon only works with a PHP MapScript map object.  There are a 
> couple of ways you could set this up to work from a database.  One would
> 
> be to have a web service that is called that returns the XML content of 
> a Context document from a database.  Another would be to write some code
> 
> inside your application to extract the contents of the Context file from
> 
> a database and then write a context file, then open it :)
> 
> Cheers,
> 
> Paul
> 
> Kralidis,Tom [Burlington] wrote:
> 
> 
>>Hi,
>>
>>You may be able to achieve this through the XML Theme files?  This 
>>groups layers together in this manner.  We had this requirement in 
>>earlier projects.
>>
>>Recent versions of Chameleon support non-context imports.  However, 
>>keep in mind by that supporting context documents, you can create and 
>>use, share context documents from and to any application.
>>
>>..Tom
>>
>>=========================
>>Tom Kralidis
>>Systems Scientist
>>Environment Canada
>>Tel: +01-905-336-4409
>>http://www.ec.gc.ca/cise/
>>
>>=========================
>>
>>
>>-----Original Message-----
>>From: Dave Astolfo [mailto:dastolfo1@cogeco.ca]
>>Sent: Tuesday, January 27, 2004 10:40 AM
>>To: Chameleon@lists.maptools.org
>>Subject: [Chameleon] Context file and Tree Legend
>>
>>
>>Hi All,
>>I am somewhat new to Chameleon / MapServer. I have been challenged
> 
> with
> 
>>having to create a new Legend Widget.  Here is what I am trying to do:
>>
>>
>>I am  trying to create a legend that uses a tree-like structure (multi
> 
> 
>>level).
>>LEGEND 
>>Layer List 
>>+  Category 1
>>-------Category 1.1
>>-------Category 1.2 
>>+  Category 2
>>-------Category 2.1
>>-------Category 2.2 
>>... etc.... 
>>
>>
>>The challenge is that the information needed to create the legend 
>>would be more than the Context file contains.  For example,  in order 
>>to know where to place a Layer name in the tree,  the context file 
>>would require additional info such as PARENT_ID.  I was able to get 
>>this working in the GMAP demo by some JavaScript I found. The 
>>challenge here is that GMAP was written In PHP and JavaScript while we
> 
> 
>>need to get it working in an environment
>>where the Chameleon service is doing most of the legwork.   
>>So my questions are:
>>1)  Is there a way to feed Chameleon the same info that is in the
> 
> Context
> 
>>file from say a XML recordset stream from a database?  If so, can
> 
> someone
> 
>>point me to the code/files where Chameleon opens and reads the
> 
> context.xml
> 
>>file it is passed?
>>2) Does anybody have examples of Legend Widgets that they wrote that
> 
> may be
> 
>>similar to what I am trying to do? 
>>3) Can someone direct me on which way I should go if I have to create
> 
> my own
> 
>>widget? Is there any code I could start with?
>>
>>
>>Any help or suggestions is appreciated.
>>Thanks a bunch! 
>>Dave A. 
>>_______________________________________________
>>Chameleon mailing list
>>Chameleon@lists.maptools.org
>>http://lists.maptools.org/mailman/listinfo/chameleon
>>
> 
> 

-- 
  -----------------------------------------------------------------
|Paul Spencer                           spencer@dmsolutions.ca    |
|-----------------------------------------------------------------|
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
  -----------------------------------------------------------------



This archive was generated by Pipermail.