|
POST
|
Are you familiar with Cartographic Representation? This will allow you to have dashed lines around polygons that share a common boundary. Take a look at the Help files
... View more
06-18-2010
11:01 AM
|
1
|
0
|
933
|
|
POST
|
Here's the VB.NET code for my extension
Imports ESRI.ArcGIS.ADF.CATIDs
Imports ESRI.ArcGIS.esriSystem
Imports System.Runtime.InteropServices
Imports ESRI.ArcGIS.Framework
<ComClass(Extension.ClassId, Extension.InterfaceId, Extension.EventsId), _
ProgId("HabitatDigitizer_92.Extension")> _
Public Class Extension
Implements IExtension
Implements IExtensionConfig
Implements IPersistVariant
#Region "COM Registration Function(s)"
<ComRegisterFunction(), ComVisibleAttribute(False)> _
Public Shared Sub RegisterFunction(ByVal registerType As Type)
' Required for ArcGIS Component Category Registrar support
ArcGISCategoryRegistration(registerType)
'Add any COM registration code after the ArcGISCategoryRegistration() call
End Sub
<ComUnregisterFunction(), ComVisibleAttribute(False)> _
Public Shared Sub UnregisterFunction(ByVal registerType As Type)
' Required for ArcGIS Component Category Registrar support
ArcGISCategoryUnregistration(registerType)
'Add any COM unregistration code after the ArcGISCategoryUnregistration() call
End Sub
#Region "ArcGIS Component Category Registrar generated code"
''' <summary>
''' Required method for ArcGIS Component Category registration -
''' Do not modify the contents of this method with the code editor.
''' </summary>
Private Shared Sub ArcGISCategoryRegistration(ByVal registerType As Type)
Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
MxExtension.Register(regKey)
End Sub
''' <summary>
''' Required method for ArcGIS Component Category unregistration -
''' Do not modify the contents of this method with the code editor.
''' </summary>
Private Shared Sub ArcGISCategoryUnregistration(ByVal registerType As Type)
Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
MxExtension.Unregister(regKey)
End Sub
#End Region
#End Region
#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String = "85653ca9-ea9e-4c4a-894c-3a263c12e509"
Public Const InterfaceId As String = "4326fdc0-a7bb-4f21-8f0b-f03d0caec6c0"
Public Const EventsId As String = "940f2b66-d7b2-44bb-9025-4a1c380c98aa"
#End Region
Private m_application As IApplication
Private m_enableState As esriExtensionState
' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
End Sub
''' <summary>
''' Determine extension state
''' </summary>
Private Function StateCheck(ByVal requestEnable As Boolean) As esriExtensionState
'TODO: Replace with advanced extension state checking if needed
'Turn on or off extension directly
If requestEnable Then
Return esriExtensionState.esriESEnabled
Else
Return esriExtensionState.esriESDisabled
End If
End Function
#Region "IExtension Members"
''' <summary>
''' Name of extension. Do not exceed 31 characters
''' </summary>
Public ReadOnly Property Name() As String Implements ESRI.ArcGIS.esriSystem.IExtension.Name
Get
Return "Habitat Digitizer Extension"
End Get
End Property
Public Sub Shutdown() Implements ESRI.ArcGIS.esriSystem.IExtension.Shutdown
'TODO: Clean up resources
m_application = Nothing
End Sub
Public Sub Startup(ByRef initializationData As Object) Implements ESRI.ArcGIS.esriSystem.IExtension.Startup
m_application = CType(initializationData, IApplication)
If m_application Is Nothing Then Return
'TODO: Add code to initialize the extension
End Sub
#End Region
#Region "IExtensionConfig Members"
Public ReadOnly Property Description() As String Implements ESRI.ArcGIS.esriSystem.IExtensionConfig.Description
Get
'TODO: Replace description (use \r\n for line break)
Return "Habitat Digitizer 5.0" & vbCrLf & "NOAA/NOS/NCCOS/CCMA/Biogeography Program" & vbCrLf & vbCrLf & "Provides tools to simplify the digitizing attribution process."
End Get
End Property
''' <summary>
''' Friendly name shown in the Extensions dialog
''' </summary>
Public ReadOnly Property ProductName() As String Implements ESRI.ArcGIS.esriSystem.IExtensionConfig.ProductName
Get
'TODO:Replace()
Return "Habitat Digitizer Extension"
End Get
End Property
Public Property State() As ESRI.ArcGIS.esriSystem.esriExtensionState Implements ESRI.ArcGIS.esriSystem.IExtensionConfig.State
Get
Return m_enableState
End Get
Set(ByVal value As ESRI.ArcGIS.esriSystem.esriExtensionState)
'If m_enableState <> 0 Or value = m_enableState Then Exit Property
If value = m_enableState Then Exit Property
'Check if ok to enable or disable extension
Dim requestState As esriExtensionState = value
If requestState = esriExtensionState.esriESEnabled Then
'Cannot enable if it's already in unavailable state
If m_enableState = esriExtensionState.esriESUnavailable Then
Throw New COMException("Cannot enable extension")
End If
'Determine if state can be changed
Dim checkState As esriExtensionState = StateCheck(True)
m_enableState = checkState
ElseIf requestState = esriExtensionState.esriESDisabled Then
'Determine if state can be changed
Dim checkState As esriExtensionState = StateCheck(False)
If (m_enableState <> checkState) Then m_enableState = checkState
End If
End Set
End Property
#End Region
#Region "IPersistVariant Members"
Public ReadOnly Property ID() As ESRI.ArcGIS.esriSystem.UID Implements ESRI.ArcGIS.esriSystem.IPersistVariant.ID
Get
Dim typeID As UID = New UIDClass()
typeID.Value = Me.GetType().GUID.ToString("B")
Return typeID
End Get
End Property
Public Sub Load(ByVal Stream As ESRI.ArcGIS.esriSystem.IVariantStream) Implements ESRI.ArcGIS.esriSystem.IPersistVariant.Load
'TODO: Load persisted data from document stream
Dim HDXTest As String
Dim Count As Integer
Dim Key As Object
Dim ItemList() As Object
Dim ListCount As Integer
Try
HDXTest = Stream.Read
While Not HDXTest Is Nothing
If HDXTest <> "HDX Stream" Then
System.Windows.Forms.MessageBox.Show("The classification scheme and settings in this project cannot be read and must be reloaded manually.", "Cannot load settings", Windows.Forms.MessageBoxButtons.OK, Windows.Forms.MessageBoxIcon.Exclamation)
Exit Sub
Else
Exit While
End If
HDXTest = Stream.Read
End While
Count = Stream.Read
If Not theDict Is Nothing Then If theDict.ContainsKey("HDX.Classification Name") Then theDict.Clear()
For i As Integer = 1 To Count
Key = Stream.Read
ListCount = Stream.Read
ReDim ItemList(ListCount)
For j As Integer = 0 To ListCount
ItemList(j) = Stream.Read
Next
theDict.Add(Key, ItemList)
Next
'If Count > 0 Then createrenderer()
Catch ex As Exception
ExceptionMessage(ex, "Extension: IPersist_Load")
End Try
Marshal.ReleaseComObject(Stream)
End Sub
Public Sub Save(ByVal Stream As ESRI.ArcGIS.esriSystem.IVariantStream) Implements ESRI.ArcGIS.esriSystem.IPersistVariant.Save
'TODO: Save extension related data to document stream
Dim Count As Integer
Dim ItemList() As Object
Try
Count = theDict.Count
If theDict.ContainsKey("HDX.Point Legend") Then Count -= 1
If theDict.ContainsKey("HDX.Line Legend") Then Count -= 1
If theDict.ContainsKey("HDX.Polygon Legend") Then Count -= 1
Stream.Write("HDX Stream")
Stream.Write(Count)
For Each Key As Object In theDict.Keys
If InStr(Key, "Legend") = 0 Then
ItemList = theDict.Item(Key)
Stream.Write(Key)
Count = ItemList.GetUpperBound(0)
Stream.Write(Count)
For i As Integer = 0 To Count
Stream.Write(ItemList(i))
Next
End If
Next
Catch ex As Exception
ExceptionMessage(ex, "Extension: IPersist_Save")
End Try
Marshal.ReleaseComObject(Stream)
End Sub
#End Region
End Class
... View more
06-17-2010
06:31 AM
|
0
|
0
|
762
|
|
POST
|
In the extension I developed, I used the same ESRI example as you did. One thing that is different between our code is when you initialize the variable m_extensionState. When you initialize it, you're also setting it to disabled. In my code, the variable gets set to either disabled or enabled in the State Property.
... View more
06-16-2010
12:38 PM
|
0
|
0
|
762
|
|
POST
|
Hi Eddie, DataPopup is a MXML Component that I've created that is based on a TitleWindow (File|New|MXML Component). This component contains the variables referenced in the first code fragment
... View more
06-14-2010
10:32 AM
|
0
|
0
|
1118
|
|
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
|
539
|
|
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
|
1497
|
|
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
|
1497
|
|
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
|
1110
|
|
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
|
2297
|
|
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
|
606
|
|
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
|
441
|
|
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
|
505
|
|
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
|
500
|
|
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
|
279
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 weeks ago | |
| 2 | 3 weeks ago | |
| 1 | 3 weeks ago | |
| 1 | 3 weeks ago | |
| 1 | 4 weeks ago |
| Online Status |
Online
|
| Date Last Visited |
4 hours ago
|