[Cartoweb-users] MapOverlay

Oliver Christen oliver.christen at camptocamp.com
Tue Apr 3 09:09:16 EDT 2007


you shouldnt need a common part, if the data transfered from client side to
server side is a simple string.

but we can try that.
create a new DataMappa.php file in dataMappa/comon/
with:

class DataMappa extends CwSerializable {

  public $flag;

    /**
     * @see Serializable::unserialize()
     */
    public function unserialize($struct) {
        $this->flag = self::unserializeValue($struct, 'flag');
    }
}

and in your ClientDataMappa.php, change:

    public function buildRequest() {
      if ($this->flag) {
        $result = new DataMappa;
        $result->flag =  $this->flag;
        return $result;
      }
    }

and in your ServerDataMappa.php, change:

  public function initializeRequest($requ) {
    if ($requ) {
      $this->flag=$requ->flag;
      return $this->flag;
    }
  }

>I Yves,
> Sorry for my english . I have try tu use the comment, but the
> error
> don't disappear. The same error persist even if I comment all the line in
> the serverclass. It's possible thath I need a Common part?
>
>
>
>>Hi Luigi,
>>
>>It is an english only list, so you will better information if you ask your
>>question in english ;-)
>>
>>Well, I saw that your error come form the server side of your plugin and
> you
>>try to get a property of an object which does not exist.
>>
>>You can try to check this line
>>>       $mapOverlay =
>>> $this->serverContext->getPluginManager()->mapOverlay;
>>>       $mapOverlay->updateMap($layer);
>>>       $this->serverContext->getMapObj()->save('/tmp/debug.map');
>>Or comment some line begining in the end and go up until the error
> disappear.
>>
>>Regards,
>>
>>Y.
>>Le Lundi 2 Avril 2007 11:48, Luigi.marotta a �crit�:
>>> Sto cercando di scrivere un plugin che, utilizzando mapOvrlay, mi
> consenta
>>> di campiare l'argomento "data" di un
>>>
>>> layer nel mio map file. Per il momento il plugin consiste: in un
> pulstante
>>> che cambia un'immagine.
>>> La parte client �:
>>>
>>> <?php
>>> /**
>>>  * ClientDataMappa.php
>>>  */
>>>
>>> class ClientDataMappa extends ClientPlugin
>>>                                implements ServerCaller, GuiProvider {
>>>
>>>     protected $specialactiontrigger;
>>>     protected $flag;
>>>
>>>     public function handleHttpPostRequest($request) {
>>>       if (isset($request['specialactiontrigger'])) {
>>>         $this->flag = true;
>>>       }
>>>       else {
>>>         $this->flag = false;
>>>       }
>>>     }
>>>
>>>     public function handleHttpGetRequest($request) {}
>>>
>>>     public function buildRequest() {
>>>       if ($this->flag) {
>>>         $flag=$this->flag;
>>>         return $flag;
>>>       }
>>>     }
>>>
>>>     protected function drawUserForm() {
>>>       $smarty = new Smarty_Plugin($this->getCartoclient(), $this);
>>>       return $smarty->fetch('dataInput.tpl');
>>>    }
>>>
>>>     public function renderForm(Smarty $template) {
>>>       $template->assign('dataInput', $this->drawUserForm());
>>>     }
>>>
>>>     public function initializeResult ($request){
>>>     if (isset ($this->flag)) {
>>>       print ('ok');}
>>>     }
>>>     public function handleResult($request){
>>>     if (isset ($this->flag)) {
>>>       print ('ok');}
>>>     }
>>>
>>>
>>> }
>>> ?>
>>>
>>> Il template:
>>>
>>> <!-- dataInput.tpl -->
>>> <input type="submit" name="specialactiontrigger" value="ok" />
>>>
>>> e la parte server:
>>>
>>> <?php
>>> class ServerDataMappa extends ClientResponderAdapter {
>>>
>>>   public $flag;
>>>
>>>   public function initializeRequest($requ) {
>>>     if ($requ) {
>>>       $this->flag=$requ;
>>>       $flag=$this->flag;
>>>       return $flag;
>>>     }
>>>   }
>>>
>>>   public function handlePreDrawing($request){
>>>     if (isset ($this->flag)) {
>>>       $layer = new LayerOverlay();
>>>       $layer->action = BasicOverlay::ACTION_UPDATE;
>>>       $layer->name = "mappa";
>>>       $layer->data = "images/cc_20050621.tif";
>>>       $mapOverlay =
>>> $this->serverContext->getPluginManager()->mapOverlay;
>>>       $mapOverlay->updateMap($layer);
>>>       $this->serverContext->getMapObj()->save('/tmp/debug.map');
>>>      }
>>>   }
>>> }
>>> ?>
>>>
>>> La parte Cliente sembra funzionare ma quando viene chiamato il server mi
>>> compare questo errore:
>>>
>>> Failure
>>>
>>> CartoWeb version: 3.3.0 [$Revision: 1.2 $]
>>> class:   SoapFaultWrapper
>>> message:   Error [8, Trying to get property of non-object,
>>> C:\wamp\www\cartoweb3\server\Cartoserver.php, 229]
>>> Backtrace:
>>>
>>> file: 229 - C:\wamp\www\cartoweb3\server\Cartoserver.php
>>> call: Common::cartowebErrorHandler(8, "Trying to get property of
>>> non-object",
>>>
>>> "C:\wamp\www\cartoweb3\server\Cartoserver.php", 229, Array(4))
>>>
>>> file: 265 - C:\wamp\www\cartoweb3\server\Cartoserver.php
>>> call: Cartoserver->checkRequest(Object(MapRequest))
>>>
>>> file: 349 - C:\wamp\www\cartoweb3\server\Cartoserver.php
>>> call: Cartoserver->doGetMap(Object(MapRequest))
>>>
>>> file: 370 - C:\wamp\www\cartoweb3\server\Cartoserver.php
>>> call: Cartoserver->callWithExceptionCheck("doGetMap",
>>> Object(MapRequest))
>>>
>>> file: 81 - C:\wamp\www\cartoweb3\server\MapResultCache.php
>>> call: Cartoserver->cacheGetMap(Object(MapRequest))
>>>
>>> file: 115 - C:\wamp\www\cartoweb3\server\MapResultCache.php
>>> call: MapResultCache->getMapResultFromServer(Object(MapRequest))
>>>
>>> file: 198 - C:\wamp\www\cartoweb3\server\MapResultCache.php
>>> call: MapResultCache->cacheMapResult(Object(MapRequest))
>>>
>>> file: 380 - C:\wamp\www\cartoweb3\server\Cartoserver.php
>>> call: MapResultCache->getMap(Object(MapRequest))
>>>
>>> file: 104 - C:\wamp\www\cartoweb3\client\CartoserverService.php
>>> call: Cartoserver->getMap(Object(MapRequest))
>>>
>>> file: 165 - C:\wamp\www\cartoweb3\client\CartoserverService.php
>>> call: CartoserverService->callDirect("getMap", Object(MapRequest))
>>>
>>> file: 233 - C:\wamp\www\cartoweb3\client\CartoserverService.php
>>> call: CartoserverService->callFunction("getMap", Object(MapRequest))
>>>
>>> file: 916 - C:\wamp\www\cartoweb3\client\Cartoclient.php
>>> call: CartoserverService->getMap(Object(MapRequest))
>>>
>>> file: 1045 - C:\wamp\www\cartoweb3\client\Cartoclient.php
>>> call: Cartoclient->getMapResultFromRequest(Object(MapRequest))
>>>
>>> file: 1220 - C:\wamp\www\cartoweb3\client\Cartoclient.php
>>> call: Cartoclient->doMain()
>>>
>>> file: 38 - C:\wamp\www\cartoweb3\htdocs\client.php
>>> call: Cartoclient->main()
>>>
>>> file: 3 - C:\wamp\www\cartoweb3\htdocs\mymap.php
>>> call: require_once("C:\wamp\www\cartoweb3\htdocs\client.php").
>>>
>>> Utilizzando la funzione print ho potuto notare che nessuna parte del
> server
>>> viene eseguita o, comunque, l'errore
>>>
>>> viene generato dall'inizializzazione.
>>> Qualcuno ha gia implementato un plugin simele?
>>> Qualcuno pu&#65533; aiutarmi?
>>> Non so pi&#65533; che pesci prendere.
>>> Grazie.
>>>  --
>>>  Email.it, the professional e-mail, gratis per te: http://www.email.it/f
>>>
>>>  Sponsor:
>>>  Prestiti e Finanziamenti con un semplice click, scopri subito se sei
>>> finanziabile cliccando qui
>>>  Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=2910&d=20070402
>>>
>>>
>>> _______________________________________________
>>> Cartoweb-users mailing list
>>> Cartoweb-users at lists.maptools.org
>>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>>
>>-- 
>>Yves Jacolin
>>---
>>http://yjacolin.gloobe.org
>
> --
> Email.it, the professional e-mail, gratis per te: http://www.email.it/f
>
> Sponsor:
> Tutto per il Modding PC: Case, Led, Neon, Ventole. Il tuo PC
> personalizzato
> da noi conviene, visita il nostro sito
> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=6123&d=20070403
>
>
> _______________________________________________
> 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