2014-09-26 2 views
0

svg 요소를 Microsoft.Maps.Pushpin의 아이콘으로 사용하는 방법이 있습니까? 당신이 값으로 htmlContent 속성을 지정할 수있는 옵션 (PushpinOptions)를 설정하는 것이 가능하다 Microsoft.Maps.Pushpin에bingmap 압핀 아이콘으로 svg 요소 사용

var fillcolor = "#ff0222"; 
var svg1 = document.createElementNS("http://www.w3.org/2000/svg", "svg"); 
svg1.setAttribute("height",50); 
svg1.setAttribute("width",50); 

var circles = document.createElementNS("http://www.w3.org/2000/svg", "circle"); 
circles.setAttribute("cx",25); 
circles.setAttribute("cy",25); 
circles.setAttribute("r",25); 
circles.setAttribute("fill",fillcolor); 
svg1.appendChild(circles); 

답변

0

:

나는

요소이 같은 SVG를 생성 너의 선택의.

참조 : http://msdn.microsoft.com/en-us/library/gg427629.aspx

그리고 iSDK 샘플 : 코드는 다음과 같이 뭔가 영감을해야 http://www.bingmapsportal.com/isdk/ajaxv7#Pushpins15

:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html> 
    <head> 
     <title>Add pushpin with options</title> 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
     <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script> 
     <script type="text/javascript"> 
     var map = null; 

     function getMap() 
     { 
     map = new Microsoft.Maps.Map(document.getElementById('myMap'), {credentials: 'Your Bing Maps Key'}); 
     } 

     function addCustomPushpin() 
     { 
     var pushpinOptions = {width: null, height: null, htmlContent: "<div style='font-size:12px;font-weight:bold;border:solid 2px;background-color:LightBlue;width:100px;'>Custom Pushpin</div>"}; 
     var pushpin= new Microsoft.Maps.Pushpin(map.getCenter(), pushpinOptions); 
     map.entities.push(pushpin); 
     } 
     </script> 
    </head> 
    <body onload="getMap();"> 
     <div id='myMap' style="position:relative; width:400px; height:400px;"></div> 
     <div> 
     <input type="button" value="AddCustomPushpin" onclick="addCustomPushpin();" /> 
     </div> 
    </body> 
</html> 
+0

내가 완전히 htmlContent 속성 – Zay

+0

을 놓친 감사 SVG 개체를 배치하고 ? / –