ESRI Javascript API获取范围中的功能

ESRI Javascript API获取范围中的功能,javascript,esri,arcgis-js-api,Javascript,Esri,Arcgis Js Api,解决了…我正在尝试获取分组图形的几何图形,如果不将graphic.attributes.baseGraphic添加到我必须创建的新图形中,我似乎无法获取x和y。有问题的代码具有“***”字符,用于定义有问题的部分 handleMouseOver: function(evt) { var graphic = evt.graphic; var latlon = evt.graphic.geometry; //alert('x =' + latlon.x

解决了…我正在尝试获取分组图形的几何图形,如果不将graphic.attributes.baseGraphic添加到我必须创建的新图形中,我似乎无法获取x和y。有问题的代码具有“***”字符,用于定义有问题的部分

handleMouseOver: function(evt) {
        var graphic = evt.graphic;
        var latlon = evt.graphic.geometry;
        //alert('x =' + latlon.x + 'y =' + latlon.y);
        if (graphic.symbol.type == 'textsymbol' || graphic.symbol.type == 'simplelinesymbol') {
            if (graphic.attributes) {
                if (graphic.attributes.baseGraphic && graphic.attributes.baseGraphic.task) {
                    graphic.attributes.baseGraphic.task.cancel();
                }
            }
            //return;
        }
        if (graphic.attributes.isCluster) { //cluster mouse over
            if (graphic.attributes.clustered) {
                for (var i = 0; i < graphic.attributes.clusterSize; i++)
                {
                    x = graphic.attributes[i].baseGraphic.geometry.x;

                    y = graphic.attributes[i].baseGraphic.geometry.y;
                    //alert('x=' + x + 'y=' + y);
                }
                if (graphic.task) {
                    graphic.task.cancel();
                }
                //return;
            }
        } else { //single marker or cluster flare mouse over
            if (graphic.attributes.baseGraphic) { //cluster flare
                graphic.attributes.baseGraphic.task.cancel();
            }
            this.showInfoWindow(graphic);
            //return;
        }

        graphic.clusterGraphics = [];
        //alert('x =' + latlon.x + 'y =' + latlon.y);
        var cSize = graphic.attributes.clusterSize;
        var lineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 0, 1]), 1);

        //polyline used to "tie" flare to cluster
        //set up initially with the center pt of the cluster as the first point and a dummy point @ 0,0 for a placeholder
        var line = new esri.geometry.Polyline(map.spatialReference);
        line.addPath([graphic.geometry, new esri.geometry.Point(0, 0)]);

        //polyline graphic
        var lineGraphic = new esri.Graphic(line, lineSymbol);

        //creating a circle to evenly distribute our flare graphics around
        if (cSize > 1 && cSize <= this._flareLimit) {  //cSize > 1 may not be needed
            //takes the number of points (flares) for the cluster
            var numPoints = graphic.attributes.clusterSize;

            //takes the pixel distance from the center of the graphic to flare out the graphics
            var bufferDistance = this.getPixelDistanceFromCenter(graphic.geometry);

            //center of cluster graphic
            var centerPoint = graphic.geometry;


            //variables used to plot points evenly around the cluster
            var dblSinus, dblCosinus, x, y, pt, ptGraphic, p, l;


            ***for (var i = 0; i < graphic.attributes.clusterSize; i++)  {
                    //constructing the flare graphic point


                //pt = new esri.geometry.Point(x, y, this._map.spatialReference)
                //ptGraphic = new esri.Graphic(pt, this.symbolBank.single, dojo.mixin(graphic.attributes[i], { baseGraphic: graphic }), this._infoTemplate);
                x = graphic.attributes[i].baseGraphic.geometry.x;

                y = graphic.attributes[i].baseGraphic.geometry.y;***

                //constructing the flare graphic point
                //pt = new esri.geometry.Point(x, y, this._map.spatialReference)
                //ptGraphic = new esri.Graphic(pt, this.symbolBank.single, dojo.mixin(graphic.attributes[i], { baseGraphic: graphic }), this._infoTemplate);
                //alert('pt.x=' + pt.x + 'pt.y=' + pt.y )
                //try to always bring flare graphic to front of everything else
                p = this.add(ptGraphic);
                //p.getDojoShape().moveToFront();

                //reset our 0,0 placeholder point in line to the actual point of the recently created flare graphic
                line.setPoint(0, 1, pt);
                lineGraphic = new esri.Graphic(line, lineSymbol, { baseGraphic: graphic });

                //try to always have connector line behind everything else
                l = this.add(lineGraphic);
                //l.getDojoShape().moveToBack();

                //store flare graphic and connector graphic
                graphic.clusterGraphics.push(p);
                graphic.clusterGraphics.push(l);
            }

            //set "clustered" flag
            graphic.attributes.clustered = true;
        }
    },
handleMouseOver:功能(evt){
var图形=evt图形;
var latlon=evt.graphic.geometry;
//警报('x='+latlon.x+'y='+latlon.y);
if(graphic.symbol.type='textsymble'| | graphic.symbol.type==''simplelinesymbol'){
if(图形属性){
if(graphic.attributes.baseGraphic&&graphic.attributes.baseGraphic.task){
graphic.attributes.baseGraphic.task.cancel();
}
}
//返回;
}
如果(graphic.attributes.isCluster){//cluster鼠标悬停
if(graphic.attributes.clustered){
对于(var i=0;i