[Gfoss] mapoverlay con cartoweb

Luigi.marotta luigi.marotta at email.it
Mon Apr 2 11:50:54 CEST 2007


Sto cercando di scrivere un plugin per CartoWeb 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ò aiutarmi?
Non so più che pesci prendere.
Grazie.


 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 Analisi di Bilancio: come capire correttamente un bilancio aziendale
Esempi, modelli pratici, software utili
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=6199&d=20070402





More information about the Gfoss mailing list