Exemplo n.º 1
0
 $mapheight = $pmap->pmap_returnMapH();
 $geo_scale = $pmap->pmap_returnGeoScale();
 // Check if layers in TOC should be refreshed
 $visGroupsBefore = array();
 $visGroupsAfter = array();
 if ($scaleLayers) {
     foreach ($grouplist as $grp) {
         $grpName = $grp->getGroupName();
         $layerList = $grp->getLayers();
         foreach ($layerList as $glayer) {
             $layName = $glayer->getLayerName();
             $qLayer = $map->getLayerByName($layName);
             if (PMCommon::checkScale($map, $qLayer, $geo_scale)) {
                 $visGroupsAfter[] = $layName;
             }
             if (PMCommon::checkScale($map, $qLayer, $old_geo_scale)) {
                 $visGroupsBefore[] = $layName;
             }
         }
     }
     if ($visGroupsAfter == $visGroupsBefore) {
         $refreshToc = 0;
     } else {
         $refreshToc = 1;
     }
     // original code to determinate when legend has to be refreshed
     if ($refreshToc && $oldGroups != $groups) {
         $refreshLegend = 0;
     } else {
         $refreshLegend = 1;
     }
Exemplo n.º 2
0
Arquivo: map.php Projeto: sukma279/GIS
 /** 
  * Set image format according to settings
  * if alternative format is defined for some layers
  * and if one of these layers is active, then use altImgFormat
  */
 protected function pmap_setImgFormat($print = false)
 {
     $altImgFormatLayers = $_SESSION['altImgFormatLayers'];
     $altImgFormat = $_SESSION['altImgFormat'];
     $useAltImgFormat = 0;
     if ($altImgFormatLayers && $altImgFormat) {
         foreach ($altImgFormatLayers as $ai) {
             $mapLay = @$this->map->getLayerByName($ai);
             if ($mapLay) {
                 if ((in_array($mapLay->name, $this->groups) || in_array($mapLay->group, $this->groups)) && PMCommon::checkScale($this->map, $mapLay, $this->map->scaledenom)) {
                     $useAltImgFormat = 1;
                     break;
                 }
             }
         }
     }
     if (!$print) {
         if ($useAltImgFormat) {
             $this->map->selectOutputFormat($_SESSION["altImgFormat"]);
         } else {
             $this->map->selectOutputFormat($_SESSION["imgFormat"]);
         }
     } else {
         if ($useAltImgFormat) {
             $this->map->selectOutputFormat($_SESSION["printAltImgFormat"]);
         } else {
             $this->map->selectOutputFormat($_SESSION["printImgFormat"]);
         }
     }
 }
Exemplo n.º 3
0
                $hasTemplate = 1;
            }
            $numclasses = $mapLayer->numclasses;
            for ($cl = 0; $cl < $numclasses; $cl++) {
                $class = $mapLayer->getClass($cl);
                $classTemplate = $class->template;
                if ($class->template) {
                    $hasTemplate = 1;
                }
            }
            if ($XYLayerProperties = $glayer->getXYLayerProperties()) {
                if (!$XYLayerProperties['noQuery']) {
                    $hasTemplate = 1;
                }
            }
            if ($mapLayer->type < 3 && PMCommon::checkScale($map, $mapLayer, $scale) == 1 && $resFldList[0] != '0' && $hasTemplate) {
                $showgroups[] = $grp;
                break;
            }
        }
    }
}
// Print combo box with all visible groups
$gstr = "<form id=\"selform\"><div class=\"pm-selectbox\">";
if (count($showgroups) > 0) {
    $gstr .= _pjs("Apply on Layer") . "";
    $gstr .= "";
    $gstr .= "<select name=\"selgroup\" >";
    foreach ($showgroups as $g) {
        $gstr .= "<option value=\"" . $g->getGroupName() . "\" ";
        if ($g->getGroupName() == $activegroup) {
Exemplo n.º 4
0
/**
 * Return groups available in array
 */
function getAvailableGroups($map, $onlyChecked, $onlyNonRasters, $onlyVisibleAtScale, $onlyQueryable = true, $onlyInCategories = false)
{
    // only checked groups :
    if ($onlyChecked) {
        $groupsStep1 = $_SESSION["groups"];
    } else {
        $groupsStep1 = $_SESSION["allGroups"];
    }
    $groupsStep2 = array();
    $scale = $_SESSION["geo_scale"];
    $grouplist = $_SESSION["grouplist"];
    foreach ($grouplist as $grp) {
        if (in_array($grp->getGroupName(), $groupsStep1, TRUE)) {
            $glayerList = $grp->getLayers();
            foreach ($glayerList as $glayer) {
                $mapLayer = $map->getLayer($glayer->getLayerIdx());
                $groupOk = true;
                // no raster layers / groups :
                if ($groupOk && $onlyNonRasters) {
                    if ($mapLayer->type >= 3) {
                        $groupOk = false;
                    }
                }
                // only visible layers / groups depending on scale :
                if ($groupOk && $onlyVisibleAtScale) {
                    if (PMCommon::checkScale($map, $mapLayer, $scale) != 1) {
                        $groupOk = false;
                    }
                }
                if ($groupOk && $onlyQueryable) {
                    $hasTemplate = 0;
                    if ($mapLayer->template) {
                        $hasTemplate = 1;
                    }
                    if (!$hasTemplate) {
                        $numclasses = $mapLayer->numclasses;
                        for ($cl = 0; $cl < $numclasses; $cl++) {
                            $class = $mapLayer->getClass($cl);
                            $classTemplate = $class->template;
                            if ($class->template) {
                                $hasTemplate = 1;
                                break;
                            }
                        }
                    }
                    $groupOk = $hasTemplate;
                }
                if ($groupOk) {
                    $groupsStep2[] = $grp;
                    break;
                }
            }
        }
    }
    // only layers in categories
    $groupsStep3 = array();
    if ($onlyInCategories) {
        // get Categories
        require_once $_SESSION['PM_INCPHP'] . "/layerview.php";
        $layerView = new LayerView($map, false, false);
        $categoryList = $layerView->getCategoryList();
        if (count($categoryList) > 0) {
            foreach ($categoryList as $cat) {
                $catGrps = $cat['groups'];
                $categoriesGroups = array();
                foreach ($catGrps as $catGrp) {
                    if ($catGrp) {
                        $catGrpName = $catGrp['name'];
                        foreach ($groupsStep2 as $grp) {
                            $grpName = $grp->getGroupName();
                            if ($catGrpName === $grpName) {
                                $groupsStep3[] = $grp;
                            }
                        }
                    }
                }
            }
        }
    } else {
        $groupsStep3 = $groupsStep2;
    }
    return $groupsStep3;
}
Exemplo n.º 5
0
 /**
  * Check if group has visible layer at current scale
  * @param object $map
  * @param object $grp
  * @param int $scale
  */
 public function checkGroup($map, $grp, $scale)
 {
     $printGroup = 0;
     $glayerList = $grp->getLayers();
     if (is_array($glayerList)) {
         foreach ($glayerList as $glayer) {
             $tocLayer = $map->getLayer($glayer->getLayerIdx());
             if (PMCommon::checkScale($map, $tocLayer, $scale) == 1 && $tocLayer->type != 5) {
                 $printGroup = 1;
                 //pm_logDebug(3, "Layer: $tocLayer->name; scale: $scale; PrintGrp: $printGroup");
             }
         }
     }
     return $printGroup;
 }