이 페이지가 유용했습니까?
이 콘텐츠에 대한 여러분의 의견은 중요합니다. 의견을 알려주십시오.
추가 의견
1500자 남음
내보내기(0) 인쇄
모두 확장

VEShape.GetDescription Method

Gets the description of the VEShape object. This description will be displayed in the shape's info box.


VEShape.GetDescription();

A String object representing the description field of the VEShape object.

<html>
    <head>
    	<title></title>
    	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    	<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5"></script>
    	<script>
    	var map = null;
        var lat1 = 44.88980971906551; 
        var lon1 = -85.39827346801759;
        var lat2 = 44.99879594361408; 
        var lon2 = -85.70159912109375;
        var latLong1 = new VELatLong(lat1, lon1);
        var latLong2 = new VELatLong(lat2, lon2);
        var latLong3 = new VELatLong(45.004622150149935, -85.56427001953126);
        
        //Create a pair of VELatLong arrays in the shape of an octagon
        var points01=[new VELatLong(lat1, lon1 - 0.15),
		    new VELatLong(lat1 + 0.1, lon1 - 0.05),
            new VELatLong(lat1 + 0.1, lon1 + 0.05),
            new VELatLong(lat1, lon1 + 0.15),
            new VELatLong(lat1 - 0.1, lon1 + 0.05),
            new VELatLong(lat1 - 0.1, lon1 - 0.05)];
            
        var points02=[new VELatLong(lat2, lon2 - 0.15),
		    new VELatLong(lat2 + 0.1, lon2 - 0.05),
            new VELatLong(lat2 + 0.1, lon2 + 0.05),
            new VELatLong(lat2, lon2 + 0.15),
            new VELatLong(lat2 - 0.1, lon2 + 0.05),
            new VELatLong(lat2 - 0.1, lon2 - 0.05)];
	
    	function GetMap()
    	{
     	   map = new VEMap('myMap');
     	   map.LoadMap();
     	   map.SetCenterAndZoom(latLong3, 9);
     	   map.SetMapStyle("a");  	   
     	   map.AttachEvent("onclick", ShapeInfo);
     	   AddShapes();
    	}   
    	
    	function AddShapes()
    	{   
    	    //Create VEShape objects, set parameters, and add to the map         
            shape01 = new VEShape(VEShapeType.Polygon, points01);            
            shape01.SetLineWidth(2);
            shape01.SetLineColor(new VEColor(0,150,100,1.0));
            shape01.SetFillColor(new VEColor(0,100,150,0.5));
            shape01.SetTitle("Title for shape01");
            shape01.SetDescription("This is the description of shape01.");
            shape01.SetMoreInfoURL("http://msdn.microsoft.com");
            shape01.SetPhotoURL("http://msdn2.microsoft.com/msdn/images/msdn_logo.gif");
            shape01.SetPoints(points01);
            shape01.ShowIcon();
            map.AddShape(shape01);
            
            shape02 = new VEShape(VEShapeType.Polygon, points02);            
            shape02.SetLineWidth(2);
            shape02.SetLineColor(new VEColor(0,100,150,1.0));
            shape02.SetFillColor(new VEColor(0,150,100,0.5));
            shape02.SetTitle("Title for shape02");
            shape02.SetDescription("This is the description of shape02.");
            shape02.SetMoreInfoURL("http://msdn.microsoft.com");
            shape02.SetPhotoURL("http://msdn2.microsoft.com/msdn/images/msdn_logo.gif");
            shape02.SetPoints(points02);
            shape02.ShowIcon();
            map.AddShape(shape02);
        }
        
        function SwapPoints()
        {
            //Switch the points between the two shapes, making them trade places
            var pts = shape01.GetPoints();
            if (pts[0].Latitude == "44.88980971906551")
            {
                shape01.SetPoints(points02);
                shape02.SetPoints(points01);
            }
            else
            {
                shape01.SetPoints(points01);
                shape02.SetPoints(points02);
            }
        }
        
        function ShapeInfo(e)
        {
	        if(e.elementID != null)
	        {
	            shape = map.GetShapeByID(e.elementID);
	            var info = "";
	            info += "ID (event object): " + e.elementID + "<br />";
	            info += "ID (GetID method): " + shape.GetID() + "<br />";
	            info += "Type: " + shape.GetType() + "<br />";
	            info += "Title: " + shape.GetTitle() + "<br />";
	            info += "Description: " + shape.GetDescription() + "<br />";
	            info += "More Info URL: " + shape.GetMoreInfoURL() + "<br />";
	            info += "Photo URL: " + shape.GetPhotoURL() + "<br />";
	            
	            fillColor = shape.GetFillColor();
	            info += "Fill Color: R: " + fillColor.R + " | G: " + fillColor.G + " | B: " + fillColor.B + " | A: " + fillColor.A + "<br />";
	         
	            lineColor = shape.GetLineColor();  
	            info += "Line Color: R: " + lineColor.R + " | G: " + lineColor.G + " | B: " + lineColor.B + " | A: " + lineColor.A + "<br />"; 
	            
	            info += "Line Width: " + shape.GetLineWidth() + "<br />";

		        label.innerHTML = info;
	        }
	        else
	        label.innerText = "";
        }

    	</script>
    </head>
    <body onload="GetMap();" style="font-family:Arial">
        <div id='myMap' style="position:relative; width:400px; height:400px;"></div>
        <a href='#' onclick="SwapPoints()">Swap Points</a><br />
        Click a shape to get more info.<br />
        <div id="label"></div>
    </body>
</html>

표시:
© 2015 Microsoft