×
Namespaces

Variants
Actions
Revision as of 15:52, 16 November 2011 by Maveric (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

HERE Maps API - How to check the Date Border Crossing

From Nokia Developer Wiki
Jump to: navigation, search

This article explains how to check the Date Border Crossing.


Introduction

Example code

<html>
<head>
<script type="text/javascript" charset="UTF-8" src="http://api.maps.nokia.com/2.0.0/jsl.js"></script>
</head>
<body>
<div id="map" style="width:100%; height:100%;"></div>
<script type="text/javascript">
 
var map = new nokia.maps.map.Display(document.getElementById("map"),
{ components: [ new nokia.maps.map.component.Behavior()],
{
'zoomLevel': 10,
'center':[-1.366667, 176.466667]
}
);
 
var markerContainer = new nokia.maps.map.Container()
markerContainer.objects.add(
new nokia.maps.map.StandardMarker
(
[-1.366667, 176.466667],
{
text: "-1.366667, 176.466667",
draggable: false
}));
 
markerContainer.objects.add(
new nokia.maps.map.StandardMarker(
[-1.366667, 180.000000],
{
text: "-1.366667, 180.000000",
draggable: false,
}));
 
map.objects.add(markerContainer);
map.zoomTo(markerContainer.getBoundingBox(),false,true);
 
// Check for Date Border Crossing
checkDateBorder();
 
// Add new Marker randomly
markerContainer.objects.add(
new nokia.maps.map.StandardMarker(
[Math.random() * 180 - 90, -176.000],
{ text: "-176.000, 179.000",
draggable: false,
}));
 
map.zoomTo(markerContainer.getBoundingBox(),false,true);
 
// Check for Date Border Crossing
 
checkDateBorder();
 
function checkDateBorder()
{
var CDB = markerContainer.getBoundingBox().isCDB;
if (CDB == false)
{
alert("False - The Bounding box is not crossing the date border");
} else if(CDB == true)
{
alert("True - The Bounding box crosses the date border");
}
}
 
</script>
</body>
</html>


Tested with

FireFox 7.0.1


Add categories below. Remove Category:Draft when the page is complete or near complete

117 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×