[Chameleon] Drawing a Point
Jason Fournier
jfournier at dmsolutions.ca
Wed Aug 11 22:41:44 EDT 2004
If you take a look at the Locate widget it contains a significant amount of code related
to adding a point on the map. If you're able to swim your way through it you may find
some useful tidbits.
Perhaps someone else on the list knows offhand?
If this fails then I'd suggest mailing the MapServer list as there are many PHP/MapScript
(and generally more MapScript) developers who may have input.
As for debugging ... what kind of information were you looking for? Are you looking for
information about Chameleon errors? This can be reported by the ErrorReport widget. Or
are you interested more in logging the application?
Thanks,
Jason
On Aug 11, Ken-ichi <kueda at wso.williams.edu> wrote:
>
> Hi again. To learn about widget development, I'm trying to make a copy
> of the ZoomIn widget draw a point on the map instead of zooming in. To
> that end, I've altered the ParseURL method so that the if( $szInputType
> == "POINT" ) clause looks like this:
>
> if ($szInputType == "POINT")
> {
> $aPixPos = explode(",", $szInputCoords);
>
> //draw a point with MapScript
> $map = $this->moMapNavigator->oSession->oMap;
>
> $daLayer = ms_newLayerObj($map);
> $daLayer->set("type", MS_LAYER_POINT);
> $daLayer->set("transform", MS_FALSE);
> $daLayer->set("status", MS_ON);
>
> $class = ms_newClassObj($daLayer);
> $class->set("name", "Temp Class");
> $style = ms_newStyleObj($class);
> $style->color->setRGB(255,0,0);
> $style->set("symbolname", "circle");
> $style->set("size", 10);
>
> $my_point = ms_newPointObj();
> $my_point->setXY($aPixPos[0],$aPixPos[1]);
>
>
> $image = $map->draw();
>
> $temp = $my_point->draw( $map, $daLayer, $image, 0,
> "Temp Point" );
>
> if( $temp == MS_SUCCESS ) $daLayer->set("name", $temp);
> }
>
> This successfully adds a layer to the legend with the correct styling,
> but fails to draw the point on the map. Note that the last line does
> result in setting the name of the new layer to MS_SUCCESS (haven't
> figured out how to use any of Chameleon's debugging capabilities, if
> such things exist), so the draw() method thinks it's working.
>
> Can anyone tell me what I'm doing wrong? Many thanks.
>
> -Ken-ichi
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> <a
href='http://lists.maptools.org/mailman/listinfo/chameleon'>http://lists.maptools.org/mail
man/listinfo/chameleon</a>
>
More information about the Chameleon
mailing list