The goal: Allow user to turn on and off different layers of data; and to dynamically pull the data for the current extent from a database on map move event.
This works fine and good if you hard code your VEShapeLayers as done here.
My list of layers is coming from a database, I have everything working the way I want except that when I add shapes to my VEShapeLayer none are rendered on my map. Calling VEShapeLayer.GetShapeCount() returns the expected number... so the layer has the data..
Here are the important bits of the code:
var assets = [];
if (WebServiceResult.length > 0) {
for (var i = 0; i < WebServiceResult.length; i++) {
var ix = FindLayerIndex(WebServiceResult[0].AssetMapLayer);
var velatlong = new VELatLong();
velatlong.Latitude = WebServiceResult[i].Latitude;
velatlong.Longitude = WebServiceResult[i].Longitude;
newShape = new VEShape(VEShapeType.Pushpin, velatlong);
assets.push(newShape);
}
// ix is defined above and is vaild and correct
map.GetShapeLayerByIndex(ix).AddShape(assets);
}
// a call here to map.GetShapeLayerByIndex(ix).GetShapeCount()
// returns the expected number of shapes