Skip to content

Commit

Permalink
add testmap for iOS ,because if the differnt between two platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
胡翔喻 committed Jun 1, 2016
1 parent 2bbb32b commit 1e69382
Show file tree
Hide file tree
Showing 47 changed files with 3,354 additions and 4 deletions.
2 changes: 1 addition & 1 deletion MapExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ var MapExample = React.createClass({
onUserLocationChange={this.onUserLocationChange}
onLongPress={this.onLongPress}
logoIsHidden={true}
attributionButtonIsHidden={true}
attributionButtonIsHidden={false}
onOpenAnnotation={this.onOpenAnnotation}
/>

Expand Down
2 changes: 1 addition & 1 deletion index.ios.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from 'react';
import {AppRegistry} from 'react-native';
var test = require('./TheCam');
var test = require('./testmap');
AppRegistry.registerComponent('test', () => test);
Binary file added ios/Mapbox.framework/Compass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ios/Mapbox.framework/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ios/Mapbox.framework/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions ios/Mapbox.framework/Headers/MGLAccountManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#import <Foundation/Foundation.h>

#import "MGLTypes.h"

NS_ASSUME_NONNULL_BEGIN

/**
The MGLAccountManager object provides a global way to set a Mapbox API access
token, as well as other settings used framework-wide.
*/
@interface MGLAccountManager : NSObject

#pragma mark Authorizing Access

/**
Set the [Mapbox access token](https://www.mapbox.com/help/define-access-token/)
to be used by all instances of MGLMapView in the current application.
Mapbox-hosted vector tiles and styles require an API access token, which you
can obtain from the
[Mapbox account page](https://www.mapbox.com/studio/account/tokens/). Access
tokens associate requests to Mapbox’s vector tile and style APIs with your
Mapbox account. They also deter other developers from using your styles without
your permission.
@param accessToken A Mapbox access token. Calling this method with a value of
`nil` has no effect.
@note You must set the access token before attempting to load any Mapbox-hosted
style. Therefore, you should generally set it before creating an instance of
MGLMapView. The recommended way to set an access token is to add an entry to
your application’s Info.plist file with the key `MGLMapboxAccessToken` and
the type String. Alternatively, you may call this method from your
application delegate’s `-applicationDidFinishLaunching:` method.
*/
+ (void)setAccessToken:(nullable NSString *)accessToken;

/**
Returns the
[Mapbox access token](https://www.mapbox.com/help/define-access-token/) in use
by instances of MGLMapView in the current application.
*/
+ (nullable NSString *)accessToken;

+ (BOOL)mapboxMetricsEnabledSettingShownInApp __attribute__((deprecated("Telemetry settings are now always shown in the ℹ️ menu.")));

@end

NS_ASSUME_NONNULL_END
48 changes: 48 additions & 0 deletions ios/Mapbox.framework/Headers/MGLAnnotation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import <TargetConditionals.h>

#import "MGLTypes.h"

NS_ASSUME_NONNULL_BEGIN

/**
The `MGLAnnotation` protocol is used to provide annotation-related information to a map view. To use this protocol, you adopt it in any custom objects that store or represent annotation data. Each object then serves as the source of information about a single map annotation and provides critical information, such as the annotation’s location on the map. Annotation objects do not provide the visual representation of the annotation but typically coordinate (in conjunction with the map view’s delegate) the creation of an appropriate objects to handle the display.
An object that adopts this protocol must implement the `coordinate` property. The other methods of this protocol are optional.
*/
@protocol MGLAnnotation <NSObject>

#pragma mark Position Attributes

/** The center point (specified as a map coordinate) of the annotation. (required) (read-only) */
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;

@optional

#pragma mark Title Attributes

/**
The string containing the annotation’s title.
Although this property is optional, if you support the selection of annotations in your map view, you are expected to provide this property. This string is displayed in the callout for the associated annotation.
*/
@property (nonatomic, readonly, copy, nullable) NSString *title;

/**
The string containing the annotation’s subtitle.
This string is displayed in the callout for the associated annotation.
*/
@property (nonatomic, readonly, copy, nullable) NSString *subtitle;

#if !TARGET_OS_IPHONE

/** The string containing the annotation’s tooltip. */
@property (nonatomic, readonly, copy, nullable) NSString *toolTip;

#endif

@end

NS_ASSUME_NONNULL_END
44 changes: 44 additions & 0 deletions ios/Mapbox.framework/Headers/MGLAnnotationImage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#import <UIKit/UIKit.h>

#import "MGLTypes.h"

NS_ASSUME_NONNULL_BEGIN

/** The MGLAnnotationImage class is responsible for presenting point-based annotations visually on a map view. Annotation image objects wrap `UIImage` objects and may be recycled later and put into a reuse queue that is maintained by the map view. */
@interface MGLAnnotationImage : NSObject

#pragma mark Initializing and Preparing the Image Object

/**
Initializes and returns a new annotation image object.
@param image The image to be displayed for the annotation.
@param reuseIdentifier The string that identifies that this annotation image is reusable.
@return The initialized annotation image object or `nil` if there was a problem initializing the object.
*/
+ (instancetype)annotationImageWithImage:(UIImage *)image reuseIdentifier:(NSString *)reuseIdentifier;

#pragma mark Getting and Setting Attributes

/** The image to be displayed for the annotation. */
@property (nonatomic, strong) UIImage *image;

/**
The string that identifies that this annotation image is reusable. (read-only)
You specify the reuse identifier when you create the image object. You use this type later to retrieve an annotation image object that was created previously but which is currently unused because its annotation is not on screen.
If you define distinctly different types of annotations (with distinctly different annotation images to go with them), you can differentiate between the annotation types by specifying different reuse identifiers for each one.
*/
@property (nonatomic, readonly) NSString *reuseIdentifier;

/**
A Boolean value indicating whether the annotation is enabled.
The default value of this property is `YES`. If the value of this property is `NO`, the annotation image ignores touch events and cannot be selected.
*/
@property (nonatomic, getter=isEnabled) BOOL enabled;

@end

NS_ASSUME_NONNULL_END
67 changes: 67 additions & 0 deletions ios/Mapbox.framework/Headers/MGLCalloutView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#import <Foundation/Foundation.h>

#import "MGLTypes.h"

NS_ASSUME_NONNULL_BEGIN

@protocol MGLCalloutViewDelegate;
@protocol MGLAnnotation;

/**
A protocol for a `UIView` subclass that displays information about a selected annotation near that annotation.
*/
@protocol MGLCalloutView <NSObject>

/**
An object conforming to the `MGLAnnotation` protocol whose details this callout view displays.
*/
@property (nonatomic, strong) id <MGLAnnotation> representedObject;

/**
A view that the user may tap to perform an action. This view is conventionally positioned on the left side of the callout view.
*/
@property (nonatomic, strong) UIView *leftAccessoryView;

/**
A view that the user may tap to perform an action. This view is conventionally positioned on the right side of the callout view.
*/
@property (nonatomic, strong) UIView *rightAccessoryView;

/**
An object conforming to the `MGLCalloutViewDelegate` method that receives messages related to the callout view’s interactive subviews.
*/
@property (nonatomic, weak) id<MGLCalloutViewDelegate> delegate;

/**
Presents a callout view by adding it to `inView` and pointing at the given rect of `inView`’s bounds. Constrains the callout to the bounds of the given view.
*/
- (void)presentCalloutFromRect:(CGRect)rect inView:(UIView *)view constrainedToView:(UIView *)constrainedView animated:(BOOL)animated;

/**
Dismisses the callout view.
*/
- (void)dismissCalloutAnimated:(BOOL)animated;

@end

/**
The MGLCalloutViewDelegate protocol defines a set of optional methods that you can use to receive messages from an object that conforms to the MGLCalloutView protocol. The callout view uses these methods to inform the delegate that the user has interacted with the the callout view.
*/
@protocol MGLCalloutViewDelegate <NSObject>

@optional
/**
Returns a Boolean value indicating whether the entire callout view “highlights” when tapped. The default value is `YES`, which means the callout view highlights when tapped.
The return value of this method is ignored unless the delegate also responds to the `-calloutViewTapped` method.
*/
- (BOOL)calloutViewShouldHighlight:(UIView<MGLCalloutView> *)calloutView;

/**
Tells the delegate that the callout view has been tapped.
*/
- (void)calloutViewTapped:(UIView<MGLCalloutView> *)calloutView;

@end

NS_ASSUME_NONNULL_END
98 changes: 98 additions & 0 deletions ios/Mapbox.framework/Headers/MGLGeometry.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import <CoreGraphics/CGBase.h>

#import "MGLTypes.h"

NS_ASSUME_NONNULL_BEGIN

/** Defines the area spanned by an `MGLCoordinateBounds`. */
typedef struct MGLCoordinateSpan {
/** Latitudes spanned by an `MGLCoordinateBounds`. */
CLLocationDegrees latitudeDelta;
/** Longitudes spanned by an `MGLCoordinateBounds`. */
CLLocationDegrees longitudeDelta;
} MGLCoordinateSpan;

/** Creates a new `MGLCoordinateSpan` from the given latitudinal and longitudinal deltas. */
NS_INLINE MGLCoordinateSpan MGLCoordinateSpanMake(CLLocationDegrees latitudeDelta, CLLocationDegrees longitudeDelta) {
MGLCoordinateSpan span;
span.latitudeDelta = latitudeDelta;
span.longitudeDelta = longitudeDelta;
return span;
}

/** Returns `YES` if the two coordinate spans represent the same latitudinal change and the same longitudinal change. */
NS_INLINE BOOL MGLCoordinateSpanEqualToCoordinateSpan(MGLCoordinateSpan span1, MGLCoordinateSpan span2) {
return (span1.latitudeDelta == span2.latitudeDelta &&
span1.longitudeDelta == span2.longitudeDelta);
}

/** An area of zero width and zero height. */
extern const MGLCoordinateSpan MGLCoordinateSpanZero;

/** A rectangular area as measured on a two-dimensional map projection. */
typedef struct MGLCoordinateBounds {
/** Coordinate at the southwest corner. */
CLLocationCoordinate2D sw;
/** Coordinate at the northeast corner. */
CLLocationCoordinate2D ne;
} MGLCoordinateBounds;

/** Creates a new `MGLCoordinateBounds` structure from the given southwest and northeast coordinates. */
NS_INLINE MGLCoordinateBounds MGLCoordinateBoundsMake(CLLocationCoordinate2D sw, CLLocationCoordinate2D ne) {
MGLCoordinateBounds bounds;
bounds.sw = sw;
bounds.ne = ne;
return bounds;
}

/** Returns `YES` if the two coordinate bounds are equal to each other. */
NS_INLINE BOOL MGLCoordinateBoundsEqualToCoordinateBounds(MGLCoordinateBounds bounds1, MGLCoordinateBounds bounds2) {
return (bounds1.sw.latitude == bounds2.sw.latitude &&
bounds1.sw.longitude == bounds2.sw.longitude &&
bounds1.ne.latitude == bounds2.ne.latitude &&
bounds1.ne.longitude == bounds2.ne.longitude);
}

/** Returns the area spanned by the coordinate bounds. */
NS_INLINE MGLCoordinateSpan MGLCoordinateBoundsGetCoordinateSpan(MGLCoordinateBounds bounds) {
return MGLCoordinateSpanMake(bounds.ne.latitude - bounds.sw.latitude,
bounds.ne.longitude - bounds.sw.longitude);
}

/** Returns a coordinate bounds with southwest and northeast coordinates that are offset from those of the source bounds. */
NS_INLINE MGLCoordinateBounds MGLCoordinateBoundsOffset(MGLCoordinateBounds bounds, MGLCoordinateSpan offset) {
MGLCoordinateBounds offsetBounds = bounds;
offsetBounds.sw.latitude += offset.latitudeDelta;
offsetBounds.sw.longitude += offset.longitudeDelta;
offsetBounds.ne.latitude += offset.latitudeDelta;
offsetBounds.ne.longitude += offset.longitudeDelta;
return offsetBounds;
}

/** Returns `YES` if the coordinate bounds covers no area.
Note that a bounds may be empty but have a non-zero coordinate span (e.g., when its northeast point lies due north of its southwest point). */
NS_INLINE BOOL MGLCoordinateBoundsIsEmpty(MGLCoordinateBounds bounds) {
MGLCoordinateSpan span = MGLCoordinateBoundsGetCoordinateSpan(bounds);
return span.latitudeDelta == 0 || span.longitudeDelta == 0;
}

/** Returns a formatted string for the given coordinate bounds. */
NS_INLINE NSString *MGLStringFromCoordinateBounds(MGLCoordinateBounds bounds) {
return [NSString stringWithFormat:@"{ sw = {%.1f, %.1f}, ne = {%.1f, %.1f}}",
bounds.sw.latitude, bounds.sw.longitude,
bounds.ne.latitude, bounds.ne.longitude];
}

/** Returns radians, converted from degrees. */
NS_INLINE CGFloat MGLRadiansFromDegrees(CLLocationDegrees degrees) {
return (CGFloat)(degrees * M_PI) / 180;
}

/** Returns degrees, converted from radians. */
NS_INLINE CLLocationDegrees MGLDegreesFromRadians(CGFloat radians) {
return radians * 180 / M_PI;
}

NS_ASSUME_NONNULL_END
53 changes: 53 additions & 0 deletions ios/Mapbox.framework/Headers/MGLMapCamera.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <CoreLocation/CoreLocation.h>

#import "MGLTypes.h"

NS_ASSUME_NONNULL_BEGIN

/** An `MGLMapCamera` object represents a viewpoint from which the user observes some point on an `MGLMapView`. */
@interface MGLMapCamera : NSObject <NSSecureCoding, NSCopying>

/** Coordinate at the center of the map view. */
@property (nonatomic) CLLocationCoordinate2D centerCoordinate;

/** Heading measured in degrees clockwise from true north. */
@property (nonatomic) CLLocationDirection heading;

/** Pitch toward the horizon measured in degrees, with 0 degrees resulting in a two-dimensional map. */
@property (nonatomic) CGFloat pitch;

/** Meters above ground level. */
@property (nonatomic) CLLocationDistance altitude;

/** Returns a new camera with all properties set to 0. */
+ (instancetype)camera;

/**
Returns a new camera using based on information about the camera’s viewpoint and focus point.
@param centerCoordinate The geographic coordinate on which the map should be centered.
@param eyeCoordinate The geometric coordinate at which the camera should be situated.
@param eyeAltitude The altitude (measured in meters) above the map at which the camera should be situated. The altitude may be less than the distance from the camera’s viewpoint to the camera’s focus point.
*/
+ (instancetype)cameraLookingAtCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate
fromEyeCoordinate:(CLLocationCoordinate2D)eyeCoordinate
eyeAltitude:(CLLocationDistance)eyeAltitude;

/**
Returns a new camera with the given distance, pitch, and heading.
@param centerCoordinate The geographic coordinate on which the map should be centered.
@param distance The straight-line distance from the viewpoint to the `centerCoordinate`.
@param pitch The viewing angle of the camera, measured in degrees. A value of `0` results in a camera pointed straight down at the map. Angles greater than `0` result in a camera angled toward the horizon.
@param heading The camera’s heading, measured in degrees clockwise from true north. A value of `0` means that the top edge of the map view corresponds to true north. The value `90` means the top of the map is pointing due east. The value `180` means the top of the map points due south, and so on.
*/
+ (instancetype)cameraLookingAtCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate
fromDistance:(CLLocationDistance)distance
pitch:(CGFloat)pitch
heading:(CLLocationDirection)heading;

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit 1e69382

Please sign in to comment.