ThinkGeo.com    |     Documentation    |     Premium Support

AutoRefreshInterval refresh TextStyle Issue

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

Hi Riyaz,

The struct is different between desktop and web edition, I viewed your code, it looks you implement it by modify the style and redraw the layer.

That cannot works for webEdition in server side code, because when you tried to modify it the page will get refresh.

If you don’t want to map get refresh, you need to implement that by JavaScript code. But the problem is we don’t have the “shape” or “feature” in client side, in client side it’s only the tile images, so you cannot directly modify it.

If your shape can be generated in client side, I think you can make it blink by set its style, but that’s not easy.

Regards,

Ethan

Hi Ethan,
Thanks for your reply. I want to BLINK in server side.
Please tell me solution in server side.

Thanks,
Riyaz

Hi Riyaz,

I think I find another solution for your scenario.

You should want to build two overlays with the different style, then switch them in client side.

Please view the attached sample: 8997.zip (174.0 KB)

Regards,

Ethan

Hi Ethan,
Thanks for it. But this concept will not work out.
Finally conclude, Blink Text Style is possible in Web Edition or not (Using AutoRefreshInterval) even in server or client side.

I just struck in whatever applied text style is not firing basing on time interval.

Thanks,
Riyaz

Hi Riyaz,

If you want map don’t get reload, and the style Blink like your logic, and it’s in server side. That’s impossible for web edition.

That’s because the different format between web and winform, so I think you should want to find some workaround for example my sample shows.

Regards,

Ethan

Hi Ethan,
I tried your sample it’s not work out.

please check attached sample and fix that issue. (Webforms1)

WebApplication_AircraftBlink.zip (240.8 KB)

Result:

Any other ways to blink features in client side please share it.

Thanks,
Riyaz

Hi Riyaz,

It looks your sample works well.

I did a quickly modify for it and please download and try it:

WebApplication_AircraftBlink.zip (1.7 MB)

Regards,

Ethan

Hi Ethan,
I mean your sample not working in my side(8997.zip).
Please check once again, 1.png bug coming while executing your sample application(WebForm1.aspx)

you work out for Client side blink right, i want to try it in Client side. Please fix it.

Thanks,
Riyaz

Hi Ethan,
Got it.

Thanks,
Riyaz

Hi Riyaz,

Thanks for your update.

Regards,

Ethan