[Cartoweb-users] Re: Cartoweb-users Digest, Vol 17, Issue 8

Jonathan Gillot john.gillot at gmail.com
Thu Sep 7 03:21:23 EDT 2006


Hello,

first thanks for your answer i began to despair.

I already have implemented the ToolProvider interface and her 4 methods. Its
works but when i click on the tool it would not be selected. but if i remove
"mainmap.{$tool->id}('map');" from toolbar.tpl it could be selected but
nothing occurs (off course).do you think this could be because i don't have
write the javascript methods yet? could you give me more details on the way
to implement the javascript methods? I'm a little bit confused.

thanks in advance

Jonathan


Pierre Giraud wrote:

Hello,
>
> I think I know the functionnalities you are about to add to the routing
> plugin. We developped some similar tools for one of our customers.
>
> The first thing you need to know is that there is a generic way to add
> tools to the toolbar. You cannot get what you want with simply adding
> code in the templates.
>
> This generic way uses the ToolProvider interface.
> So, your php class that extends ClientRouting needs to implement the
> ToolProvider interface.
> Then, you'll have to define 4 methods (handleMainmapTool,
> handleKeymapTool, handleApplicationTool, and getTools). The last one
> will probably look something like :
>
>     const TOOL_ROUTING_FROM = 'routing_from';
>     const TOOL_ROUTING_TO = 'routing_to';
>
>     /**
>      * Returns the routing tools : RoutingFrom, RoutingTo
>      * @see ToolProvider::getTools()
>      * @return array of ToolDescription
>      */
>     public function getTools() {
>         $toolsArray = array();
>
>         $toolsArray[] = new ToolDescription(self::TOOL_ROUTING_FROM,
> true, 101);
>         $toolsArray[] = new ToolDescription(self::TOOL_ROUTING_TO, true,
> 102);
>
>         return $toolsArray;
>     }
>
> That done, you should be able to see the new tools in the toolbar. To
> get images within those tools, you need "routing_from.gif" and
> "routing_to.gif" files in the correct directory
> (plugins/routing/htdocs/gfx/).
>
> The next step is to write the javascript methods for the tools. Edit a
> new javascript file "plugins/routing/htdocs/js/dhtmlRouting.js" (loaded
> in your templates) with the needed functions.
>
> Map.prototype.routing_from = function(aDisplay) {
> ...
> }
>
> Hope this helps.
> Don't hesitate to ask if this isn't clear or if you are not able to go
> further.
>
> Regards
>
> Pierre
>
>
>
> Jonathan Gillot wrote:
>
> > hello,
> >
> > i'm writting a plugin to find the path between 2 point clicked on the
> > map. So i must add a new tool to the toolbar what is the good method
> > to do this?
> >
> >------------------------------------------------------------------------
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20060907/4b6f7eae/attachment.html


More information about the Cartoweb-users mailing list