|
POST
|
You could also set mouseChildren to false on the Graphic.
... View more
11-01-2010
01:47 PM
|
0
|
0
|
1438
|
|
POST
|
There's not an easy way to get to the Graphic from the InfoWindow. It sounds like you're using Graphic.infoWindowRenderer. If you also listen for click on the Graphic, you can save the clicked Graphic to a var and then refer back to it in the zoomHandler. The zoomHandler should take an Event, since that's what is being dispatched. You should be getting an error otherwise when you debug the app or use the Flash Debug player.
... View more
11-01-2010
01:45 PM
|
0
|
0
|
1444
|
|
POST
|
Have you also added useproxy="true" on the layer(s) that you want to use the proxy? I'd try using a tool like HttpFox to see what the requests and responses are when you run the Viewer.
... View more
11-01-2010
01:28 PM
|
0
|
0
|
4654
|
|
POST
|
Try: mainMap.infoWindow.addEventListener("zoomHere", zoomHandler);
... View more
11-01-2010
01:06 PM
|
0
|
0
|
1444
|
|
POST
|
The map's spatialReference property is read-only since we don't officially support changing it. Technically, it can be changed though by setting map.spatialReference.wkid. You'll also need to reproject any client side graphics.
... View more
10-28-2010
11:02 AM
|
0
|
0
|
626
|
|
POST
|
If the spatial reference of your map is web mercator, then it will convert to geographic. Try running config-all.xml for an example. If the spatial reference of your map is geographic, then no conversion is required, but if it's something else, you won't see geographic values.
... View more
10-22-2010
02:37 PM
|
0
|
0
|
1992
|
|
POST
|
There's not an easy way to handle this now. I'll enter an enhancement request to have FeatureLayerEvent.features populated for a "selectionClear" event. In the meantime, try doing this when you get a "selectionComplete" event: var featureLayer:FeatureLayer = event.featureLayer;
var selectedFeatures:Array = featureLayer.selectedFeatures;
for each (var graphic:Graphic in featureLayer.graphicProvider)
{
if (graphic.toolTip && selectedFeatures.indexOf(graphic) == -1)
{
graphic.toolTip = null;
}
}
... View more
10-22-2010
02:19 PM
|
0
|
0
|
770
|
|
POST
|
The Geometry Service's "Areas and Lengths" operation measures the area in the spatial reference of the input geometry, which in this case is web mercator. The web mercator projection stretches areas the further you go from the equator. I've updated the sample below to first project the polygon to 54034 (World_Cylindrical_Equal_Area). This will give more accurate results, but it's best to use an appropriate projection for the area you're measuring. For even better results, you can use the Geometry Service to densify the polygon before projecting it. <?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"
xmlns:esri="http://www.esri.com/2008/ags"
pageTitle="Measure Areas">
<!--
This sample shows how to use the DrawTool and GeometryService to:
- simplify ("clean") the drawn polygon
- measure the area of the polygon
- create a properly placed label for the polygon
Workflow for this sample:
1. Click on map to draw an area
2. Double-click to end the drawing
-> Calls onDrawEnd (as set up in DrawTool):
Sends polygon to geometry service for clean-up/simplication (in case lines cross etc)
-> When simplify has completed, simplifyCompleteHandler(event) is called (as setup in GeometryService task):
Adds cleaned up graphic to the graphics layer.
Sends cleaned up graphic to geometry service to be "measured".
-> When areasAndLengths has completed successfully, areasAndLengths_resultHandler is called.
Get the area.
Sends request for best placement of the label
-> When labelPoints has completed successfully, labelPoints_resultHandler will:
Display a label with the area.
-->
<s:layout>
<s:VerticalLayout horizontalAlign="center" paddingTop="5"/>
</s:layout>
<fx:Script>
<![CDATA[
import com.esri.ags.Graphic;
import com.esri.ags.SpatialReference;
import com.esri.ags.events.DrawEvent;
import com.esri.ags.events.GeometryServiceEvent;
import com.esri.ags.geometry.Extent;
import com.esri.ags.geometry.Geometry;
import com.esri.ags.symbols.TextSymbol;
import com.esri.ags.tasks.supportClasses.AreasAndLengthsParameters;
import com.esri.ags.tasks.supportClasses.AreasAndLengthsResult;
import mx.controls.Alert;
import mx.rpc.AsyncResponder;
import mx.rpc.Fault;
private function activateTool():void
{
drawTool.activate(DrawTool.POLYGON);
act.enabled = false;
deact.enabled = true;
}
private function deactivateTool():void
{
drawTool.deactivate();
deact.enabled = false;
act.enabled = true;
}
private function onDrawEnd(event:DrawEvent):void
{
// simplify the drawn polygon
// Note: As of version 2.0, GeometryService input is geometries (instead of graphics).
geometryService.simplify([ event.graphic.geometry ]);
}
private function simplifyCompleteHandler(event:GeometryServiceEvent):void
{
// Note: GeometryService returns geometries instead of graphics as of Flex API 2.0
if (event.result)
{
var polygon:Geometry = (event.result as Array)[0]; // we only draw one area at a time
var newGraphic:Graphic = new Graphic(polygon);
newGraphic.autoMoveToTop = false;
myGraphicsLayer.add(newGraphic);
// project to 54034 (World_Cylindrical_Equal_Area)
geometryService.project([ polygon ], new SpatialReference(54034), new AsyncResponder(project_resultHandler, project_faultHandler, polygon));
}
}
private function project_resultHandler(result:Object, token:Object = null):void
{
if (result)
{
var polygon:Geometry = (result as Array)[0];
var areasAndLengthsParameters:AreasAndLengthsParameters = new AreasAndLengthsParameters();
areasAndLengthsParameters.areaUnit = GeometryService.UNIT_SQUARE_KILOMETERS;
areasAndLengthsParameters.polygons = [ polygon ];
geometryService.areasAndLengths(areasAndLengthsParameters, new AsyncResponder(areasAndLengths_resultHandler, areasAndLengths_faultHandler, token));
}
}
private function project_faultHandler(fault:Fault, token:Object = null):void
{
Alert.show(fault.faultString + "\n\n" + fault.faultDetail, "project Fault " + fault.faultCode);
}
private function areasAndLengths_resultHandler(result:AreasAndLengthsResult, token:Object = null):void
{
const area:String = myNumberFormatter.format(result.areas[0]);
geometryService.labelPoints([ token ], new AsyncResponder(labelPoints_resultHandler, labelPoints_faultHandler, area + " km2."));
}
private function areasAndLengths_faultHandler(fault:Fault, token:Object = null):void
{
Alert.show(fault.faultString + "\n\n" + fault.faultDetail, "areasAndLengths Fault " + fault.faultCode);
}
private function labelPoints_resultHandler(result:Object, token:Object = null):void
{
for each (var geom:Geometry in result)
{
var g:Graphic = new Graphic();
g.geometry = geom;
var tf:TextFormat = new TextFormat(null, 16, 0x00FF00);
g.symbol = new TextSymbol(String(token), null, 0xFFFFFF, true, 0xFFFFFF, true,
0xFF0000, "middle", 0, 0, 0, tf);
myGraphicsLayer.add(g);
}
}
private function labelPoints_faultHandler(fault:Fault, token:Object = null):void
{
Alert.show(fault.faultString + "\n\n" + fault.faultDetail, "labelPoints Fault " + fault.faultCode);
}
]]>
</fx:Script>
<fx:Declarations>
<esri:DrawTool id="drawTool"
drawEnd="onDrawEnd(event)"
fillSymbol="{mySFS}"
map="{myMap}"/>
<esri:GeometryService id="geometryService"
showBusyCursor="true"
simplifyComplete="simplifyCompleteHandler(event)"
url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"/>
<esri:SimpleFillSymbol id="mySFS" color="0xAA0000">
<esri:SimpleLineSymbol width="2" color="0xAA0000"/>
</esri:SimpleFillSymbol>
<mx:NumberFormatter id="myNumberFormatter"
precision="2"
useThousandsSeparator="true"/>
</fx:Declarations>
<s:Label color="0xAA0000"
fontSize="14"
text="Draw an area with at least three nodes."/>
<s:HGroup>
<s:Button id="deact"
click="deactivateTool()"
label="Stop measuring"/>
<s:Button id="act"
click="activateTool()"
enabled="false"
label="Start measuring"/>
</s:HGroup>
<esri:Map id="myMap"
extent="{new Extent(-13658000, 5703000, -13655000, 5705000, new SpatialReference(102100))}"
load="drawTool.activate(DrawTool.POLYGON)">
<esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
<esri:GraphicsLayer id="myGraphicsLayer" symbol="{mySFS}"/>
</esri:Map>
</s:Application>
... View more
10-22-2010
01:39 PM
|
0
|
0
|
891
|
|
POST
|
Try also setting the buttonMode to true on the Image.
... View more
10-22-2010
10:29 AM
|
0
|
0
|
2237
|
|
POST
|
See the section on "How do you create a cache to match the Mercator-based ArcGIS Online Servcies?" at: http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/20/ArcGIS-Online-moving-to-Google-_2F00_-Bing-tiling-scheme_3A00_-What-does-this-mean-for-you_3F00_.aspx You may also need to contact Esri Support at: http://support.esri.com
... View more
10-22-2010
10:27 AM
|
0
|
0
|
856
|
|
POST
|
Are you using version 2.1? Do you get any errors when you start the app?
... View more
10-21-2010
01:59 PM
|
0
|
0
|
1761
|
|
POST
|
Nothing happens when you click the black circles? I tried the config from above with the change to the url and it seems to be working for me.
... View more
10-21-2010
01:17 PM
|
0
|
0
|
1761
|
|
POST
|
Try using a different GraphicsLayer (or don't specify one) and then call applyEdits() on drawEnd.
... View more
10-21-2010
12:38 PM
|
0
|
0
|
515
|
|
POST
|
Is it possible that you're using any widgets or custom code that's change the map's lods?
... View more
10-21-2010
12:30 PM
|
0
|
0
|
2187
|
|
POST
|
You need to escape the backslash with another backslash. See: http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7ef8.html
... View more
10-21-2010
12:14 PM
|
0
|
0
|
546
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-06-2017 01:13 PM | |
| 2 | 03-06-2017 02:12 PM | |
| 1 | 06-22-2010 12:01 PM | |
| 1 | 08-06-2012 09:29 AM |
| Online Status |
Offline
|
| Date Last Visited |
04-15-2025
04:18 PM
|