Last active
August 29, 2015 14:20
-
-
Save brunoksato/197c348cff49814e0eca to your computer and use it in GitHub Desktop.
mapa peretta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mapQuery($q) { | |
return { | |
require: ['esriFeatureLayer', '^esriMap', 'query'], | |
scope:{ | |
url: "=" | |
}, | |
controller: function ($scope, $element, $attrs) { | |
var queryDeferred = $q.defer(); | |
require(['esri/tasks/query'], function (QueryParameters) { | |
var query = new esri.tasks.QueryTask("http://geops-03:6080/arcgis/rest/services/Pegasus/Pegasus/MapServer/13"); | |
queryDeferred.resolve(query); | |
}); | |
this.getFind = function () { | |
return queryDeferred.promise; | |
}; | |
}, | |
link: function (scope, element, attrs, controllers) { | |
console.log(scope.url); | |
var layerController = controllers[0]; | |
var mapController = controllers[1]; | |
controllers[2].getFind().then(function (queryTask) { | |
var query = new esri.tasks.Query(); | |
query.where = "OBJECTID = 30386833"; | |
queryTask.execute(query).then(function (features) { | |
mapController.getMap().then(function (map) { | |
map.graphics.clear(); | |
var symbol = new esri.symbol.SimpleFillSymbol | |
(esri.symbol.SimpleFillSymbol.STYLE_SOLID, | |
new esri.symbol.SimpleLineSymbol | |
(esri.symbol.SimpleLineSymbol.STYLE_SOLID, | |
new Color([255, 255, 255, 0.35]), 1), | |
new Color([125, 125, 125, 0.35]) | |
); | |
//QueryTask returns a featureSet. Loop through features in the featureSet and add them to the map. | |
for (feature in features.features) | |
var graphic = feature; | |
graphic.setSymbol(symbol); | |
graphic.setInfoTemplate(infoTemplate); | |
map.graphics.add(graphic); | |
}); | |
}); | |
}); | |
} | |
} | |
} | |
<esri-feature-layer query ng-repeat="feature in features" title="{{feature.nome}}" | |
url="feature.url"> | |
</esri-feature-layer> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment