/**
  * 
  * 
  * 
  * 
  *
  */
 public function getBbox()
 {
     if (!is_array($this->featureArray) || count($this->featureArray) === 0) {
         return null;
     }
     $bBoxArray = array();
     for ($i = 0; $i < count($this->featureArray); $i++) {
         $currentBbox = $this->featureArray[$i]->getBbox();
         if (!is_null($currentBbox)) {
             $bBoxArray[] = $currentBbox;
         }
     }
     return Mapbender_bbox::union($bBoxArray);
 }
 public function getBbox()
 {
     $bboxArray = array();
     for ($i = 0; $i < count($pointArray); $i++) {
         $p = new Mapbender_point($this->pointArray[$i]["x"], $this->pointArray[$i]["y"], $this->srs);
         $bboxArray[] = new Mapbender_bbox($p, $p, $this->srs);
     }
     return Mapbender_bbox::union($bboxArray);
 }
 /**
  * Computes a new bounding box, bbox1 UNION bbox2
  */
 static function union($bboxArray)
 {
     if (count($bboxArray) == 1) {
         return array_pop($bboxArray);
     } elseif (count($bboxArray) >= 2) {
         $bbox1 = array_pop($bboxArray);
         $bbox2 = Mapbender_bbox::union($bboxArray);
         if (!($bbox1 != null && $bbox1->isValid()) && !($bbox2 != null && $bbox2->isValid())) {
             $e = new mb_exception("Mapbender_bbox: union: both parameters invalid!");
             return null;
         } elseif (!($bbox1 != null && $bbox1->isValid()) && ($bbox2 != null && $bbox2->isValid())) {
             $e = new mb_exception("Mapbender_bbox: union: first parameter invalid!");
             return $bbox2;
         } elseif ($bbox1 != null && $bbox1->isValid() && !($bbox2 != null && $bbox2->isValid())) {
             $e = new mb_exception("Mapbender_bbox: union: second parameter invalid!");
             return $bbox1;
         } else {
             if ($bbox1->epsg == $bbox2->epsg) {
                 $e = new mb_notice("Mapbender_bbox: union: bbox1 is: " . $bbox1);
                 $e = new mb_notice("Mapbender_bbox: union: bbox2 is: " . $bbox2);
                 $e = new mb_notice("Mapbender_bbox: union: merging bbox1 and bbox2...");
                 return new Mapbender_bbox(Mapbender_point::min($bbox1->min, $bbox2->min), Mapbender_point::max($bbox1->max, $bbox2->max), $bbox1->epsg);
             } else {
                 $e = new mb_exception("Mapbender_bbox: cannot process union with different EPSG codes");
             }
         }
     } else {
         $e = new mb_exception("Mapbender_bbox: Invalid parameter (Not an array)!");
     }
     return null;
 }
 /**
  * Merge WMS into this map
  * 
  * @return 
  */
 public function mergeWmsArray($wmsArray)
 {
     if (func_num_args() > 1 && is_array($wmsArray) && count($wmsArray) > 0) {
         $options = func_get_arg(1);
         if ($options["zoom"]) {
             $currentWms = $wmsArray[0];
             $bboxArray = array();
             for ($i = 0; $i < count($currentWms->objLayer[0]->layer_epsg); $i++) {
                 $bboxArray[] = Mapbender_bbox::createFromLayerEpsg($currentWms->objLayer[0]->layer_epsg[$i]);
             }
             $this->mergeExtent($bboxArray);
         }
         // visibility of WMS
         if (isset($options["visible"])) {
             if ($options["visible"]) {
                 // set all layers of WMS to visible
                 for ($i = 0; $i < count($wmsArray); $i++) {
                     $numLayers = count($wmsArray[$i]->objLayer);
                     // using option show is dependent to option visible = true
                     if ($options["show"] && is_numeric($options["show"])) {
                         // do not display if layer count is too big
                         if ($numLayers > intval($options["show"])) {
                             continue;
                         }
                     }
                     for ($j = 0; $j < $numLayers; $j++) {
                         $wmsArray[$i]->objLayer[$j]->gui_layer_visible = 1;
                     }
                 }
             } else {
                 // set all layers of WMS to visible
                 for ($i = 0; $i < count($wmsArray); $i++) {
                     $numLayers = count($wmsArray[$i]->objLayer);
                     for ($j = 0; $j < $numLayers; $j++) {
                         $wmsArray[$i]->objLayer[$j]->gui_layer_visible = 0;
                     }
                 }
             }
         }
         // querylayer
         if (isset($options["querylayer"])) {
             $val = $options["querylayer"] ? 1 : 0;
             // set all queryable layers of WMS to querylayer
             for ($i = 0; $i < count($wmsArray); $i++) {
                 $numLayers = count($wmsArray[$i]->objLayer);
                 for ($j = 0; $j < $numLayers; $j++) {
                     $currentLayer = $wmsArray[$i]->objLayer[$j];
                     if ($currentLayer->gui_layer_queryable) {
                         $currentLayer->gui_layer_querylayer = $val;
                     }
                 }
             }
         }
         if ($options["show"] && is_numeric($options["show"]) && !isset($options["visible"])) {
             $e = new mb_exception("show");
             // set all layers of WMS to visible
             for ($i = 0; $i < count($wmsArray); $i++) {
                 $numLayers = count($wmsArray[$i]->objLayer);
                 // do not display if layer count is too big
                 if ($numLayers > intval($options["show"])) {
                     continue;
                 }
                 for ($j = 0; $j < $numLayers; $j++) {
                     $wmsArray[$i]->objLayer[$j]->gui_layer_visible = 1;
                 }
             }
         }
     }
     $this->wmsArray = wms::merge(array_merge($this->wmsArray, $wmsArray));
 }
                // make WMS visible if it has less than 100000 layers
                $options["show"] = 100000;
            }
            if (isset($input["querylayer"])) {
                $options["querylayer"] = $input["querylayer"];
            }
            $wmcGetApi->mergeWmsArray(array($wms), $options);
            // do not use "zoom" attribute of mergeWmsArray,
            // as this would zoom to the entre WMS.
            // Here we set extent to the layer extent only.
            if ($input["zoom"]) {
                $bboxArray = array();
                try {
                    $layer = $wms->getLayerById(intval($input["id"]));
                    for ($i = 0; $i < count($layer->layer_epsg); $i++) {
                        $bboxArray[] = Mapbender_bbox::createFromLayerEpsg($layer->layer_epsg[$i]);
                    }
                    $wmcGetApi->mainMap->mergeExtent($bboxArray);
                } catch (Exception $e) {
                }
            }
        }
    }
}
//
// FEATURETYPE
//
$inputFeaturetypeArray = $getApi->getFeaturetypes();
if ($inputFeaturetypeArray) {
    $wfsConfIds = array();
    foreach ($inputFeaturetypeArray as $input) {