public function __construct($baseURL, $parser=null) {
        $this->baseURL = $baseURL;
        $this->parser = ArcGISDataController::parserFactory($this->baseURL);
        $this->mapProjector = new MapProjector();
        
        $this->supportedImageFormats = $this->parser->getSupportedImageFormats();
        $this->enableAllLayers();

        // permanently set projection based on associated parser        
        $this->mapProjection = $this->parser->getProjection();
        $this->mapProjector->setDstProj($this->mapProjection);
        $this->unitsPerMeter = null;

        $bbox = $this->parser->getInitialExtent();

        $xrange = $bbox['xmax'] - $bbox['xmin'];
        $yrange = $bbox['ymax'] - $bbox['ymin'];
        $bbox['xmin'] += 0.4 * $xrange;
        $bbox['xmax'] -= 0.4 * $xrange;
        $bbox['ymin'] += 0.4 * $yrange;
        $bbox['ymax'] -= 0.4 * $yrange;
        $this->bbox = $bbox;
        $this->zoomLevel = $this->zoomLevelForScale($this->getCurrentScale());
        $this->center = array(
            'lat' => ($this->bbox['ymin'] + $this->bbox['ymax']) / 2,
            'lon' => ($this->bbox['xmin'] + $this->bbox['xmax']) / 2,
            );
    }
Exemplo n.º 2
0
 public function __construct($baseURL)
 {
     $this->baseURL = $baseURL;
     $arcgisParser = ArcGISDataController::parserFactory($this->baseURL);
     $wkid = $arcgisParser->getProjection();
     $this->mapProjector = new MapProjector();
     $this->mapProjector->setDstProj($wkid);
 }
 public static function parserFactory($baseURL) {
     $throwawayController = new ArcGISDataController();
     $throwawayController->init(array('BASE_URL' => $baseURL));
     $data = $throwawayController->getData();
     $throwawayController->parseData($data);
     return $throwawayController->parser;
 }