_addAddress: function () { //添加热点地址
this.curNavToolbar.deactivate();
this._draw.deactivate();
this._graphiclayer.clear();
this.cmap.graphics.clear();
this.cmap.setMapCursor("pointer");
this._draw.activate(Draw.POINT);
this._draw.on("draw-end", function (evt) {
this._hotCanMove = true;
this.cmap.setMapCursor("default");
this._draw.deactivate();
this._point = evt.geometry;
var marksymbol = new esri.symbol.PictureMarkerSymbol("/images/position.png", 20, 24).setOffset(0, 11);
this._graphic = new Graphic(evt.geometry, marksymbol);
this._graphiclayer.clear();
this._graphiclayer.add(this._graphic);
this.cmap.addLayer(this._graphiclayer);
this._graphiclayer.on("mouse-down", function (evt) {
if (this._hotCanMove) {
this._isMouseDown = true;
this.cmap.disableMapNavigation();
}
}.bind(this));
this.curNavToolbar.deactivate();
this._draw.deactivate();
this._graphiclayer.clear();
this.cmap.graphics.clear();
this.cmap.setMapCursor("pointer");
this._draw.activate(Draw.POINT);
this._draw.on("draw-end", function (evt) {
this._hotCanMove = true;
this.cmap.setMapCursor("default");
this._draw.deactivate();
this._point = evt.geometry;
var marksymbol = new esri.symbol.PictureMarkerSymbol("/images/position.png", 20, 24).setOffset(0, 11);
this._graphic = new Graphic(evt.geometry, marksymbol);
this._graphiclayer.clear();
this._graphiclayer.add(this._graphic);
this.cmap.addLayer(this._graphiclayer);
this._graphiclayer.on("mouse-down", function (evt) {
if (this._hotCanMove) {
this._isMouseDown = true;
this.cmap.disableMapNavigation();
}
}.bind(this));
本文介绍了一种在地图上添加并编辑热点地址的方法。通过禁用当前导航工具和绘图功能,清除之前的图形图层,并设置鼠标指针样式为指向状态。使用绘图功能绘制点,绘制结束后设置热点可移动标志,更改鼠标样式,获取绘制点的几何位置,并创建标记符号。最终将带有位置标记的图形添加到图层中,并监听鼠标点击事件以便后续移动。
885

被折叠的 条评论
为什么被折叠?



