/** * implements detials of checking map request data, it should be overloaded by subclasses * * @throws WrongMapRequestDataException * @return bool return false if data are incorect */ protected function _check() { $bbox = $this->_mapData->getBBox(); //checking if bbox is given correctly if (is_null($bbox)) { throw new WrongMapRequestDataException('Bbox has not been defined'); } if (!is_numeric($bbox['left']) && !is_numeric($bbox['top']) && !is_numeric($bbox['right']) && !is_numeric($bbox['bottom'])) { throw new WrongMapRequestDataException('Bbox has wrong paramters'); } $worldMap = new BaseWorldMap(); if (!$worldMap->isCorrectLat($bbox['top']) || !$worldMap->isCorrectLat($bbox['bottom'])) { throw new WrongMapRequestDataException('Bbox has wrong parameters'); } if ($bbox['bottom'] >= $bbox['top']) { throw new WrongMapRequestDataException('Bbox has wrong parameters'); } }
/** * implements details of checking map request data, it should be overloaded by subclasses * * */ protected function _check() { $centerPoint = $this->_mapData->getCenterPoint(); //checking if mapa data are correct, and map can be build from it if (is_null($centerPoint)) { throw new WrongMapRequestDataException('Center point has not been given'); } if (!is_numeric($centerPoint['lon']) || !is_numeric($centerPoint['lat'])) { throw new WrongMapRequestDataException('Wrong paramters of center point have been given1'); } $worldMap = new BaseWorldMap(); if (!$worldMap->isCorrectLat($centerPoint['lat'])) { throw new WrongMapRequestDataException('Wrong parameters of center point have been given2'); } if (!$this->_checkZoom()) { throw new WrongMapRequestDataException('Wrong zoom is given'); } if (!$this->_checkWidth() || !$this->_checkHeight()) { throw new WrongMapRequestDataException('Wrong parameters of map is given'); } }