Add Region
Instructions
Use the "Add" button to add a predefined region.
See addRegion and
createColorStyle on
JavaScript API for more information.
Source Code
The Javascript code for the above map is:
<script language="Javascript"
src="http://www.locationbox.com.tr/locationbox/services?Key=key&Cmd=APIV2
&Typ=JS"></script>
<script language="JavaScript">
var mapper = new IMapper();
function startup() {
mapper.initMap(41.1, 29.1, 8);
mapper.addNavigationPanel();
return;
}
function add() {
var sym;
sym = new OM.style.Color({styleName:"polygonToolStyle",fillOpacity:0.7,
stroke:"#ff00C0", fill:"#0000FF",strokeThickness:3});
ordinates = [29.0, 41.0, 29.1, 41.1, 29.15, 41.05, 29.05, 41.0];
mapper.addRegion('id_1', ordinates, 'SampleRegion', sym,mclick, 99);
return;
}
function remove() {
mapper.removeFeature('id_1');
return;
}
function mclick() {
alert('Region Click ...');
return;
}
</script>
Buttons:
<a href="javascript:add()"
><img src="images/add.gif" border=0></a>
<a href="javascript:remove()"
><img src="images/remove.gif" border=0></a>
Download working pageRemember that you need to use your key code as Key attribute.