[core] Remove bundled styles.

Fixes #2239
This commit is contained in:
Leith Bade
2015-10-23 13:42:07 +11:00
committed by Minh Nguyễn
parent ddc4251074
commit abf93c008b
20 changed files with 56 additions and 119 deletions

4
.gitmodules vendored
View File

@@ -2,10 +2,6 @@
path = .mason
url = https://github.com/mapbox/mason.git
[submodule "styles"]
path = styles
url = https://github.com/mapbox/mapbox-gl-styles.git
[submodule "test/ios/KIF"]
path = test/ios/KIF
url = https://github.com/kif-framework/KIF.git

View File

@@ -28,27 +28,27 @@ public class Style {
/**
* Mapbox Streets: A complete basemap, perfect for incorporating your own data.
*/
public static final String MAPBOX_STREETS = "asset://styles/streets-v8.json";
public static final String MAPBOX_STREETS = "mapbox://styles/mapbox/streets-v8";
/**
* Emerald: A versatile style, with emphasis on road networks and public transit.
*/
public static final String EMERALD = "asset://styles/emerald-v8.json";
public static final String EMERALD = "mapbox://styles/mapbox/emerald-v8";
/**
* Light: Subtle light backdrop for data visualizations.
*/
public static final String LIGHT = "asset://styles/light-v8.json";
public static final String LIGHT = "mapbox://styles/mapbox/light-v8";
/**
* Dark: Subtle dark backdrop for data visualizations.
*/
public static final String DARK = "asset://styles/dark-v8.json";
public static final String DARK = "mapbox://styles/mapbox/dark-v8";
/**
* Satellite: A beautiful global satellite and aerial imagery layer.
*/
public static final String SATELLITE = "asset://styles/satellite-v8.json";
public static final String SATELLITE = "mapbox://styles/mapbox/satellite-v8";
/**
* Satellite Streets: Global satellite and aerial imagery with unobtrusive labels.
*/
public static final String SATELLITE_STREETS = "asset://styles/satellite-hybrid-v8.json";
public static final String SATELLITE_STREETS = "mapbox://styles/mapbox/satellite-hybrid-v8";
}

View File

@@ -9,10 +9,10 @@
<string name="infoWindowAddress">Address</string>
<!-- these are public -->
<string name="style_mapbox_streets">asset://styles/streets-v8.json</string>
<string name="style_emerald">asset://styles/emerald-v8.json</string>
<string name="style_light">asset://styles/light-v8.json</string>
<string name="style_dark">asset://styles/dark-v8.json</string>
<string name="style_satellite">asset://styles/satellite-v8.json</string>
<string name="style_satellite_streets">asset://styles/satellite-hybrid-v8.json</string>
<string name="style_mapbox_streets">mapbox://styles/mapbox/streets-v8</string>
<string name="style_emerald">mapbox://styles/mapbox/emerald-v8</string>
<string name="style_light">mapbox://styles/mapbox/light-v8</string>
<string name="style_dark">mapbox://styles/mapbox/dark-v8</string>
<string name="style_satellite">mapbox://styles/mapbox/satellite-v8</string>
<string name="style_satellite_streets">mapbox://styles/mapbox/satellite-hybrid-v8</string>
</resources>

View File

@@ -1,35 +0,0 @@
{
'targets': [
{
'target_name': 'touch_styles',
'type': 'none',
'hard_dependency': 1,
'actions': [
{
'action_name': 'Touch Stylesheet Directory',
'inputs': ['../styles'],
'outputs': ['<(SHARED_INTERMEDIATE_DIR)/'], # need to specify a distinct directory
'action': ['touch', '../styles'],
}
],
},
{
'target_name': 'bundle_styles', # use this only for targets that create an App bundle
'type': 'none',
'hard_dependency': 1,
'dependencies': [ 'touch_styles' ], # required for xcode http://openradar.appspot.com/7232149
'direct_dependent_settings': {
'mac_bundle_resources': [ '../styles/styles' ],
}
},
{
'target_name': 'copy_styles', # use this only for targets that don't create an App bundle
'type': 'none',
'hard_dependency': 1,
'dependencies': [ 'touch_styles' ],
'direct_dependent_settings': {
'copies': [{ 'files': [ '../styles/styles' ], 'destination': '<(PRODUCT_DIR)' }],
}
},
]
}

View File

