Hi,
I want to Blink a feature by text style. it’s working fine in Desktop Edition.
But same thing not working in Web Edition.
Issue in refreshing textstyle with time interval, In Web it’s calling only on loading time(I mean Single Time.
After Loading it didn’t call it.
I tried with Tick with, even though it’s not firing.
Please check the code and fix this issue.
Code:
InMemoryFeatureLayer imBlinkAircraft_DR = new InMemoryFeatureLayer();
imBlinkAircraft_DR.Open();
imBlinkAircraft_DR.Columns.Add(new FeatureSourceColumn(“FlightID”));
imBlinkAircraft_DR.Close();
BlinkingTextStyle_DR blinkingTextStyle_DR = new BlinkingTextStyle_DR();
blinkingTextStyle_DR.FillBrushes.Add(new GeoSolidBrush(GeoColors.Red));
blinkingTextStyle_DR.FillBrushes.Add(new GeoSolidBrush(GeoColors.Orange));
blinkingTextStyle_DR.FillBrushes.Add(new GeoSolidBrush(GeoColors.Red));
blinkingTextStyle_DR.OverlappingRule = LabelOverlappingRule.AllowOverlapping;
blinkingTextStyle_DR.DuplicateRule = LabelDuplicateRule.UnlimitedDuplicateLabels;
imBlinkAircraft_DR.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(blinkingTextStyle_DR);
imBlinkAircraft_DR.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay blinkingOverlay_DR = new LayerOverlay("BlinkAircraftDROverlay") { AutoRefreshInterval = TimeSpan.FromMilliseconds(200) };
blinkingOverlay_DR.Tick += new EventHandler<EventArgs>(markerOverlay_Tick);
blinkingOverlay_DR.Layers.Add("BlinkAircraftDRLayer", imBlinkAircraft_DR);
wfMap.CustomOverlays.Add(blinkingOverlay_DR);
Feature fAircraft = new Feature(new PointShape(10,10));
fAircraft.ColumnValues.Add(“FlightID”, “AC1100”);
imBlinkAircraft_DR.InternalFeatures.Add(fAircraft.Id, fAircraft);
static bool isBlinkAircraftActive = false;
void markerOverlay_Tick(object sender, EventArgs e)
{
if (wfMap.CustomOverlays.Contains(“BlinkAircraftDROverlay”))
{
InMemoryFeatureLayer imBlinkAircraft_DR = (InMemoryFeatureLayer)((LayerOverlay)wfMap.CustomOverlays[“BlinkAircraftDROverlay”]).Layers[“BlinkAircraftDRLayer”];
imBlinkAircraft_DR.IsVisible = true;
if (!isBlinkAircraftActive)
{
isBlinkAircraftActive = true;
imBlinkAircraft_DR.ZoomLevelSet.ZoomLevel01.CustomStyles[0].IsActive = true;
}
else
{
isBlinkAircraftActive = false;
imBlinkAircraft_DR.ZoomLevelSet.ZoomLevel01.CustomStyles[0].IsActive = false;
}
((LayerOverlay)wfMap.CustomOverlays["BlinkAircraftDROverlay"]).Redraw();
}
}
BlinkingTextStyle_DR class code:
public partial class BlinkingTextStyle_DR : TextStyle
{
private Collection candidates =new Collection();
protected override void DrawCore(IEnumerable features, GeoCanvas canvas, System.Collections.ObjectModel.Collection labelsInThisLayer, System.Collections.ObjectModel.Collection labelsInAllLayers)
{
foreach (var feature in features)
{
canvas.DrawText(feature.ColumnValues[“FlightID”].ToString(), new GeoFont(“Arial”, (float)10, DrawingFontStyles.Regular), GetFillBrush(“255,255,0,0”), new GeoPen(GeoColor.FromArgb(0, 255, 255, 255)), new Collection { ExtentHelper.ToScreenCoordinate(canvas.CurrentWorldExtent, (PointShape)feature.GetShape(), canvas.Width, canvas.Height) }, DrawingLevel, 0, 0, (float)Convert.ToDouble(feature.ColumnValues[“HDirection”].ToString()));
}
}
public Collection<GeoBrush> FillBrushes
{
get { return candidates; }
}
int count=0;
private GeoBrush GetFillBrush(string sDRAlertColor)
{
int index = count;
if (sDRAlertColor == "255,255,0,0" && index != 0)
index = 2;
else if (sDRAlertColor != "255,255,0,0" && index!=0)
index = 1;
if (count == 2)
count = 0;
else
count++;
return candidates[index];
}
}
In Desktop Edition, BlinkingTextStyle_DR drawcore method calling each time, so it’s blinking. but In Web Edition it’s not calling
Thanks,
Riyaz