[Chameleon] How to pass forward user specific extents?

Ken Sanderson ken at rockies.ca
Tue Aug 24 11:56:56 EDT 2004


Thanks Paul and Bill.

I used Bill's method of:
$oApp->moMapSession->oMap->setextent

As this was creating an unknown object error:
$this->moMapObject->oMap->extent->setextent

How do you suggest checking for first load? I had assumed that the
script in PHTML only was read on the original load.

Ken

-----Original Message-----
From: Paul Spencer [mailto:pagameba at magma.ca] 
Sent: August 24, 2004 6:46 AM
To: Ken Sanderson
Cc: chameleon at lists.maptools.org
Subject: Re: [Chameleon] How to pass forward user specific extents?


Ken,

assuming you can tell in your code when the user is first entering the 
application as opposed to just using it (i.e. submits coming from tools 
in the template), you can do something like this

<?php

//these come from the user choosing them ...
$minx = <minx>;
$miny = <miny>;
$maxx = <maxx>;
$maxy = <maxy>;

class SampleApp extends Chameleon
{
   ... your existing code here ...

   function CWCInitializeMap()
   {
     parent::CWCInitializeMap();
     if ( <test-for-first-load> )
     {
       $this->moMapObject->oMap->extent->setextent( $GLOBALS['minx'],
                                                    $GLOBALS['miny'],
                                                    $GLOBALS['maxx'],
                                                    $GLOBALS['maxy'] );
     }
   }
}

... the rest of your chameleon code ...

?>

The 'trick' in this case is in understanding the application object that

the Chameleon core provides for you and to override the appropriate 
methods of the Chameleon class to provide your custom behaviour using 
standard Object Oriented design.  In this case, it is relatively simple 
because you only need to modify the map extents for the initial load.

An alternative approach may be appropriate if you have fixed sets of 
extents to choose from, then you may just want to have several map files

with different initial extents and have the necessary code to choose 
between them.

Cheers,

Paul


Ken Sanderson wrote:
> Here is what I have setup. I have a phtml file similar to the ones 
> found in the samples (using beta 1.99b), only I have added code to 
> handle a username and password first and I have put the related HTML 
> tempalate file in a non-accesible directory. In short it only runs the

> core of the original PHTML file if they have the right username and 
> password.
> 
> I also want to have them select the extent they wish start off the map

> with. Full extent will be an option which would be the extents set in 
> the MAP file, but there will be a few choices that I want to over-ride

> the MAP file extents when it loads, instead using the choosen extents.

> Is there a way I can send new extents before the map loads?
> 
> Thanks,
> 
> Ken Sanderson
> 
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org 
> http://lists.maptools.org/mailman/listinfo/chameleon
> 

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





More information about the Chameleon mailing list