|
POST
|
In my VB.NET application, I've used a scratch workspace to store the temporary files. Here's the help information about creating them.
... View more
06-23-2011
07:35 AM
|
0
|
0
|
1146
|
|
POST
|
You should be able to do this by removing the references to tab and changing newVBox.addElement(newDG); newVBox.label = oldLayer.toString(); tab.addElement(newVBox); myInfoRenderer.addElement(tab); to newVBox.addElement(newDG); newVBox.label = oldLayer.toString(); myInfoRenderer.addElement(newVBox);
... View more
06-16-2011
01:25 PM
|
0
|
0
|
980
|
|
POST
|
Take a look at this thread to see if there's anything in there that would help you.
... View more
06-16-2011
07:42 AM
|
0
|
0
|
1246
|
|
POST
|
You can see this code in action in this application. Click a point on the map near the corner of one of the grids. Is this the type of results you're looking for?
... View more
06-16-2011
07:03 AM
|
0
|
0
|
980
|
|
POST
|
I've noticed that if I set breakpoints but haven't made any changes to my code since last debugging it, the breakpoints won't be hit. I have to make sure the project is built (either by making a insubstantial addition or building it manually) so the breakpoints are hit.
... View more
06-15-2011
07:47 AM
|
0
|
0
|
1415
|
|
POST
|
Here's some code in one of my applications that will populate a datagrid from a map click, putting it into a tab navigator in an InfoWindow. The portion of the code that is commented out allows you to get back the results from multiple visible layers in your layer, which are put into separate tabs. The listeners that are added allow you to highlight the features on the map when you click or roll over the entries in the datagrid.
protected function MainMap_mapClickHandler(event:MapMouseEvent):void
{
var identifyParams:IdentifyParameters = new IdentifyParameters();
var clickGraphic:Graphic = new Graphic(event.mapPoint, clickPointSymbol);
identifyParams.returnGeometry = true;
identifyParams.tolerance = 5;
identifyParams.width = MainMap.width;
identifyParams.height = MainMap.height;
identifyParams.geometry = event.mapPoint;
identifyParams.mapExtent = MainMap.extent;
identifyParams.spatialReference = MainMap.spatialReference;
identifyParams.layerIds = layerLIS.visibleLayers.source; //replace this with your layerID
identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;
clickGraphicsLayer.clear();
MainMap.infoWindow.hide();
graphicsLayer.clear();
cursorManager.setBusyCursor();
identifyTask.url = layerLIS.url; //replace this with your layer URL
identifyTask.execute(identifyParams, new AsyncResponder(resultFunction, faultFunction, clickGraphic));
function resultFunction(results:Array, clickGraphic:Graphic):void
{
var myInfoRenderer:InfoRenderer = new InfoRenderer;
var mapPoint:MapPoint = MapPoint(clickGraphic.geometry);
var point:Point = MainMap.toScreen(mapPoint);
if (results && results.length > 0)
{
var oldLayer:Number = -1;
var resultsArray:Array = [];
var result:IdentifyResult;
var resultGraphic:Graphic;
var tab:TabNavigator = new TabNavigator();
var newVBox:VBox = new VBox;
var newVBoxDG:VBox = new VBox;
var newText:Text = new Text;
var newDG:DataGrid = new DataGrid;
var graphic:Graphic;
clickGraphicsLayer.add(clickGraphic);
result = results[0];
oldLayer = result.layerId;
resultsArray.push(result.feature.attributes);
newText = new Text;
newText.text = result.layerName;
graphic = result.feature;
graphic.alpha = 0.3;
graphicsLayer.add(graphic);
tab.width = 400;
tab.height = 230;
// for (var i:int = 1; i < results.length; i++)
// {
// result = results;
// graphic = new Graphic;
// graphic = result.feature;
// graphic.alpha = 0.3;
// graphicsLayer.add(graphic);
// if (result.layerId == oldLayer)
// {
// resultsArray.push(result.feature.attributes);
// }
// else
// {
// newDG = new DataGrid;
// newVBox = new VBox;
// 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);
//
// newVBox.addElement(newText);
// newVBox.addElement(newDG);
// newVBox.label = oldLayer.toString();
// newVBox.label = oldLayer.toString();
// tab.addElement(newVBox);
// myInfoRenderer.addElement(tab);
//
// newText = new Text;
// newText.text = result.layerName;
// resultsArray = [];
// resultsArray.push(result.feature.attributes);
// }
// oldLayer = result.layerId;
// }
newVBox = new VBox;
newVBoxDG = new VBox;
newDG = new DataGrid;
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);
newVBox.addElement(newText);
newDG.dataProvider = resultsArray;
newVBox.addElement(newDG);
newVBox.label = oldLayer.toString();
tab.addElement(newVBox);
myInfoRenderer.addElement(tab);
cursorManager.removeBusyCursor();
MainMap.infoWindow.content = myInfoRenderer;
MainMap.infoWindow.label = "Results";
MainMap.infoWindow.show(MainMap.toMap(point));
MainMap.infoWindow.addEventListener(Event.CLOSE, infoWindow_Close, 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 faultFunction(error:Object, token:Object = null):void
{
cursorManager.removeBusyCursor();
Alert.show(error.toString());
}
protected function findGraphicByAttribute(attributes:Object):Graphic
{
for each (var graphic:Graphic in graphicsLayer.graphicProvider)
{
if (graphic.attributes == attributes)
{
return graphic;
}
}
return null;
}
... View more
06-15-2011
07:35 AM
|
0
|
0
|
979
|
|
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
|
1654
|
|
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
|
1682
|
|
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
|
652
|
|
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
|
921
|
|
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
|
1037
|
|
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
|
921
|
|
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
|
453
|
|
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
|
1193
|
|
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
|
1377
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | yesterday | |
| 1 | yesterday | |
| 1 | 12-18-2025 10:17 AM | |
| 2 | 12-17-2025 11:04 AM | |
| 1 | 11-18-2025 12:30 PM |
| Online Status |
Online
|
| Date Last Visited |
5 hours ago
|