[Cartoweb-users] mapOverlay plugin

Oliver Christen oliver.christen at camptocamp.com
Fri Jan 30 03:29:25 EST 2009


hi

there is two way to activate a plugin server side:
you call it from another plugin, server side (class extends ServerPlugin)
you call it from it's client side (class extends ClientResponderAdapter)

the most common type are the ClientResponderAdapter ones.
you need to create a client side which only purpose will be to activate the 
server side.

client:

class ClientFoo extends ClientPlugin implements ServerCaller {

    /**
     * @see ServerCaller::buildRequest()
     */
    public function buildRequest() {
        $trigger = new FooRequest();
        $trigger->trigger = 1;
        return $trigger;
    }

    /**
     * @see ServerCaller::initializeResult()
     */
    public function initializeResult($editResult) {}

    /**
     * @see ServerCaller::handleResult()
     */
    public function handleResult($editResult) {}
}


common:

/**
 * Request
 * @package Plugins
 */
class FooRequest extends CwSerializable {

    /**
     * @var boolean
     */
    public $trigger;

    /**
     * @see CwSerializable::unserialize()
     */
    public function unserialize($struct) {
        $this->trigger = CwSerializable::unserializeValue($struct, 
'trigger', 'boolean');
    }
}

/**
 * Result
 * @package Plugins
 */
class FooResult {}


server :

the usual entry points on server side are initializeRequest or 
handlePreDrawing, simply put any print "foo"; in any of these functions to 
see if the functions are called correctly.

regards
Oliver


> On Mon, Jan 26, 2009 at 3:34 PM, Oliver Christen
> <oliver.christen at camptocamp.com> wrote:
>> Hi
>>
>> the mapOverlay plugin is a toolbox only, you need to create your own 
>> plugin
>> which will use the tools provided by the mapOverlay plugin so you can 
>> modify
>> the parts you want.
>>
>> there are several example of plugins on the website wiki
>> http://www.cartoweb.org/cwiki/HowTo which should be simple enough,
>> and you can search
>> (http://www.google.com/webhp?sitesearch=lists.maptools.org/pipermail/cartoweb-users)
>> the mailing-list archive for several example of mapOverlay usage.
>> be sure to have this document under the eyes at all times
>> http://www.cartoweb.org/doc/misc/plugins_diagram.pdf
>>
>> regards
>> Oliver
>>
>>
>
> hi Oliver,
>
> I have to admit I have been waiting for you :-)
>
> I am sorry, read all the above a couple of times (and studied the
> examples), but to no avail...
> I have a plugin (a ServerXplugin.php in the server directory of the
> plugin folder of my project, it get's loaded (?!) with all the rubbish
> inside, debug in log does not complain...
> from there on it gets foggy with my object programming...
>
> I am pretty sure the plugin does not get executed at all...
>
> If at least/only I could get the famous line:
> $this->serverContext->getMapObj()->save('debug.map');
> (map file temp save) executed and see the file saved
> I think I could handle the rest
>
> Would/could you please write down what should be the whole content of
> my ServerXplugin.php to execute the mapfile save
> and what do I have to do elsewhere
>
> Sorry to bother/ask you so much,
> many thanks in advance
>
> frequens
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users
> 



More information about the Cartoweb-users mailing list