@@ -326,7 +326,7 @@ static NSUInteger const kStyleVersion = 8;
self.styleIndex = (self.styleIndex + 1) % (sizeof(MBXAvailableStyles) / sizeof(MBXAvailableStyles[0]));
self.mapView.styleURL = [NSURL URLWithString:
[NSString stringWithFormat:@"asset://styles/%@-v%lu.json",
[NSString stringWithFormat:@"mapbox://styles/mapbox/%@-v%lu",
MBXAvailableStyles[self.styleIndex].name,
(unsigned long)kStyleVersion]];

View File

@@ -18,7 +18,6 @@
],
'dependencies': [
'../mbgl.gyp:bundle_styles',
'../mbgl.gyp:core',
'../mbgl.gyp:platform-<(platform_lib)',
'../mbgl.gyp:http-<(http_lib)',

View File

@@ -44,7 +44,7 @@
{
[super viewDidLoad];
NSURL* url = [[NSURL alloc] initWithString:@"asset://styles/streets-v8.json"];
NSURL* url = [[NSURL alloc] initWithString:@"mapbox://styles/mapbox/streets-v8.json"];
self.mapView = [[MGLMapView alloc] initWithFrame:self.view.bounds styleURL:url];
self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.mapView.delegate = self;

View File

@@ -12,7 +12,6 @@
'<!@(find ../ios/benchmark/img -type f)',
'assets/glyphs',
'assets/sprites',
'assets/styles',
'assets/tiles',
],

View File

@@ -13,7 +13,6 @@
'../mbgl.gyp:http-<(http_lib)',
'../mbgl.gyp:asset-<(asset_lib)',
'../mbgl.gyp:cache-<(cache_lib)',
'../mbgl.gyp:copy_styles',
'../mbgl.gyp:copy_certificate_bundle',
],

View File

