示例#1
0
<?php

require_once 'library/map.php';
use MapFile\Map;
use MapFile\Label;
use MapFile\Layer;
use MapFile\LayerClass;
use MapFile\Legend;
use MapFile\Scalebar;
use MapFile\Style;
session_start();
$settings = parse_ini_file('settings.ini');
$mapfile = $_SESSION['mapfile-generator']['mapfile'];
$map = new Map($mapfile);
if (isset($_POST['up']) || isset($_POST['down']) || isset($_POST['delete'])) {
    if (isset($_POST['up'])) {
        $map->moveLayerUp(intval($_POST['up']));
    } else {
        if (isset($_POST['down'])) {
            $map->moveLayerDown(intval($_POST['down']));
        } else {
            if (isset($_POST['delete'])) {
                $map->removeLayer(intval($_POST['delete']));
            }
        }
    }
} else {
    $map->projection = $_POST['projection'];
    if (strlen($_POST['extentminx']) > 0 && strlen($_POST['extentminy']) > 0 && strlen($_POST['extentmaxx']) > 0 && strlen($_POST['extentmaxy']) > 0) {
        $map->setExtent($_POST['extentminx'], $_POST['extentminy'], $_POST['extentmaxx'], $_POST['extentmaxy']);
    }
示例#2
0
                $label = $class->getLabel(0);
                $data['class'][$c]['label']['align'] = $label->align;
                $data['class'][$c]['label']['position'] = $label->position;
                $data['class'][$c]['label']['color'] = array('r' => $label->color->red, 'g' => $label->color->green, 'b' => $label->color->blue);
                $data['class'][$c]['label']['outlinecolor'] = array('r' => $label->outlinecolor->red, 'g' => $label->outlinecolor->green, 'b' => $label->outlinecolor->blue);
                $data['class'][$c]['label']['minscaledenom'] = $label->minscaledenom != -1 ? $label->minscaledenom : NULL;
                $data['class'][$c]['label']['maxscaledenom'] = $label->maxscaledenom != -1 ? $label->maxscaledenom : NULL;
                //}
            }
        }
        $layers_json[$k] = json_encode($data);
    }
    $map->free();
    unset($map);
} else {
    $map = new Map($_SESSION['mapfile-generator']['mapfile']);
    $map_name = $map->name;
    $map_extent = $map->extent;
    $map_projection = !is_null($map->projection) ? $map->projection : 'epsg:3857';
    $wms_enabled = $map->getMetadata('wms_enable_request') !== FALSE;
    if ($wms_enabled) {
        $map_wmstitle = $map->getMetadata('wms_title') !== FALSE ? $map->getMetadata('wms_title') : NULL;
        $map_wmsabstract = $map->getMetadata('wms_abstract') !== FALSE ? $map->getMetadata('wms_abstract') : NULL;
    }
    $layers_json = array();
    foreach ($map->getLayers() as $k => $layer) {
        $data = array();
        if ($wms_enabled) {
            $data['wms_title'] = $layer->getMetadata('wms_title') !== FALSE ? $layer->getMetadata('wms_title') : NULL;
            $data['wms_abstract'] = $layer->getMetadata('wms_abstract') !== FALSE ? $layer->getMetadata('wms_abstract') : NULL;
            $data['wms_include_items'] = $layer->getMetadata('wms_include_items') !== FALSE ? $layer->getMetadata('wms_include_items') : NULL;