[Cartoweb-users] Make Outline plugin draw a ms_shape_obj

Simon ORTET simon.ortet at silogic.fr
Fri Oct 12 04:31:46 EDT 2007


Hi,

I made a plugin that uses outline plugin. It takes coordinates, make a 
Cartoweb Shape of it and send it to outline with

    $pluginManager->outline->draw($this->shapes);

It works fine. Now i need this plugin to deal with shapes extracted from 
my postgis database (ms_ShapeObj). Here's what i did to implement this. 
In Server[myPlugin].php (handlePreDrawing function):
               
                $mySelection = new IdSelection();
                $mySelection->layerId = $this->objTable; // The name of 
my postgis layer
                $mySelection->idAttribute = $this->objField;
                $mySelection->idType = "string";
                $mySelection->selectedIds = array($this->objValue);
           
                $styledShape = new StyledShape();
                $styledShape->shape = 
$pluginManager->mapquery->queryByIdSelection($mySelection);

                $shapeStyle = new StyleOverlay();
                $shapeStyle->size = 20;
                $shapeStyle->color->setFromRGB(-1, -1, -1);
                $shapeStyle->outlineColor->setFromRGB(120, 20, 20);

                $styledShape->shapeStyle = $shapeStyle;           
                $this->shapes = array($styledShape);

And then i do the
                $pluginManager->outline->draw($this->shapes);

So i expected my plugin to deal with both coordinates requests and 
postgis requests. But i've got an error "unknown shape type". So i guess 
the outline plugin only takes Cartoweb Shapes.

Is there a way to convert my ms_ShapeObj to a cartoweb shape? Or to make 
outline plugin draw my ms_ShapeObj?

Thanks

Simon Ortet
Silogic


More information about the Cartoweb-users mailing list