|
POST
|
Take a look at this thread on how to set up the Geoprocessor for the Analysis Tools. If I ever have trouble in setting up the code to run a tool, I run the tool manually and examine the results page to see what the syntax looks like.
... View more
06-13-2011
01:21 PM
|
0
|
0
|
2046
|
|
POST
|
Here's an example, although written in VB.NET
Dim graphicsContainer As ESRI.ArcGIS.Carto.IGraphicsContainer
Dim pElement As ESRI.ArcGIS.Carto.IElement
dim HasParagraph as Boolean = False
graphicsContainer = CType(pMxDoc.FocusMap, ESRI.ArcGIS.Carto.IGraphicsContainer)
graphicsContainer.Reset()
pElement = graphicsContainer.Next
While Not pElement Is Nothing
If TypeOf pElement Is ESRI.ArcGIS.Carto.IParagraphTextElement Then HasParagraph = True
pElement = graphicsContainer.Next
End While
If Not HasParagraph then graphicsContainer.AddElement (pParagraphElement, 0)
... View more
06-13-2011
06:10 AM
|
0
|
0
|
2459
|
|
POST
|
This may or may not help in your situation, but you should get into the habit of releasing your cursors when you are finished with them. Read this post about one way to do this.
... View more
06-09-2011
06:54 AM
|
0
|
0
|
735
|
|
POST
|
You should also note that in ArcGIS 10, the Geoprocessing tools run in code will also show up in the Results window. You can check there for problems with your code. The attached picture shows the results of testing the code in my previous post.
... View more
06-07-2011
08:18 AM
|
0
|
0
|
1243
|
|
POST
|
Hi Leo, I don't think it currently has that capability for the inset maps, and unfortunately, I'm not updating this script any more.
... View more
06-06-2011
07:43 AM
|
0
|
0
|
1419
|
|
POST
|
This code in VB.NET works for me.
Dim pFlayer As ESRI.ArcGIS.Carto.IFeatureLayer
Dim pFlayer1 As ESRI.ArcGIS.Carto.IFeatureLayer
pFlayer = pMxDoc.FocusMap.Layer(1)
pFlayer1 = pMxDoc.FocusMap.Layer(0)
SelectbyLocation(pFlayer, pFlayer1, "INTERSECT", "NEW_SELECTION")
Friend Sub SelectbyLocation(ByVal InputLayer As ESRI.ArcGIS.Carto.IFeatureLayer2, ByVal SelectionLayer As ESRI.ArcGIS.Carto.IFeatureLayer2, ByVal OverlapType As String, ByVal SelectionType As String)
Dim SelByLoc As New ESRI.ArcGIS.DataManagementTools.SelectLayerByLocation
Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Try
Using releaser As New ESRI.ArcGIS.ADF.ComReleaser
releaser.ManageLifetime(SelByLoc)
SelByLoc.in_layer = InputLayer
SelByLoc.overlap_type = OverlapType
SelByLoc.select_features = SelectionLayer
SelByLoc.selection_type = SelectionType
Result = RunTool(SelByLoc, Nothing)
If Result Is Nothing Then
System.Windows.Forms.MessageBox.Show("Could not select features")
End If
End Using
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString, "Select Layer by Location")
End Try
End Sub
Private Sub ReturnMessages(ByVal pResult As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2, ByVal Title As String)
Dim ErrorMessage As String
If pResult.MessageCount > 0 Then
For Count As Integer = 0 To pResult.MessageCount - 1
ErrorMessage += pResult.GetMessage(Count)
Next
End If
System.Windows.Forms.MessageBox.Show(ErrorMessage, Title)
End Sub
Friend Function RunTool(ByVal Process As ESRI.ArcGIS.Geoprocessor.IGPProcess, ByVal TC As ESRI.ArcGIS.esriSystem.ITrackCancel2) As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Dim GP As New ESRI.ArcGIS.Geoprocessor.Geoprocessor
Try
Result = CType(GP.Execute(Process, Nothing), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2)
If Result.Status <> ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded Then ReturnMessages(Result, "Geoprocessing Error")
GP.ClearMessages()
Catch ex As Exception
ReturnMessages(Result, "Fail")
System.Windows.Forms.MessageBox.Show(ex.ToString, "Run Geoprocessor")
End Try
Return Result
End Function
... View more
06-06-2011
06:13 AM
|
0
|
0
|
1243
|
|
POST
|
You can set the current tool like this: Dim pUID As New ESRI.ArcGIS.esriSystem.UID Dim pCommandItem As ESRI.ArcGIS.Framework.ICommandItem pUID.Value = My.ThisAddIn.IDs.DrawTool 'Substitute in the name of your tool pCommandItem = m_application.Document.CommandBars.Find(pUID, False, False) m_application.CurrentTool = pCommandItem
... View more
06-06-2011
05:18 AM
|
0
|
0
|
552
|
|
POST
|
Does this happen with only integer numbers as opposed to decimals or just 5 but not 6? Try forcing the number to a double data type as in Dim dBufferMiles As Double = 5.0R or Dim dBufferMiles# = 5
... View more
05-25-2011
09:23 AM
|
0
|
0
|
1766
|
|
POST
|
Here's another way that I'm using in my add-in. I have a form (DrawFeature) containing buttons for different polygons the user can create on screen: buffered points, polygons, freehand polygons, and rectangles. I also have a tool (DrawTool) that is called when one of the buttons on that form is pushed. I'm using a global variable (DrawFeatureType) to pass what type of feature is being created. I've attached the code since it's too long to post.
... View more
05-25-2011
08:01 AM
|
0
|
0
|
2025
|
|
POST
|
I have this functionality running in a couple of non-FlexViewer applications. In this example (only showing the relevant portions of the code) using Flash Builder 4.5 and the 2.3.1 API, I have created the datagrid newDG programmatically, then added the event listeners for click, roll over, and roll out.
var newDG:DataGrid = new DataGrid;
newDG.dataProvider = resultsArray;
newDG.addEventListener(ListEvent.ITEM_CLICK, newDG_ItemRollOver, false, 0, true);
newDG.addEventListener(ListEvent.ITEM_ROLL_OUT, newDG_ItemRollOut, false, 0 ,true);
newDG.addEventListener(ListEvent.ITEM_ROLL_OVER, newDG_ItemRollOver, false, 0, true);
protected function newDG_ItemRollOut(event:ListEvent):void
{
graphicLayer.clear();
}
protected function newDG_ItemRollOver(event:ListEvent):void
{
var highlightedGraphic:Graphic = findGraphicByAttribute(event.itemRenderer.data);
var glowFill:SimpleFillSymbol = new SimpleFillSymbol;
var glower:AnimateFilter = new AnimateFilter(highlightedGraphic,glow);
glower.motionPaths = kf;
glower.duration = 500;
glower.play();
}
protected function findGraphicByAttribute(attributes:Object):Graphic
{
for each (var graphic:Graphic in graphicsLayer.graphicProvider)
{
if (graphic.attributes == attributes)
{
return graphic;
}
}
return null;
}
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:GlowFilter id="glow" blurX="20" blurY="20" alpha="1" strength="100" color="0xff0000"/>
<fx:Vector id="kf" type="spark.effects.animation.MotionPath">
<s:SimpleMotionPath id="smpAlpha" property="alpha" valueFrom="1" valueTo="0"/>
<s:SimpleMotionPath id="smpBlurX" property="blurX" valueFrom="20" valueTo="0"/>
<s:SimpleMotionPath id="smpBlurY" property="blurY" valueFrom="20" valueTo="0"/>
</fx:Vector>
</fx:Declarations>
... View more
05-24-2011
12:41 PM
|
0
|
0
|
1261
|
|
POST
|
The only drawback to using the DataSourceType is that it returns a string in the localized language. Take a look at this post for code to get a language-independent identification of what type it is.
... View more
05-24-2011
06:31 AM
|
0
|
0
|
549
|
|
POST
|
Make sure you're adding the correct reference. You have to add it using the Add Reference.. tool instead of the Add ArcGIS Reference.. When that dialog is opened, look for the ESRI.ArcGIS.Geoprocessor component.
... View more
05-24-2011
05:21 AM
|
0
|
0
|
791
|
|
POST
|
You can reference another add in component with the following code Dim pUID As New ESRI.ArcGIS.esriSystem.UID Dim pCommandItem As ESRI.ArcGIS.Framework.ICommandItem pUID.Value = My.ThisAddIn.IDs.DrawTool 'DrawTool is the name of my addin tool...yours will be different pCommandItem = m_application.Document.CommandBars.Find(pUID, False, False)
... View more
05-23-2011
06:23 AM
|
0
|
0
|
1565
|
|
POST
|
If you're using ArcGIS 10, then you can use the Data Driven pages to do this. If you're using ArcGIS 9.x, check out my script to do this.
... View more
05-20-2011
10:50 AM
|
0
|
0
|
1419
|
|
POST
|
Please note that the ArcGIS Viewer for Flex forum has been created for the Flex Viewer and Widget code questions.
... View more
05-18-2011
06:56 AM
|
0
|
0
|
527
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-04-2025 06:39 AM | |
| 1 | 2 weeks ago | |
| 1 | 04-10-2026 12:01 PM | |
| 1 | a month ago | |
| 1 | 10-11-2023 06:18 AM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|