new Map(options)
The raw and Basic implementation of Navionics Maps Engines
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Array.<Object> |
the Configuration of Map
|
Fires:
- JNC.Views.Map#map:click
- JNC.Views.Map#map:pointermove
- JNC.Views.Map#map:mousePosition
- JNC.Views.Map#map:zoomchange
- JNC.Views.Map#map:centerchange
Example
var webapi = new JNC.Views.Map({
tagId: '.test_map_div',
center: [ 12.0, 46.0 ]
});
Methods
-
showDepthUnitControl(value)
-
Enable or disable depth unit switcher control over the map
Name Type Default Description value
boolean true optional visible/invisible
-
addPostponedFunctions(func)
-
This method allow to enqueue functions in to internal Queue. All of this function will be executed only once the component is ready
Name Type Description func
function optional the function to be called
-
centerLayer(layer)
-
Fit the viewport on selected layer
Name Type Description layer
ol.layer.Layer the layer
-
flyToPosition(position)
-
Move the map view to the defined coordinates.
Name Type Description position
OpenLayer.Coordinate Coordinate where the map view should be moved.
-
getBoundsArea(precision){array}
-
Get Lantidute and Longitude of actual bound area
Name Type Description precision
int precision of lat lng
Returns:
points
-
getCoordinateFromPixel(){float}
-
Get The Coordinate From Pixel
Returns:
- The coordinate in Map Projection
-
getDistanceUnit(){JNC.DISTANCE_UNIT}
-
Get the distance unit of chart
-
getExtentFromCoordinate(coordinate, delta){array}
-
Get the Extent From Coordinate
Name Type Description coordinate
array the point
delta
number the distance from the point
Returns:
extent
-
getLayers(){ol.Collection.<ol.layer.Base>}
-
Get the native OpenLayer3 Layers
- Deprecated
- Yes
Returns:
Layers of Map
-
getProjection(){ol.Projection}
-
Get the current Pojection Of MAP
Returns:
openlayer3 projection
-
getRowMap(){ol.Map}
-
Get the native OpenLayer3 Map
- Deprecated
- Yes
Returns:
Openlayer 3 Map
-
getRowView(){ol.View}
-
Get the native openlayer 3 view associated with this map. A view manages properties such as center and resolution.
- Deprecated
- Yes
Returns:
View of Map
-
getViewportHeight(){float}
-
Get The Height of Viewport
Returns:
height in pixel
-
getViewportWidth(){float}
-
Get The Width of Viewport
Returns:
width in pixel
-
getZoom(zoom)
-
Get the current zoom level
Name Type Description zoom
float the current zoom level
-
goToCoord(longitude, latitude, zoom)
-
Set the center of map at specific latitude longitude with specific zoom else Navionics position
Name Type Default Description longitude
float the Longitude
latitude
float the Latitude
zoom
float 6.0 optional zoom the Zoom
-
hideBalloons()
-
Close all opened balloons.
-
hideBalloonsFiltered()
-
Close all balloons filtered by id using filter function.
returns list of skipped balloon's -
loadKml(kmlUrl, fitKmlOnView){ol.layer.Vector}
-
Load one KML on Map
Name Type Default Description kmlUrl
string the url of kml
fitKmlOnView
boolean true optional fit the content of kml in to the view
Returns:
layer
-
lookupAddress(address)
-
Get the address and center the map on it
Name Type Description address
string The address
-
moveToPosition(position)
-
Move the map view to the defined coordinates.
Name Type Description position
OpenLayer.Coordinate Coordinate where the map view should be moved.
-
setDistanceUnit(unit)
-
Set the distance unit of chart
Name Type Description unit
JNC.DISTANCE_UNIT the Unit to use
Example
-
setSafeCenter(longitude, latitude, defaultLongitude, defaultLatitude)
-
Set the center of map in according of longitude e latitude. If error occurs use defaultLongitude and defaultLatitude
Name Type Default Description longitude
float The longitude
latitude
float The latitude
defaultLongitude
float 10.294393 optional The longitude used if the point it's no good (the Navionics headquarter longitude)
defaultLatitude
float 43.879246 optional The latitude used if the point it's no good (the Navionics headquarter latitude)
-
setZoom(zoom)
-
Set the zoom level
Name Type Description zoom
float from 0.0 to 100.0 in according of current layer
-
show()
-
Show the map on page
-
showBalloon(options, closeBalloons, centralize, fastCentralize)
-
Shows information balloon on the map.
Name Type Default Description options
object optional Balloon options
Name Type Description title
string optional The title to display.
description
string optional The description to display.
coordinates
ol.Coordinate optional Coordinate where balloon should be displayed
offset
Array.<Number> optional Offset for balloon
closeBalloons
boolean true optional Close all other opened balloon
centralize
boolean true optional Fly to the Balloon
fastCentralize
boolean optional Move to the Balloon
-
showDistanceUnitControl(value)
-
Show the distance unit switcher control over the map
Name Type Default Description value
boolean true optional visible/invisible
-
showScaleLineControl(value)
-
Show the scale line control over the map
Name Type Description value
boolean -
showZoomControl(value)
-
Show the zoom control over the map
Name Type Default Description value
boolean true optional visible/invisible
-
zoomByDelta(step)
-
Execute a Zoom with a specific delta
Name Type Default Description step
integer 1 optional the step to zoom from -100 to 100 in according of current layer
-
zoomIn()
-
Execute a Zoom In with step equal 1
- See:
-
- zoomByDelta
-
zoomOut()
-
Execute a zoom Out with step equal -1
- See:
-
- zoomByDelta
Events
-
event:initTrackKML
-
Event is triggered when selected track has KML URL data
-
KmlBalloonOpen
-
The event is fired for trace in GoogleAnalytics when kml balloon open.
Properties:
Name Type Description value
String zoom direction 'zoom-in'\'zoom-out'
-
KmlLoaded
-
The event is fired for trace in GoogleAnalytics when default Kml loaded.
Properties:
Name Type Description kmlUrl
String KML url
-
MapLoaded
-
The event is fired for trace in GoogleAnalytics when default map loaded.
Properties:
Name Type Description navKey
String Map's navKey
-
NavionicsAcknowledgementsClicked
-
The event is fired for trace in GoogleAnalytics when Navionics acknowledgements clicked.
-
NavionicsDistanceUnitClicked
-
The event is fired for trace in GoogleAnalytics when Navionics Distance Ruler clicked.
-
NavionicsLogoClicked
-
The event is fired for trace in GoogleAnalytics when Navionics logo clicked.
-
event:resetTrackLML
-
Event is triggered when opened track need to be hidden
-
event:showText
-
Event is triggered to show notification text
-
ZoomControl
-
The event is fired for trace in GoogleAnalytics when zoom controls used.
Properties:
Name Type Description status
String zoom direction zoom-in\zoom-out
-
map:centerchange
-
Event is triggered by changing center of the map
-
map:click
-
Event is triggered by map click
-
map:mousePosition
-
Event is triggered by position of mouse on the map
-
map:pointermove
-
Event is triggered by moving of pointer on the map
-
map:pointermove
-
Event is triggered by moving of pointer on the map
-
map:resize
-
Event is triggered by resize
-
map:zoomchange
-
Event is triggered by map zoom