ichim / LeafletForBlazor-NuGet

LeafletForBlazor NuGet Package - You can quickly add a map control to your Blazor application - 2.2.2.2 version. #12 issue, StreamLegend customization
https://www.nuget.org/packages/LeafletForBlazor#versions-body-tab
74 stars 9 forks source link

Initial StreamPoint data for RealTimeMap #17

Closed smog82 closed 8 months ago

smog82 commented 8 months ago

Hi Laurentiu, Thank you very much for this package. I have a question is there a way to load some initial StreamPoint to RealTimeMap? All examples are only after click on button but i want to show some data immediately as well. Thanks Martin

ichim commented 8 months ago

Hello sir,

You can upload StreamPoint array on blazor page method event OnAfterRenderAsync():

     protected override Task OnAfterRenderAsync(bool firstRender)
     {
              if(firstRender)
              {
                   //upload StreamPoint array
              }
     }
smog82 commented 8 months ago

Hi Laurentiu,

I tried exactly like you mention before but it didn't worked for me for that reason i wrote to you. Tried again with steps below but map is empty without any points. It start to work after i click on some button. 1) Clone your solution RealTimeMap Geometric.Points collection 2) Added protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { await upload(); } }

Do you know what i'm doing wrongly?

Thanks Martin

ichim commented 8 months ago

Got it, I'll check. Sorry for the delay

ichim commented 8 months ago

Hello sir,

That's right, the OnAfterRenderAsync event does not find the loaded map, being an asynchronous process. The next version of the package (2.0.2.6) will have the OnAfterMapLoaded event that is triggered after the map is loaded on the page. On this event you can load the StreamPoint array in the map, without that button being necessary ...

Laurentiu

smog82 commented 8 months ago

Thanks a lot. Once it will be deployed i will check and close issue.

Martin

ichim commented 8 months ago

Thank you

ichim commented 8 months ago

Hello sir,

The Last vesion of the package provide you events method. OnAfterMapLoaded method can be used to upload StreamPoint collection.

smog82 commented 8 months ago

Hi Laurentiu,

Thanks for fix i will close the ticket.

Martin