function flashFeature(graphic) { var text; if (graphic.geometry.type == "point") { var extent = graphic.geometry; text = "Point: " + graphic.geometry.x + ", " + graphic.geometry.y; } else if (graphic.geometry.type == "polyline") { var lineExtent = graphic.geometry.getExtent(); var extent = new Extent(lineExtent.xmin, lineExtent.ymin, lineExtent.xmax, lineExtent.ymax, new SpatialReference({ wkid:102100})); text = "Line: " + extent.xmin + ", " + extent.ymin + ", " + extent.xmax + ", " + extent.ymax; } if (!map.extent.contains(extent)) { console.log("Outside current extent - " + text); } else { console.log("Inside current extent - " + text); } map.graphics.add(graphic); }
var extent = map.extent; if(extent.contains(graphic.geometry)) { graphic.setSymbol(highlightSymbol); }
function flashFeature(graphic) { var text, extent; if (graphic.geometry.type == "point") { extent = graphic.geometry; text = "Point: " + graphic.geometry.x + ", " + graphic.geometry.y; } else if (graphic.geometry.type == "polyline") { extent = graphic.geometry.getExtent(); text = "Line: " + extent.xmin + ", " + extent.ymin + ", " + extent.xmax + ", " + extent.ymax; } if (!map.extent.contains(extent)) { console.log("Outside current extent - " + text); } else { console.log("Inside current extent - " + text); } map.graphics.add(graphic); }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.