Document Maps JavaScript API Reference Manual Tool Category BezierCurveEditor

BezierCurveEditor

AMap.BezierCurveEditor

Construct a Bezier curve editing plugin object

new AMap.BezierCurveEditor(map: Map, bezier: BezierCurve?, opts: Object?)

Parameter

map (MapAMap.Map instance

bezier (BezierCurve?) Curve instance

opts (Object?) Set parameters

Attribute

Type

Description

createOptions

Object?

Newly created object style

editOptions

Object?

Edit Style

controlPoint

Object?

Vertex Style MarkerOptions

midControlPoint

Object?

Midpoint Style MarkerOptions

bezierControlPoint

Object?

Bezier Control Point Style MarkerOptions

bezierControlLine

Object?

Bezier Control Line Style PolylineOptions

Demo

//Import the Bezier Curve Editor Plugin
map.plugin(["AMap.BezierCurveEditor"], function () {
  //Instantiate the Bezier Curve Editor, passing in the map instance and the polygon instance to be edited
  var bezierCurveEditor = new AMap.BezierCurveEditor(map, bezierCurve);
  //Enable Edit Mode
  bezierCurveEditor.open();
});

Method

setTarget(overlay?)

Set Edit Object

Parameteroverlay (BezierCurve?) Edit Object

Demo:

//Create a Bézier curve instance
var path = [
  [116.37, 39.91], 
  [116.380298, 39.907771, 116.38, 39.9], 
  [116.385298, 39.907771, 116.4, 39.9], 
  [
    [116.392872, 39.887391], 
    [116.40772, 39.909252], 
    [116.41, 39.89], 
  ],
  [116.423857, 39.889498, 116.422312, 39.899639, 116.425273, 39.902273],
];
var bezierCurve = new AMap.BezierCurve({ path: path });
map.add(bezierCurve);
//Instantiate the Bézier curve editor, passing in the map instance and the Bézier curve instance to be edited
var bezierCurveEditor = new AMap.BezierCurveEditor(map);
//Set bezierCurve as the Bézier curve instance to be edited
bezierCurveEditor.setTarget(bezierCurve);
bezierCurveEditor.open();

getTarget()

Get editing object

return value:  (BezierCurve | undefined) Current editing object

Demo:

bezierCurveEditor.getTarget();

open()

Start editing the object

Demo:

bezierCurveEditor.open();

close()

Stop editing the object

Demo:

bezierCurveEditor.close();

Event

Event Name

Description

addnode

This event is triggered when a node is added

adjust

This event is triggered when a point on the curve is adjusted

removenode

This event is triggered when a node is deleted

add

This event is triggered after creating a curve, and the target is the created object. When the editor's editing object is empty, calling the open interface and clicking the screen once will create a new overlay object

end

This event is triggered after calling close, and the target is the edited overlay object

For event object property descriptions, go to:MapsEvent