DOC
|
Author: Rebecca Zeckoski Organization: Patrick Engineering Address: 200 South Tryon St, Suite 500, Charlotte, NC 28202 Email: rzeckoski@patrickco.com Presenter Biography: Rebecca Zeckoski is senior geospatial developer for Patrick Engineering. Her current focus is developing GIS software to streamline field work for linemen at large utility companies. Abstract: Automated unit testing is a useful part of any well-designed application. However, it is problematic to run automated tests for an offline ArcGIS runtime application on a machine without access to side-loaded data (e.g., a build server), as so much of ArcGIS runtime code ultimately depends on non-creatable map objects like geodatabases. We will present our solution to this issue, a methodology that allows mocking of ArcGIS data objects for use in automated unit testing.
... View more
01-12-2018
11:18 AM
|
7
|
0
|
843
|
POST
|
ESRI support has confirmed that I have found a bug in ArcGIS 10 and has submitted a bug report for it (bug NIM080497). The specific bug is that IActiveView::Refresh does not work when called inside an IEditEvents.OnStartEditing event handler. They didn't mention when this might be fixed.
... View more
05-03-2012
03:36 AM
|
0
|
0
|
976
|
POST
|
I have come across a rather strange workaround, so I figured I should post in case anyone else has this issue in the future. As far as I can tell, this issue was occurring because I was trying to refresh the view as part of my OnStartEditing event handling (this seems to be a bug, and I've reported it to the lady I was working with at ESRI support on this issue). In my editor extension, the OnStartup wired the OnStartEditing event handler, and the OnStartEditing event handler tried to create the renderer and refresh the view. I decided that rather than immediately enabling the capabilities of my extension when the editing session starts, I wanted to have the user click a button to enable the capabilities. I'll skip over all my reasoning on that as it's irrelevant to the issue at hand. What is relevant is that I moved the call to the rendering routine (CreateRenderer) (with the code as previously posted) OUT of the OnStartEditing event handler and INTO my new button click event. So, the new flow is something like this: On Startup --> Enable new custom button, Wire OnStartEditing and OnStopEditing Custom button click --> run CreateRenderer subroutine And voila! All the sudden my screen actually refreshes. I want to emphasize that I changed NOTHING in the CreateRenderer subroutine - I just moved the call to it out of the OnStartEditing Event and into the new button click event. If I do hear back from ESRI about this issue I'll post any additional relevant information.
... View more
04-30-2012
11:00 AM
|
0
|
0
|
976
|
POST
|
Thanks for your post, but in essence you seem to be taking the same steps I take, though your renderer definition is more complicated. This just further confuses me as to why my code isn't working!
... View more
04-26-2012
06:24 AM
|
0
|
0
|
976
|
POST
|
I can't seem to find anyone else with this problem, but I'm hoping maybe I'm missing something obvious! I am writing an Editor Extension add-in using VB.net for ArcMap 10. Once the user starts editing, I use a unique value renderer to display features, omitting some (the client wants features they have classified as 'inactive' to disappear - without being deleted - and my understanding is that a definition query won't work in an edit session, so I have modified the symbology instead). After I set the renderer, I want the display to refresh to show the new symbology. However, ActiveView.Refresh, ActiveView.PartialRefresh, and ScreenDisplay.Invalidate will not work. There is no error, but the screen does not refresh. I have stepped through using the debugger and confirmed that the program execution does reach those lines, but after 'executing' those lines nothing happens. The TOC updates properly, but the view does not. I can manually click the refresh button and it refreshes just fine, but I can't seem to make it work programmatically. I have tried brute forcing it by using ActiveView.Deactivate followed by ActiveView.Activate, and this does cause a screen refresh, but then when I try to draw the point, the mouse pointer and the marker symbol indicating the potential location of the new point are offset by about 4 inches. I'm completely at a loss here. Any ideas? I've included an exerpt from my code below (this is done nearly identically for 4 feature layers, so normally the select case would have 3 more entries, but I simplified it for this post). Thanks!! 'define the colors to use in the renderers Dim pOutlineColor As New ESRI.ArcGIS.Display.RgbColor Dim pStructureColor As New ESRI.ArcGIS.Display.RgbColor 'make the structure outline color black pOutlineColor.Red = 0 pOutlineColor.Blue = 0 pOutlineColor.Green= 0 'make the structure center color macaw green pStructureColor.Red = 152 pStructureColor.Blue = 0 pStructureColor.Green = 230 'create the symbols Dim pStructureSymbol As New ESRI.ArcGIS.Display.SimpleMarkerSymbol 'construct the structures symbol pStructureSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle pStructureSymbol.Size = 4 pStructureSymbol.Outline = True pStructureSymbol.OutlineSize = 1 pStructureSymbol.OutlineColor = pOutlineColor pStructureSymbol.Color = pStructureColor 'define renderers Dim pStructureRenderer As New ESRI.ArcGIS.Carto.UniqueValueRenderer 'set the fields used in the renderers - we'll just have one, the 'Active' field 'set usedefaultsymbol to false so that inactive features 'will not draw (i.e., if Active <> 1 or Null) 'structures renderer With pStructureRenderer .FieldCount = 1 .Field(0) = "Active" .UseDefaultSymbol = False 'add "1" to the value list for the renderer - i.e., display "1" values using pStructureSymbol .AddValue("1", "Active", pStructureSymbol) .Label("1") = "Active" 'add "<Null>" to the value list for the renderer using the same symbology as "1" .AddReferenceValue("<Null>", "1") 'tell it we're using our own custom style .ColorScheme = "Custom" 'tell it the field type for the 'Active' field is not a string (it's an integer) .FieldType(0) = False End With Dim pLayer As ESRI.ArcGIS.Carto.ILayer Dim pFeatureLayer As ESRI.ArcGIS.Carto.IFeatureLayer2 Dim pGeoFeatureLayerStructures As ESRI.ArcGIS.Carto.IGeoFeatureLayer 'this makes the layer properties symbology tab show 'the correct interface. Dim pPropertyPage As ESRI.ArcGIS.CartoUI.IRendererPropertyPage pPropertyPage = New ESRI.ArcGIS.CartoUI.UniqueValuePropertyPage Do Until pLayer Is Nothing If TypeOf (pLayer) Is ESRI.ArcGIS.Carto.IFeatureLayer2 Then pFeatureLayer = pLayer If pFeatureLayer.FeatureClass.FindField("Active") > 0 Then 'only set the renderer if there is an 'active' field in the layer Select Case pFeatureLayer.FeatureClass.AliasName Case strStructuresLayerName pGeoFeatureLayerStructures = pFeatureLayer pGeoFeatureLayerStructures.Renderer = pStructureRenderer pGeoFeatureLayerStructures.DisplayField = "Active" pGeoFeatureLayerStructures.RendererPropertyPageClassID = pPropertyPage.ClassID End Select End If pFeatureLayer = Nothing End If pLayer = pEnumLayers.Next Loop My.Document.ActiveView.ContentsChanged() My.Document.UpdateContents() My.Document.ActiveView.Refresh() 'this does nothing 'This also does nothing: 'My.Document.ActiveView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewAll, Nothing, pActiveView.Extent) 'This also does nothing: 'My.ThisApplication.Display.Invalidate(My.Document.ActiveView.Extent, False, ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache) 'this makes the screen go blank: 'Dim pMaps As ESRI.ArcGIS.Carto.IMaps 'pMaps = My.Document.Maps 'My.Document.ActiveView = My.Document.PageLayout 'My.Document.ActiveView = pMaps.Item(0) 'My.Document.ActiveView.Refresh() 'this makes the cursor and the point to be drawn offset by about 4 inches: 'Dim pActiveView As ESRI.ArcGIS.Carto.IActiveView 'pActiveView = My.Document.FocusMap 'pActiveView.Deactivate() 'pActiveView.Activate(My.ThisApplication.Display.hWnd)
... View more
04-26-2012
05:12 AM
|
0
|
6
|
2787
|
POST
|
Found the cause: http://forums.arcgis.com/threads/4679-Buffer-error - apparently the dissolve component of the buffer operation runs out of memory. Once the dissolve parameter is set to 'none' my code works just fine.
... View more
01-03-2011
09:41 AM
|
0
|
0
|
386
|
POST
|
UPDATE: upon further investigation, the geoprocessor is not executing, with ERROR 999999:Error executing function; GP3.GetMessage(3) only says that "An error occurred during the buffer operation". This time around, the crash happens later when I try to access the file that was supposedly created. Back to the original question - any ideas on why the geoprocessor wouldn't work with the code below? Hi all, I'm using VB.NET (2008) to create a DLL for ArcGIS 9.3.1. I am having difficulty with the geoprocessor. In short, it appears to fail randomly after working normally; but once it fails, I can't get it to work again in subsequent executions. This is happening while I execute within the debugger. In long...my first attempt to solve this was to switch from using the ESRI.ArcGIS.Geoprocessing.GeoProcessor to using the ESRI.ArcGIS.Geoprocessor.Geoprocessor. This appeared to work, but then after about 15 or so successful executions it stopped working again, again crashing at the geoprocessor, and now I can't get it to work anymore. Both versions of the geoprocessor give the same result - they'll usually work when I just execute the code within ArcGIS (not using the debugger), but when I attempt to run the code through the debugger, execution fails at the geoprocessor with a hideous and uninformative ArcGIS error ("ArcGIS has encountered a serious application error and is unable to continue"). I've tried validating the geoprocessor inputs (previously, when using the IGeoProcessor interface) before I execute the geoprocessor and the validation comes back fine. The most confusing part about this is that it will work fine for a few debugging sessions, but then all of a sudden, with the same inputs, will start failing. Obviously I'm tweaking parts of the code as I go, but nothing even remotely related to the geoprocessor or its inputs (I know, that's the obvious reason) so I don't know what's going on. I've pasted the relevant parts of my most current code (with the Geoprocessor.Geoprocessor) below (note that the inputs for parmBuffer are actually concatenations of various strings that evaluate to what I've entered - I've verified in the debugger that they're getting passed as shown) (also, I've verified that the input shapefile exists in that directory). Has anyone else encountered this/does anyone have a suggestion about how to fix it? I'm trying to debug later sections of my code, so not worrying about it because it works fine when executing outside the debugger isn't a viable option. Thanks! Dim strTbxPath As String 'path to analysis toolbox strTbxPath = "C:\Program Files\ArcGIS\ArcToolbox\Toolboxes\Analysis Tools.tbx" Dim GP3 As ESRI.ArcGIS.Geoprocessor.Geoprocessor GP3 = New ESRI.ArcGIS.Geoprocessor.Geoprocessor() GP3.AddOutputsToMap = False GP3.AddToolbox(strTbxPath) Dim parmBuffer As New ESRI.ArcGIS.AnalysisTools.Buffer With parmBuffer [INDENT] .in_features = "C:\GISFiles\TestFiles\RaccoonBufFeatures1.shp" .out_feature_class = "C:\GISFiles\TestFiles\RaccoonBuffered1.shp" .buffer_distance_or_field = "10 Meter" .line_side = "FULL" .line_end_type = "ROUND" .dissolve_option = "ALL"[/INDENT] End With Try [INDENT]GP3.Execute(parmBuffer, Nothing) [/INDENT] Catch err As Exception [INDENT]MsgBox(err.Message)[/INDENT] End Try
... View more
01-03-2011
05:05 AM
|
0
|
1
|
644
|
Title | Kudos | Posted |
---|---|---|
7 | 01-12-2018 11:18 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|