fleaflet / flutter_map

A versatile mapping package for Flutter. Simple and easy to learn, yet completely customizable and configurable, it's the best choice for mapping in your Flutter app.
https://pub.dev/packages/flutter_map
BSD 3-Clause "New" or "Revised" License
2.74k stars 861 forks source link

[FEATURE] Drawing interactive polygons in real time #1900

Closed masoudafrakhteh closed 4 months ago

masoudafrakhteh commented 4 months ago

What do you want implemented?

  1. Drawing filled up or dashed polygons in real time using mouse clicks for windows
  2. User can make a left click to start drawing
  3. User will only hover mouse to continue drawing ( no need to press and hold)
  4. User will make a 2nd left click indicating that drawing is finalized
  5. User should decide on whether to save or discard the drawn polygon:

What other alternatives are available?

No response

Can you provide any other information?

I have implemented this to some extent BUT only the last polygon is showed , they are all saved though Here is the modified version of the page from fluttermap package : polygon_draw.txt

Severity

Obtrusive: No workarounds are available, and this is essential to me

ibrierley commented 4 months ago

You could always take a look at https://github.com/ibrierley/flutter_map_line_editor if any use.

masoudafrakhteh commented 4 months ago

Well, I just used it and thanks for the recommendation; however, this example also overwrites the only one polygon which is drawn. I am trying to see more than one polygon on the map drawn and kept showing.

JaffaKetchup commented 4 months ago

I believe the Every Door app does this for Polylines: https://discord.com/channels/951867686378409984/989576405580918804/1229341271072575509 & https://github.com/Zverik/every_door/blob/main/lib/screens/modes/notes.dart#L130. Maybe you can adapt this for Polygons. The FMTC example app also supports drawing of polygons in two modes: either move the map, and the point is added at the center crosshairs on tap, or tap and the point is added at tap location. The code is at https://github.com/JaffaKetchup/flutter_map_tile_caching/tree/main/example/lib/screens/main/pages/region_selection, but it will need some decomposing as it does quite a lot more. (It's also GPL licensed).

However, this is out of scope for the core. We try to give options so that you can build solutions, we don't build the solutions ourself (with the exception perhaps of the RichAttributionWidget).