Hi,
I've detected a strange behaviour adding a vector layer (EPSG:4326) to
a Mapnik base layer. The same layer is not always properly rendered.
See the code below:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute"
xmlns:os="
http://openscales.org" creationComplete="initMap();">
<mx:Script>
<![CDATA[
import com.mgm.solapexplorer.GLServer.OpenScalesGLSLayer;
import com.mgm.solapexplorer.GLServer.GLSData;
import org.openscales.core.Map;
import org.openscales.core.feature.MultiPolygonFeature;
import org.openscales.core.layer.FeatureLayer;
import org.openscales.core.geometry.LinearRing;
import org.openscales.core.geometry.MultiPolygon;
import org.openscales.core.geometry.Polygon;
import org.openscales.core.style.Style;
import org.openscales.core.style.Rule;
import org.openscales.core.style.symbolizer.PolygonSymbolizer;
import org.openscales.core.style.stroke.Stroke;
import org.openscales.core.style.symbolizer.LineSymbolizer;
import org.openscales.core.style.symbolizer.PointSymbolizer;
import org.openscales.core.style.fill.SolidFill;
private function initMap():void {
var map=fxmap.map;
var layer:FeatureLayer = new FeatureLayer("Drawing
samples",false,true,"EPSG:4326");
var style:Style;
var rule:Rule;
var arrayComponents:Array;
var arrayVertices:Array;
// Add a MultiPolygon.
var polygonArray:Array = new Array();
style = new Style();
style.rules[0] = new Rule();
(style.rules[0] as Rule).symbolizers.push(new PolygonSymbolizer(new
SolidFill(0xFF00FF,0.5),new Stroke(0xFF00FF,2)));
arrayComponents = new Array();
arrayVertices = new Array();
arrayVertices.push(new
org.openscales.core.geometry.Point(-75.71,-17.50));
arrayVertices.push(new
org.openscales.core.geometry.Point(-67.053,-17.50));
arrayVertices.push(new
org.openscales.core.geometry.Point(-67.053,-55.71));
arrayVertices.push(new
org.openscales.core.geometry.Point(-75.71,-55.71));
arrayComponents.push(new LinearRing(arrayVertices));
arrayVertices = new Array();
arrayVertices.push(new
org.openscales.core.geometry.Point(-68.396665573120117,
-54.959449768066406));
arrayVertices.push(new
org.openscales.core.geometry.Point(-69.061111450195312,
-55.057228088378906));
arrayVertices.push(new
org.openscales.core.geometry.Point(-68.210556030273438,
-55.265007019042969));
arrayVertices.push(new
org.openscales.core.geometry.Point(-68.745010375976563,
-55.2711181640625));
arrayVertices.push(new
org.openscales.core.geometry.Point(-68.159454345703125,
-55.398612976074219));
arrayVertices.push(new
org.openscales.core.geometry.Point(-68.053619384765625,
-55.712501525878906));
arrayVertices.push(new
org.openscales.core.geometry.Point(-68.376113891601563,
-55.476951599121087));
arrayVertices.push(new
org.openscales.core.geometry.Point(-68.939178466796875,
-55.459724426269531));
arrayVertices.push(new
org.openscales.core.geometry.Point(-68.775009155273437,
-55.384170532226562));
arrayComponents.push(new LinearRing(arrayVertices));
polygonArray.push(new Polygon(arrayComponents));
layer.addFeature(new MultiPolygonFeature(new
MultiPolygon(polygonArray),null,style));
map.addLayer(layer);
}
]]>
</mx:Script>
<mx:Canvas
width ="100%"
height ="100%"
horizontalScrollPolicy ="off"
verticalScrollPolicy ="off">
<os:Map id="fxmap" width="100%" height="100%" zoom="3"
centerLonLat="4.84479575848897,45.7531798723947">
<os:Mapnik name="Mapnik"
isBaseLayer="true" />
<os:MousePosition x="10" y="{height-20}" displayProjection="EPSG:
4326"/>
<os:PanZoomBar />
<os:DragHandler />
<os:ClickHandler />
<os:WheelHandler />
</os:Map>
<mx:Button label="Button" click="initMap()"/>
</mx:Canvas>
</mx:Application>
After loading the application the initMap() function is executed and
the layer is rendered OK.
If the application creation complete event is deleted and the
initMap() function is called using the button then the layer is
rendered in a wrong place.
Any idea why this happen? I'm doing something wrong?
Thanks in advance.
Manel
--
You received this message because you are subscribed to the Google Groups "openscales-dev" group.
To post to this group, send email to
opensca...@googlegroups.com.
To unsubscribe from this group, send email to
openscales-de...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/openscales-dev?hl=en.