public function __construct($path) { $pos = strpos($path, 'http://'); if ($pos !== 0) { $path = 'http://' . $path; } $size = HelpClass::getSizeOfRemoteFile($path); if ($size !== false && $size <= self::$maxSizeOfFile) { $file = @fopen($path, 'r'); if ($file !== false) { $this->_parseFile($file); fclose($file); } } }
/** * draw point on map * * @param Map $map */ public function draw(Map $map) { $image = $map->getImage(); $color = $this->_getDrawColor($image); $pointImage = false; if ($this->hasImageUrl()) { $size = HelpClass::getSizeOfRemoteFile($this->_imageUrl->getUrl()); if ($size <= self::$maxSizeOfPointImage) { try { $imageHandler = ImageHandler::createImageHandlerFromFileExtension($this->_imageUrl->getUrl()); $pointImage = $imageHandler->loadImage($this->_imageUrl->getUrl()); } catch (ImageHandlerException $e) { } } } if ($pointImage !== false) { $map->putImage($pointImage, $this->getLon(), $this->getLat()); } else { $color = $this->_getDrawColor($image); $point = $map->getPixelPointFromCoordinates($this->getLon(), $this->getLat()); $vertices = array($point['x'], $point['y'], $point['x'] - 10, $point['y'] - 20, $point['x'] + 10, $point['y'] - 20); imagefilledpolygon($map->getImage(), $vertices, 3, $color); } }