POST
|
Please see the workaround I mentioned in my previous posting, which is working for my purposes. Implementing a custom layer enables you to write you own code to determine layers's extent and passing to custom layer class. I didn't find any other approaches to fix this problem.
... View more
06-21-2017
02:11 AM
|
0
|
0
|
739
|
POST
|
Unfortunately, there is no built-in functionality that would allow one to choose between "Input Extent" and "Use Spatial Reference". This requires usage of Custom Layers and overriding the default behaviour of a feature layers extent property (IFeatureLayer.Extent). See http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Creating_custom_layers/0001000003v4000000/http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Creating_custom_layers/0001000003v4000000/ for details. See custom layer class below which makes it possible to define a fixed extent for a underlying feature layer: <Guid("3460FB55-4326-4d28-9F96-D62211B0C754"), ClassInterface(ClassInterfaceType.None), ComVisible(True), ProgId("CustomLayer")> _Public NotInheritable Class CustomLayer Inherits BaseCustomLayer Implements IIdentify Implements ILegendInfo Private _featureLayer As IFeatureLayer Private _env As IEnvelope Public Sub New(feautreLayer As IFeatureLayer, ByVal env As IEnvelope) _featureLayer = feautreLayer End Sub Public Overrides Sub Draw(drawPhase As ESRI.ArcGIS.esriSystem.esriDrawPhase, Display As ESRI.ArcGIS.Display.IDisplay, trackCancel As ESRI.ArcGIS.esriSystem.ITrackCancel) _featureLayer.Draw(drawPhase, Display, trackCancel) End Sub Public Overrides ReadOnly Property Extent() As IEnvelope Get Return _env End Get End Property Public Function Identify(pGeom As IGeometry) As ESRI.ArcGIS.esriSystem.IArray Implements IIdentify.Identify Return CType(_featureLayer, IIdentify).Identify(pGeom) End Function Public ReadOnly Property LegendGroup(Index As Integer) As ILegendGroup Implements ILegendInfo.LegendGroup Get Return CType(_featureLayer, ILegendInfo).LegendGroup(Index) End Get End Property Public ReadOnly Property LegendGroupCount As Integer Implements ILegendInfo.LegendGroupCount Get Return CType(_featureLayer, ILegendInfo).LegendGroupCount End Get End Property Public ReadOnly Property LegendItem As ILegendItem Implements ILegendInfo.LegendItem Get Return CType(_featureLayer, ILegendInfo).LegendItem End Get End Property Public Property SymbolsAreGraduated As Boolean Implements ILegendInfo.SymbolsAreGraduated Get Return CType(_featureLayer, ILegendInfo).SymbolsAreGraduated End Get Set(value As Boolean) CType(_featureLayer, ILegendInfo).SymbolsAreGraduated = value End Set End Property
... View more
08-16-2016
02:53 AM
|
1
|
0
|
739
|
POST
|
Hi, when adding a query layer to ArcMap by ArcObjects code the extent of the newly created layer will be calculated based on data by default. This causes significant performance issues (i.e. full table scans with several millions rows). When redefining a query layer in ArcMap manually an options-dialog is provided where you can choose between "Input Extent" and "Use Spatial Reference Extent" (see http://desktop.arcgis.com/en/arcmap/10.3/map/working-with-layers/creating-a-query-layer.htm). The second option is what I need. Is there any ArcObjects interface to force this? Is there any way to prevent the extent calculation and to use a given Extent? I've tried without effect to deal with: - Setting ILayer2.AreaOfInterest before loading layer - Setting SpatialDomain in IFeatureClass.SpatialReference of the query class - Loading a layerfile is no option in my case (the extent will be saved in layerfile) Thank you. Sample code: Protected Sub AddNewQueryLayerToFocusMap(ByVal sqlWorkspace As ISqlWorkspace, _ ByVal featureClassName As String, _ ByVal geomType As esriGeometryType, _ ByVal spatialRef As ISpatialReference, ByVal map As IMap) Dim query = String.Format("SELECT * FROM {0}", featureClassName) Dim queryDesc = sqlWorkspace.GetQueryDescription(query) queryDesc.OIDFields = "OBJECTID" queryDesc.GeometryType = geomType queryDesc.SpatialReference = spatialRef ' Ensure that the specified name for the Query Layer feature class is not ' already being used. Dim newName = String.Empty sqlWorkspace.CheckDatasetName(featureClassName, queryDesc, newName) Dim queryClass = sqlWorkspace.OpenQueryClass(newName, queryDesc) Dim featureClass = TryCast(queryClass, IFeatureClass) Dim featureLayer = New FeatureLayerClass() With {.FeatureClass = featureClass} map.AddLayer(featureLayer) '==> extent calculation will be performed End Sub
... View more
07-18-2016
02:39 AM
|
0
|
3
|
2396
|
POST
|
There only workarounds to handle this bug I can imaging are both about automating GUI by doing the clicks for you. Anyone who is familar with AutoHotKey ( http://www.autohotkey.com) could try to get a macro going. Let it open the edit options dialog, selecting versioning tab on its propertysheet and unchecking the two Checkboxes for multiversioning and auto-commit. With a few nasty hacks it's possible to get another temporary workaound by code. The workaround is about automating GUI by using WinAPI aswell: 1. Ensure "Versioning" tab is focussed in edit options propertysheet when opening edit options dialog: a registry key will do that for you (HKEY_CURRENT_USER\Software\ESRI\Desktop10.2\ArcMap\PropertySheets\EditOptions. Set default key to value=2. 2. Start a new thread perfoming all following steps from step 4 to 5 (because edit options dialog is modal). Thread must begin with a short sleep (about 500ms) to ensure, that edit options dialog is opened when starting GUI automation 3. Execute Command to open edit options dialog: UID "esriEditor.PropertiesCommand" in the main thread. Dialog will appear. 4. Use WinAPI to get handles to the two checkboxes and to the OK button. A good example about how to query handles see here. As mentioned in step 2 this must be done outside the main thread. 5. Performing clicks by sending windows messages WM_LBUTTONDOWN + WM_LBUTTONUP to mutliversioning checkbox, then to auto-commit checkbox and at least to OK-Button. This workaound ist not very safe and it isn't suitable for production environments. But for development and testing purposes it works for me and saves a lot of time during development. Hope it helps someone.
... View more
09-19-2014
01:17 AM
|
0
|
0
|
660
|
POST
|
Meanwhile i've got a response from ESRI: As this functionality is newly introduced in ArcGIS 10.2.1, it hasn't been exposed to ArcObjects for development yet, and there is no individual interface/method to deal with this function. Nevertheless, as this bug has already been fixed in ArcGIS 10.3, my hope is that there will be some interface to deal with.
... View more
08-15-2014
12:22 AM
|
0
|
2
|
660
|
POST
|
Hi, does anyone know how to disable auto-commit mode in non-versioned editing environment with ArcObjects? At 10.2.1 there is a new setting available in edit options "Automatically save changes after each edit". Per default this option is activated. So any change during an edit session is committed immediately. See ArcGIS Help 10.2 - Configuring an ArcMap edit session to perform nonversioned edits A bug related to this option is reported, see NIM098991 - The option to 'Automatically save changes after ea.. I did neither find any interface or property in ArcObjects SDK nor any registry key to set this option. Any suggestions or experiences? Thanks.
... View more
07-30-2014
07:26 AM
|
0
|
5
|
4798
|
Title | Kudos | Posted |
---|---|---|
1 | 08-16-2016 02:53 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|