|
POST
|
I've used this code to created the embedded image that I use with AlivePDF [Embed(source="/assets/Images/Boundary.png", mimeType="application/octet-stream")] var legendBoundary:Class;
... View more
06-11-2010
10:33 AM
|
0
|
0
|
497
|
|
POST
|
As you state, OnCreate is only fired when the command is created, whereas Enabled is fired continuously (which is also why you shouldn't have any extensive code in that subroutine). This will react to any changes in the environment, like enabling the extension.
... View more
06-10-2010
01:20 PM
|
0
|
0
|
1431
|
|
POST
|
This is what I've done for my extension (in VB.NET). All the commands on the toolbar were created with BaseCommand and I overrode the Enabled property of each command.
Public Overrides ReadOnly Property Enabled() As Boolean
Get
Dim ext As ESRI.ArcGIS.esriSystem.IExtension = m_application.FindExtensionByName("myExtension.Extension")
Dim extConf As ESRI.ArcGIS.esriSystem.IExtensionConfig = ext
If extConf.State = ESRI.ArcGIS.esriSystem.esriExtensionState.esriESEnabled Then
Return True
Else
Return False
End If
End Get
End Property
... View more
06-10-2010
11:51 AM
|
0
|
0
|
1431
|
|
POST
|
When I call my modeless form, I initialize its position to the center of the ArcMap window with the following code.
Dim InitializeForm As New myProject.Processing
InitializeForm.Form_Initialize(m_application)
InitializeForm.Show(New Win32HWNDWrapper(m_application.hWnd))
the following is the code for the form
Public Class Processing
Friend Sub Form_Initialize(ByVal m_Application As ESRI.ArcGIS.Framework.IApplication)
Dim pWinPos As ESRI.ArcGIS.Framework.IWindowPosition
Dim CenterX As Short
Dim CenterY As Short
pWinPos = m_Application
CenterX = (pWinPos.Width / 2) + pWinPos.Left
CenterY = (pWinPos.Height / 2) + pWinPos.Top
Me.Left = CenterX - Me.Width / 2
Me.Top = CenterY - Me.Height / 2
End Sub
End Class
the following is the code for the class Win32HWNDWrapper
Public Class Win32HWNDWrapper
Implements System.Windows.Forms.IWin32Window
Private _hwnd As System.IntPtr
Public ReadOnly Property Handle() As System.IntPtr Implements System.Windows.Forms.IWin32Window.Handle
Get
Return _hwnd
End Get
End Property
Public Sub New(ByVal Handle As System.IntPtr)
_hwnd = Handle
End Sub
End Class
... View more
06-10-2010
05:56 AM
|
0
|
0
|
1076
|
|
POST
|
Hi Brad, Although this isn't in the Flex Viewer framework, here's my app where the user can print out a map that contains a legend, text, imagery, etc. This was using the AlivePDF library. Also, take a look at this for a tool to add MGRS grid to your map Here's the code I'm using to create it. The last two references are the pop up windows that contain data or images.
public static function printPDF(mainMap:Map, overviewMap:Map, legendTitle:String, popData:DataPopup, popAbout:AboutWindow):void
{
CursorManager.setBusyCursor();
var date:Date = new Date();
var legendImage:Class;
var legendLength:Number;
var h:Number = mainMap.measuredHeight;
var w:Number = mainMap.measuredWidth;
var ovH:Number = overviewMap.measuredHeight;
var ovW:Number = overviewMap.measuredWidth;
var fullWidth:Number = w + ovW + 126;
var fullHeight:Number = h + 144;
var legendY:Number = ovH + 132;
var minHeight:Number = ovH + 42 + 72; // overview map + header to legend + logos
var scaleArray:Array = [110000,64000,32000,16000,8000,4000,2000];
// if (h1 < 650) {h1 = 650;}
mainMap.zoomSliderVisible = false;
try
{
if (legendTitle != null)
{
switch (legendTitle)
{
case "Boundaries":
legendImage = popData.legendBoundary;
legendLength = 16;
break;
case "Structure":
legendImage = popData.legendStructure;
legendLength = 279;
break;
case "Biological Cover":
legendImage = popData.legendCover;
legendLength = 244;
break;
case "Coral Cover":
legendImage = popData.legendDensity;
legendLength = 68;
break;
case "Zone":
legendImage = popData.legendZone;
legendLength = 172;
break;
}
minHeight = minHeight + legendLength + 7;
}
if (popData.chkDive.selected) {minHeight = minHeight + 103 + 7;}
if (popData.chkROV.selected) {minHeight = minHeight + 13 + 7;}
if (popData.chkMPA.selected) {minHeight = minHeight + 33 + 7;}
if (popData.chkModImagery.selected) {minHeight = minHeight + 53 + 7;}
if (minHeight > h) {fullHeight = fullHeight + minHeight - h;}
var myPDF:PDF = new PDF(Orientation.LANDSCAPE, Unit.POINT, new Size([fullHeight,fullWidth],"dynamicSize",[(fullHeight)/96,(fullWidth)/96],[(fullHeight)*3.779527559,(fullWidth)*3.779527559]));
myPDF.setDisplayMode(Display.FULL_PAGE, Layout.SINGLE_PAGE);
myPDF.addPage();
myPDF.addImage(mainMap, 54, ((fullHeight - 108 - h) / 2) + 72 , 0, 0, ImageFormat.PNG);
myPDF.lineStyle(new RGBColor(0x000000),1);
myPDF.drawRect(new Rectangle(54, ((fullHeight - 108 - h) / 2) + 72, w - 2, h - 2)); // map border
myPDF.lineStyle(new RGBColor(0x00529E),1);
myPDF.drawRect(new Rectangle(36,36,fullWidth - 72, fullHeight - 72)); // page border
myPDF.beginFill(new RGBColor(0x00529E));
myPDF.drawRect(new Rectangle(36,36,fullWidth - 72,36)); // header box
// myPDF.drawPolygone([36,36, w + fullwidth - 64,36, w + fullwidth - 64,72, 36,72, 36,36]); // header box
myPDF.endFill();
myPDF.setFont(FontFamily.ARIAL,Style.BOLD,22);
myPDF.textStyle(new RGBColor(0xFFFFFF));
myPDF.addText("U.S. Virgin Islands (St. John): Shallow-water Benthic Habitats",((fullWidth - 72) / 2) - 320,63);
// myPDF.setFont(FontFamily.ARIAL,Style.NORMAL,7);
// myPDF.textStyle(new RGBColor(0x000000));
// myPDF.addText("http://ccma.nos.noaa.gov/ecosystems/coralreef/benthic_usvi.html",13.275,10.2425);
myPDF.addImage(overviewMap, w + 72, 90 ,0 , 0);
myPDF.lineStyle(new RGBColor(0x000000),1);
// myPDF.drawRect(new Rectangle(w + 72, 90,ovW - 2,ovH - 2)); // overview map border
myPDF.textStyle(new RGBColor(0x000000));
if (legendTitle != null)
{
myPDF.setFont(FontFamily.ARIAL,Style.BOLD,18);
myPDF.addText(legendTitle, w + 72, ovH + 120);
myPDF.addImageStream(new legendImage as ByteArray, w + 74, legendY);
legendY = legendY + legendLength + 7;
}
if (popData.chkDive.selected)
{
myPDF.addImageStream(new popData.legendDives as ByteArray, w + 74, legendY);
legendY = legendY + 103 + 7;
}
if (popData.chkROV.selected)
{
myPDF.addImageStream(new popData.legendROV as ByteArray, w + 74, legendY);
legendY = legendY + 13 + 7;
}
if (popData.chkMPA.selected)
{
myPDF.addImageStream(new popData.legendMPA as ByteArray, w + 74, legendY);
legendY = legendY + 36 + 7
}
if (popData.chkModImagery.selected)
{
if (popData.radBackscatter.selected) {myPDF.addImageStream(new popData.legendBackscatter as ByteArray, w + 74, legendY);}
if (popData.radBathymetry.selected) {myPDF.addImageStream(new popData.legendBathy as ByteArray, w + 74, legendY);}
if (popData.radSlope.selected) {myPDF.addImageStream(new popData.legendSlope as ByteArray, w + 74, legendY);}
}
// myPDF.setFont(FontFamily.ARIAL,Style.NORMAL, 14);
// myPDF.addText("Minimum Mapping Unit",w + 110, fullHeight - 145);
// myPDF.addText("(0.25 acre, 0.1012 ha)",w + 110, fullHeight - 131);
myPDF.addImageStream(new popAbout.NOAAClass as ByteArray, w + 70, fullHeight - 108, 30, 28);
myPDF.addImageStream(new popAbout.NPSClass as ByteArray, w + 70 + 198, fullHeight - 110, 23, 29);
myPDF.setFont(FontFamily.ARIAL,Style.NORMAL, 7);
myPDF.addText("Data prepared by the National Ocean Service,", w + 54 + 57, fullHeight - 98);
myPDF.addText("Biogeography Branch, in cooperation with", w + 54 + 64, fullHeight - 90);
myPDF.addText("the National Park Service. 2009", w + 54 + 77, fullHeight - 82);
myPDF.setFont(FontFamily.ARIAL,Style.BOLD, 7);
myPDF.addText("http://ccma.nos.noaa.gov/ecosystems/coralreef/benthic_usvi.html", w + 72, fullHeight - 56);
// myPDF.addLink(w + 80, fullHeight - 56, 20, 5, "http://ccma.nos.noaa.gov/ecosystems/coralreef/benthic_usvi.html");
myPDF.save(Method.REMOTE,"http://ccma.nos.noaa.gov/gv_stjohn/create.php", Download.INLINE);
}
catch (e:Error)
{
Alert.show(e.message)
}
mainMap.zoomSliderVisible = true;
CursorManager.removeBusyCursor();
}
... View more
06-03-2010
12:08 PM
|
0
|
0
|
2157
|
|
POST
|
Take a look at this blog about formatting ToolTips: http://flexscript.wordpress.com/2008/08/19/flex-html-tooltip-component/
... View more
05-03-2010
12:40 PM
|
0
|
0
|
578
|
|
POST
|
I use a sorting function that utilizes the SortField class. This contains a property ("numeric") that allow it to sort using a numeric comparison or a string comparison. If that property is set to null, it inspects the list and selects what comparison to use based on the first item in the list.
public static function sortCollection(arrayColl:ArrayCollection, sortField:String, caseSensistive:Boolean = false, numericSort:Object = null):void
{
var dataSortField:SortField = new SortField();
var dataSort:Sort = new Sort();
dataSortField.name = sortField;
dataSortField.numeric = numericSort;
dataSortField.caseInsensitive = caseSensistive;
dataSort.fields = [dataSortField];
arrayColl.sort = dataSort;
arrayColl.refresh();
}
... View more
04-30-2010
05:49 AM
|
0
|
0
|
415
|
|
POST
|
I've used the swc in this Code Gallery post to add a graticule to my map.
... View more
04-29-2010
09:15 AM
|
0
|
0
|
478
|
|
POST
|
Where is this listed in the Samples Index? Am I missing it or is it not listed?
... View more
04-28-2010
12:06 PM
|
0
|
0
|
471
|
|
POST
|
Look at this thread for the answer to your first question:http://forums.arcgis.com/showthread.php?p=8086#poststophttp://forums.arcgis.com/threads/2209-Show-disclaimer-in-popup-window-when-layer-is-turned-on
... View more
04-27-2010
11:41 AM
|
0
|
0
|
264
|
|
POST
|
I have an application (http://ccma.nos.noaa.gov/gv_stjohn/stjohn_biomapper.html) that has a datagrid in a separate popup window. If I move the mouse over the datagrid, a graphic on the screen will be highlighted. Also, if I move the mouse over a graphic on the map, the corresponding row in datagrid will be highlighted. The popup window contains variables where I pass in the the map and the graphic layer
[Bindable] public var MainMap:Map
[Bindable] public var layerROVGraphics:GraphicsLayer;
In my main application, I set up a variable for the popup window and pass in the variables
private var popData:DataPopup = new DataPopup;
PopUpManager.addPopUp(popData,this,false,PopUpManagerChildList.POPUP);
popData.MainMap = MainMap; 'MainMap is the <esri:Map> id
popData.layerROVGraphics = layerROVGraphics; 'this is a graphics layer with a MouseEvent.ROLL_OVER event listener attached to each graphic
This is the MouseEvent.ROLL_OVER function for the graphics
private function onMouseOver(event:MouseEvent):void
{
var graphic:Graphic = Graphic(event.target);
for each (var attributes:Object in popData.dataGrid.dataProvider)
{
if (attributes["OBJECTID"] == graphic.attributes["OBJECTID"])
{
popData.dataGrid.selectedIndex = (popData.dataGrid.dataProvider as ArrayCollection).getItemIndex(attributes)
}
}
popData.dataGrid.scrollToIndex(dataGrid.selectedIndex)
And finally, in the datagrid in the floating window, this is the itemRollOver event
private function onItemRollOver(event:ListEvent): void
{
highlightedGraphic = findGraphicByAttribute(event.itemRenderer.data, layerROVGraphics);
// code to make the graphic glow
}
private function findGraphicByAttribute(attributes:Object, graphicLayer:GraphicsLayer):Graphic
{
for each (var graphic:Graphic in graphicLayer.graphicProvider)
{
if (graphic.attributes["OBJECTID"] == attributes["OBJECTID"])
{
return graphic;
}
}
return null;
}
... View more
04-15-2010
10:35 AM
|
0
|
0
|
1053
|
|
POST
|
Use the Repair Geometry tool in the ArcGIS's Toolbox to fix this problem.
... View more
04-14-2010
07:50 AM
|
1
|
0
|
2554
|
|
POST
|
The event listener FlexEvent.SHOW will fire when an object's visibility is set to True.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:esri="http://www.esri.com/2008/ags">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
private function loadHandler():void
{
dynamicMap.addEventListener(FlexEvent.SHOW, onShow)
}
private function onShow(e:Event):void
{
Alert.show("Visible")
}
]]>
</mx:Script>
<mx:Canvas width="100%" height="100%">
<esri:Map>
<esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer"/>
<esri:ArcGISDynamicMapServiceLayer id="dynamicMap" visible="{chkBox.selected}" load="loadHandler();" url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"/>
</esri:Map>
<mx:CheckBox label="Layer visible" id="chkBox"/>
</mx:Canvas>
</mx:Application>
... View more
04-09-2010
07:28 AM
|
0
|
0
|
558
|
|
POST
|
I noticed the same about the Quick Links submenu, but only when I wasn't logged on. When I did log in, that problem went away. Since the submenus do things that would be assigned to your profile, that action makes sense. However, why the submenus don't automatically open on mouse over doesn't make sense.
... View more
04-08-2010
11:14 AM
|
0
|
0
|
676
|
|
POST
|
At the developer's summit, it was emphasized that you should use XCOPY to move caches.
... View more
04-08-2010
09:59 AM
|
0
|
0
|
582
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 2 weeks ago | |
| 2 | 3 weeks ago | |
| 1 | 3 weeks ago | |
| 1 | 3 weeks ago | |
| 1 | 4 weeks ago |
| Online Status |
Offline
|
| Date Last Visited |
Friday
|