[Chameleon] Drawing a Point

Ken-ichi kueda at wso.williams.edu
Wed Aug 11 20:03:52 EDT 2004


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


More information about the Chameleon mailing list