@@ -13,7 +13,6 @@
],
'dependencies': [
'../mbgl.gyp:bundle_styles',
'../mbgl.gyp:core',
'../mbgl.gyp:platform-<(platform_lib)',
'../mbgl.gyp:http-<(http_lib)',

View File

@@ -76,7 +76,6 @@
{
'files': [
'../../common/ca-bundle.crt',
'../../styles/styles'
],
'destination': '<(pwd)/../android/MapboxGLAndroidSDK/src/main/assets'
},

View File

@@ -4,12 +4,12 @@ namespace mbgl {
namespace util {
const std::vector<std::pair<std::string, std::string>> defaultStyles = {
{ "asset://styles/streets-v8.json", "Mapbox Streets" },
{ "asset://styles/emerald-v8.json", "Emerald" },
{ "asset://styles/light-v8.json", "Light" },
{ "asset://styles/dark-v8.json", "Dark" },
{ "asset://styles/satellite-v8.json", "Satellite" },
{ "asset://styles/satellite-hybrid-v8.json", "Satellite Streets" }
{ "mapbox://styles/mapbox/streets-v8", "Mapbox Streets" },
{ "mapbox://styles/mapbox/emerald-v8", "Emerald" },
{ "mapbox://styles/mapbox/light-v8", "Light" },
{ "mapbox://styles/mapbox/dark-v8", "Dark" },
{ "mapbox://styles/mapbox/satellite-v8", "Satellite" },
{ "mapbox://styles/mapbox/satellite-hyrid-v8", "Satellite Streets" },
};
} // end namespace util

View File

@@ -62,7 +62,7 @@ NSString *const MGLAnnotationSpritePrefix = @"com.mapbox.sprites.";
static NSURL *MGLURLForBundledStyleNamed(NSString *styleName)
{
return [NSURL URLWithString:[NSString stringWithFormat:@"asset://styles/%@.json", styleName]];
return [NSURL URLWithString:[NSString stringWithFormat:@"mapbox://styles/mapbox/%@", styleName]];
}
mbgl::util::UnitBezier MGLUnitBezierForMediaTimingFunction(CAMediaTimingFunction *function)
@@ -207,7 +207,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
- (void)commonInit
{
_isTargetingInterfaceBuilder = NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent;
BOOL background = [UIApplication sharedApplication].applicationState == UIApplicationStateBackground;
if (!background)
{
@@ -284,7 +284,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
_attributionButton.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_attributionButton];
_attributionButtonConstraints = [NSMutableArray array];
_attributionSheet = [[UIActionSheet alloc] initWithTitle:@"Mapbox iOS SDK"
delegate:self
cancelButtonTitle:@"Cancel"
@@ -344,7 +344,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
[twoFingerTap requireGestureRecognizerToFail:_pinch];
[twoFingerTap requireGestureRecognizerToFail:_rotate];
[self addGestureRecognizer:twoFingerTap];
_twoFingerDrag = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleTwoFingerDragGesture:)];
_twoFingerDrag.minimumNumberOfTouches = 2;
_twoFingerDrag.maximumNumberOfTouches = 2;
@@ -401,7 +401,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
- (void)createGLView
{
if (_context) return;
// create context
//
_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
@@ -476,7 +476,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
{
[EAGLContext setCurrentContext:nil];
}
[self.logoViewConstraints removeAllObjects];
self.logoViewConstraints = nil;
[self.attributionButtonConstraints removeAllObjects];
@@ -488,7 +488,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
if (_delegate == delegate) return;
_delegate = delegate;
if ([delegate respondsToSelector:@selector(mapView:symbolNameForAnnotation:)])
{
[NSException raise:@"Method unavailable" format:
@@ -743,7 +743,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
{
_mbglMap->update(mbgl::Update::Dimensions);
}
if (self.attributionSheet.visible)
{
[self.attributionSheet dismissWithClickedButtonIndex:self.attributionSheet.cancelButtonIndex animated:YES];
@@ -812,7 +812,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
if (self.isDormant && [UIApplication sharedApplication].applicationState != UIApplicationStateBackground)
{
self.dormant = NO;
[self createGLView];
[MGLMapboxEvents validate];
@@ -966,7 +966,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
if (log2(newScale) < _mbglMap->getMinZoom()) return;
_mbglMap->setScale(newScale, [pinch locationInView:pinch.view].x, [pinch locationInView:pinch.view].y);
[self notifyMapChange:mbgl::MapChangeRegionIsChanging];
}
else if (pinch.state == UIGestureRecognizerStateEnded || pinch.state == UIGestureRecognizerStateCancelled)
@@ -1060,7 +1060,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
_mbglMap->setBearing(newDegrees,
[rotate locationInView:rotate.view].x,
self.bounds.size.height - [rotate locationInView:rotate.view].y);
[self notifyMapChange:mbgl::MapChangeRegionIsChanging];
}
else if (rotate.state == UIGestureRecognizerStateEnded || rotate.state == UIGestureRecognizerStateCancelled)
@@ -1181,7 +1181,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
if (disabledAnnotationIDs.size())
{
// Clear out any nearby annotations that are in our set of
// disabled annotations.
// disabled annotations.
mbgl::util::erase_if(nearbyAnnotations, [&](const uint32_t annotationID) {
return disabledAnnotationIDs.count(annotationID) != 0;
});
@@ -1375,7 +1375,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
if (newZoom < _mbglMap->getMinZoom()) return;
_mbglMap->scaleBy(powf(2, newZoom) / _mbglMap->getScale(), self.bounds.size.width / 2, self.bounds.size.height / 2);
[self notifyMapChange:mbgl::MapChangeRegionIsChanging];
}
else if (quickZoom.state == UIGestureRecognizerStateEnded || quickZoom.state == UIGestureRecognizerStateCancelled)
@@ -1389,9 +1389,9 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
- (void)handleTwoFingerDragGesture:(UIPanGestureRecognizer *)twoFingerDrag
{
if ( ! self.isPitchEnabled) return;
_mbglMap->cancelTransitions();
if (twoFingerDrag.state == UIGestureRecognizerStateBegan)
{
[self trackGestureEvent:MGLEventGesturePitchStart forRecognizer:twoFingerDrag];
@@ -1403,9 +1403,9 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
CGFloat slowdown = 20.0;
CGFloat pitchNew = mbgl::util::clamp(currentPitch - (gestureDistance / slowdown), MGLMinimumPitch, MGLMaximumPitch);
_mbglMap->setPitch(pitchNew);
[self notifyMapChange:mbgl::MapChangeRegionIsChanging];
}
else if (twoFingerDrag.state == UIGestureRecognizerStateEnded || twoFingerDrag.state == UIGestureRecognizerStateCancelled)
@@ -1414,7 +1414,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
[self notifyMapChange:mbgl::MapChangeRegionDidChange];
}
}
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
@@ -1749,9 +1749,9 @@ mbgl::LatLngBounds MGLLatLngBoundsFromCoordinateBounds(MGLCoordinateBounds coord
}
_mbglMap->easeTo(options);
[self didChangeValueForKey:@"visibleCoordinateBounds"];
[self unrotateIfNeededAnimated:duration > 0];
[self notifyMapChange:(duration > 0 ? mbgl::MapChangeRegionDidChangeAnimated : mbgl::MapChangeRegionDidChange)];
}
@@ -1811,7 +1811,7 @@ mbgl::LatLngBounds MGLLatLngBoundsFromCoordinateBounds(MGLCoordinateBounds coord
}
CLLocationCoordinate2D edgeCoordinate = [self convertPoint:edgePoint toCoordinateFromView:self];
mbgl::ProjectedMeters edgeMeters = _mbglMap->projectedMetersForLatLng(MGLLatLngFromLocationCoordinate2D(edgeCoordinate));
// Because we constrain the zoom level vertically in portrait orientation,
// the visible medial span is affected by pitch: the distance from the
// center point to the near edge is less than than distance from the center
@@ -1827,7 +1827,7 @@ mbgl::LatLngBounds MGLLatLngBoundsFromCoordinateBounds(MGLCoordinateBounds coord
CLLocationCoordinate2D nearEdgeCoordinate = [self convertPoint:nearEdgePoint toCoordinateFromView:self];
nearEdgeMeters = _mbglMap->projectedMetersForLatLng(MGLLatLngFromLocationCoordinate2D(nearEdgeCoordinate));
}
// The opposite side is the distance between the center and one edge.
CLLocationCoordinate2D centerCoordinate = self.centerCoordinate;
mbgl::ProjectedMeters centerMeters = _mbglMap->projectedMetersForLatLng(MGLLatLngFromLocationCoordinate2D(centerCoordinate));
@@ -1836,9 +1836,9 @@ mbgl::LatLngBounds MGLLatLngBoundsFromCoordinateBounds(MGLCoordinateBounds coord
CLLocationDistance centerToNearEdge = std::hypot(centerMeters.easting - nearEdgeMeters.easting,
centerMeters.northing - nearEdgeMeters.northing);
CLLocationDistance altitude = (centerToEdge + centerToNearEdge) / 2 / std::tan(MGLAngularFieldOfView / 2.);
CGFloat pitch = _mbglMap->getPitch();
return [MGLMapCamera cameraLookingAtCenterCoordinate:centerCoordinate
fromDistance:altitude
pitch:pitch
@@ -1861,7 +1861,7 @@ mbgl::LatLngBounds MGLLatLngBoundsFromCoordinateBounds(MGLCoordinateBounds coord
mbgl::LatLng centerLatLng = MGLLatLngFromLocationCoordinate2D(camera.centerCoordinate);
mbgl::ProjectedMeters centerMeters = _mbglMap->projectedMetersForLatLng(centerLatLng);
CLLocationDistance centerToEdge = camera.altitude * std::tan(MGLAngularFieldOfView / 2.);
double angle = -1;
if (camera.heading >= 0)
{
@@ -1872,7 +1872,7 @@ mbgl::LatLngBounds MGLLatLngBoundsFromCoordinateBounds(MGLCoordinateBounds coord
{
pitch = MGLRadiansFromDegrees(mbgl::util::clamp(camera.pitch, MGLMinimumPitch, MGLMaximumPitch));
}
// Make a visible bounds that extends in the constrained direction (the
// shorter of the two axes).
CGRect frame = self.frame;
@@ -1899,12 +1899,12 @@ mbgl::LatLngBounds MGLLatLngBoundsFromCoordinateBounds(MGLCoordinateBounds coord
centerMeters.easting + centerToEdge * std::sin(-angle) - centerToEdge * std::sin(-angle) * std::sin(pitch) / 2,
});
}
// Fit the viewport to the bounds. Correct the center in case pitch should
// cause the visual center to lie above the screen center.
mbgl::CameraOptions options = _mbglMap->cameraForLatLngs({ sw, ne }, {});
options.center = centerLatLng;
if (camera.heading >= 0)
{
options.angle = angle;
@@ -2201,7 +2201,7 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng)
{
// store image & symbol name
[self.annotationImages setObject:annotationImage forKey:annotationImage.reuseIdentifier];
[self installAnnotationImage:annotationImage];
}
@@ -2252,14 +2252,14 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng)
CGContextDrawImage(context, CGRectMake(0, 0, width, height), image);
CGContextRelease(context);
CGColorSpaceRelease(colorSpace);
// add sprite
auto cSpriteImage = std::make_shared<mbgl::SpriteImage>(
uint16_t(annotationImage.image.size.width),
uint16_t(annotationImage.image.size.height),
float(annotationImage.image.scale),
std::move(pixels));
// sprite upload
NSString *symbolName = [MGLAnnotationSpritePrefix stringByAppendingString:annotationImage.reuseIdentifier];
_mbglMap->setSprite(symbolName.UTF8String, cSpriteImage);
@@ -2428,10 +2428,10 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng)
[self.selectedAnnotationCalloutView.rightAccessoryView addGestureRecognizer:calloutAccessoryTap];
}
}
// set annotation delegate to handle taps on the callout view
self.selectedAnnotationCalloutView.delegate = self;
// present popup
[self.selectedAnnotationCalloutView presentCalloutFromRect:calloutBounds
inView:self.glView
@@ -2681,7 +2681,7 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng)
{
CLLocation *oldLocation = self.userLocation.location;
CLLocation *newLocation = locations.lastObject;
if ( ! _showsUserLocation || ! newLocation || ! CLLocationCoordinate2DIsValid(newLocation.coordinate)) return;
if (! oldLocation || ! CLLocationCoordinate2DIsValid(oldLocation.coordinate) || [newLocation distanceFromLocation:oldLocation])
@@ -2696,7 +2696,7 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng)
[self.delegate mapView:self didUpdateUserLocation:self.userLocation];
}
}
CLLocationDirection course = self.userLocation.location.course;
if (course < 0 || self.userTrackingMode != MGLUserTrackingModeFollowWithCourse)
{
@@ -2751,7 +2751,7 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng)
}
}
}
self.userLocationAnnotationView.haloLayer.hidden = ! CLLocationCoordinate2DIsValid(self.userLocation.coordinate) ||
newLocation.horizontalAccuracy > 10;

