/** * Register added dynamic layers in p.mapper group/layer objects * is called from initDynLayers() */ protected function registerDynLayers($layerNames, $rewriteLegend) { $allGroups = array_merge($_SESSION['allGroups'], $layerNames); $_SESSION['allGroups'] = array_unique($allGroups); if ($rewriteLegend) { $initMap = new Init_map($this->map, false, false, $_SESSION['gLanguage']); $initMap->createLegendList(); } $iG = new Init_groups($this->map, $allGroups, $_SESSION['language'], false); $iG->createGroupList(); }
public function initDynLayers($rewriteLegend = true) { $this->createDynLayers(); require_once $_SESSION['PM_INCPHP'] . "/initgroups.php"; $allGroups = array_merge($_SESSION['allGroups'], $this->dynLayerList); $_SESSION['allGroups'] = array_unique($allGroups); if ($rewriteLegend) { require_once $_SESSION['PM_INCPHP'] . "/init/initmap.php"; $initMap = new Init_map($this->map, false, false, $_SESSION['gLanguage']); $initMap->createLegendList(); } $iG = new Init_groups($this->map, $allGroups, $_SESSION['language'], false); $iG->createGroupList(); }
public function __get($name) { if ($name == 'jsReference') { return $this->initJSReference(); } else { return parent::__get($name); } }
$newAllGroups = array(); foreach ($allGroups as $grp) { $found = false; foreach ($removedLayers as $removedLayer) { if ($grp == $removedLayer) { $found = true; break; } } if (!$found) { $newAllGroups[] = $grp; } } $_SESSION["allGroups"] = $newAllGroups; } // Add new / remove old layers to group list: if ($addedLayersStr != '[]' || $removedLayersStr != '[]') { require_once $_SESSION['PM_INCPHP'] . '/common.php'; require_once $_SESSION['PM_INCPHP'] . '/globals.php'; require_once dirname(__FILE__) . '/../common/groupsAndLayers.php'; updateGroupList($map); } // (re-) regenrate legend : if (count($activeLayers) > 0) { require_once $_SESSION['PM_INCPHP'] . '/common.php'; require_once $_SESSION['PM_INCPHP'] . '/globals.php'; require_once $_SESSION['PM_INCPHP'] . '/initgroups.php'; require_once $_SESSION['PM_INCPHP'] . '/init/initmap.php'; $initMap = new Init_map($map, false, false, $_SESSION['gLanguage'], true); $initMap->createLegendList(); }
* (at your option) any later version. See the COPYING file. * * p.mapper is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with p.mapper; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * ******************************************************************************/ /** * Initialize settings (using "initmap.php") */ $initMap = new Init_map($map, $PM_MAP_FILE, $ini, $gLanguage); $initMap->initAllParameters(); $infoWin = $_SESSION['infoWin']; $mapW = $map->width; //540; $mapH = $map->height; //430; //$_SESSION["mapwidth"] = $mapW; //$_SESSION["mapheight"] = $mapH; /** * Reference map section */ $refmap = $map->reference; $refW = $refmap->width; $refH = $refmap->height; $refImg = basename($refmap->image);
/** * * Update legend and pmapper variables: * * - add or remove layers to $_SESSION['allGroups'] * - create legend (call Init_map::createLegendList) * - update groups and glayers definitions (instanciate Init_groups) */ private function updateToc($dynLayers) { $allGroups = $_SESSION['allGroups']; $initialCount = count($allGroups); if ($initialCount > 0) { foreach ($dynLayers as $dynLayer) { if ($layerName = $dynLayer->getLayerName()) { // update the groups lists: if ($dynLayer->hasFeatures()) { $allGroups = array_merge($allGroups, array($layerName)); } else { $newGroups = array(); foreach ($allGroups as $groupName) { if ($groupName != $layerName) { $newGroups[] = $groupName; } } $allGroups = $newGroups; } } $allGroups = array_unique($allGroups); } $_SESSION['allGroups'] = $allGroups; // get original opacities: // this require should be done before session_start!!! // require_once($_SESSION['PM_INCPHP'] . '/group.php'); $grouplist = $_SESSION['grouplist']; $opacities = array(); foreach ($grouplist as $grp) { // to avoid bad incphp/group.php inclusion, like in map.phtml for instance // for instance : // refresh a page // -> call map.phtml // -> session_start(), then include group.php // -> error : __PHP_Imcomplete_Class if (is_object($grp)) { $glayerList = $grp->getLayers(); foreach ($glayerList as $glayer) { $opacities[$glayer->getLayerName()] = $glayer->getOpacity(); } } } // update legend: if ($initialCount != count($allGroups)) { require_once $_SESSION['PM_INCPHP'] . '/init/initmap.php'; $initMap = new Init_map($this->map, false, false, $_SESSION['gLanguage']); $initMap->createLegendList(); } // update groups and glayer definitions require_once $_SESSION['PM_INCPHP'] . '/initgroups.php'; $iG = new Init_groups($this->map, $allGroups, $_SESSION['gLanguage'], true); $iG->createGroupList(); // restore opacity: $grouplist = $_SESSION['grouplist']; foreach ($grouplist as $grp) { $glayerList = $grp->getLayers(); foreach ($glayerList as $glayer) { $name = $glayer->getLayerName(); if (isset($opacities[$name])) { $opacity = $opacities[$name]; $glayer->setOpacity($opacity); } } } } }