Toggle navigation
Toggle navigation
This project
Loading...
Sign in
尹诚
/
Mapbox-iOS-SDK
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
Justin R. Miller
11 years ago
Commit
7e4797f7b681f8b23aa6dd1c87f01946b5c87197
1 parent
f7516278
refs #386: remember early tile source setups
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
3 deletions
MapView/Map/RMMapView.m
MapView/Map/RMMapView.m
View file @
7e4797f
...
...
@@ -169,6 +169,8 @@
RMFractalTileProjection
*
_mercatorToTileProjection
;
RMTileSourcesContainer
*
_tileSourcesContainer
;
NSMutableArray
*
_earlyTileSources
;
NSMutableSet
*
_annotations
;
NSMutableSet
*
_visibleAnnotations
;
...
...
@@ -299,13 +301,33 @@
[
self
setBackgroundView
:
nil
];
}
if
(
initialTileSourceMinZoomLevel
<
newTilesource
.
minZoom
)
initialTileSourceMinZoomLevel
=
newTilesource
.
minZoom
;
if
(
initialTileSourceMaxZoomLevel
>
newTilesource
.
maxZoom
)
initialTileSourceMaxZoomLevel
=
newTilesource
.
maxZoom
;
if
([
_earlyTileSources
count
])
{
for
(
id
<
RMTileSource
>
earlyTileSource
in
_earlyTileSources
)
{
if
(
initialTileSourceMinZoomLevel
<
earlyTileSource
.
minZoom
)
initialTileSourceMinZoomLevel
=
earlyTileSource
.
minZoom
;
if
(
initialTileSourceMaxZoomLevel
>
earlyTileSource
.
maxZoom
)
initialTileSourceMaxZoomLevel
=
earlyTileSource
.
maxZoom
;
}
}
else
{
if
(
initialTileSourceMinZoomLevel
<
newTilesource
.
minZoom
)
initialTileSourceMinZoomLevel
=
newTilesource
.
minZoom
;
if
(
initialTileSourceMaxZoomLevel
>
newTilesource
.
maxZoom
)
initialTileSourceMaxZoomLevel
=
newTilesource
.
maxZoom
;
}
[
self
setTileSourcesMinZoom
:
initialTileSourceMinZoomLevel
];
[
self
setTileSourcesMaxZoom
:
initialTileSourceMaxZoomLevel
];
[
self
setTileSourcesZoom
:
initialTileSourceZoomLevel
];
[
self
setTileSource
:
newTilesource
];
if
([
_earlyTileSources
count
])
{
[
self
setTileSources
:
_earlyTileSources
];
[
_earlyTileSources
removeAllObjects
];
}
else
{
[
self
setTileSource
:
newTilesource
];
}
[
self
setCenterCoordinate
:
initialCenterCoordinate
animated
:
NO
];
[
self
setDecelerationMode
:
RMMapDecelerationFast
];
...
...
@@ -378,6 +400,8 @@
if
(
!
newTilesource
||
!
(
self
=
[
super
initWithFrame
:
frame
]))
return
nil
;
_earlyTileSources
=
[
NSMutableArray
array
];
[
self
performInitializationWithTilesource
:
newTilesource
centerCoordinate
:
initialCenterCoordinate
zoomLevel
:
initialZoomLevel
...
...
@@ -388,6 +412,16 @@
return
self
;
}
-
(
id
)
initWithCoder
:(
NSCoder
*
)
decoder
{
if
(
!
[
super
initWithCoder
:
decoder
])
return
nil
;
_earlyTileSources
=
[
NSMutableArray
array
];
return
self
;
}
-
(
void
)
setFrame
:(
CGRect
)
frame
{
CGRect
r
=
self
.
frame
;
...
...
@@ -2111,6 +2145,16 @@
-
(
void
)
setTileSources
:
(
NSArray
*
)
tileSources
{
if
(
!
_tileSourcesContainer
)
{
// If we've reached this point, it's because our scroll view etc.
// aren't yet setup. So let's remember the tile source(s) set so that
// we can apply them later on once we're properly initialized.
//
[
_earlyTileSources
setArray
:
tileSources
];
return
;
}
if
(
!
[
_tileSourcesContainer
setTileSources
:
tileSources
])
return
;
...
...
@@ -2139,6 +2183,16 @@
-
(
void
)
addTileSource
:
(
id
<
RMTileSource
>
)
newTileSource
atIndex
:
(
NSUInteger
)
index
{
if
(
!
_tileSourcesContainer
)
{
// If we've reached this point, it's because our scroll view etc.
// aren't yet setup. So let's remember the tile source(s) set so that
// we can apply them later on once we're properly initialized.
//
[
_earlyTileSources
insertObject
:
newTileSource
atIndex
:(
index
>
[
_earlyTileSources
count
]
?
0
:
index
)];
return
;
}
if
([
_tileSourcesContainer
.
tileSources
containsObject
:
newTileSource
])
return
;
...
...
Please
register
or
login
to post a comment