Javascript 如何在不使用新对象的情况下更改nokia.maps.map.StandardMarker的颜色?
我一直在尝试这样的事情: LastMarker是一种nokia.maps.map.StandardMarker ncolor是一个字符串=#0000FFJavascript 如何在不使用新对象的情况下更改nokia.maps.map.StandardMarker的颜色?,javascript,here-api,Javascript,Here Api,我一直在尝试这样的事情: LastMarker是一种nokia.maps.map.StandardMarker ncolor是一个字符串=#0000FF 还有其他事情,我如何在不删除并再次添加到地图的情况下更改颜色?这里需要注意的重要一点是,画笔是-这意味着您不能直接更新参数-您需要使用setter,例如,marker.set(“画笔”,“颜色:{FF0000”)-这之后通常是map.update(-1,0)以刷新地图 下面的示例在鼠标指针悬停在标记上时高亮显示该标记。你需要用你自己的来让它工作
还有其他事情,我如何在不删除并再次添加到地图的情况下更改颜色?这里需要注意的重要一点是,画笔是-这意味着您不能直接更新参数-您需要使用setter,例如,
marker.set(“画笔”,“颜色:{FF0000”)代码>-这之后通常是map.update(-1,0)代码>以刷新地图
下面的示例在鼠标指针悬停在标记上时高亮显示该标记。你需要用你自己的来让它工作
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="X-UA-Compatible" content="IE=7; IE=EmulateIE9" />
<base href="http://www.wrc.com/" />
<title>Highlighing a marker</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script language="javascript" src="http://api.maps.nokia.com/2.2.4/jsl.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<p> Place your pointer over the marker to highlight it.</p>
<div id="gmapcanvas" style="width:600px; height:600px;" > </div><br/><br/>
<script type="text/javascript">
// <![CDATA[
/////////////////////////////////////////////////////////////////////////////////////
// Don't forget to set your API credentials
//
// Replace with your appId and token which you can obtain when you
// register on http://api.developer.nokia.com/
//
nokia.Settings.set( "appId", "YOUR APP ID GOES HERE");
nokia.Settings.set( "authenticationToken", "YOUR AUTHENTICATION TOKEN GOES HERE");
/////////////////////////////////////////////////////////////////////////////////////
map = new nokia.maps.map.Display(document.getElementById('gmapcanvas'), {
'components': [
// Behavior collection
new nokia.maps.map.component.Behavior() ],
'zoomLevel': 5, // Zoom level for the map
'center': [41.0125,28.975833] // Center coordinates
});
// Remove zoom.MouseWheel behavior for better page scrolling experience
map.removeComponent(map.getComponentById("zoom.MouseWheel"));
var normalMarker = new nokia.maps.map.StandardMarker(new nokia.maps.geo.Coordinate(41.0125,28.975833), {brush: {color: "#FF0000"}});
normalMarker.addListener("mouseover" , function(evt) {
normalMarker.set("brush" , { color :"#0000FF"});
map.update(-1,0);
}, false);
normalMarker.addListener("mouseout" , function(evt) {
normalMarker.set("brush" , { color :"#FF0000"});
map.update(-1,0);
}, false);
map.objects.add(normalMarker);
// ]]>
</script>
</body>
</html>
高亮度标记
将指针放在标记上以高亮显示
//
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="X-UA-Compatible" content="IE=7; IE=EmulateIE9" />
<base href="http://www.wrc.com/" />
<title>Highlighing a marker</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script language="javascript" src="http://api.maps.nokia.com/2.2.4/jsl.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<p> Place your pointer over the marker to highlight it.</p>
<div id="gmapcanvas" style="width:600px; height:600px;" > </div><br/><br/>
<script type="text/javascript">
// <![CDATA[
/////////////////////////////////////////////////////////////////////////////////////
// Don't forget to set your API credentials
//
// Replace with your appId and token which you can obtain when you
// register on http://api.developer.nokia.com/
//
nokia.Settings.set( "appId", "YOUR APP ID GOES HERE");
nokia.Settings.set( "authenticationToken", "YOUR AUTHENTICATION TOKEN GOES HERE");
/////////////////////////////////////////////////////////////////////////////////////
map = new nokia.maps.map.Display(document.getElementById('gmapcanvas'), {
'components': [
// Behavior collection
new nokia.maps.map.component.Behavior() ],
'zoomLevel': 5, // Zoom level for the map
'center': [41.0125,28.975833] // Center coordinates
});
// Remove zoom.MouseWheel behavior for better page scrolling experience
map.removeComponent(map.getComponentById("zoom.MouseWheel"));
var normalMarker = new nokia.maps.map.StandardMarker(new nokia.maps.geo.Coordinate(41.0125,28.975833), {brush: {color: "#FF0000"}});
normalMarker.addListener("mouseover" , function(evt) {
normalMarker.set("brush" , { color :"#0000FF"});
map.update(-1,0);
}, false);
normalMarker.addListener("mouseout" , function(evt) {
normalMarker.set("brush" , { color :"#FF0000"});
map.update(-1,0);
}, false);
map.objects.add(normalMarker);
// ]]>
</script>
</body>
</html>