<div>Hello,<br><br>first thanks for your answer i began to despair.<br><br>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.
<br><br>thanks in advance<br></div><span class="sg"><br>Jonathan</span><br><br><br><div><span class="gmail_quote"></span>Pierre Giraud wrote:<br><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br><br>I think I know the functionnalities you are about to add to the routing<br>plugin. We developped some similar tools for one of our customers.<br><br>The first thing you need to know is that there is a generic way to add
<br>tools to the toolbar. You cannot get what you want with simply adding<br>code in the templates.<br><br>This generic way uses the ToolProvider interface.<br>So, your php class that extends ClientRouting needs to implement the
<br>ToolProvider interface.<br>Then, you'll have to define 4 methods (handleMainmapTool,<br>handleKeymapTool, handleApplicationTool, and getTools). The last one<br>will probably look something like :<br><br> const TOOL_ROUTING_FROM = 'routing_from';
<br> const TOOL_ROUTING_TO = 'routing_to';<br><br> /**<br> * Returns the routing tools : RoutingFrom, RoutingTo<br> * @see ToolProvider::getTools()<br> * @return array of ToolDescription<br> */<br> public function getTools() {
<br> $toolsArray = array();<br><br> $toolsArray[] = new ToolDescription(self::TOOL_ROUTING_FROM,<br>true, 101);<br> $toolsArray[] = new ToolDescription(self::TOOL_ROUTING_TO, true,<br>102);<br><br> return $toolsArray;
<br> }<br><br>That done, you should be able to see the new tools in the toolbar. To<br>get images within those tools, you need "routing_from.gif" and<br>"routing_to.gif" files in the correct directory
<br>(plugins/routing/htdocs/gfx/).<br><br>The next step is to write the javascript methods for the tools. Edit a<br>new javascript file "plugins/routing/htdocs/js/dhtmlRouting.js" (loaded<br>in your templates) with the needed functions.
<br><br>Map.prototype.routing_from = function(aDisplay) {<br>...<br>}<br><br>Hope this helps.<br>Don't hesitate to ask if this isn't clear or if you are not able to go<br>further.<br><br>Regards<br><br>Pierre<br><br><br><br>
Jonathan Gillot wrote:<br><br>> hello,<br>><br>> i'm writting a plugin to find the path between 2 point clicked on the<br>> map. So i must add a new tool to the toolbar what is the good method<br>> to do this?
<br>><br>>------------------------------------------------------------------------<br></blockquote></div><br>