new ExternalReaction(annot, func, params)
Create an ExternalReaction object.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
annot |
WIND.Annotation | The annotation where the reaction will be occure. | |
func |
string | The function that will occure. | |
params |
JSON |
<optional> |
-
The "func" parameter difers epending on the type of the annotation.
- "zoom": Zoom in on the annotation.
- "zoomWith": Zoom in on the annotation with an other annotation so that the map will be centered on them both.
Here we must give the second annotation (WIND.Annotation) in the "params" parameters - "highlight": Highlight the selected annotation.
- "focus": Highlight and zoom in on the selected annotation.
- "setFeatureStyle": Puts the selected annotation in a given style.
Here we must give the style (JSON) in the "params" parameters. It may contain 5 options: strokeColor, strokeWidth, strokeOpacity, fillColor and fillOpacity (Example 3). - "hide": Hides the selected anotation.
- "show": Shows the selected annotation.
- "zoom": Zoom in on the annotation.
- "highlight": Highlight the selected annotation.
- "focus": Highlight and zoom in on the selected annotation.
If "annot" is a map annotation, the "func" parameter can be:
Example 1
var carte = new WIND.Map('map',{});
var annot = carte.createAnnotation("Town",Bayonne","Polygon((1 1,2 2,3 3))");
var react = new WIND.ExternalReaction(annot,"zoom");
Example 2
var carte = new WIND.Map('map',{});
var annot = carte.createAnnotation("Town",Bayonne","Polygon((1 1,2 2,3 3))");
var annot1 = carte.createAnnotation("Town",Anglet","Polygon((4 4,5 5,6 6))");
var react = new WIND.ExternalReaction(annot,"zoomWith",annot1);
Example 3
var carte = new WIND.Map('map',{});
var annot = carte.createAnnotation("Town",Bayonne","Polygon((1 1,2 2,3 3))");
var react = new WIND.ExternalReaction(annot,"setFeatureStyle",{"strokeColor":"#40A497","strokeWidth":3,"strokeOpacity":1,"fillColor":"white","fillOpacity":0.5});