ThinkGeo.com    |     Documentation    |     Premium Support

InMemoryFeatureLayer refresh without use winformmap.refresh() method

Hi Team,

Any possible to refresh dynamic added feature without use winformmap.refresh() method.

Feature add ,update and remove it call from background thread process.

Regrads,
Tamilarasan.

Hi Tamilarasan,

If your layer number is big, you can put the dynamic layer into a separate overlay, and only refresh this overlay when necessary.

Wish that’s helpful.

Regards,

Ethan

Hi Ethan,’

Good Morning,

Please share any sample on only refresh Overlay in map suite desktop edition

Regards,
Tamilarasan.

Hi Tamilarasan,

You can directly call the LayerOverlay.Refresh(), which can only refresh one overlay.

Regards,

Ethan

Hi Ethan,

We try but LayerOverlay.Refresh(GeoCanvas,Rectangle) method only available in map suite winform desktop version

I want know how to pass those parameter for this LayerOverlay.Refresh(GeoCanvas,Rectangle)

Regards,

Tamilarasan.

Hi Tamilarasan,

It looks the LayerOverlay.Refresh() is a little complex for this scenario, please just ignore that and use this API instead of it, it can refresh specified overlay.

winformsMap1.Refresh(layerOverlay);

Regards,

Ethan

Hi Ethan,

I try to Implement pointOverlay.AutoRefreshInterval = TimeSpan.FromMilliseconds(1000); but it cause some exception when close my current winform .

Fatal Thread System.NullReferenceException: Object reference not set to an instance of an object.
at ThinkGeo.MapSuite.WinForms.WinformsMap.PFM=(Graphics graphics, RectangleShape extent)
at ThinkGeo.MapSuite.WinForms.WinformsMap.GlM=(RectangleShape drawingExtent, RectangleShape extent)
at ThinkGeo.MapSuite.WinForms.WinformsMap.OVM=(RectangleShape extent)
at ThinkGeo.MapSuite.WinForms.WinformsMap.gRU=(Int32 delayInterval, RectangleShape extent)
at ThinkGeo.MapSuite.WinForms.WinformsMap.Refresh(RectangleShape extent, IEnumerable1 overlays)** **at ThinkGeo.MapSuite.WinForms.WinformsMap./RU=(IEnumerable1 extentsToRefresh, IEnumerable1 overlays)** **at ThinkGeo.MapSuite.WinForms.WinformsMap.ixo=.kxo=()** **at ThinkGeo.MapSuite.WinForms.WinformsMap.ixo=.kho=(AVQ= parameter, RequestDrawingBufferTimeType bufferTimeType)** **at ThinkGeo.MapSuite.WinForms.WinformsMap.EVM=(Object sender, RequestedDrawingOverlayEventArgs e)** **at ThinkGeo.MapSuite.WinForms.Overlay.OnRequestedDrawing(RequestedDrawingOverlayEventArgs eventArgs)** **at ThinkGeo.MapSuite.WinForms.Overlay.eCU=(IEnumerable1 extentsToRefresh, TimeSpan bufferTime, RequestDrawingBufferTimeType bufferTimeType)
at ThinkGeo.MapSuite.WinForms.Overlay.RequestDrawing()
at ThinkGeo.MapSuite.WinForms.Overlay.b__88_0(Object , EventArgs )
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Regards,
Tamilarasan.

Hi Tamilarasan,

I tried to set the layerOverlay.AutoRefreshInterval = TimeSpan.FromMilliseconds(1000), it works well.

Please show us your code or upload a simple sample, so we can see what’s the problem.

Regards,

Ethan

Hi Ethan,

Here attach my sample code.
InMemoryFeatureLayer pointLayer = new InMemoryFeatureLayer();
pointLayer.Open();
TextStyle txtStyle = new TextStyle(“UnitNbr”, new GeoFont(“Arial”, 9), new GeoSolidBrush(new GeoColor(0, 0, 0)));
txtStyle.YOffsetInPixel = 22;
txtStyle.XOffsetInPixel = -15;
txtStyle.MaskType = MaskType.RoundedCorners;
txtStyle.MaskMargin = 1;
txtStyle.Mask = new AreaStyle(new GeoPen(GeoColor.FromArgb(10, 204, 204, 204), 1),
new GeoSolidBrush(GeoColor.FromArgb(10, 75, 75, 0)));

        pointLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(txtStyle);

        pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

        pointOverlay = new LayerOverlay();
        pointOverlay.Layers.Add("PHX_PointLayer", pointLayer);
        ctrlThinkGEOMap.Overlays.Add("PointOverlay", pointOverlay);
        collMapLayers.Add(pointLayer);

        pointOverlay.AutoRefreshInterval = TimeSpan.FromMilliseconds(1000);

Regards,
Tamilarasan.

Hi Tamilarasan,

We still cannot reproduce this issue you reported, we created a sample based on your code here: 8906.zip (102.4 KB)

Please download it and run it, then modify the code to reproduce your issue, so our developer can look into it and solve it.

Regards,

Ethan

Hi Ethan,

I attached the updated code, Please run the solution if click map menu and close the mdi child window it cause the exception.

Please refer below screen shot

Thanks,
Tamilarasan.Uploading…

Hi Tamilarasan,

It looks you failed to upload that, please upload it again.

Regards,

Ethan

Hi Ethan,

Here attached latest file .

Regards,
Tamilarasan.Overlay.zip (2.4 MB)

Hi Tamilarasan,

Thanks for your project, please see the solution as below. I have let our developer know it and they will do enhancement for this API, but it won’t be changed now because it’s related with the structure.

        private void Form1_Load(object sender, EventArgs e)
    {
        this.FormClosed += Form1_FormClosed;

        winformsMap1.MapUnit = GeographyUnit.DecimalDegree;            

        InMemoryFeatureLayer pointLayer = new InMemoryFeatureLayer();
        pointLayer.Open();
        TextStyle txtStyle = new TextStyle("UnitNbr", new GeoFont("Arial", 9), new GeoSolidBrush(new GeoColor(0, 0, 0)));
        txtStyle.YOffsetInPixel = 22;
        txtStyle.XOffsetInPixel = -15;
        txtStyle.MaskType = MaskType.RoundedCorners;
        txtStyle.MaskMargin = 1;
        txtStyle.Mask = new AreaStyle(new GeoPen(GeoColor.FromArgb(10, 204, 204, 204), 1),
        new GeoSolidBrush(GeoColor.FromArgb(10, 75, 75, 0)));

        pointLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(txtStyle);

        pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

        LayerOverlay pointOverlay = new LayerOverlay();
        pointOverlay.Layers.Add("PHX_PointLayer", pointLayer);
        winformsMap1.Overlays.Add("PointOverlay", pointOverlay);            

        pointOverlay.AutoRefreshInterval = TimeSpan.FromMilliseconds(1000);

        winformsMap1.Refresh(pointOverlay);
    }

    private void Form1_FormClosed(object sender, FormClosedEventArgs e)
    {
        LayerOverlay pointOverlay = winformsMap1.Overlays["PointOverlay"] as LayerOverlay;
        pointOverlay.AutoRefreshInterval = TimeSpan.FromMilliseconds(0);            
    }

Thanks to let us know that and wish that’s helpful.

Regards,

Ethan

Hi Ethan,

It help, Thanks.

Regards,
Tamilarasan.

Hi Tamilarasan,

I am glad to hear that’s helpful.

Any question please let us know.

Regards,

Ethan