Comments (15)
from flutter_map_line_editor.
Have you tried it? What problems did you get ?
from flutter_map_line_editor.
@ibrierley , I was investigating multi-geometries and polygons with holes. This might be related for the first.
First off, would I have to create a polyEditor for each Geometry? And then when it comes to create:
DragMarkerPluginOptions(markers: polyEditor.edit()),
would I collect the markers from each? They should not suffer from mixups, right?
from flutter_map_line_editor.
Yes, you would need to create a polyeditor for each currently.
I don't think there should be mixups, assuming the lists of points are separate and not reused between geometries.
I haven't tested this scenario, but I can't think of any caveats, but do let me know if you find any.
from flutter_map_line_editor.
from flutter_map_line_editor.
Let me know your code for a minimal testing example, and I shall take a look.
from flutter_map_line_editor.
if i add multipolygon, would I have to create a DragMarkerPluginOptions(markers: polyEditor.edit())
before, right?
Can I add that after the second drawing polygon ?
from flutter_map_line_editor.
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong/latlong.dart';
import 'package:flutter_map/plugin_api.dart';
import 'package:flutter_map_dragmarker/dragmarker.dart';
import 'polyeditor.dart';
void main() {
runApp(TestApp());
}
class TestApp extends StatefulWidget {
@override
_TestAppState createState() => _TestAppState();
}
class _TestAppState extends State<TestApp> {
PolyEditor polyEditor, polyEditor2;
final MapController mapController = MapController();
List<Polygon> polygons = [];
List dragMarkerEditor = List();
var testPolygon = new Polygon(
color: Colors.deepOrange.withOpacity(0.2),
points: [],
borderColor: Colors.deepOrange,
borderStrokeWidth: 2,
);
var testPolygon2 = new Polygon(
color: Colors.blue.withOpacity(0.2),
points: [],
borderColor: Colors.blue,
borderStrokeWidth: 2,
);
@override
void initState() {
super.initState();
polyEditor = new PolyEditor(
addClosePathMarker: true,
points: testPolygon.points,
pointIcon: Icon(Icons.crop_square, size: 23),
intermediateIcon: Icon(Icons.lens, size: 15, color: Colors.grey),
callbackRefresh: () => {this.setState(() {})},
);
polyEditor2 = new PolyEditor(
addClosePathMarker: true,
points: testPolygon2.points,
pointIcon: Icon(Icons.crop_square, size: 23),
intermediateIcon: Icon(Icons.lens, size: 15, color: Colors.grey),
callbackRefresh: () => {this.setState(() {})},
);
// polygons.clear();
polygons.add(testPolygon);
polygons.add(testPolygon2);
}
@override
Widget build(BuildContext context) {
//
return MaterialApp(
home: Scaffold(
body: Center(
child: Container(
child: Stack(
children: [
FlutterMap(
mapController: mapController,
options: MapOptions(
onTap: (ll) {
polyEditor.add(testPolygon.points, ll);
polyEditor2.add(testPolygon2.points, ll);
},
plugins: [
DragMarkerPlugin(),
],
center: LatLng(45.5231, -122.6765),
zoom: 6.4,
),
layers: [
TileLayerOptions(
urlTemplate:
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
subdomains: ['a', 'b', 'c']),
PolygonLayerOptions(polygons: polygons),
DragMarkerPluginOptions(markers: polyEditor.edit()),
DragMarkerPluginOptions(markers: polyEditor2.edit()),
],
),
],
),
),
),
),
);
}
}
from flutter_map_line_editor.
I guess the question with the code above is, firstly what happens, and secondly what do you want to happen ?
I can see in onTap you are adding a point to both sets of polyEditors, which looks a bit strange, but what logic do you want to happen when you click on a map ? How do you want to decide which polyEditor you will add a point to. So I think maybe you need to clarify the logic of what you want to happen firstly.
You see normally you would only have an onTap work for one object I would assume, which you have selected via some method. Dragging the existing points on any polygon I would assume to make sense though, does that work ?
from flutter_map_line_editor.
I try to follow an example. http://leaflet.github.io/Leaflet.Editable/example/undo-redo.html
from flutter_map_line_editor.
So you need to decide what method you are going to 'select' which polygon you are currently working on (adding new points to).
What currently happens ?
from flutter_map_line_editor.
from flutter_map_line_editor.
What do you expect to do, rather than add the option once for each polygon ?
I'm kind of failing to see what the problem actually is. You could naturally use a list and loop through them to do it, but each poly will need an editor.
from flutter_map_line_editor.
from flutter_map_line_editor.
Just to be clear, I am guessing there will be problems, if you have many editors live at the same time. It will probably be just the top layer which receives the drag clicks (I haven't had chance to test this yet)...but this is possibly part of the logic which you may need to figure out, which one you have 'selected'. I'm not sure the plugin itself could figure that out...if you need ALL the be simultaneously able to move the markers around and create new ones, I don't think that would work, but if you have the logic of only one you have selected needing the events, it may work.
from flutter_map_line_editor.
Related Issues (20)
- hardcoded DragMarker size HOT 5
- null safety HOT 5
- License? HOT 1
- How do you compute the area of the polygon? HOT 2
- Non-nullable instance field 'polyEditor' must be initialized. HOT 3
- Moving Polygon/Polyline HOT 1
- FLUTTER_MAP RELATIONS: New Documentation HOT 1
- Markes not dragging HOT 20
- Update LatLng2 to 0.8.1 HOT 2
- Please update cupertino icons on nullsafety branch HOT 2
- Web support HOT 2
- no filled colors on polygon HOT 6
- Make it compatible with latlong2 0.8.1 as in dragmarker HOT 7
- Markers not dragging - again HOT 3
- Inbetween point of a line not quite accurate on low zooms. HOT 5
- Is a point inside of polygon? HOT 1
- Next version HOT 2
- Drag marker does not update polygon points HOT 2
- Feature request: option to make start/end of polyline non-editable
- Featrue request: make a config option for long-press on tap to remove points
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_map_line_editor.