Open
Description
maptalks's version and what browser you use?
maptalks v0.37.0
Google Chrome
Issue description
I need two split a existed LineString, into Two Line Strings from where the user right clicks and choose the split option. I wonder if there is way for it. Any help would be appreciated. Thank you.
this is my function for split:
this.splitLineString = function (coordinate, target) { new maptalks.Marker( coordinate, { 'symbol': { 'markerType': 'ellipse', 'markerFill': '#ffffff', 'markerLineColor': '#e65100', 'markerLineWidth': 3, 'markerWidth': 5, 'markerHeight': 5 }, } ).addTo(draw_layer); console.log(target) }
and this is the code which makes the LineString:
`if (param.geometry.type === 'LineString' && FreeLineMode === true) {
var GisSymbol = param.target.options.symbol.tag.GisSymbol;
var dg = drawTool.getCurrentGeometry();
if (dg != null) {
line = new maptalks.LineString(
dg.getCoordinates(),
{
tag: {
GisSymbolId: GisSymbol.GisSymbolId,
GisInfoGuid: guid(),
GisInfoId: null,
GisSymbolSeqNum: GisSymbol.GisSymbolSeqNum,
IsNew: true,
Element: GisSymbol,
Label: null
},
symbol: {
'lineColor': 'red',
'lineWidth': 2,
'lineJoin': 'round',
'lineCap': 'round',
//'lineDasharray': lineDasharray,
//'lineOpacity': {
// stops: [[GisSymbol.GisSymbolZoomStart, 0], [GisSymbol.GisSymbolZoomStop, 1]]
//},
'textPlacement': 'line',
'textSize': 12,
'textDy': -20,
'textFaceName': 'sans-serif',
//'textName': "" + element.ItemLength + " m",
'textWeight': 'normal',
'textStyle': 'normal',
'textFill': '#000',
//'textOpacity': { stops: [[GisSymbol.GisSymbolZoomStart, 0], [GisSymbol.GisSymbolZoomStop, 1]] },
'textHaloFill': '#fff',
//'textOpacity': { stops: [[GisSymbol.GisSymbolZoomStart, 0], [GisSymbol.GisSymbolZoomStop, 1]] },
'textWrapCharacter': '\n',
'textLineSpacing': 0,
'textHorizontalAlignment': 'middle',
'textVerticalAlignment': 'middle',
'textAlign': 'center'
},
}
);
draw_line_layer.addGeometry(line);
}
}`