Classes
The following classes are available globally.
-
A camera position defining a viewpoint for a map.
See moreDeclaration
Objective-C
@interface TGCameraPosition : NSObject <NSCopying>Swift
class TGCameraPosition : NSObject, NSCopying
-
Helper class to contain a polygon geometry for use in
-[TGMarker polygon].The polygon winding order and internal polygons must be set according to the GeoJSON specification.
See moreDeclaration
Objective-C
@interface TGGeoPolygon : NSObjectSwift
class TGGeoPolygon : NSObject
-
Helper class to contain a polyline geometry for use in
-[TGMarker polyline].Set the geometry of a marker to a polyline along the given coordinates; _coordinates is a pointer to a sequence of _count LngLats; markers can have their geometry set multiple times with possibly different geometry types; returns true if the marker ID was found and successfully updated, otherwise returns false.
See moreDeclaration
Objective-C
@interface TGGeoPolyline : NSObjectSwift
class TGGeoPolyline : NSObject
-
Data structure holding the result of a label selection that occured on the map view.
See
See more-[TGMapView pickLabelAt:]and[TGMapViewDelegate mapView:didSelectLabel:atScreenPosition:].Declaration
Objective-C
@interface TGLabelPickResult : NSObjectSwift
class TGLabelPickResult : NSObject
-
A
TGMapDatais a convenience class to display point, polygons or polylines from a dynamic data layer. The data layer will be styled according to the scene file using the provided data layer name.In your stylesheet, add a layer with the name of the data layer you want to add in your client application:
layers: mz_route_line_transit: data: { source: mz_route_line_transit } draw: polylines: color: function() { return feature.color || '#06a6d4'; } order: 500 width: 10pxIn your implementation, to add a polyline fitting under the
mz_route_line_transitlayer:
See more// Create a data layer in the TGMapView mapView var dataLayer = mapView.addDataLayer(name: "mz_Route_line_transit"); var line = TGGeoPolyline() // Add some coordinates to the polyline line.addPoint(point: CLLocationCoordinate2DMake(longitude0, latitude0)) line.addPoint(point: CLLocationCoordinate2DMake(longitude1, latitude1)) // Set the data properties var properties = ["type": "line", "color": "#D2655F"] // Add the line to the data layer dataLayer.add(polyline: line, properties: properties);Declaration
Objective-C
@interface TGMapData : NSObjectSwift
class TGMapData : NSObject
-
TGMapViewis a flexible and customizable map view managing the lifecycle of an OpenGL ES map. This view provides gesture handlers for tap, double-tap, long press, pan, pinch, rotate, and shove gestures.The public interface provides dynamic map marker placement, change of camera view settings, and map description changes through scene updates.
This view uses scene files described by the Tangram scene format allowing you to fully customize your map using your own data. Some pre-made basemap styles can be found here using Nextzen data sources.
To use basemap styles you can sign up for an API key and load it through your application:
let sceneURL = URL("https://www.nextzen.org/carto/bubble-wrap-style/9/bubble-wrap-style.zip"); let sceneUpdates = [ TGSceneUpdate(path: "global.sdk_api_key", value: "YOUR_API_KEY") ]; view.loadScene(from: sceneURL, with: sceneUpdates);See moreNote
All the screen positions used in this inteface are in logical pixel or drawing coordinate system (based on aUIKitcoordinate system), which is independent of the phone pixel density. Refer to the Apple documentation regarding Coordinate Systems and Drawing in iOS for more information.Declaration
Objective-C
@interface TGMapView : UIView <UIGestureRecognizerDelegate>Swift
class TGMapView : UIView, UIGestureRecognizerDelegate
-
Marker interface that makes you able to add icons, polylines and polygons to the map view.
The marker style should defined using the Tangram YAML syntax.
See moreDeclaration
Objective-C
@interface TGMarker : NSObjectSwift
class TGMarker : NSObject
-
Data structure holding the result of a marker selection that occured on the map view.
See
See more-[TGMapView pickMarkerAt:]and[TGMapViewDelegate mapView:didSelectMarker:atScreenPosition:].Declaration
Objective-C
@interface TGMarkerPickResult : NSObjectSwift
class TGMarkerPickResult : NSObject
-
Represents a data structure to specify a YAML path and the corresponding value for a Tangram scene update.
Example to update an API key for a source defined like this in your stylesheet:
sources: osm: type: MVT url: https://tile.mapzen.com/mapzen/vector/v1/all/{z}/{x}/{y}.mvt max_zoom: 16 url_params: api_key: vector-tiles-tyHL4AY
See moreview.queueSceneUpdates(sceneUpdates: [ TGSceneUpdate(path: "sources.osm.url_params", value: "{ api_key: \(YOUR_API_KEY) }") ]) view.applySceneUpdates()Declaration
Objective-C
@interface TGSceneUpdate : NSObjectSwift
class TGSceneUpdate : NSObject
-
A default implementation of the
See moreTGURLHandlerinterface.Declaration
Objective-C
@interface TGDefaultURLHandler : NSObject <TGURLHandler>Swift
class TGDefaultURLHandler : NSObject, TGURLHandler
View on GitHub
Classes Reference
