mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 19:16:41 +07:00
new-poly: new poly, continue forward
This commit is contained in:
parent
3093bd24da
commit
2f9952e8fa
7 changed files with 723 additions and 5 deletions
|
@ -1,4 +1,5 @@
|
|||
import { Map } from '$modules/Map';
|
||||
import { NewPoly } from '$modules/NewPoly';
|
||||
import { Poly } from '$modules/Poly';
|
||||
import { MODES } from '$constants/modes';
|
||||
import { Stickers } from '$modules/Stickers';
|
||||
|
@ -40,6 +41,11 @@ export class Editor {
|
|||
this.poly = new Poly({
|
||||
map, routerMoveStart, lockMapClicks, setTotalDist: this.setDistance, triggerOnChange, editor: this,
|
||||
});
|
||||
|
||||
this.newPoly = new NewPoly({
|
||||
map, editor: this,
|
||||
});
|
||||
|
||||
this.stickers = new Stickers({ map, lockMapClicks, triggerOnChange });
|
||||
this.router = new Router({
|
||||
map, lockMapClicks, setRouterPoints: this.setRouterPoints, changeMode, pushPolyPoints
|
||||
|
|
45
src/modules/NewPoly.js
Normal file
45
src/modules/NewPoly.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
import L from 'leaflet';
|
||||
import 'leaflet-geometryutil';
|
||||
import '../utils/EditablePolyline';
|
||||
import { simplify } from '$utils/simplify';
|
||||
import { findDistance, middleCoord } from '$utils/geom';
|
||||
import { CLIENT } from '$config/frontend';
|
||||
import { MODES } from '$constants/modes';
|
||||
|
||||
const polyStyle = {
|
||||
color: 'url(#activePathGradient)',
|
||||
weight: '6',
|
||||
markerMid: 'url(#arrow)'
|
||||
};
|
||||
// const polyStyle = { color: '#ff3344', weight: '5' };
|
||||
|
||||
export class NewPoly {
|
||||
constructor({
|
||||
map, routerMoveStart, lockMapClicks, setTotalDist, triggerOnChange, editor,
|
||||
}) {
|
||||
// this.poly = L.polyline([], polyStyle);
|
||||
const coordinates = [
|
||||
[54.985987, 82.921543],
|
||||
[55.03845, 82.97699],
|
||||
[55.0345, 82.67699],
|
||||
[55.0145, 82.67699],
|
||||
];
|
||||
this.poly = L.Polyline.PolylineEditor(coordinates, { ...polyStyle, maxMarkers: 300 }).addTo(map);
|
||||
this.poly.addTo(map);
|
||||
map.fitBounds(this.poly.getBounds());
|
||||
//
|
||||
// this.latlngs = [];
|
||||
// this.poly.addTo(map);
|
||||
// this.editor = editor;
|
||||
//
|
||||
// this.map = map;
|
||||
//
|
||||
// this.routerMoveStart = routerMoveStart;
|
||||
// this.setTotalDist = setTotalDist;
|
||||
// this.triggerOnChange = triggerOnChange;
|
||||
// this.lockMapClicks = lockMapClicks;
|
||||
// this.bindEvents();
|
||||
//
|
||||
// this.arrows = new L.LayerGroup().addTo(map);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue