1) {
currentStyleName = (this.styles[1] as Style).name;
this.styles.splice(1, this.styles.length);
}
switch (currentStyleName) {
case "Latitude related coloration":
Trace.info("Use the 'Geographical coloration' style");
this.createStyleGeographical();
break;
case "Geographical coloration":
Trace.info("Use the 'Latitude related coloration' style");
this.createStyleLatitude();
break;
default:
Trace.warning("Error in the style's names used => use the 'Latitude related coloration' style");
this.createStyleLatitude();
}
this.generateLegend();
}
private function createStyleLatitude():void {
var style:Style = new Style();
style.name = "Latitude related coloration";
var fill:SolidFill, stroke:Stroke, symbolizer:Symbolizer, rule:Rule;
rule = new Rule();
rule.name = "Centroid Y-coordinate in [70000;75000]";
fill = new SolidFill(0x176273, .8);
stroke = new Stroke(0x0A2C33, 2);
symbolizer = new PolygonSymbolizer(fill, stroke);
rule.symbolizers.push(symbolizer);
rule.filter = new CentroidYFilter(70000, 75000);
style.rules.push(rule);
rule = new Rule();
rule.name = "Centroid Y-coordinate in [65000;70000]";
fill = new SolidFill(0xD8F20F, .8);
stroke = new Stroke(0x2D3303, 2);
symbolizer = new PolygonSymbolizer(fill, stroke);
rule.symbolizers.push(symbolizer);
rule.filter = new CentroidYFilter(65000, 70000);
style.rules.push(rule);
rule = new Rule();
rule.name = "Centroid Y-coordinate out of previous ranges";
fill = new SolidFill(0x84BF7A, .8);
stroke = new Stroke(0x233321, 2);
symbolizer = new PolygonSymbolizer(fill, stroke);
rule.symbolizers.push(symbolizer);
rule.filter = new ElseFilter();
style.rules.push(rule);
this.styles.push(style);
this.ignGeoplaRegion.style = style;
this.ignGeoplaRegion.layer.redraw();
}
private function createStyleGeographical():void {
var style:Style = new Style();
style.name = "Geographical coloration";
var fill:SolidFill, stroke:Stroke, symbolizer:Symbolizer, rule:Rule;
var bounds:Bounds;
rule = new Rule();
rule.name = "Departements of Bourgogne";
fill = new SolidFill(0x176273, .8);
stroke = new Stroke(0x0A2C33, 2);
symbolizer = new PolygonSymbolizer(fill, stroke);
rule.symbolizers.push(symbolizer);
bounds = new Bounds(682105, 6558859, 892780, 6816381);
rule.filter = new ContainsFilter(bounds.toGeometry(), "EPSG:2154");
style.rules.push(rule);
rule = new Rule();
rule.name = "Other departements of France";
fill = new SolidFill(0x84BF7A, .8);
stroke = new Stroke(0x233321, 2);
symbolizer = new PolygonSymbolizer(fill, stroke);
rule.symbolizers.push(symbolizer);
rule.filter = new ElseFilter();
style.rules.push(rule);
this.styles.push(style);
this.ignGeoplaRegion.style = style;
this.ignGeoplaRegion.layer.redraw();
}
private function createBitmapStyle():Style {
var style:Style = new Style();
style.name = "France";
var fill:BitmapFill, stroke:Stroke, symbolizer:Symbolizer, rule:Rule;
var bounds:Bounds;
rule = new Rule();
rule.name = "France";
fill = new BitmapFill((new Pattern().bitmapData as BitmapData));
stroke = new Stroke(0xECF2BA, 6);
symbolizer = new PolygonSymbolizer(fill, stroke);
rule.symbolizers.push(symbolizer);
style.rules.push(rule);
this.styles[0] = style;
return style;
}
private function mouseOverDepartement(evt:MouseEvent):void {
//this.ignGeoplaRegion.toolTip = "coucou" + evt.localX;
}
]]>