Created
November 26, 2013 15:50
-
-
Save tschaub/7660771 to your computer and use it in GitHub Desktop.
Highlight a feature on the map based on user interaction with a feature table. The two examples below provide a "highlight" function. In both cases, the application would be responsible for getting a feature based on user interaction with a feature table. The highlight function just shows the code necessary to highlight the feature on the map.
This file contains hidden or 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
/** | |
* Layer with a style that provides symbolizers for | |
* the "selected" render intent defined elsewhere. | |
*/ | |
function highlight(feature) { | |
feature.setRenderIntent('selected'); | |
} |
This file contains hidden or 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
/** | |
* Layer and highlightStyle defined elsewhere. | |
*/ | |
function highlight(feature) { | |
var geometry = feature.getGeometry(); | |
map.requestRenderFrame(); | |
layer.setRenderGeometryFunction(function(candidate) { | |
return geometry !== candidate; | |
}); | |
map.on('postcompose', function(evt) { | |
var render = evt.getRender(); | |
render.drawFeature(feature, highlightStyle); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment