2
2
#name : #GeoViewLocalDirectoryTilesProvider ,
3
3
#superclass : #GeoViewTilesProvider ,
4
4
#instVars : [
5
- ' tileDirectory'
5
+ ' tileDirectory' ,
6
+ ' imageType'
6
7
],
7
8
#category : #' GeoView-Map'
8
9
}
@@ -13,10 +14,16 @@ GeoViewLocalDirectoryTilesProvider class >> defaultDirectory [
13
14
^ FileLocator imageDirectory / ' map' / ' r'
14
15
]
15
16
16
- { #category : #initialization }
17
- GeoViewLocalDirectoryTilesProvider >> initialize [
18
-
19
- super initialize.
17
+ { #category : #accessing }
18
+ GeoViewLocalDirectoryTilesProvider >> imageType [
19
+
20
+ ^ imageType
21
+ ]
22
+
23
+ { #category : #accessing }
24
+ GeoViewLocalDirectoryTilesProvider >> imageType: anObject [
25
+
26
+ imageType := anObject
20
27
]
21
28
22
29
{ #category : #accessing }
@@ -35,13 +42,21 @@ GeoViewLocalDirectoryTilesProvider >> tileDirectory: anObject [
35
42
{ #category : #request }
36
43
GeoViewLocalDirectoryTilesProvider >> tileFilenameFor: aZoomLevel x: anXCoordinate y: anYCoordinate [
37
44
38
- | filename |
45
+ | filename types |
39
46
filename := self tileDirectory asFileReference.
40
47
filename exists ifFalse: [ ^ nil ].
41
48
42
49
filename := filename / aZoomLevel asString.
43
50
filename := filename / anXCoordinate asString.
44
- filename := filename / (anYCoordinate asString , ' .png' ).
51
+ filename := filename / anYCoordinate asString.
52
+
53
+ imageType ifNil: [
54
+ " trying to find the type of the image"
55
+ types := #( 'jpg' 'png' ) .
56
+ imageType := types detect: [ :e | (filename , (e asString)) exists ] ifNone: [ ^ nil ].
57
+ ].
58
+
59
+ filename := filename , imageType asString.
45
60
46
61
^ filename
47
62
]
0 commit comments