Ejemplo n.º 1
0
 private function getProjectedBBox()
 {
     $bbox = $this->getBoundingBox();
     $northeast = array('lat' => $bbox['ymax'], 'lon' => $bbox['xmax']);
     $southwest = array('lat' => $bbox['ymin'], 'lon' => $bbox['xmin']);
     if ($this->mapProjector) {
         $northeast = $this->mapProjector->projectPoint($northeast, MapProjector::FORMAT_LATLON);
         $southwest = $this->mapProjector->projectPoint($southwest, MapProjector::FORMAT_LATLON);
     }
     list($bbox['xmin'], $bbox['ymin'], $fmt) = MapProjector::getXYFromPoint($southwest);
     list($bbox['xmax'], $bbox['ymax'], $fmt) = MapProjector::getXYFromPoint($northeast);
     return $bbox;
 }
Ejemplo n.º 2
0
    function getFooterScript()
    {
        // put dojo stuff in the footer since the header script
        // gets loaded before the included script
        $zoomLevel = $this->zoomLevel;
        $targetScale = oldPixelScaleForZoomLevel($zoomLevel);
        if ($this->levelsOfDetail) {
            foreach ($this->levelsOfDetail as $levelData) {
                if ($levelData['scale'] < $targetScale) {
                    break;
                } else {
                    $zoomLevel = $levelData['level'];
                }
            }
        }
        $moreLayersJS = '';
        foreach ($this->moreLayers as $anotherLayer) {
            $moreLayersJS .= <<<JS
    map.addLayer(new esri.layers.ArcGISDynamicMapServiceLayer("{$anotherLayer}", 1.0));
JS;
        }
        $footer = $this->prepareJavascriptTemplate('ArcGISJSMapFooter');
        $footer->setValues(array('___FULL_URL_PREFIX___' => FULL_URL_PREFIX, '___API_URL___' => FULL_URL_BASE . API_URL_PREFIX . "/map/projectPoint", '___WKID___' => $this->mapProjection, '___MAPELEMENT___' => $this->mapElement, '___IMAGE_WIDTH___' => $this->imageWidth, '___IMAGE_HEIGHT___' => $this->imageHeight, '___ZOOMLEVEL___' => $zoomLevel, '___BASE_URL___' => $this->baseURL, '___MORE_LAYER_SCRIPT___' => $moreLayersJS, '___MARKER_SCRIPT___' => $this->getMarkerJS(), '___POLYGON_SCRIPT___' => $this->getPolygonJS(), '___PATH_SCRIPT___' => $this->getPathJS()));
        if ($this->mapProjector) {
            $xy = $this->mapProjector->projectPoint($this->center);
            list($x, $y) = MapProjector::getXYFromPoint($xy);
            $footer->setValues(array('___X___' => $x, '___Y___' => $y));
        } else {
            $footer->setValues(array('___X___' => $this->center['lon'], '___Y___' => $this->center['lat']));
        }
        return $footer->getScript();
    }
Ejemplo n.º 3
0
 function getFooterScript()
 {
     $zoomLevel = $this->zoomLevel;
     $targetScale = oldPixelScaleForZoomLevel($zoomLevel);
     if ($this->levelsOfDetail) {
         // TODO: if all zoom levels fail this test, the zoom level will
         // revert to the internal powers-of-two style zoom level i.e. not
         // necessarily what we want
         foreach ($this->levelsOfDetail as $levelData) {
             if ($levelData['scale'] < $targetScale) {
                 break;
             } else {
                 $zoomLevel = $levelData['level'];
             }
         }
     }
     $moreLayers = array();
     foreach ($this->moreLayers as $layer) {
         $moreLayers[] = '"' . $layer . '"';
     }
     $footer = $this->prepareJavascriptTemplate('ArcGISJSMapFooter');
     $footer->setValues(array('___WKID___' => $this->mapProjection, '___MAPELEMENT___' => $this->mapElement, '___IMAGE_WIDTH___' => $this->imageWidth, '___IMAGE_HEIGHT___' => $this->imageHeight, '___ZOOMLEVEL___' => $zoomLevel, '___BASE_URL___' => $this->baseURL, '___MORE_LAYER_SCRIPT___' => '[' . implode(',', $moreLayers) . ']', '___MARKER_SCRIPT___' => $this->getMarkerJS(), '___POLYGON_SCRIPT___' => $this->getPolygonJS(), '___PATH_SCRIPT___' => $this->getPathJS()));
     if ($this->mapProjector) {
         $xy = $this->mapProjector->projectPoint($this->center);
         list($x, $y) = MapProjector::getXYFromPoint($xy);
         $footer->setValues(array('___X___' => $x, '___Y___' => $y));
     } else {
         $footer->setValues(array('___X___' => $this->center['lon'], '___Y___' => $this->center['lat']));
     }
     return $footer->getScript();
 }
Ejemplo n.º 4
0
 private function getCenterJS() {
     if ($this->mapProjector) {
         $xy = $this->mapProjector->projectPoint($this->center);
         list($x, $y) = MapProjector::getXYFromPoint($xy);
         $xy = array('x' => $x, 'y' => $y);
     } else {
         $xy = array('x' => $this->center['lat'], 'y' => $this->center['lon']);
     }
 
     $js = 'new esri.geometry.Point('.$xy['x'].', '.$xy['y'].', spatialRef)';
 
     return $js;
 }