Thank you very much
I'll implement it in the new 3.1.0 pmapper version
ad after I'll try to implement the plugin

all the best

Walter


Alessandro Pasotti ha scritto:
> I hope I did'nt forget anything....
>
> First make a backup of your pmapper folder.
>
>
> See ABP tagged comments.
>
> In pmdraw.js
> add this function:
>
> // ABP: persistenza
> function persistPolygon(){
>     if(geoPolyline.points.length > 0){
>         // Ajax call
>         var persisturl = PM_XAJAX_LOCATION + 'x_persist_polygon.php?'+SID;
>         $.ajax({
>             url: persisturl,
>             data : 'persist_polygon='+geoPolyline.toString(),
>             type : 'POST',
>             success: function(response){
>                 alert('La linea e\' stata resa persistente, puoi eliminarla 
> facendo clic sul pulsante "Ricarica"');
>                 var mapurl = PM_XAJAX_LOCATION + 'x_load.php?'+SID;
>                 updateMap(mapurl, '');
>             }
>         });
>     }
> }
>
> --------------------------------
> In zoombox.js (around line 745) add this case:
>
>           case 83:// ABP: "S" or "s" persist polyline
>           case 115:
>             if(e.type == 'keypress'){
>                 persistPolygon();
>             }
>           break;
>
> --------------------------------
> In incphp/xajax folder, add this in a file x_persist_polygon.php:
>
> session_start();
> require_once("../globals.php");
> require_once("../common.php");
>
> $up = $_REQUEST['persist_polygon'];
> $pointList = explode(",", $up);
>
> foreach($pointList as $tuple){
>     $polygon[] = split(' ', $tuple);
> }
>
> $_SESSION['persist_polygon'][] = $polygon;
>
>
> header("Content-Type: text/plain; charset=$defCharset");
>
> // return JS object literals "{}" for XMLHTTP request
> echo "{retvalue:'$txt'}";
>
> ------------------------------
> In incphp/map.php, add those pieces of code:
>
>
>     function pmap_createMap()
>     {
>
>         // CHECK IF THERE ARE RESULTLAYERS (HIGHLIGHT) AND ADD THEM TO MAP
>         $this->pmap_checkResultLayers();
>
>         // ABP: persistent layers
>         $this->pmap_checkPersistentLayer();
>
>
> [...]
>
>
>     // ABP: Check for persistent layers
>     function pmap_checkPersistentLayer()
>     {
>         if(is_array($_SESSION['persist_polygon']) && 
> count($_SESSION['persist_polygon'])){
>             $this->pmap_addPersistentLayer($_SESSION['persist_polygon']);
>         }
>     }
>
>     // ABP: Draw persistent layers
>     function pmap_addPersistentLayer($resulttilelayers)
>     {
>
>         // NEW RESULT LAYER
>         $newResLayer = ms_newLayerObj($this->map);
>         $newResLayer->set("name", "persist_polygon");
>         $newResLayer->set("type", 1);  // Line
>
>         // ADD LINES TO NEW LAYER
>
>         foreach($resulttilelayers as $persist_polygon){
>             $resLine = ms_newLineObj();   // needed to use a line because 
> only 
> a line can be added to a shapeObj
>             foreach($persist_polygon as $point){
>                 $resLine->addXY($point[0], $point[1]);
>             }
>             $resShape = ms_newShapeObj(1);
>             $resShape->add($resLine);
>             $newResLayer->addFeature($resShape);
>         }
>
>         $newResLayer->set("status", MS_ON);
>         $newResLayerIdx = $newResLayer->index;
>
>
>         // CREATE NEW CLASS
>         $resClass = ms_newClassObj($newResLayer);
>         $clStyle = ms_newStyleObj($resClass);
>         $clStyle->color->setRGB(255, 0, 0);
>
>
>         $clStyle->set("symbolname", "circle");
>         $clStyle->set("size", 2);
>
>     }
>
>
>
>     /*
>      * CHECK IF THERE ARE RESULTLAYERS TO ADD
>      ********************************************************/
>     function pmap_checkResultLayers()
>     {
>         // ADD RESULTLAYER: MARKING SHAPE(S) AND ADD AS IN NEW CREATED LAYER
>         if (isset($_GET["resultlayer"])) {
>             $resultlayerStr = $_GET["resultlayer"];
>             if ($resultlayerStr == "remove") {
>                 session_unregister("resultlayers");
>               // ABP: clear persistent polygons
>                 unset ($_SESSION["persist_polygon"]);
>             } else {
>                 $resultlayer = explode(" ", $resultlayerStr);
>                 $reslayname = $resultlayer[0];
>                 $shpindexes = explode("|", $resultlayer[1]);
>                 $resultlayers[$reslayname] = $shpindexes;
>                 $this->pmap_addResultLayer($reslayname, $shpindexes);
>                 $_SESSION["resultlayers"] = $resultlayers;
>             }
>         } elseif (isset($_SESSION["resultlayers"])) {
>             $resultlayers = $_SESSION["resultlayers"];
>             foreach ($resultlayers as $reslayer => $shpindexes) {
>                 $this->pmap_addResultLayer($reslayer, $shpindexes);
>             }
>         }
>     }
>
>
> ------------------------------
> In print/print.php, add this function call in PrintMap():
>
>
>         // Check and if necessary add result layers to map
>         $this->pmap_checkResultLayers();
>
>         // ABP: Check if there is a persistent layer
>         $this->pmap_checkPersistentLayer();
>
>
>
>
>   

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
pmapper-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pmapper-users

Reply via email to