Skip to main content

method

calcPosition(camera:geometry:screenArea:tilt:bearing:size:)

public func calcPosition(
camera: BaseCamera,
geometry: Geometry,
screenArea: Padding? = nil,
tilt: Tilt? = nil,
bearing: Bearing? = nil,
size: ScreenSize? = nil
) -> CameraPosition

Calculating the camera position such that the geometric object located on the map completely fits into the screen area specified by the screen_area parameter.

If you do not need to change the settings of the original camera, you can configure the camera copied through IBaseCamera::clone().

Parameters

camera

Camera used to calculate the position.

geometry

Geometric object to fit into the screen area specified by the screen_area parameter.

screenArea

Screen area to embed geometry. If not set, camera padding is used for calculation.

tilt

Tilt

bearing

Bearing

size

The size of the viewing area. If not specified, the ICamera::size() value is used.

Returns

calcPosition(camera:objects:screenArea:tilt:bearing:size:)

public func calcPosition(
camera: BaseCamera,
objects: [SimpleMapObject],
screenArea: Padding? = nil,
tilt: Tilt? = nil,
bearing: Bearing? = nil,
size: ScreenSize? = nil
) -> CameraPosition

Calculating the camera position such that the map objects are completely embedded in the screen area defined by the screen_area parameter.

Parameters

camera

Camera used to calculate the position.

objects

Map objects to be embedded in the screen area specified by the screen_area parameter.

screenArea

Screen area to embed geometry. If not set, camera padding is used for calculation.

tilt

Tilt

bearing

Bearing

size

The size of the viewing area. If not specified, the ICamera::size() value is used.

Returns

createRasterTileDataSource(context:sublayerName:urlTemplate:)

public func createRasterTileDataSource(
context: Context,
sublayerName: String,
urlTemplate: String
) -> Source

Create a source that receives raster tiles.

Parameters

context

Context.

sublayerName

Name to be used when generating objects. This name must be specified in the styles in the filter condition of a raster layer for the db_sublayer attribute. Example: [“match”, [“get”, “db_sublayer”], [“NAME”], true, false]. For details, see the specification: https://docs.2gis.com/ru/mapgl/stylespecification

urlTemplate

The url template for the tile request, must contain substring {x}, {y} and {z}, which when substituted with numeric values form a valid URL to which a request for tile data will be sent.

Returns

createRawMyLocationController()

public func createRawMyLocationController() -> MyLocationController

Uses platform data. The coordinates and orientation of the geopositioning marker change instantly when the data is received.

createSmoothMyLocationController()

public func createSmoothMyLocationController() -> MyLocationController

Uses map data. The coordinates and orientation of the geopositioning marker change smoothly. When using the tracking mode, marker changes are synchronized with camera position changes.

createStyleZoomToTiltRelation(points:)

public func createStyleZoomToTiltRelation(
points: [StyleZoom: Tilt]
) -> StyleZoomToTiltRelation

Create a dependence of the camera tilt angle on the style zoom level.

Returns
StyleZoomToTiltRelation

Dependence of the camera tilt angle on the style zoom level, if the dependence could not be created - throw an exception.

getHttpCacheManager(context:)

public func getHttpCacheManager(
context: Context
) -> HttpCacheManager?

HTTP cache management interface. Null if HTTP cache is not used.

Parameters

getInstructionManeuver(extraInstructionInfo:)

public func getInstructionManeuver(
extraInstructionInfo: ExtraInstructionInfo
) -> InstructionManeuver

Get the maneuver required to move along the route.

Parameters

extraInstructionInfo

Returns

getLanesControlImages(laneSign:maxCount:ignoreActiveManeuver:)

public func getLanesControlImages(
laneSign: RouteLaneSign,
maxCount: UInt32,
ignoreActiveManeuver: Bool
) -> [LanesControlImage]

Get the list of images to be displayed in the lane control. The number of images (not including separators and dots) is limited to maxCount; if this is exceeded, the images on one or both sides are cropped so that as many active maneuver images as possible remain. On the side where the deletion occurred, a ellipsis is displayed. If ignoreActiveManeuver is true, the active maneuver is ignored and the image corresponding to all allowed directions of movement is returned.

Parameters

laneSign

maxCount

ignoreActiveManeuver

Returns

getLocaleManager(context:)

public func getLocaleManager(
context: Context
) -> LocaleManager

