function parseLayers() { $layerParameters = array("name", "group", "type", "projection", "connection", "connectiontype", "data", "filter", "opacity", "minscaledenom", "maxscaledenom", "labelitem", "labelminscaledenom", "labelmaxscaledenom", "vue_defaut"); $layerMetaData = array("wms_name", "wms_title", "wms_group_title", "wfs_maxfeatures", "gml_include_items", "gml_exclude_items", "ows_exclude_items", "ows_include_items", "msp_classe_meta", "wms_attribution_title", "layer_name_igo"); $layerZIndex = array('LINE' => 2001, 'POINT' => 3001, 'POLYGON' => 1001, 'RASTER' => 1, 'CHART' => 5000, 'CIRCLE' => 1001, 'QUERY' => 0, 'ANNOTATION' => 4001, 'TILEINDEX' => 1001); $baseIndex = -1; $index = -1; $layers = array(); //Parse layers for ($i = 0; $i < $this->oMap->numlayers; $i++) { //create new layer object $layer = new Layer($this->oMap->getLayer($i)); //Create new empty hash array to store layer data $l = array(); //Get some layer parameters foreach ($layerParameters as $parameter) { $l[$parameter] = $layer->getParam($parameter); } //Get some metadata foreach ($layerMetaData as $metaData) { $metaDataValue = $layer->getMeta($metaData); $l[$metaData] = $metaDataValue; if ('layer_name_igo' == $metaData && $metaDataValue) { $l['name'] = $metaDataValue; } } //Get other parameters as plain text $l['layer_def'] = $layer->getLayerDef($layerParameters); //Get other metadata as plain text $l['meta_def'] = $layer->getMetaDef($layerMetaData); //Get attributes $l['attributes'] = $layer->getAttributes(); //Parse layer classes $classes = $layer->getClasses(); $l['classes'] = array(); foreach ($classes as $class) { $l['classes'][] = utf8_encode($class->convertToString()); } if ($layerZIndex[$l['type']] > $baseIndex && $layerZIndex[$l['type']] > $index) { $index = $layerZIndex[$l['type']]; } else { $index += 1; } $baseIndex = $layerZIndex[$l['type']]; $l['zIndex'] = $index; $layers[] = $l; } return $layers; }