4.0.4 • Published 5 years ago

cordova-plugin-hms-map v4.0.4

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
5 years ago

cordova-plugin-hms-map

Contents

  1. Introduction
  2. Installation Guide
  3. Cordova Example API Method Definition
  4. Configure Description
  5. Licensing and Terms

1. Introduction

This Cordova SDK code encapsulates the Huawei Maps Kit interface. It provides many APIs for your reference or use.

The package is described as follows:

  • src/main/com/huawei/hms/cordova/map: core layer that exposes MapsKit SDK functionality to JS side.
  • www/: Public interfaces for interacting MapsKit SDK through Cordova.

2. Installation Guide

  1. Download the Cordova Map Plugin.

  2. Add platform to project.

cordova platform add android
  1. Run the following command in the root directory of the Cordova project:
cordova plugin add PATH_TO_CORDOVA_ADS_PLUGIN
  1. Check whether the Cordova Map Plugin is successfully added to plugins folder in the root directory of your Cordova project.

  2. Add agconnect-services.json and jks file to root directory. You can see how to create jks file in this link.

  3. Add build.json file to your project's root.

  4. Enable Maps API on AppGallery Connect.

  5. Add keystore file and build.json file to your project's root.

{
    "android": {
        "debug": {
            "keystore": "<keystore>",
            "storePassword": "<password>",
            "alias": "<alias>",
            "password" : "<password>",
        },
        "release": {
            "keystore": "<keystore>",
            "storePassword": "<password>",
            "alias": "<alias>",
            "password" : "<password>",
        }
    }
}

3. Cordova SDK API method definitions

Overview

ModuleDescription
HMSMapThe entrance module.
HuaweiMapA map view object.
MarkerA marker object on a map view.
CircleA circle object on a map view.
GroundOverlayA ground overlay object on a map view.
PolygonA polygon object on a map view.
PolylineA polyline object on a map view.
LatLngBoundsA latitude longitude bounds object.

Constants

Constant Name
HMSMap.PatternItemTypes.TYPE_GAP
HMSMap.PatternItemTypes.TYPE_DOT
HMSMap.PatternItemTypes.TYPE_DASH
HMSMap.JointTypes.ROUND
HMSMap.JointTypes.BEVEL
HMSMap.JointTypes.DEFAULT
HMSMap.CapTypes.TYPE_BUTT_CAP
HMSMap.CapTypes.TYPE_SQUARE_CAP
HMSMap.CapTypes.TYPE_ROUND_CAP
HMSMap.CapTypes.TYPE_CUSTOM_CAP
HMSMap.CameraMoveReasons.REASON_DEVELOPER_ANIMATION
HMSMap.CameraMoveReasons.REASON_API_ANIMATION
HMSMap.CameraMoveReasons.REASON_GESTURE
HMSMap.Color.RED
HMSMap.Color.DKGRAY
HMSMap.Color.GRAY
HMSMap.Color.WHITE
HMSMap.Color.BLUE
HMSMap.Color.BLACK
HMSMap.Color.LTGRAY
HMSMap.Color.MAGENTA
HMSMap.Color.YELLOW
HMSMap.Color.CYAN
HMSMap.Color.GREEN
HMSMap.Color.TRANSPARENT
HMSMap.HUE_GREEN
HMSMap.HUE_AZURE
HMSMap.HUE_ROSE
HMSMap.HUE_CYAN
HMSMap.HUE_ORANGE
HMSMap.HUE_MAGENTA
HMSMap.HUE_VIOLET
HMSMap.HUE_YELLOW
HMSMap.HUE_BLUE
HMSMap.HUE_RED
HMSMap.MAP_TYPE_NONE
HMSMap.MAP_TYPE_SATELLITE
HMSMap.MAP_TYPE_NORMAL
HMSMap.MAP_TYPE_HYBRID
HMSMap.MAP_TYPE_TERRAIN

Data Types

HuaweiMapOptions

Field NameType
mapTypeinteger
zoomControlsEnabledboolean
compassEnabledboolean
zoomGesturesEnabledboolean
scrollGesturesEnabledboolean
rotateGesturesEnabledboolean
zOrderOnTopboolean
liteModeboolean
ambientEnabledboolean
minZoomPreferenceboolean
cameraCameraPosition
latLngBoundsLatLngBounds

LatLng

Field NameTypeDescription
latfloatLatitude
lngfloatLongitude

PatternItem

Field NameType
typeinteger
lengthfloat

Anchor

Field NameType
ufloat
vfloat

Bitmap

Variation 1
Field NameType
huefloat
Variation 2
Field NameType
assetstring
Variation 3
Field NameType
fileNamestring

LatLngBounds

Field NameType
southwestfloat
northeastfloat

Position

Field NameType
xfloat
yfloat

Position

Variation 1
Field NameType
widthfloat
heightfloat
latLngLatLng
Variation 2
Field NameType
widthfloat
latLngLatLng
Variation 3
Field NameType
latLngBoundsLatLng

Cap

Field NameType
typefloat
refWidthfloat
bitmapDescriptiorBitmap

Padding

Variation 1
Field NameType
allinteger
Variation 2
Field NameType
horizontalinteger
verticalinteger
Variation 3
Field NameType
leftinteger
topinteger
rightinteger
bottominteger

