Any way to make that code universal for other tasks I will add in later (a GP task for example) or do I have to use this code each time I show results for my tasks?
findParams = new esri.tasks.FindParameters(); findParams.returnGeometry = true; findParams.layerIds = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18]; findParams.searchFields = ["FARM_NAME", "LF_NAME", "COMPANY", "FACILITY", "NAME", "Company"]; findParams.outSpatialReference = map.spatialReference;
//Display results for Find tool function showResults(results){ var markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 1), new dojo.Color([0, 255, 0, 0.25])); map.graphics.clear(); dojo.forEach(results, function(result){ var graphic = result.feature; graphic.setSymbol(markerSymbol); map.graphics.add(graphic); }); }
function showResults(results){ var markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 1), new dojo.Color([0, 255, 0, 0.25])); map.graphics.clear(); dojo.forEach(results, function(result){ result.feature.geometry = esri.geometry.geographicToWebMercator(result.feature.geometry); var graphic = result.feature; graphic.setSymbol(markerSymbol); 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.