[REQ] Official Leaflet Wisej Control or some advice tutorial to create it

2
2

Hi
Can i request official wisej control?, or some advice/tutorial/guideline to start to create a wisej leaflet advanced control (events-properties, methods…) for :
http://leafletjs.com/
Has a great plugins to integrate too, would be amazing to have some samples with plugins to start with wisej control, personally i was using googlemaps/ajax/aspnet some time ago with some plugins like markercluster…, but leaflet markercluster plugin is a winner, smooth animations, small js file…
http://leafletjs.com/plugins.html

For reference here are some samples for leaflet markercluster plugin, has cluster feature, events like marker click to zoom pan and declutter, dinamic cluster/declustering … try change zoom…
http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.388.html
http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-zoomtobounds.html

You can using leaflet too, with openstreetmap provider to avoid some polices and save some cost like others (googlemaps…)

Thanks in advance!

  • Tom Van den Eynde
    I’d love to see a Leaflet component as well. Is it hard to create one myself (without being a Javascript wizard)?
  • You must to post comments
1
0

Does anyone know why OnWidgetEvent(WidgetEventArgs e) reports 0,0 instead of coordinates, works with same event in VsCode?

The repository / source code can be found at: https://github.com/Opzet/WjLeaflet

This works in js

      map.on('click', function(e) {
      	alert(e.latlng);
      } );

but calling the same via WidgetEvent return dynamic is faulty?

 protected override void OnWidgetEvent(WidgetEventArgs e)
        {
            switch (e.Type)
            {
                case "click":  //Mapclick
                case "rightclick":
                    // latlng 
                    OnMapClick(new MapMouseEventArgs(e));
                    break;

LeafletjsMap -> LeafletMap.cs

        /// <summary>
        /// Fired when the user clicks on the map or a marker.
        /// </summary>
        public event MapMouseEventHandler MapClick
        {
            add { base.AddHandler(nameof(MapClick), value); }
            remove { base.RemoveHandler(nameof(MapClick), value); }
        }

Wired up

this.leafletMap1.MapClick` += new LeafletjsMaps.MapMouseEventHandler(this.leafletMap1_MapClick);

Line 60: frmWjLeafletjs.cs

// C# Event -> reports co ordinates 0,0 ?

        private void leafletMap1_MapClick(object sender, MapMouseEventArgs e)
        {
            
            // To Do : MapMouseEventArgs not bubbling up, always shows as Lat:0 , Lon:0 ?
            // Works in VsCode?

            if (e.Marker == null)
                AlertBox.Show("You clicked location: " + e.Location.ToString());
  • David
    • David
    • Feb 6, 2023 - 9:06 am
    Works now.. :) Implemented -> map. On(“click”, this._onMapClick.bind(this)); //Js – > this.map.on(‘click’, function(e) { alert(“Location is: ” + e.latlng); }); in startup.js see https://github.com/Opzet/WjLeaflet
  • ken xu
    Hello David, I am trying your WJLeaflet, When click “Add Marker”, nothing happen. How to make the Add Marker works?
  • ken xu
    David. I figured it out. This is a great tool. Thank you.
  • You must to post comments
1
0

Hello Wisej Community,

I’ve created a Github repository for a Wisej LeafletJS widget called WjLeaflet. This widget provides advanced control features such as events, properties, and methods.

The repository can be found at: https://github.com/Opzet/WjLeaflet

I would greatly appreciate it if the Wisej community could review the repository and contribute to help implement the full feature set of LeafletJS from Wisej C#.

Thank you for your time and support!

 

  • You must to post comments
0
0

You’ll need to create a Widget. (see https://docs.wisej.com/docs/controls/content/widget )

I would recommend following the Leaflet Quick Start Guide when you are trying to figure out what Javascript you need to write to get a simple implementation of Leaflet.

A similar question was recently asked, about implementing a different JavaScript widget (Lottie Web Player). It’s a very similar process to implement Leaflet. For Leaflet, you will need a different Javascript source code file. (For Leaflet, I believe it is “https://unpkg.com/leaflet@1.9.3/dist/leaflet.js”). Additionally, the Javascript to initialize the component will look a little different.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.