#CACHE{0}#HTTP_HEADER{Content-type: image/png}<?php
require_once _DIR_PLUGIN_BIODIV.'lib/osm/vendor/autoload.php';
require_once _DIR_PLUGIN_BIODIV.'lib/osm/src/MapData.php';
require_once _DIR_PLUGIN_BIODIV.'lib/osm/src/LatLng.php';
require_once _DIR_PLUGIN_BIODIV.'lib/osm/src/Line.php';
require_once _DIR_PLUGIN_BIODIV.'lib/osm/src/Markers.php';
require_once _DIR_PLUGIN_BIODIV.'lib/osm/src/OpenStreetMap.php';
require_once _DIR_PLUGIN_BIODIV.'lib/osm/src/XY.php';

define('_MRK_DIR', _DIR_PLUGIN_BIODIV.'lib/osm/src/samples/resources/');
define('_MRK_DIR2',_DIR_PLUGIN_BIODIV.'lib/leaflet/images/');

use \DantSu\OpenStreetMapStaticAPI\OpenStreetMap;
use \DantSu\OpenStreetMapStaticAPI\LatLng;
use \DantSu\OpenStreetMapStaticAPI\Line;
use \DantSu\OpenStreetMapStaticAPI\Markers;

[
  (#SET{lat,[(#ENV**{lat,[(#CONFIG{feuillet/lat})]})]})  		][
  (#SET{lng,[(#ENV**{lng,[(#CONFIG{feuillet/lng})]})]})  		][
  (#SET{zoom,[(#ENV**{zoom,[(#CONFIG{feuillet/zoom})]})]})	][
  (#SET{size,[(#ENV**{size,1024})]})						][
  (#SET{obsarray,[(#ENV**{obsliste}|retrouver_donnees)]})	][
  (#SET{fitmode,[(#ENV**{fit,none})]})
]
(new OpenStreetMap(new LatLng(#GET{lat}, #GET{lng}), #GET{zoom}, #GET{size}, #GET{size}))
<B_obsnon>
    ->addMarkers(
        (new Markers(_MRK_DIR2 . 'blue-mkr.png'))
            ->setAnchor(Markers::ANCHOR_CENTER, Markers::ANCHOR_BOTTOM)
           <BOUCLE_obsnon(BIODIV_OBSERVATIONS) {id_observation IN #GET{obsarray}} {discret=non}>
            ->addMarker(new LatLng(#LAT, #LNG))</BOUCLE_obsnon>
            
    )</B_obsnon>
<B_obsoui>
    ->addMarkers(
        (new Markers(_MRK_DIR2 . 'red-mkr.png'))
            ->setAnchor(Markers::ANCHOR_CENTER, Markers::ANCHOR_BOTTOM)
           <BOUCLE_obsoui(BIODIV_OBSERVATIONS) {id_observation IN #GET{obsarray}} {discret=oui}>
            ->addMarker(new LatLng(#LAT, #LNG))</BOUCLE_obsoui>
            
    )</B_obsoui>
<B_obsnsp>
    ->addMarkers(
        (new Markers(_MRK_DIR2 . 'yellow-mkr.png'))
            ->setAnchor(Markers::ANCHOR_CENTER, Markers::ANCHOR_BOTTOM)
           <BOUCLE_obsnsp(BIODIV_OBSERVATIONS) {id_observation IN #GET{obsarray}} {discret !IN oui,non}>
            ->addMarker(new LatLng(#LAT, #LNG))</BOUCLE_obsnsp>
            
    )</B_obsnsp>
    [(#GET{fitmode}|=={markers}|oui) ->fitToMarkers(20) ]
    ->getImage()
    ->displayPNG();
?>


