Document Maps JavaScript API Reference Manual Tool Category EllipseEditor

EllipseEditor

AMap.EllipseEditor

Construct an ellipse editing plugin object

new AMap.EllipseEditor(map: Map, ellipse: Ellipse?, opts: Object?)

Parameter

map (MapInstance of AMap.Ellipse

ellipse (Ellipse?) Instance of AMap.Map

opts (Object?) Set parameters

Attribute

Type

Description

createOptions

Object?

Newly created object style

editOptions

Object?

Edit style

movePoint

Object?

Move point style MarkerOptions

resizeXPoint

Object?

reaizeX point style MarkerOptions

resizeYPoint

Object?

reaizeY point style MarkerOptions

Demo

//Introduce oval editor plugin
map.plugin(["AMap.EllipseEditor"], function () {
  //Instantiate the Ellipse Editor, passing in the map instance and the ellipse instance to be edited
  var ellipseEditor = new AMap.EllipseEditor(map, ellipse);
  //Enable Edit Mode
  ellipseEditor.open();
});

Method

setTarget(overlay?)

Set Edit Object

Parameteroverlay (Ellipse?Edit Object

Demo:

//Ellipse Instance
var ellipse = new AMap.Ellipse({
  center: new AMap.LngLat(116.433322, 39.900255),
  radius: [2000, 1000],
});
map.add(ellipse);
//Instantiate the oval editor, passing in the map instance and the oval instance to be edited
var ellipseEditor = new AMap.EllipseEditor(map);
//Set ellipse as the oval instance to be edited
ellipseEditor.setTarget(ellipse);
ellipseEditor.open();

getTarget()

Get editing object

return value: (Ellipse undefined) Current editing object

Demo:

ellipseEditor.getTarget();

open()

Start editing object

Demo:

ellipseEditor.open();

close()

Stop editing the object

Demo:

ellipseEditor.close();

Event

Event Name

Description

adjust

This event is triggered when adjusting the ellipse range

move

This event is triggered when moving the overlay

add

This event is triggered after creating an overlay, 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