[Spanish] Geoserver Flex openscales2

J.Alejandro Martinez Linares islanis at infomed.sld.cu
Tue Feb 21 12:19:20 EST 2012


Hola amigos aca les dejo mi codigo y como soy nuevo y no me sale lo que 
quiero quiero, que noe s mas que  sacar datos de un server geoserver que 
tengo montado de un mapa que tengo ahi pero que normalmente con 
openlayer de geoserver me deja ver su info pero mi idea con esto es 
hacer click sobre mi mapa y que este me sque un popup con esos datos de 
donde hice click , eso me haria falta que alguien mirara mi codigo y me 
corrigiera es que soy nuevo gracias de antemano

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" 
minHeight="600" xmlns:os="http://openscales.org"
                creationComplete="initMap();">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<os:Map id="fxmap" width="100%" height="100%" 
center="-79.41716,22.09477" resolution="0.0115781200" visible="false" 
projection="EPSG:4326">
<os:WMS name="Cuba provincias (WMS)" 
url="http://localhost:8080/geoserver/wfs" layers="une:uneProvincia" 
format="image/png" version="1.3.0"/>
<os:WMS name="Cuba Radiacin Solar (WMS)" 
url="http://localhost:8080/geoserver/wfs" layers="une:uneSolar" 
format="image/png"  x="8" y="14" alpha="0.8"/>
<os:SelectFeaturesHandler id="selectFeaturesHandler" active="true" 
enableClickSelection="false" enableBoxSelection="false" 
enableOverSelection="true"/>
<os:DataOriginatorsDisplay x="10" y="{height-90}" />
<os:DragHandler/>
<os:WheelHandler/>
<os:PanZoom id="panZoom" x="12" y="34"  width="141" height="333"/>
</os:Map>

<fx:Script>
<![CDATA[
             import org.openscales.core.Map;
             import org.openscales.core.basetypes.Resolution;
             import org.openscales.core.events.FeatureEvent;
             import org.openscales.fx.popup.FxPopup;
             import org.openscales.fx.popup.renderer.FxPopupRenderer;
             import org.openscales.geometry.basetypes.Pixel;
             private var fxpopup:FxPopup;

             [Bindable]
             private var map:FxMap;

             private function initMap():void {
                 map=fxmap;
                 map.center = "-82.82,21.70,EPSG:4326";
                 map.resolution = new Resolution(0.001343323, "EPSG:4326");
                 map.visible = true;

                 map.map.addEventListener(FeatureEvent.FEATURE_CLICK, 
this.onFeatureClick);

             }
             public function onFeatureClick(event:FeatureEvent):void
             {
                 map.visible = false;
                 if(fxpopup){
                     fxpopup.destroy();
                 }
                 fxpopup = null;
                 fxpopup = new FxPopup();
                 fxpopup.fxmap = map;

                 var content:String="";

                 var fxpopupRenderer:FxPopupRenderer = new 
FxPopupRenderer();
                 fxpopup.popupRenderer = fxpopupRenderer;
                 fxpopup.feature = event.feature;

                 var pixel:Pixel = 
fxpopup.fxmap.map.getMapPxFromLocation(event.feature.lonlat);
                 fxpopup.relativePosition = 
fxpopup.calculateRelativePosition(pixel);
                 fxpopup.position = pixel;
                 fxpopup.setCurrentState(fxpopup.relativePosition,false);


                 if(event.feature.name){
                     fxpopupRenderer.titleContent = event.feature.name;
                 }

                 for(var attribute:String in event.feature.attributes) {
                     if((attribute != "name"))
                         content = content + "<b>" + attribute + "</b> : 
" + event.feature.attributes[attribute] + "<br />";
                 }

                 fxpopupRenderer.content = content;
                 map.addFxPopup(fxpopup,true);
                 fxpopup.visible = true;

             }

         ]]>
</fx:Script>

</s:Application>

--

Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/


More information about the Spanish mailing list