Hi!


I am creating shapes. but I am receiving a message Shape Not Initialized!





Re: I am receiving message- Shape Not Initialized!

Derek Chan

Did the link above help If not, can you post your code so I can see exactly how you are creating your shapes

Thanks,





Re: I am receiving message- Shape Not Initialized!

Hi!

Hi, I am putting a section of code

var lat = arrLatitudeIdea;
var lng = arrLongitudeIdea;
var newShape = new VEShape(VEShapeType.Pushpin, new VELatLong(lat,lng)); //control is not coming after this line.

where arrLatitude and arrLongitude are arrays containing latitudes and longitudes.





Re: I am receiving message- Shape Not Initialized!

SoulSolutions

Try this simple page (from the iSDK to help you out)


Code Snippet
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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 pinid = 0;

function GetMap()
{
map = new VEMap('myMap');
map.LoadMap();
map.SetZoomLevel(10);
}

function AddPushpin()
{
var shape = new VEShape(VEShapeType.Pushpin, map.GetCenter());
shape.SetTitle('My pushpin');
shape.SetDescription('This is shape number '+pinid);
pinid++;
map.AddShape(shape);
}
</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:400px; height:400px;"></div>
<div>Click on the links below to add a default shape to the map.</div>
<div><a href='#' onclick='AddPushpin();'>Add Pushpin</a></div>
</body>
</html>

John.






Re: I am receiving message- Shape Not Initialized!

Hi!

image1 = "http://labs.google.com/ridefinder/images/mm_20_green.png";
for (var i = 0; i < arrLatitude.length; i++) {
var pushpin = new VEPushpin(i,
new VELatLong(arrLatitudeIdea,arrLongitudeIdea),image1,"Title", "Notes");
map.AddPushpin(pushpin);
}

From This I am able to create push pins at multiple locations.
And, Now I want to create custom icon beside the push pin. For that I am using
//This code is after is inside for loop after adding pushpin
var lat = arrLatitudeIdea.toString();
var lng = arrLongitudeIdea.toString();
var newShape = new VEShape(VEShapeType.Pushpin,new VELatLong(lat,lng));
newShape.SetCustomIcon(icon1);
map.ClearInfoBoxStyles();
newShape.SetTitle("Hi!");
newShape.SetDescription("Hello");
map.AddShape(newShape);

But, I am receiving message like Shape is not intialized
Can u suggest something






Re: I am receiving message- Shape Not Initialized!

Alexandru Matei

Hi,

As already indicated in the link above, the answer to your problem is here. Please read carefully the topic:

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1720635&SiteID=1

It's essential to pass numbers not strings to the VELatLong constructor.





Re: I am receiving message- Shape Not Initialized!

Hi!

Thanks Alexandru Matei.

Actually I am passing. lat. and lon. as string so it is not working. but after converting it in to numbers. It is working now.