staticmaplite/src/Printer/AbstractPrinter.php

334 lines
6.3 KiB
PHP
Raw Normal View History

2018-02-11 18:26:56 +00:00
<?php
2018-02-11 18:28:06 +00:00
namespace StaticMapLite\Printer;
2018-02-11 18:26:56 +00:00
use StaticMapLite\Canvas\CanvasInterface;
use StaticMapLite\TileResolver\TileResolverInterface;
2018-02-13 12:52:02 +00:00
abstract class AbstractPrinter implements PrinterInterface
2018-02-11 18:26:56 +00:00
{
/** @var int $maxWidth */
protected $maxWidth = 1024;
/** @var int $maxHeight */
protected $maxHeight = 1024;
/** @var TileResolverInterface */
protected $tileResolver;
/** @var CanvasInterface $canvas */
protected $canvas;
/** @var int $tileSize */
protected $tileSize = 256;
/** @var array $tileSrcUrl */
protected $tileSrcUrl = [
'mapnik' => 'http://tile.openstreetmap.org/{z}/{x}/{y}.png',
'osmarenderer' => 'http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png',
'cycle' => 'http://a.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png',
'wikimedia-intl' => 'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png',
];
/** @var string $tileDefaultSrc */
protected $tileDefaultSrc = 'mapnik';
/** @var string $osmLogo */
protected $osmLogo = '../images/osm_logo.png';
/** @var bool $useTileCache */
protected $useTileCache = true;
protected $zoom;
protected $lat;
protected $lon;
protected $width;
protected $height;
protected $image;
protected $maptype;
protected $centerX;
protected $centerY;
protected $offsetX;
protected $offsetY;
/** @var array $markers */
protected $markers = [];
/** @var array $polylines */
protected $polylines = [];
public function getMaxWidth(): int
{
return $this->maxWidth;
}
2018-02-13 12:52:02 +00:00
public function setMaxWidth(int $maxWidth): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->maxWidth = $maxWidth;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
public function getMaxHeight(): int
{
return $this->maxHeight;
}
2018-02-13 12:52:02 +00:00
public function setMaxHeight(int $maxHeight): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->maxHeight = $maxHeight;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
public function getTileResolver(): TileResolverInterface
{
return $this->tileResolver;
}
2018-02-13 12:52:02 +00:00
public function setTileResolver(TileResolverInterface $tileResolver): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->tileResolver = $tileResolver;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
public function getCanvas(): CanvasInterface
{
return $this->canvas;
}
2018-02-13 12:52:02 +00:00
public function setCanvas(CanvasInterface $canvas): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->canvas = $canvas;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
public function getTileSize(): int
{
return $this->tileSize;
}
2018-02-13 12:52:02 +00:00
public function setTileSize(int $tileSize): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->tileSize = $tileSize;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
public function getTileSrcUrl(): array
{
return $this->tileSrcUrl;
}
2018-02-13 12:52:02 +00:00
public function setTileSrcUrl(array $tileSrcUrl): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->tileSrcUrl = $tileSrcUrl;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
public function getTileDefaultSrc(): string
{
return $this->tileDefaultSrc;
}
2018-02-13 12:52:02 +00:00
public function setTileDefaultSrc(string $tileDefaultSrc): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->tileDefaultSrc = $tileDefaultSrc;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
public function getOsmLogo(): string
{
return $this->osmLogo;
}
2018-02-13 12:52:02 +00:00
public function setOsmLogo(string $osmLogo): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->osmLogo = $osmLogo;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
public function isUseTileCache(): bool
{
return $this->useTileCache;
}
2018-02-13 12:52:02 +00:00
public function setUseTileCache(bool $useTileCache): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->useTileCache = $useTileCache;
return $this;
}
2018-02-13 12:47:12 +00:00
public function getZoom(): int
2018-02-11 18:26:56 +00:00
{
return $this->zoom;
}
2018-02-13 12:52:02 +00:00
public function setZoom(int $zoom): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->zoom = $zoom;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
2018-02-13 12:47:12 +00:00
public function getLat(): float
2018-02-11 18:26:56 +00:00
{
return $this->lat;
}
2018-02-13 12:52:02 +00:00
public function setLat(float $lat): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->lat = $lat;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
2018-02-13 12:47:12 +00:00
public function getLon(): float
2018-02-11 18:26:56 +00:00
{
return $this->lon;
}
2018-02-13 12:52:02 +00:00
public function setLon(float $lon): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->lon = $lon;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
2018-02-13 12:47:12 +00:00
public function getWidth(): int
2018-02-11 18:26:56 +00:00
{
return $this->width;
}
2018-02-13 12:52:02 +00:00
public function setWidth($width): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->width = $width;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
2018-02-13 12:47:12 +00:00
public function getHeight(): int
2018-02-11 18:26:56 +00:00
{
return $this->height;
}
2018-02-13 12:52:02 +00:00
public function setHeight($height): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->height = $height;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
public function getImage()
{
return $this->image;
}
2018-02-13 12:52:02 +00:00
public function setImage($image): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->image = $image;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
2018-02-13 12:47:12 +00:00
public function getMaptype(): string
2018-02-11 18:26:56 +00:00
{
return $this->maptype;
}
2018-02-13 12:52:02 +00:00
public function setMaptype(string $maptype): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->maptype = $maptype;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
2018-02-13 12:47:12 +00:00
public function getCenterX(): int
2018-02-11 18:26:56 +00:00
{
return $this->centerX;
}
2018-02-13 12:52:02 +00:00
public function setCenterX($centerX): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->centerX = $centerX;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
2018-02-13 12:47:12 +00:00
public function getCenterY(): int
2018-02-11 18:26:56 +00:00
{
return $this->centerY;
}
2018-02-13 12:52:02 +00:00
public function setCenterY(int $centerY): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->centerY = $centerY;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
2018-02-13 12:47:12 +00:00
public function getOffsetX(): int
2018-02-11 18:26:56 +00:00
{
return $this->offsetX;
}
2018-02-13 12:52:02 +00:00
public function setOffsetX(int $offsetX): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->offsetX = $offsetX;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
2018-02-13 12:47:12 +00:00
public function getOffsetY(): int
2018-02-11 18:26:56 +00:00
{
return $this->offsetY;
}
2018-02-13 12:52:02 +00:00
public function setOffsetY(int $offsetY): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->offsetY = $offsetY;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
public function getMarkers(): array
{
return $this->markers;
}
2018-02-13 12:52:02 +00:00
public function setMarkers(array $markers): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->markers = $markers;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
public function getPolylines(): array
{
return $this->polylines;
}
2018-02-13 12:52:02 +00:00
public function setPolylines(array $polylines): PrinterInterface
2018-02-11 18:26:56 +00:00
{
$this->polylines = $polylines;
2018-02-13 12:47:12 +00:00
2018-02-11 18:26:56 +00:00
return $this;
}
}