Skip to content

Commit c59c75e

Browse files
committed
TileLayer implementation
1 parent 184ba2b commit c59c75e

File tree

16 files changed

+318
-49
lines changed

16 files changed

+318
-49
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
],
2424
"require": {
2525
"php": ">=7.0",
26-
"dantsu/php-image-editor": "^1.1"
26+
"dantsu/php-image-editor": "^1.2"
2727
},
2828
"autoload": {
2929
"psr-4": {

docs/classes/DantSu/OpenStreetMapStaticAPI/Circle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,4 @@ Draw the circle on the map image.
127127

128128

129129
---
130-
> Automatically generated from source code comments on 2022-05-24 using [phpDocumentor](http://www.phpdoc.org/)
130+
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)

docs/classes/DantSu/OpenStreetMapStaticAPI/Interfaces/Draw.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@
4141

4242

4343
---
44-
> Automatically generated from source code comments on 2022-05-24 using [phpDocumentor](http://www.phpdoc.org/)
44+
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)

docs/classes/DantSu/OpenStreetMapStaticAPI/LatLng.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ Get longitude
8282

8383

8484
---
85-
> Automatically generated from source code comments on 2022-05-24 using [phpDocumentor](http://www.phpdoc.org/)
85+
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)

docs/classes/DantSu/OpenStreetMapStaticAPI/Line.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,4 @@ Draw the line on the map image.
9999

100100

101101
---
102-
> Automatically generated from source code comments on 2022-05-24 using [phpDocumentor](http://www.phpdoc.org/)
102+
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)

docs/classes/DantSu/OpenStreetMapStaticAPI/MapData.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,4 +379,4 @@ Convert a latitude and longitude to a XY pixel position in the image
379379

380380

381381
---
382-
> Automatically generated from source code comments on 2022-05-24 using [phpDocumentor](http://www.phpdoc.org/)
382+
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)

docs/classes/DantSu/OpenStreetMapStaticAPI/Markers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,4 @@ Draw markers on the image map.
135135

136136

137137
---
138-
> Automatically generated from source code comments on 2022-05-24 using [phpDocumentor](http://www.phpdoc.org/)
138+
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)

docs/classes/DantSu/OpenStreetMapStaticAPI/OpenStreetMap.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ DantSu\OpenStreetMapStaticAPI\OpenStreetMap is a PHP library created for easily
1616
## Methods
1717

1818
- [__construct](#-__construct)
19+
- [addLayer](#-addlayer)
1920
- [addMarkers](#-addmarkers)
2021
- [addDraw](#-adddraw)
2122
- [getMapData](#-getmapdata)
@@ -40,10 +41,36 @@ OpenStreetMap constructor.
4041
| `zoom` | **int** | Zoom |
4142
| `imageWidth` | **int** | Width of the generated map image |
4243
| `imageHeight` | **int** | Height of the generated map image |
44+
| `tileServer` | **\DantSu\OpenStreetMapStaticAPI\TileLayer** | Tile server configuration, defaults to OpenStreetMaps tile server |
4345

4446

4547

4648

49+
---
50+
### ->addLayer
51+
52+
Add tile layer to the map
53+
54+
55+
56+
57+
58+
59+
60+
61+
#### Parameters:
62+
63+
| Parameter | Type | Description |
64+
|-----------|------|-------------|
65+
| `layer` | **\DantSu\OpenStreetMapStaticAPI\TileLayer** | An instance of TileLayer |
66+
67+
68+
#### Return Value:
69+
70+
**$this** : Fluent interface
71+
72+
73+
4774
---
4875
### ->addMarkers
4976

@@ -142,4 +169,4 @@ Get the map image with markers and lines.
142169

143170

144171
---
145-
> Automatically generated from source code comments on 2022-05-24 using [phpDocumentor](http://www.phpdoc.org/)
172+
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)

docs/classes/DantSu/OpenStreetMapStaticAPI/Polygon.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ Draw the polygon on the map image.
100100

101101

102102
---
103-
> Automatically generated from source code comments on 2022-05-24 using [phpDocumentor](http://www.phpdoc.org/)
103+
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
2+
# TileLayer
3+
4+
DantSu\OpenStreetMapStaticAPI\TileLayer define tile server url and related configuration
5+
6+
7+
8+
* Full name: `\DantSu\OpenStreetMapStaticAPI\TileLayer`
9+
10+
**See Also:**
11+
12+
* https://github.com/DantSu/php-osm-static-api - Github page of this project
13+
14+
15+
16+
## Methods
17+
18+
- *(static)* [defaultTileLayer](#defaulttilelayer)
19+
- [__construct](#-__construct)
20+
- [setOpacity](#-setopacity)
21+
- [getTileUrl](#-gettileurl)
22+
- [getAttributionText](#-getattributiontext)
23+
- [getTile](#-gettile)
24+
25+
### ::defaultTileLayer
26+
27+
Default tile server. OpenStreetMaps with related attribution text
28+
29+
30+
31+
* This method is **static**.
32+
33+
34+
35+
36+
37+
#### Return Value:
38+
39+
**\DantSu\OpenStreetMapStaticAPI\TileLayer** : default tile server
40+
41+
42+
43+
---
44+
### ->__construct
45+
46+
TileLayer constructor
47+
48+
49+
50+
51+
52+
53+
54+
55+
#### Parameters:
56+
57+
| Parameter | Type | Description |
58+
|-----------|------|-------------|
59+
| `url` | **string** | tile server url with placeholders (`x`, `y`, `z`, `r`, `s`) |
60+
| `attributionText` | **string** | tile server attribution text |
61+
| `subdomains` | **string** | tile server subdomains |
62+
63+
64+
65+
66+
---
67+
### ->setOpacity
68+
69+
Set opacity of the layer
70+
71+
72+
73+
74+
75+
76+
77+
78+
#### Parameters:
79+
80+
| Parameter | Type | Description |
81+
|-----------|------|-------------|
82+
| `opacity` | **float** | Opacity value (0 to 1) |
83+
84+
85+
#### Return Value:
86+
87+
**$this** : Fluent interface
88+
89+
90+
91+
---
92+
### ->getTileUrl
93+
94+
Get tile url for coordinates and zoom level
95+
96+
97+
98+
99+
100+
101+
102+
103+
#### Parameters:
104+
105+
| Parameter | Type | Description |
106+
|-----------|------|-------------|
107+
| `x` | **int** | x coordinate |
108+
| `y` | **int** | y coordinate |
109+
| `z` | **int** | zoom level |
110+
111+
112+
#### Return Value:
113+
114+
**string** : tile url
115+
116+
117+
118+
---
119+
### ->getAttributionText
120+
121+
Get attribution text
122+
123+
124+
125+
126+
127+
128+
129+
130+
131+
#### Return Value:
132+
133+
**string** : Attribution text
134+
135+
136+
137+
---
138+
### ->getTile
139+
140+
Get an image tile
141+
142+
143+
144+
145+
146+
147+
148+
149+
#### Parameters:
150+
151+
| Parameter | Type | Description |
152+
|-----------|------|-------------|
153+
| `x` | **float** | |
154+
| `y` | **float** | |
155+
| `z` | **int** | |
156+
157+
158+
#### Return Value:
159+
160+
**\DantSu\PHPImageEditor\Image** : Image instance containing the tile
161+
162+
163+
164+
---
165+
166+
167+
---
168+
> Automatically generated from source code comments on 2022-05-31 using [phpDocumentor](http://www.phpdoc.org/)

0 commit comments

Comments
 (0)