[Chameleon] Adding Points

Ken Sanderson ken at rockies.ca
Mon Aug 9 15:29:00 EDT 2004


Thanks Will for the reply.

I have sorta been a bit down this road before and I am having a problem
with the classes. I really don't have a lot of experience with PHP
classes so I find it hard to follow all the dependancies, but from what
I can tell $this->moMapObject->oMap needs to be with a widget that's an
extend of the CWCWidget?

My widget I have created does the following:
1) loads the button image with the other Navigation tools, sets the
appropriate NavCommand when its selected.
2) user clicks on the map, it gets the pixel coords, converts to
geographic coords, then sends to a PHP script that loads up a userform
to collect some specific information about the point.
3) this is the part I am struggling with: want to display a point on the
map where the user clicked and add another if they click again. I have
the coords from step 2, but still need to find a way of adding the
point.

For parts one and two I have it setup so that my widget class extends
NavTool. I assume you can't extend to more then one object? So my
question is how do I access both the NavTool and CWCWidget in order to
use $this->moMapObject->oMap? 

Thanks again,

Ken

-----Original Message-----
From: chameleon-bounces at lists.maptools.org
[mailto:chameleon-bounces at lists.maptools.org] On Behalf Of William A.
Bronsema
Sent: August 9, 2004 5:00 AM
To: Ken Sanderson
Cc: chameleon at lists.maptools.org
Subject: Re: [Chameleon] Adding Points


Hi Ken,

Ken Sanderson wrote:
> A few more questions in regards to adding a point, or points, to the 
> map within Chameleon. Been tossing around various ideas so my 
> questions are a bit mixed:
> 
> 1) I have been looking over the mapscript examples, which are fairly 
> clear, what I don't understand is how I hook into the map/image that 
> chameleon is going to return vs returning another image with my points

> on it. Is there a way to reference the map object that chameleon is 
> using from another widget and add points to it?
Widgets have access to the map object by using:
$this->moMapObject->oMap.

There are a number of widgets to look at that reference the map object. 
  Take a look at the expressionbuilder.widget.php file for example 
(specifically the parseURL function).

> 
> 2) Another method I found an exmaple on was the MapImageSharedResource

> in conjunction with SQLQuery Widget, only in my case I would likely 
> create a widget to build the array of points in another method. It 
> says in the example: "where you want your map, you should include the 
> MapImageSharedResource". Where is that supposed to be? In the 
> MAPDHTMLWIDGET table?
Sorry, I'm not too familiar with using the SQLQuery widget.  I'll leave 
that to someone else to answer.

> 
> 3) Lastly while poking around in the drawmap.php file I found some 
> references to pulling points from the URL, specifically: "Draw points 
> from URL if necessary" section. Has anyone used this or knows if there

> is any functions/widgets/documentation on how this might be used?
To the best of my knowledge there is nothing in Chameleon that is making

use of that point drawing functionality.  The drawmap.php file has a 
fairly long history and this code, I believe, was added pre-Chameleon.

Although I don't think there is a way in Chameleon to access this 
functionality, it appears that the code is a complete example of how to 
add points to a new layer in your mapfile (although I haven't tried it -

it looks like it should).

In a nutshell, what you'll need to do is create a new widget and copy 
the point creation code to it.  This will involve referencing the map 
object as indicated in question 1 ($this->moMapObject->oMap) as well as 
collecting point information (possibly as indicated in question 2 - or 
some other way).

Hope that helps.

Regards,
Bill

-- 
________________________________________________

  William A. Bronsema, C.E.T.
  Applications Developer,
  DM Solutions Group Inc.

  e-mail: wbronsema at dmsolutions.ca
  Web   : http://www.dmsolutions.ca
  Phone : (613) 565-5056 ext.25
  Fax   : (613) 565-0925
________________________________________________

_______________________________________________
Chameleon mailing list
Chameleon at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/chameleon




More information about the Chameleon mailing list