Posted by david on 2. December 2008 22:50
Solved the mystery of the extra empty layers
I was following instructions from - well I can’t remember where I saw it – but for whatever reason, I was doing the geoRss import in three steps:
ShapeLayer aGeoRSSLayer = new ShapeLayer();
ScubaMap.AddShapeLayer(aGeoRSSLayer);
ScubaMap.ImportShapeLayerData(new ShapeSourceSpecification(DataType.GeoRSS, "http://david.egerton.info/Storage/1992hurricaneandrew.xml", aGeoRSSLayer), "", true);
the second step was adding an empty layer – somewhere someone said you had to add an empty layer in which you would import the shapes … however what actually happens is that in the third step, a new layer is added with the shapes. At the end of the shapesourcespec, the previously created layer is named but the control seems to ignore that & just add another layer. So how does one add or delete a shape from existing layer ??
Anyway, knocking out that 2nd step stopped the empty layers being added
get counts at the layer level – code below
to work around the delay between initiating the layer add, add a timed update to the counts & text area
Matt Berseth Using the AJAX Timer Control as an UpdatePanel Trigger
ASP.NET AJAX The Timer Control Introduction to the Timer Control
ASP.NET Ajax Update Panel
this worked … dropped a timer inside of the left bar update panel. @ 15 sec, refreshes, calling the updateLitInfo method which updates the counts in the left bar and the text box below. Cool.
Work on the display … I viewed the page @ K’s and the map got dropped below the left bar.
Narrow the left bar … currently 175 pixels.
loosen up the sizing on the map
worked – help on the fluid layout from here
things moving very very slowly … not sure whether my net connection is hanging or what …
Here is the result
private void UpdateLayerTextInfoLit()
{
int layercount = ScubaMap.GetShapeLayerCount();
StringBuilder builder = new StringBuilder();
for (int i = 1; i <= layercount; i++)
{
builder.Append(" Layer count ");
builder.Append(i.ToString());
builder.Append(" of ");
builder.Append(layercount.ToString());
builder.Append(";");
builder.Append(" ID is: ");
builder.Append(ScubaMap.GetShapeLayerByIndex(i - 1).ID);
builder.Append(";");
builder.Append(" Shapecount is: ");
int currentShapecount = ScubaMap.GetShapeLayerByIndex(i - 1).GetShapeCount();
builder.AppendLine(currentShapecount.ToString());
}
string testString = builder.ToString();
txtLayerInfo.Text = testString;
//builder.ToString();
}