View File

@@ -12,9 +12,6 @@ export MASON_ANDROID_ABI=${ANDROID_ABI}
# Build
################################################################################
mapbox_time "checkout_styles" \
git submodule update --init styles
mkdir -p ./android/MapboxGLAndroidSDKTestApp/src/main/res/raw
echo "${MAPBOX_ACCESS_TOKEN}" > ./android/MapboxGLAndroidSDKTestApp/src/main/res/raw/token.txt

View File

@@ -104,8 +104,6 @@ step "Copying Resources..."
cp -pv LICENSE.md "${OUTPUT}/static"
mkdir -p "${OUTPUT}/static/${NAME}.bundle"
cp -pv platform/ios/resources/* "${OUTPUT}/static/${NAME}.bundle"
mkdir -p "${OUTPUT}/static/${NAME}.bundle/styles"
cp -pv styles/styles/{dark,emerald,light,streets,satellite,satellite-hybrid}-v8.json "${OUTPUT}/static/${NAME}.bundle/styles"
step "Creating API Docs..."
if [ -z `which appledoc` ]; then

View File

@@ -11,9 +11,6 @@ BUILDTYPE=${BUILDTYPE:-Release}
# Build
################################################################################
mapbox_time "checkout_styles" \
git submodule update --init styles
mapbox_time "compile_program" \
make linux -j${JOBS} BUILDTYPE=${BUILDTYPE}

View File

@@ -38,10 +38,6 @@ SUBMODULES += .mason/mason.sh
.mason/mason.sh:
./scripts/flock.py .git/Submodule.lock git submodule update --init .mason
SUBMODULES += styles/styles
styles/styles:
./scripts/flock.py .git/Submodule.lock git submodule update --init styles
SUBMODULES += src/mbgl/util/geojsonvt/geojsonvt.hpp
src/mbgl/util/geojsonvt/geojsonvt.hpp:
./scripts/flock.py .git/Submodule.lock git submodule update --init src/mbgl/util/geojsonvt

View File

@@ -14,9 +14,6 @@ BUILDTYPE=${BUILDTYPE:-Release}
source ~/.nvm/nvm.sh
nvm use $NODE_VERSION
mapbox_time "checkout_styles" \
git submodule update --init styles
mapbox_time "compile_program" \
npm install --build-from-source

View File

@@ -11,9 +11,6 @@ BUILDTYPE=${BUILDTYPE:-Release}
# Build
################################################################################
mapbox_time "checkout_styles" \
git submodule update --init styles
mapbox_time "checkout_geojsonvt" \
git submodule update --init src/mbgl/util/geojsonvt

1
styles

Submodule styles deleted from decac15acd