POST
|
I am setting the infoWindow on the individual graphics of the graphicslayer. When I tried taking that out of the for each loop, then my infoWindow only had a title and no data. public function layerQueryResults(qryFeatures:FeatureSet, token:Object = null): void {
/* populate graphic layer with features returned from the querytask. Using a graphiclayer instead of just calling
the service allows you to add tool tips etc that aren't available otherwise */
for each(var myGraphic : Graphic in qryFeatures.features) {
var houseVis:Boolean = houseLayer.visible;
var senateVis:Boolean = senateLayer.visible;
var congressVis:Boolean = congressLayer.visible;
/* myGraphic.addEventListener(MouseEvent.ROLL_OVER, onMouseOver);
myGraphic.addEventListener(MouseEvent.ROLL_OUT, onMouseOut); */
myGraphic.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
myGraphic.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
//myGraphic.infoWindowRenderer = new ClassFactory(MyDistrictWindowRenderer);
myGraphicsLayer.add( myGraphic );
}
// myGraphicsLayer.graphicProvider = qryFeatures.features;
myGraphicsLayer.symbol = compositeSymbol;
mainMap.addLayer(myGraphicsLayer);
}
... View more
03-22-2012
06:54 AM
|
0
|
0
|
280
|
POST
|
I have written an external component that will check to see what layers are currently turned on and based on that, will show different results in in the infoWindow. My infoWindowRenderer is: <?xml version="1.0" encoding="utf-8"?> <mx:VBox 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:supportClasses="com.esri.ags.components.supportClasses.*" initialize="initRenderer()"> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <fx:Script> <![CDATA[ import com.esri.ags.Map; import mx.core.FlexGlobals; [Bindable] public var mainMap:Map; [Bindable] public var houseVis:Boolean; [Bindable] public var senateVis:Boolean; [Bindable] public var congressVis:Boolean; public function initRenderer(): void { mainMap = FlexGlobals.topLevelApplication.mainMap; houseVis = FlexGlobals.topLevelApplication.houseLayer.visible; senateVis = FlexGlobals.topLevelApplication.senateLayer.visible; congressVis = FlexGlobals.topLevelApplication.congressLayer.visible; trace ("within MyDistrictWindowRenderer, mainMap is " + mainMap.id + ", houseVis = " + houseVis + ", senateVis = " + senateVis + ", congressVis = " + congressVis); } ]]> </fx:Script> <supportClasses:InfoWindowLabel text="Missouri Districts" styleName="balloonTitle" /> <s:Label includeInLayout="{houseVis != ''? true:false}" visible="{houseVis != ''? true:false}" text="House: {data.HOUSE_DIST}" paddingTop="2"/> <s:Label includeInLayout="{senateVis != ''? true:false}" visible="{senateVis != ''? true:false}" text="Senate: {data.SEN_DIST}" paddingTop="2" /> <s:Label includeInLayout="{congressVis != ''? true:false}" visible="{congressVis != ''? true:false}" text="Congressional: {data.CONG_DIST}" paddingTop="2" /> </mx:VBox> I'm using a graphicslayer with event listeners to add the infoWindow (these are polygons). I have a composite layer that I'm using for labeling that contains fields for house, senate and congressional districts (so I can return all 3 districts from a single click into a single infoWindow). Whatever combination of layers I have turned on, the Renderer should recognize and set the visibility for each label based on the variable I have set for layer visibility. This should make my infoWindowRenderer a lot more dynamic. Here is where I'm calling the infoWindow: private function onMouseUp(event:MouseEvent):void { var g:Graphic = Graphic(event.currentTarget); mainMap.infoWindow.hide(); mainMap.infoWindow.data = g.attributes; mainMap.infoWindow.closeButtonVisible=true; mainMap.infoWindow.content = myInfoWindowRenderer.newInstance(); mainMap.infoWindow.show( MapPoint(g.geometry.extent.center) ); mainMap.infoWindow.styleName = "myInfoWindow"; g.checkForMouseListeners = false; } This works up to a point. For example, if I have all 3 layers turned on, when I click I see all 3 district numbers listed. When I turn off a layer (for example, house) and click in another part of the state, it shows me just the senate and congressional and the house is not included. If I click back to my original area, it still remembers that original graphic (or event.currentTarget). It will continue to remember what the visibility/renderer settings were for as many times as I care to click in that same area. Is there a way to clear this out and somehow not have it remember that I've already clicked it once so it resets the infoWindowRenderer?
... View more
03-16-2012
08:55 AM
|
0
|
5
|
640
|
POST
|
Thanks so much. I would have like to do this from within Aptana, but it seems to be working well enough with Firebug.
... View more
03-14-2012
11:38 AM
|
0
|
0
|
469
|
POST
|
Based on the Getting Started section > Setting up a Developer Environment, I've download and installed Aptana Studio 2.0. It seems to want Firefox as it's browser, so I downloaded and started that too. I can run my code from Studio, but I can't get it to debug. I suspect it's a compatibility problem between the version of Aptana, firefox, the version of Aptana debugger and firebug (I think ...) It tries, opening a browser that says' Aptana Firefox extension launching ... please wait.' But this eventually times out with an error 'Launching 'myconfig' has encountered a problem . I had Firefox version 10 loaded and thought maybe that was my problem and loaded an older version (7.0). I have Aptana Debugger 1.7.2 installed. It says it requires firebug 1.2-1.8 to work. My Firebug is 1.9.1. Is there not a matrix somewhere that spells out in more detail what versions of these add-ons are compatible with each other? If I update my Aptana Studio to version 3, it seems like none of the code assist works for the API, so I was trying to avoid that.
... View more
03-07-2012
12:25 PM
|
0
|
2
|
966
|
POST
|
Thank you so much. I'm still fiddling with this because the year isn't really an attribute ( my underlying graphics layer has both years in it), but otherwise it seems to be working for me. I've been messing with this off and on for a week!
... View more
02-23-2012
09:36 AM
|
0
|
0
|
287
|
POST
|
I have been successfully using a click event on my datagrid to display an infoWindow. This works fine as long as I have only one kind of ClassFactory for my infoWindowRenderer. I define it at the top of the script tag as: [Bindable] public var myCountyWindowRenderer:ClassFactory = new ClassFactory(MyCountyWindowRenderer); Then I have an item click event as: private function onDG_ItemClick():void { mainMap.infoWindow.styleName = "myInfoWindow"; mainMap.infoWindow.closeButtonVisible=true; var obj:Object = this.selectedItem; var clickGraphic:Graphic = findGraphicByAttribute(obj); mainMap.infoWindow.content = myCountyWindowRenderer.newInstance(); mainMap.infoWindow.data = obj; mainMap.infoWindow.show( MapPoint(clickGraphic.geometry.extent.center) ); } Now I am generating my datagrids more dynamically. From my reading, a ClassFactory isn't something I can easily generate on the fly in Actionscript. So I created a series of renderers that look something like this: <?xml version="1.0" encoding="utf-8"?> <mx:VBox 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:supportClasses="com.esri.ags.components.supportClasses.*" xmlns:esri="http://www.esri.com/2008/ags" > <fx:Declarations> <mx:NumberFormatter id="pctFormatter" precision="2" useNegativeSign="true" rounding="nearest" /> <mx:NumberFormatter id="wholeNumberFormatter" precision="0" useNegativeSign="true" rounding="nearest" /> </fx:Declarations> <supportClasses:InfoWindowLabel text="{data.NAME2}" width="150%" /> <s:Label id="lbl1_crop2002" text="Acres Treated: {wholeNumberFormatter.format(data.CROP_2002_ACRES_TREATED)}"/> <s:Label id="lbl2_crop2002" text="Sq. Miles Treated: {data.CROP_2002_SQMILES_TREATED}"/> <s:Label id="lbl3_crop2002" text="Percent Area Treated: {pctFormatter.format(data.CROP_2002_PCTAREATREATED)}%"/> <s:Label id="lbl4_crop2002" text="Percent Inc/Dec 2002-2007: {pctFormatter.format(data.CROP_PCT_INCDEC_2002_2007)}%"/> </mx:VBox> On the map, for the graphic's mouse click event, I then ended up checking to see what type of data I was displaying and setting the infoWindowRenderer for each graphic. Cludgy, but it works: switch (category){ case "CROP": if (yearValue == "2002") { myGraphic.infoWindowRenderer = new ClassFactory(InfoWindow_crop2002); //var infoWindowRenderer:ClassFactory = new ClassFactory(InfoWindow_crop2002); }else { myGraphic.infoWindowRenderer = new ClassFactory(InfoWindow_crop2007); } break; case "PAST": if (yearValue == "2002") { myGraphic.infoWindowRenderer = new ClassFactory(InfoWindow_past2002); }else { myGraphic.infoWindowRenderer = new ClassFactory(InfoWindow_past2007); } break; case "SOIL": if (yearValue == "2002") { myGraphic.infoWindowRenderer = new ClassFactory(InfoWindow_soil2002); }else { myGraphic.infoWindowRenderer = new ClassFactory(InfoWindow_soil2007); } break; case "WEED": if (yearValue == "2002") { myGraphic.infoWindowRenderer = new ClassFactory(InfoWindow_weed2002); }else { myGraphic.infoWindowRenderer = new ClassFactory(InfoWindow_weed2007); } break; } Now I want similar behavior for my datagrid items. First of all, I would think I could get to the infoWindowRenderer of the graphic since it has previously been defined. But I can't seem to get away from having to continue to create a individual instances of each ClassFactory for the renderer within my datagrid component. Even after doing a similar 'looping' for determining which map.infowindow.content to use, my infoWindow is still blank. My datagrid component is attached. I'm sure there is a much cleaner way to do this!
... View more
02-21-2012
11:03 AM
|
0
|
2
|
827
|
POST
|
I think the navigation widget is different than a lot of the other widgets because navigation is sort of standalone anyway (only deals with the map, not any of your layers etc). I wouldn't expect to see hardly anyone pulling apart the widgets and converting them to standalone. I wouldn't recommend that you even try. There is a lot of overhead involved that keeping the widget interaction going that completely falls apart once you start to use just parts of a widget . (Unless you're a programmer, then go for it!) Otherwise, if there are certain pieces of functionality you need, there are lots of examples in the API reference. Personally I'm not a fan of the widget approach because I see people put a lot of extra tools in their map because they're easy to add, not because they really need them. I seem to be in the minority, though.
... View more
02-07-2012
12:02 PM
|
0
|
0
|
303
|
POST
|
There is no 'removeAll' option on the data provider. The dg.columns = []; sounded promising. But no go! I have the datagrid as a separate custom component (it has listeners etc back to the graphicslayer) and the titlewindow is also custom. I'm making a new datagrid each time var dg:Fields_DataGrid = new Fields_DataGrid; but the titlewindow was a variable set at the top. This turned out to be the problem, I needed to create a new one. (You'd think I would have seen a bunch of datagrid all getting added to the same titlewindow, but it didn't work out that way!) Thanks for your assistance, I need an extra pair of eyes, and I don't have anyone around me to ask!
... View more
02-02-2012
05:41 AM
|
0
|
0
|
202
|
POST
|
I have a map services with many fields. There are logical names to the fields like "Pasture_2002_Acres", Pasture_2007_Acres", "Crops_2002_Acres", "Crops_2007_Acres" I created an array of fields that I'd like to have show up in a datagrid. Based on whether the user wants to see Pasture information vs Crop information, the fields you'd want to see would be different. I've run a querytask that generates a graphics layer and it contains all the attributes. If the user wants to see just Pasture information, I made an array of just the fields related to that. These become the fieldnames for a newly creaed datagrid. The year is set from a radio button. The results is an ArrayCollection I populated during the OnResults function of the querytask and it does have the right data in it. var fieldNameArray:Array = ["COUNTY","SQMILES",year+"_PASTURE_ACRES",year+"_PASTURE_SQMILES_TREATED",year+"_ PCTAREA_PASTURE"]; var selectDGcolumns:Array = []; for each (var fieldName:String in fieldNameArray) { var dgColumn:DataGridColumn = new DataGridColumn; dgColumn.dataField = fieldName; trace (dgColumn.dataField); dgColumn.setStyle("textAlign","right"); selectDGcolumns.push(dgColumn); } dg.columns = selectDGcolumns; dg.dataProvider = results; This works just great the first time around. I have an "Open Table" button that opens a titleWindow that displays the datagrid. The grid populates with the fields and values I expect. The problem comes in when I want to change to a different subject. The field array traces just fine (shows the change in the year).But when I go back through the 'for each' loop, the columns in the datagrid continue to be the ones I had chosen from the first time I used the tool. I think I have emptied the array out by maybe I'm not understanding how to empty out all my arrays etc properly.
... View more
02-01-2012
12:55 PM
|
0
|
2
|
583
|
POST
|
I've experienced a similar problem myself. The source does display, but the scrollbar that comes up doesn' really scroll through the entire set of code. I remembered that all the samples were included in the API download and I've just been going there instead.
... View more
01-31-2012
08:14 AM
|
0
|
0
|
196
|
POST
|
Yes, you can include these as part of your component. You'd want to insert something like this: <mx:LinkButton label="View Website" click="{navigateToURL(new URLRequest(data.URL_ADDRESS), '_blank');}" toolTip = "Click to view web site for this location" includeInLayout="{data.URL_ADDRESS.length > 1? true:false}" visible="{data.URL_ADDRES.length > 1? true:false}" /> I like to add the 'includeInLayout' and 'visible' arguments because in my data I may or may not have a URL in my link field (URL_ADDRESS in this example).
... View more
01-31-2012
08:09 AM
|
0
|
0
|
184
|
POST
|
Thanks! It didn't even occur to me that the formatter would return a string! I figured if it was a numberformatter, it would be a number. I think truncating would work in this situation since I have such a string of 000000s on some of these. Tracy
... View more
01-31-2012
07:59 AM
|
0
|
0
|
203
|
POST
|
I'm working on dynamically finding the classbreaks from a user selected field. The data is all numeric. Some fields contain whole numbers, some contain numbers with decimals. For the columns that have numbers with decimal places, these are not well formatted. I'm executing a querytask and in the results function I'm capturing the values in the selected field in an array, which I'm using to figure the class break intervals. Here's a sample of the values that might be returned: 0,0.09,0.13,0.25,0.31,0.43,0.94,1.22,1.34,1.74,1.81,1.91,1.91,2.1,2.15,2.39,2.5,2.93,3.14,3.21,3.44,3.65,3.72,3.77,3.84,3.91,4.14,4.19,4.25,4.29,4.3,4.44,4.46,4.61,4.61,4.62,4.73,4.79,4.87,4.92,4.99,5,5.0200000000000005,5.03,5.08,5.1000000000000005,5.21,5.22,5.24,5.3100000000000005,5.48,5.49,5.67,5.69,5.71,5.75,5.78,6.16,6.17,6.19,6.42,6.46,6.48,6.53,6.54,6.65,6.94,6.95,7.140000000000001,7.22,7.29,7.33,7.39,7.76,7.77,7.87,7.89,8.01,8.08,8.31,8.36,8.42,8.53,8.71,8.82,8.9,8.94,9.09,9.290000000000001,9.31,9.59,9.63,9.72,9.85,10.1,10.16,10.17,10.3,10.43,10.59,10.71,10.8,11.05,11.41,11.62,12.03,12.75,13.07,13.77,13.86,15.11,15.61,17.26,17.990000000000002,19.59 One, I'm not sure why some of my original values are returned with those very long decimal places. I'm wanting to use a number format to change these few poorly formatted numbers to match the rest. I created a number formatter as <mx:NumberFormatter id="pctBreakFormatter" precision="2" useNegativeSign="true" /> I'm selecting the numbers from the Array as var intervalBreak = Math.round(myArray.length / myInterval); var interval:int = 5; for (var i:Number = 1 i < interval + 1); i++) { var dataValue:Number = myArray[(intervalBreak * i) -1]; } So I'm defining dataValue as a number and then I ought to be able to apply the number format so that the numbers that have extra decimals match. pctBreakFormatter.format(dataValue); I don't see any changes to dataValue. If the number from the array selected was 5.1000000000000000005, it still looks that way after I apply the formatter. If I try to set a new variable: var newDataValue:Number = pctBreakFormatter.format(dataValue); Then I get an error 1067: Implicit coercion of a value of type String to an unrelated type Number. I don't understand why. At one point does it think that dataValue is a String, not a number? It doesn't work to force it back to a number using 'as Number' either. If I try that, then the variable ends up with the value of "0". It might be OK to have my classbreaks have numbers with very long decimal places, but I'm also using these numbers to create a legend and I can't leave them this way.
... View more
01-31-2012
07:37 AM
|
0
|
2
|
2005
|
POST
|
That's good to know so I can make the adjustments once version 3 comes out. For the moment, even though I know I shouldn't have gaps, I'm thinking I"m going to need to do a little math like adding or subtracting 0.001 to my values to get the results I'm expecting. My data is to 2 decimal places, so I think it will work out OK. In the meantime, I found the reference I was looking for, not under the API reference, but under the Concepts: http://help.arcgis.com/en/webapi/flex/help/index.html#/Symbolizing_graphics_with_renderers/017p0000000n000000/ "Any value that is greater than or equal to the minimum will be included in the break. Any value that is less than the maximum will be included in the break. Consequently, if you have two breaks, 0???10 and 10???20, the value 10 would fall in the second break (10???20). "
... View more
01-26-2012
12:27 PM
|
0
|
0
|
443
|
POST
|
I'm trying to dynamically calculate a quintile map, leaving the field mapped as a variable. I've captured the values dynamically from the specified field and figured out where my breaks should be within my data. My problem is in the logic of how classbreakinfos work. In the examples, it looks like the max value for the first interval is repeated again as the min value of the next interval [HTML] <esri:GraphicsLayer id="graphicsLayer"> <esri:renderer> <esri:ClassBreaksRenderer attribute="ranking"> <esri:ClassBreakInfo maxValue="0.33" symbol="{smallSym}"/> <esri:ClassBreakInfo maxValue="0.67" minValue="0.33" symbol="{mediumSym}"/> <esri:ClassBreakInfo minValue="0.67" symbol="{largeSym}"/> </esri:ClassBreaksRenderer> </esri:renderer> </esri:GraphicsLayer>[/HTML] It seems to me like the min value of each next interval would be something like "maxValue + 0.1", not just a repeat of the max value again. This doesn't seem logical to me. If I was using ArcGIS, the starting interval is always an increase for the ending value of the previous break. Example in ArcGIS: interval 1 = 0-58.56 interval 2 = 58.57 - 88.42 interval 3 = 88.43 - 126.57 interval 4 = 126.58 - 184.03 interval 5 = 184.94 - 559.21 If I use this same logic programmatically, then the polygons with the values 58.56, 88.42, 126, 57, 184.03 and 559.21 don't draw at all (even though I do have a default symbol!). If I modify my min max values to "overlap" the value of the previous interval - interval 1 = 0-58.56 interval 2 = 58.56 - 88.42 interval 3 = 88.42 - 126.57 interval 4 = 126.57 - 184.03 interval 5 = 184.04 - 559.21 Then the symbols draw, but those same polygons have the symbol from the next "highest" symbology, not the one I'd expect. It seems like I read something about being careful where you put your breaks, but now that I'm having this problem, I can't find the reference anywhere!
... View more
01-25-2012
12:03 PM
|
0
|
2
|
894
|
Title | Kudos | Posted |
---|---|---|
1 | 03-18-2022 10:14 AM | |
1 | 02-18-2016 06:28 AM | |
1 | 03-18-2024 07:29 AM | |
4 | 08-02-2023 06:08 AM | |
1 | 10-26-2022 08:27 AM |
Online Status |
Offline
|
Date Last Visited |
4 weeks ago
|