Interface to manage application locales.

Parameters

context

Returns

getPackageManager(context:)

public func getPackageManager(
context: Context
) -> PackageManager

Get an object to work with packages from the context.

Parameters

context

Returns

getRoadMacroGraph(context:)

public func getRoadMacroGraph(
context: Context
) -> RoadMacroGraph

Obtaining an object to control the global road graph from the context.

Parameters

context

Returns

getSystemMemoryManager(context:)

public func getSystemMemoryManager(
context: Context
) -> SystemMemoryManager

Getting an object to manage the use of system memory.

Parameters

getTerritoriesAlongRouteProvider(context:)

public func getTerritoriesAlongRouteProvider(
context: Context
) -> TerritoriesAlongRouteProvider

Getting an object to get a list of territories along the route from the context.

Parameters

getTerritoryManager(context:)

public func getTerritoryManager(
context: Context
) -> TerritoryManager

Getting an object to work with territories from the context.

Parameters

getVoiceManager(context:)

public func getVoiceManager(
context: Context
) -> VoiceManager

Getting an object to manage voices from the context.

Parameters

context

Returns

parseGeoJson(geoJsonData:)

public func parseGeoJson(
geoJsonData: String
) -> [GeometryMapObject]
Parameters

geoJsonData

Returns

parseGeoJsonFile(fsPath:)

public func parseGeoJsonFile(
fsPath: String
) -> [GeometryMapObject]
Parameters

projectionZToStyleZ(projectionZ:latitude:)

public func projectionZToStyleZ(
projectionZ: Zoom,
latitude: Latitude
) -> StyleZoom
Parameters

projectionZ

latitude

Returns

remainingRouteGeometry(fullRouteGeometry:currentRoutePoint:)

public func remainingRouteGeometry(
fullRouteGeometry: GeoPointRouteAttribute,
currentRoutePoint: RoutePoint
) -> GeoPointRouteAttribute

Calculates the geometry of the rest of the route, i.e. the geometry starting from the point corresponding to the current route point to the end of the route. If the route is completely passed or if the current point is outside the route, an empty geometry is returned.

Parameters

fullRouteGeometry

Full geometry of the entire route.

currentRoutePoint

Current position on the route.

Returns
GeoPointRouteAttribute

Geometry of the rest of the route.

routeMatchesTruckPassZonePasses(truckPassZoneIds:passZonePasses:)

public func routeMatchesTruckPassZonePasses(
truckPassZoneIds: TruckPassZoneIdRouteLongAttribute,
passZonePasses: [TruckPassZonePass]
) -> Bool

Checks whether the list of passes provided is sufficient to enter the truck pass zones through which the route passes.

Parameters

truckPassZoneIds

Route attribute with truck pass zone identifiers.

passZonePasses

Passes for passing through truck pass zones.

Returns
Bool

Signifies whether there are enough passes to pass a route.

styleZToProjectionZ(styleZ:latitude:)

public func styleZToProjectionZ(
styleZ: StyleZoom,
latitude: Latitude
) -> Zoom
Parameters

styleZ

latitude

Returns

toMapGeometry(geometry:)

public func toMapGeometry(
geometry: GeoPointRouteAttribute
) -> Geometry

Convert route geometry to IGeometryPtr.

Parameters

zoomOutToFit(camera:geometry:size:)

public func zoomOutToFit(
camera: BaseCamera,
geometry: Geometry,
size: ScreenSize? = nil
) -> CameraPosition

Calculating the camera position, such that with the camera installation point unchanged, the geometric object on the map fits into the screen area specified by the camera padding.

If you do not need to change the original camera settings, you can configure the camera copied through IBaseCamera::clone().

Parameters

camera

Camera used to calculate the position.

geometry

Geometric object to fit into the screen area specified by the camera's padding.

size

Size of the viewing area. If not specified, the ICamera::size() value is used.

Returns

zoomOutToFit(camera:objects:size:)

public func zoomOutToFit(
camera: BaseCamera,
objects: [SimpleMapObject],
size: ScreenSize? = nil
) -> CameraPosition

Calculating the camera position, so that with a constant camera position, the geometric object on the map fits into the screen area defined by the camera padding.

Parameters

camera

Camera used to calculate the position.

objects

Map objects to fit into the screen area specified by the camera padding.

size

Size of the viewing area. If not specified, the ICamera::size() value is used.

Returns