CircleOptions

Field NameType
centerLatLng
clickableboolean
radiusdouble
strokeWidthfloat
strokePAtternPatternItem
visibleboolean
zIndexfloat

GroundOverlayOptions

Field NameType
anchorAnchor
bearingdouble
clickableboolean
imageBitmap
visibleboolean
transparencyfloat
positionPosition
zIndexfloat

MarkerOptions

Field NameType
anchorMarkerAnchor
infoWindowAnchorAnchor
alphafloat
clusterableboolean
draggableboolean
iconBitmap
flatboolean
positionLatLng
rotationfloat
snippetstring
titlestring
visibleboolean
zIndexfloat

PolygonOptions

Field NameType
pointsLatLng
holes[LatLng]
clickableboolean
geodesicboolean
strokeColorinteger
strokeJointTypeinteger
strokeWidthfloat
visibleboolean
zIndexfloat

PolylineOptions

Field NameType
pointsLatLng
clickableboolean
endCapCap
startCapCap
geodesicboolean
jointTypeinteger
visibleboolean
zIndexfloat

CameraPosition

Field NameType
zoomfloat
bearingfloat
tiltfloat

CameraUpdate

Field NameType
methodstring

Depending on the method, there may be other required fields.

newCameraPosition
Field NameType
methodstring
zoomfloat
bearingfloat
tiltfloat
newLatLng
Field NameType
methodstring
latfloat
lngfloat
tiltfloat
newLatLngBounds
Field NameType
methodstring
southwestfloat
northeastfloat
newLatLngBounds (Variation 2)
Field NameType
methodstring
southwestfloat
northeastfloat
widthfloat
heightfloat
newCameraPosition
Field NameType
methodstring
zoomfloat
bearingfloat
tiltfloat
newLatLngZoom
Field NameType
methodstring
latfloat
lngfloat
zoomfloat
scrollBy
Field NameType
methodstring
xPixelfloat
yPixelfloat
zoomBy
Field NameType
methodstring
focusfloat
amountfloat
zoomBy
Field NameType
methodstring
zoomTofloat

HMSMap

Public Functions

NameReturn TypeDescription
init()Promise[]Initializes map kit functionality.
create(id: String, initialProps: HuaweiMapOptions)PromiseHuaweiMapCreates a HuaweiMap with given properties.
computeDistanceBetween(from: LatLng, to: LatLng)PromiseDoubleComputes distance between FROM to TO.

HuaweiMap

Public Functions

NameReturn TypeDescription
set(propName: String, value: Object)Promise[]Set given PROPNAME to VALUE.
set(propValueMap: Object)Promise[]Set multiple properties at the same time.
get()PromiseObjectGet all the properties of the HuaweiMap.
get(propName: String)PromiseObjectGet corresponding value of given property.
on(eventName: String, handler: Function)Promise[]Subscribe the given HuaweiMap event.

Marker

Public Functions

NameReturn TypeDescription
set(propName: String, value: Object)Promise[]Set given PROPNAME to VALUE.
set(propValueMap: Object)Promise[]Set multiple properties at the same time.
remove()Promise[]Remove the object from the map view.
showInfoWindow()Promise[]Display the info window of the marker.
hideInfoWindow()Promise[]Hide the info window of the marker.
update()PromiseMarkerOptionsGet the updated properties of the marker.

Circle

Public Functions

NameReturn TypeDescription
set(propName: String, value: Object)Promise[]Set given PROPNAME to VALUE.
set(propValueMap: Object)Promise[]Set multiple properties at the same time.
remove()Promise[]Remove the object from the map view.
update()PromiseCircleOptionsGet the updated properties of the circle.

GroundOverlay

Public Functions

NameReturn TypeDescription
set(propName: String, value: Object)Promise[]Set given PROPNAME to VALUE.
set(propValueMap: Object)Promise[]Set multiple properties at the same time.
remove()Promise[]Remove the object from the map view.
update()PromiseGroundOverlayOptionsGet the updated properties of the ground overlay.

Polygon

Public Functions

NameReturn TypeDescription
set(propName: String, value: Object)Promise[]Set given PROPNAME to VALUE.
set(propValueMap: Object)Promise[]Set multiple properties at the same time.
remove()Promise[]Remove the object from the map view.
update()PromisePolygonOptionsGet the updated properties of the polygon.

Polyline

Public Functions

NameReturn TypeDescription
set(propName: String, value: Object)Promise[]Set given PROPNAME to VALUE.
set(propValueMap: Object)Promise[]Set multiple properties at the same time.
remove()Promise[]Remove the object from the map view.
update()PromisePolygonOptionsGet the updated properties of the polyline.

IndoorLevel

Public Functions

NameReturn TypeDescription
activate()Promise[]Activates.

LatLngBounds

Public Functions

NameReturn TypeDescription
including(latLng: LatLng)PromiseResultWhether LatLngBounds object includes the given LatLng or not.
contains(latLng: LatLng)PromiseResultWhether LatLngBounds object contains the given LatLng or not.

4. Configure Description

No.

5. Licensing and Terms

Apache 2.0 license.

4.0.4

5 years ago