POST
|
Hi Tracy, You seem to have requirements similar to mine. Here is an example of how you can change infowindow contents. You can refernce the UIComponent(infowindow component) directly. I have a function which can be called from the datagrid's click event or from the graphic's click event. private function showInfoWindow(mapPoint:MapPoint, data:Object):void { var infoWindow:LabelDataRenderer; switch (data.CATEGORY) { case "CROP": infoWindow = new CropInfoWindow; break; case "SOIL": infoWindow = new SoilInfoWindow; break; case "WEED": infoWindow = new WeedInfoWindow; break; } infoWindow.data = data; myMap.infoWindowContent = infoWindow; myMap.infoWindow.show(mapPoint); } In this example all of the infowindow components extend com.esri.ags.components.LabelDataRenderer. The year logic is in the infowindow component. You could also use States within the infowindow component. The infowindows also need to override the 'set data' function. The function needs to make sure the infowindow is initialised before any of the label's text values can be set. override public function set data(value:Object):void { super.data = value; if (this.initialized) { //component is initialised. updateData(); } else { //need to wait for the component to initialise. //If it is not initialised, all the label controls etc will be null. this.removeEventListener(FlexEvent.INITIALIZE, init_completeHandler) this.addEventListener(FlexEvent.INITIALIZE, init_completeHandler); } } private function init_completeHandler(event:FlexEvent):void { //component is now initialised and the label control values can be set. updateData(); }
... View more
02-22-2012
07:41 PM
|
0
|
0
|
311
|
POST
|
There are many incredible flex mapping sites with or without the viewer framework. I dont think there is an advantage or disadvantage to either approach, if you are familiar with flex development. Here is an ESRI blog that has skinned and customised the viewer. The description reads: At the 2011 Esri Developer Summit we presented the "Go Electric" application to demonstrate how easily a Flex programmer could customize and extend the ArcGIS Viewer for Flex The key point here is "how easily a Flex Programmer could customise". http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2012/01/11/Taking-ArcGIS-Viewer-for-Flex-customization-to-the-next-level_3A00_-Go-Electric.aspx If you are serious about learning flex, I think keeping away from the both the viewer and mapping api is a good way to learn the foundations of flex. If you already know flex then you should have the foundations covered. Once you have solid flex foundations you can review the core mapping api and the provided ESRI samples, you can review the viewer and the many widgets, then make an informed decision of what is more suitable. It comes down to your own site specific requirements, and/or personal preference. If you just want to get a site up without learning the ins and outs of flex and are happy with being a "copy and paste ninjas" then the viewer is a good solid choice. You can customise widgets, create your own widgets and as the blog shows, skin the site too.
... View more
01-19-2012
06:40 PM
|
0
|
0
|
409
|
POST
|
Patrick, The code I added was a quick workaraound but not entirely foolproof. If th euser qwuiclky double or triple clicks a selected feature, the vertice's and move handles would still come up. Plus I had some extra requirements oustside of the attribute Inspector that was giving me some grief. So I have come up with a different solution by extending the Editor component. I am in the testing phase at the moment and will post here when finished. Depending on your requirements it may be a better solution. What exactly are you trying to achieve. What is your workflow or use case. If you able post your widget code I can have a look at what you need.
... View more
01-13-2012
11:14 AM
|
0
|
0
|
396
|
POST
|
I have come up with a workaround to this issue. This works for my paticular case as I only need to deal with one feature at a time. This workaround acts like a toggle to show/close the AttributeInpector window. Click once on the feature and thefeature will be selected and have the AttributeInpector shown. Click a second time on the feature and the feature will be de-selected and the AttributeInpector will close.
//add listeners when the editor component is created.
editor.attributeInspector.addEventListener(AttributeInspectorEvent.SHOW_FEATURE,attribute_showHandler);
map.infoWindow.addEventListener(Event.CLOSE,attribute_closeHandler);
/**
* Removes listener from the attributeInspector's activeFeature.
*/
protected function attribute_closeHandler(event:Event):void
{
if (editor.attributeInspector.activeFeature)
{
editor.attributeInspector.activeFeature.removeEventListener(MouseEvent.CLICK,attributeFeature_clickHandler);
}
}
/**
* Adds listener to the attributeInspector's activeFeature.
*/
protected function attribute_showHandler(event:AttributeInspectorEvent):void
{
event.feature.addEventListener(MouseEvent.CLICK,attributeFeature_clickHandler);
}
/**
* Clears the FeatureLayers selection. Clearing the selection will also trigger the attribute_closeHandler.
* Workaround to prevent the user moving the features vertices or moving the entire feature.
* Without this, the feature will show vertice's on the second click, and the entire graphic will be able to be moved on the third click,
* even with editor.updateGeometryEnabled="false".
*/
protected function attributeFeature_clickHandler(event:MouseEvent):void
{
featureLayer.clearSelection();
}
... View more
01-10-2012
01:50 PM
|
0
|
0
|
396
|
POST
|
I am finding some interesting things with the Editor component. Editor updates geometry regardless of updateGeometryEnabled=false. All I want to do is edit attributes as part of a workflow. If I click a feature once and the attribute window opens as expected, click it a second time I can the move the vertices, click a third time I can move the entire feature. Any ideas why this is happening? I want to take advantage of the Editor components undo and redo feature. <?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:esri="http://www.esri.com/2008/ags">
<fx:Script>
<![CDATA[
import com.esri.ags.layers.FeatureLayer;
import com.esri.ags.tools.EditTool;
import mx.events.FlexEvent;
protected function editor_creationCompleteHandler(event:FlexEvent):void
{
var editTool:EditTool = editor.editTool;
editTool.allowAddVertices = false;
editTool.allowDeleteVertices = false;
editor.templatePicker.visible = false;
editor.templatePicker.includeInLayout = false;
editor.selectionDropDownList.visible = false;
editor.selectionDropDownList.includeInLayout = false;
editor.deleteButton.visible = false;
editor.deleteButton.includeInLayout = false;
editor.drawDropDownList.visible = false;
editor.drawDropDownList.includeInLayout = false;
}
]]>
</fx:Script>
<esri:Map id="map">
<esri:extent>
<esri:WebMercatorExtent minlon="-97.53" minlat="37.43" maxlon="-97.26" maxlat="37.64"/>
</esri:extent>
<esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
<esri:ArcGISDynamicMapServiceLayer id="opsLayer" url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSFields/MapServer"/>
<esri:FeatureLayer id="featureLayer"
mode="selection"
outFields="[activeprod, field_name, polydate, status, prod_oil]"
url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSFields/FeatureServer/0"/>
</esri:Map>
<s:BorderContainer x="55" y="10" >
<esri:Editor id="editor" width="300"
addEnabled="false"
deleteEnabled="false"
updateAttributesEnabled="true"
updateGeometryEnabled="false"
creationComplete="editor_creationCompleteHandler(event)"
featureLayers="{[featureLayer]}"
map="{map}"
toolbarCutVisible="true" toolbarMergeVisible="true" toolbarReshapeVisible="false"
toolbarVisible="true"/>
</s:BorderContainer>
</s:Application>
... View more
01-09-2012
08:20 PM
|
0
|
6
|
797
|
POST
|
Hi Sarthak, 1. So my code works for you with SNAP_MODE_ALWAYS_ON? Do you have some tested and working code that you can provide so I can see if it something to do with my set up. 2. I do not get the bold cross on 'shared' vertices where there is a 'T' intersection like in my image. It always wants to snap to the edge and does not find the vertex. If you use the code I provided, the extents go to the polygons in the image. You can test on those polygons.
... View more
12-14-2011
10:41 AM
|
0
|
0
|
361
|
POST
|
I am using the Editor to 'Split' a polygon that has an adjacent polygon.(using Version 2.5 api). Firstly I have set the Editor's EditTool to have SNAP_MODE_ALWAYS_ON, but I still have to hold the CTRL key for snapping to engage. Am I missing something? Secondly, snapping does NOT recognised the shared Vertice and I can not snap to it. See attached image. Any ideas? Can I turn off Line snapping and only snap to vertice? Code below is a modified copy from the samples and has extent of the polygon's I am trying to edit. It also sets the EditTool's properties when the Editor component is created.
<?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"
initialize="application1_initializeHandler(event)"
pageTitle="Editor with all toolbar options">
<!--
This sample shows you how to use the editor component with a full toolbar.
-->
<fx:Style>
@namespace esri "http://www.esri.com/2008/ags";
esri|InfoWindow
{
background-color : #FFFFFF;
border-thickness : 2;
}
</fx:Style>
<fx:Script>
<![CDATA[
import com.esri.ags.components.supportClasses.CreateOptions;
import com.esri.ags.tasks.GeometryService;
import com.esri.ags.tools.DrawTool;
import com.esri.ags.tools.EditTool;
import mx.events.FlexEvent;
protected function application1_initializeHandler(event:FlexEvent):void
{
myEditor.featureLayers = [ fireAreas ];
var myDrawTypePreferences:CreateOptions = new CreateOptions();
// change the defauls drawing tool from "point-to-point" to "freehand"
myDrawTypePreferences.polygonDrawTools = [ DrawTool.POLYGON, DrawTool.POLYLINE, CreateOptions.AUTO_COMPLETE ];
myEditor.createOptions = myDrawTypePreferences;
}
protected function myEditor_creationCompleteHandler(event:FlexEvent):void
{
var editTool:EditTool = myEditor.editTool;
editTool.snapMode = EditTool.SNAP_MODE_ALWAYS_ON;
editTool.allowAddVertices = false;
editTool.allowDeleteVertices = false;
}
]]>
</fx:Script>
<mx:VBox width="100%" height="100%">
<esri:Map id="map" wrapAround180="true">
<esri:extent>
<esri:Extent id="sheepfire"
xmin="14404817" ymin="-3626334" xmax="14991242" ymax="-3224581">
<esri:SpatialReference wkid="102100"/>
</esri:Extent>
</esri:extent>
<esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
<esri:FeatureLayer id="fireAreas" mode="snapshot" outFields="*"
url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Fire/Sheep/FeatureServer/2"/>
</esri:Map>
<esri:Editor id="myEditor" creationComplete="myEditor_creationCompleteHandler(event)"
width="100%"
geometryService="{new GeometryService('http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer')}"
map="{map}"
toolbarCutVisible="true"
toolbarMergeVisible="true"
toolbarReshapeVisible="true"
toolbarVisible="true"
/>
</mx:VBox>
</s:Application>
... View more
12-13-2011
05:22 PM
|
0
|
3
|
918
|
POST
|
It should work with any subclass of com.esri.ags.layers.Layer. I do not have a Bing Maps key so I can not test, but a VETiledLayer is a subclass of Layer. You need to add the layers to 'baseLayers'. My original code is only looking for ArcGISTiledMapServiceLayers. protected function MyMap_creationCompleteHandler(event:FlexEvent):void
{
baseLayers.push(yourBingLayer);
MySlider.minimum = 1;
MySlider.maximum = baseLayers.length;
MySlider.value = 0;
}
What is a Feature Service? Do you mean ArcGISDynamicMapServiceLayer or FeatureLayer. Either way they both subclass Layer and will work. The code below now includes an ArcGISDynamicMapServiceLayer and FeatureLayer in the Map. You can manually add the layers to 'baseLayers'.
//Manually add to 'baseLayers'
baseLayers.push(l5);
baseLayers.push(l6);
<esri:Map id="MyMap" creationComplete="MyMap_creationCompleteHandler(event)">
<esri:ArcGISTiledMapServiceLayer id="l0" url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" alpha="1"/>
<esri:ArcGISTiledMapServiceLayer id="l1" url="http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer" alpha="0"/>
<esri:ArcGISTiledMapServiceLayer id="l2" url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer" alpha="0"/>
<esri:ArcGISTiledMapServiceLayer id="l4" url="http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer" alpha="0"/>
<esri:ArcGISDynamicMapServiceLayer id="l5" url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer" alpha="0" />
<esri:FeatureLayer id="l6" definitionExpression="TYPE='city' AND POP1990 > 50000"
outFields="[CITY_NAME,CAPITAL,DIVORCED,POP1990,MALES,FEMALES]"
url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/0" alpha="0">
<esri:renderer>
<esri:UniqueValueRenderer attribute="CAPITAL">
<esri:defaultSymbol>
<esri:SimpleMarkerSymbol color="0xCCCCCC"
size="12"
style="x"/>
</esri:defaultSymbol>
<esri:UniqueValueInfo value="Y">
<esri:symbol>
<esri:CompositeSymbol>
<!-- Star in circle -->
<esri:SimpleMarkerSymbol color="0xFF0000"
size="22"
style="circle"/>
<esri:SimpleMarkerSymbol color="0xFFFFFF"
size="20"
style="triangle"/>
<esri:SimpleMarkerSymbol angle="180"
color="0xFFFFFF"
size="20"
style="triangle"/>
</esri:CompositeSymbol>
</esri:symbol>
</esri:UniqueValueInfo>
<esri:UniqueValueInfo value="N">
<esri:symbol>
<esri:SimpleMarkerSymbol color="0xFF0000"
size="18"
style="diamond"/>
</esri:symbol>
</esri:UniqueValueInfo>
</esri:UniqueValueRenderer>
</esri:renderer>
</esri:FeatureLayer>
</esri:Map>
... View more
08-30-2011
04:29 PM
|
0
|
0
|
562
|
POST
|
Try this one. This is a modification from my post at http://forums.esri.com/Thread.asp?c=158&f=2421&t=291069&mc=12#920431
<?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:esri="http://www.esri.com/2008/ags"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import com.esri.ags.layers.Layer;
import mx.events.FlexEvent;
private var baseLayers:Vector.<Layer> = new Vector.<Layer>();
protected function MySlider_changeHandler(event:Event):void
{
var currentValue:Number = event.currentTarget.value;
var floorValue:Number = Math.floor(event.currentTarget.value);
trace("Current Value: " + currentValue + " Floor Value: " + floorValue);
//set the alpha if it is les than the the max value
if (currentValue < event.currentTarget.maximum)
{
baseLayers[floorValue].alpha = currentValue - floorValue;
trace("Alpha (Current - Floor): " + (currentValue - floorValue));
}
//set the alpha for the previous layer one OR the last layer
baseLayers[floorValue - 1].alpha = 1 - (currentValue - floorValue);
trace("Previous Alpha: " + (1 - (currentValue - floorValue)));
//reset the alpha to zero for the layers that are not being merged.
//This is needed to cater for a track click
for (var i:int = 0; i < baseLayers.length; i++)
{
if (i > floorValue || i < floorValue - 1)
{
baseLayers.alpha = 0;
}
}
}
/*
Load the layers into the vector. Layers can be loaded by any method.
This method adds all ArcGISTiledMapServiceLayer's that are in the map.
You could hard code the layers to add.
You could also use an xml file or webservice etc.
*/
protected function MyMap_creationCompleteHandler(event:FlexEvent):void
{
for each (var layer:ArcGISTiledMapServiceLayer in MyMap.layers)
{
baseLayers.push(layer);
}
MySlider.minimum = 1;
MySlider.maximum = baseLayers.length;
MySlider.value = 0;
}
]]>
</fx:Script>
<fx:Declarations>
</fx:Declarations>
<esri:Map id="MyMap" creationComplete="MyMap_creationCompleteHandler(event)">
<esri:ArcGISTiledMapServiceLayer id="l0" url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" alpha="1"/>
<esri:ArcGISTiledMapServiceLayer id="l1" url="http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer" alpha="0"/>
<esri:ArcGISTiledMapServiceLayer id="l2" url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer" alpha="0"/>
<esri:ArcGISTiledMapServiceLayer id="l3" url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" alpha="0"/>
<esri:ArcGISTiledMapServiceLayer id="l4" url="http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer" alpha="0"/>
</esri:Map>
<s:Panel id="aPanel" title="Slider" height="100" width="500" bottom="20" horizontalCenter="0">
<s:layout>
<s:VerticalLayout paddingBottom="10" paddingTop="10" paddingLeft="10" paddingRight="10"/>
</s:layout>
<s:HSlider width="100%" id="MySlider"
minimum="1" maximum="5"
stepSize=".01"
value="0"
change="MySlider_changeHandler(event)" />
</s:Panel>
</s:Application>
... View more
08-29-2011
05:51 PM
|
0
|
0
|
562
|
POST
|
This looks great. I'm definitely looking forward to trying it out. Will it work with SFV 2.3.1? Jay, I have not tested with 2.3.1 It was built with 2.2
... View more
05-16-2011
12:50 PM
|
0
|
0
|
744
|
POST
|
I am running version 2.3.1 of the viewer, ArcGIS Server 9.3.1, and an SDE database model. There are no joins on any of the layers. Again, version 1.0 worked fine. Hi Curtis, Getting unique values now uses objectids in the querytask, which allows for the paging in the query. Objectids are new with ArcServer 10.xx. Thats why 9.3 data isnt being returned.
... View more
05-16-2011
12:49 PM
|
0
|
0
|
1070
|
POST
|
Hi Francesco, It is not set up to work with relationships. It works with data that has a join set in ArcGIS.
... View more
05-14-2011
03:29 PM
|
0
|
0
|
1070
|
POST
|
Hi Adam, This was driving me mad for ages. It turned out all I needed was to set the datagrids minwidth property! (in the selectionresult.mxml file.) I could then change the width and height of the datagrid to 100%.
... View more
05-12-2011
06:29 AM
|
0
|
0
|
1070
|
POST
|
The widget has now been updated with bug fixes and enhancements. I have started a new thread see: http://forums.arcgis.com/threads/30179-Selection-Widget-Updated-Version Hopefully changes for the better. Been a while coming. Studying, surfing (been goin off lately!) and my children have been taking up my spare time. Havent had a chance to get back to this for a while. Still no select by graphic option, wont get a chance to look at this for a while. Leave feedback on new thread.
... View more
05-12-2011
05:31 AM
|
0
|
0
|
486
|
POST
|
The Selection widget has a "Select by Attributes" and "Select by Location" option similar to ArcGIS. Widget link: http://www.arcgis.com/home/item.html?id=20ed6af9ab204548bbf092d51b51fef8 Version 1.5 of the widget replaces version 1.0 Enhancements and fixes include: *Each time a query layer was added it was also being added to the TOC. This has been fixed. *When resizing the widget, the datgrid would not resize properly. This has been fixed. *Uses paging for selection of unique value list. This means that ALL values will be parsed regardless of the ArcGISServer setting to limit responses. There is an option to ESC out of a large query. (This is only for the Unique list, not getting features). I have included an ESRI TaxParcel Layer that has 18,000+ records. Get Unique Values on the PSTLSTATE field to see this in action. Available on my example site. The URL is on the Widget download page. *Aliases can now be used. It will now use the Alias as set in the Featureclass. You can also override the Alias in the SelectionWidget.xml config file. *ArcGis layers that have joined tables will now work with fully qualified field names. (thanks Dasa for the idea) *Styling for selection colours has been documented in the SelectionWidget.xml config file (example provided). *Styling for datagrid has been changed. It can now also be styled in SelectionWidget.xml config file (example provided). (thanks Mehul for the idea) *Changed initial uniquevalue query to use "text='%'" instead of "where '1=1'" for Mike.:) *You can now override scale range for layers. *Link field now has a prefix/suffix option in the SelectionWidget.xml config file (naming convention the same as Robert SCheitlin's esearch widget) *Shape_area and Shape_length can be used in the fields. Link to previous thread :http://forums.arcgis.com/threads/24151-Selection-Widget-for-SFV2.2-(with-a-query-builder)
... View more
05-12-2011
05:24 AM
|
0
|
146
|
44500
|
Title | Kudos | Posted |
---|---|---|
1 | 11-02-2016 07:09 PM | |
3 | 11-03-2016 02:53 PM | |
1 | 10-12-2016 08:12 PM | |
1 | 10-27-2016 02:37 PM | |
1 | 10-12-2016 09:01 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|