[Chameleon] dynamic map changes

Rhys Ickeringill rhysi at omnilink.com.au
Thu Mar 31 00:37:15 EST 2005


Sweet - just what I wanted to hear! Actually, it wasn't that far from what I
was expecting. I was hoping to be able to override either CWCInitialize() or
CWCExecute() for my app, but call parent::CWCInitialize() /
parent::CWCExecute somewhere in the overriding method. Only thing I couldn't
figure out was where in the sequence my new code went... but now I know :)

Thank you so much, it'd have taken me ages to confirm that otherwise...

Rhys

----- Original Message ----- 
From: "Paul Spencer" <pspencer at dmsolutions.ca>
To: "Rhys Ickeringill" <rhysi at omnilink.com.au>
Cc: <chameleon at lists.maptools.org>
Sent: Wednesday, March 30, 2005 9:23 PM
Subject: Re: [Chameleon] dynamic map changes


> Rhys,
>
> this can be accomplished in a slightly different way than you might
> first expect :)  The drawing of the map is actually deferred until after
> page load and happens in a script called drawmap.php
> (htdocs/common/wrapper/)
>
> You can insert your script in your index.phtml file after the call to
> CWCInitialize and before the call to CWCExecute to run the query and set
> the extents.
>
> To modify the the output image to include a query, you can save the
> query results into the session directory and drawmap.php will
> automatically load these results and use drawQuery() instead of draw()
>
> for example:
>
> $oApp->CWCInitialize( ... );
> // code to find shape index in specified layer
> ....
> // on first loading of map only...
> if( $findSuccess ){
>      $oMap = new ms_MapObj( $szMapFile );
>      $oLayer = $oMap->getLayerByName( $szLayerName );
>      $oLayer->queryByIndex( $oMap, $idx, -1 );
>      $oMap->saveQuery( getSessionSavePath()."/query_results.qry");
>      $oMap->extent = $oLayer->getResult(0)->bounds;
> }
> $oApp->CWCExecute(...);
>
> Cheers
>
> Paul
>
> Rhys Ickeringill wrote:
> > Hi All,
> >
> > If I wish dynamically change some map settings before the first drawing
of
> > the map (but not subsequent ones), what methods of the Chameleon class
> > should I override?
> >
> > Specifially I wish to do two things dynamically - highlight a specific
> > feature via a query and set the map extent to the extent of that
feature. I
> > assume this will have to happen just after the mapfile has been parsed
but
> > before the $oMap->draw() gets called (I have yet to trace where this
call
> > occurs)
> >
> > ie. the code should look something like
> >
> >     // code to find shape index in specified layer
> >     ....
> >     // on first loading of map only...
> >     if( $findSuccess ){
> >         $oMap = new ms_MapObj( $szMapFile );
> >         $oLayer = $oMap->getLayerByName( $szLayerName );
> >         $oLayer->queryByIndex( $oMap, $idx, -1 );
> >         $oMap->extent = $oLayer->getResult(0)->bounds;
> >         $oImage = $oMap->draw( );
> >         $oLayer->drawQuery( $oImage );
> >         }
> >
> > Is there somewhere I place this with minimal interuption to the rest of
> > Chaemeleon's operations but still get the desired functionality?
> >
> > Any suggestions/pointers will be greatly appreciated,
> >
> > Rhys
> >
> > _______________________________________________
> > Chameleon mailing list
> > Chameleon at lists.maptools.org
> > http://lists.maptools.org/mailman/listinfo/chameleon
> >
>
>



More information about the Chameleon mailing list