|
POST
|
The class that implements IToolbarDef needs to have the component category registration code included in its code module. Make sure that code is registering with the MxCommandBars category. We use VS2010 so we aren't able to use the ESRI addins that come with the 9.3.1 SDK. We have to copy the component registration code from existing classes and I've accidentally copied it from a command class before instead of a toolbar class.
... View more
08-01-2011
05:50 AM
|
0
|
0
|
1651
|
|
POST
|
This line is incorrect: pObj = pObj = gxCat.GetObjectFromFullName(sPath, x) It should be: pObj = gxCat.GetObjectFromFullName(sPath, x) Also, GetObjectFromFullName may return an IGxObject reference or an IEnumGxObject reference. Your code should handle the possibility of both. See the developer help for more info and for an example.
... View more
07-29-2011
05:07 AM
|
0
|
0
|
960
|
|
POST
|
Project the polygon just like this code projects the point. Then QI from IPolygon to IArea and use the Centroid property.
... View more
07-28-2011
12:58 PM
|
0
|
0
|
1181
|
|
POST
|
The most expensive thing the method does is call the Intersect method. How long does it take for that one line of code to execute?
... View more
07-28-2011
12:07 PM
|
0
|
0
|
2061
|
|
POST
|
If the geometry has a projected coordinate system then you should be able to just use the geographic coordinate system it's based on and project it. The following is a code snippet from one of our apps. ' Project the UTM to Lat/Long.
Dim projCoordinateSystem As IProjectedCoordinateSystem = DirectCast(point.SpatialReference, IProjectedCoordinateSystem)
point.Project(projCoordinateSystem.GeographicCoordinateSystem)
' Update the DD textboxes.
DdLatitudeTextbox.Text = Format(point.Y, "0.000000")
DdLongitudeTextbox.Text = Format(point.X, "0.000000")
... View more
07-28-2011
11:58 AM
|
0
|
0
|
1181
|
|
POST
|
It's probably getting overwritten because the pActiveView.Refresh call hasn't finished. The call to Refresh will return before the actual refreshing of the map is complete. You will probably have to add the drawing code to the AfterDraw event or listen for the DisplayFinished event and execute the drawing code after it has fired.
... View more
07-27-2011
01:46 PM
|
0
|
0
|
1571
|
|
POST
|
Where are you calling this code from? If you're not calling it inside the IActiveviewEvents.AfterDraw event then whatever you draw will disappear the next time anything causes the screen to refresh.
... View more
07-27-2011
01:06 PM
|
0
|
0
|
1571
|
|
POST
|
A few things to try: First, a method should only take what it really needs as parameters. In this case, you don't really need 2 features, you need 2 polygons. So I would modify the method signature to this: public static bool DetermineOverlapArea(IPolygon polygon1, IPolygon polygon2) When you call the method, pass in the feature geometries cast as polygons. Use ShapeCopy instead of Shape because you don't want your method altering the feature geometries. Try skipping the geomtry simplification. The general idea here is that an unmodified feature geometry from a feature class will already be simple. Remove the if/else block at the end and replace it with: return (appOverlap > 5 || ensOverlap > 5); Probably not much time savings there but every bit counts.
... View more
07-27-2011
12:56 PM
|
0
|
0
|
2842
|
|
POST
|
Use something like this to measure how long a block of code takes to execute. Dim startTime As Date = Now
' execute a block of code here
Dim span As TimeSpan = Now.Subtract(startTime)
Debug.Print("time to execute block: " & span.Seconds & " seconds")
Just modify the print statement so you can identify what's what in the debug window.
... View more
07-27-2011
11:48 AM
|
0
|
0
|
2842
|
|
POST
|
Converting the code to VB.NET will not help as it will still run using COM Interop. It sounds as if the data and the query logic may not the problem. It could be the code inside your GetAppInfo and PopAppCmgenTables methods. That's where I'd start to look for ways to speed things up. How fast do the queries run if you comment out the calls to these two methods. You can put code at various places to calculate how much time it takes to execute blocks of code. I would do this to find where the bottleneck is and then look for ways to overcome it. If you post the code in those bottlenecks I or someone else may be able to offer suggestions.
... View more
07-27-2011
10:58 AM
|
0
|
0
|
2842
|
|
POST
|
.NET code using ArcObjects will almost always run slower than code written in VBA/VB6. This is because .NET does not directly support COM and VBA/VB6 does. Any call into a COM object in .NET must pass through a runtime callable wrapper (RCW) that acts as a middleman between COM and .NET. Naturally, this slows things down. The more ArcObjects calls you make, the slower it will run. That being said, there are several things you may be able to do to speed things up. The first is to make sure your data is properly indexed. Aside from a spatial index on the feature class, all attribute fields involved in the process should also be indexed. When you execute your queries, setting the Subfields property on the query/spatial filter will help. You should set this property to include only the fields that you need to be populated in the cursor. You should also review your logic to see if there is a way to reduce the number of queries you have to make. I don't know exactly what your code is doing but it looks like you are performing a spatial query on one layer for each feature in the other layer that has a basin name. Could you possibly combine the geometries of all features with the same basin name into a single spatial query? For instance, let's say there are 100 features in the layer with a single basin name. If you add these 100 geometries into a geometry bag and use it to execute a single spatial query then you will eliminate 99 spatial queries from the process. Of course, depending on what it is that you're doing with the query results you may not be able to do this but this is the type of thing you should look for. If all else fails, you may be better off writing this procedure in VB6 or C++ and compiling it into a library that you can then call from your .NET application.
... View more
07-27-2011
10:24 AM
|
0
|
0
|
2842
|
|
POST
|
Refer to the developer help topic for IObjectClassDescription.RequiredFields. You can also loop through the Fields object it returns and see what fields it put in there.
... View more
07-27-2011
05:12 AM
|
0
|
0
|
2208
|
|
POST
|
It looks like you're adding the required fields with this line: IFields fields = ocDescription.RequiredFields; The OID is a required field so I imagine you're getting the error because you're trying to add it a second time with this code. // Add an object ID field to the fields collection. This is mandatory for feature classes.
IField oidField = new FieldClass();
IFieldEdit oidFieldEdit = (IFieldEdit)oidField;
oidFieldEdit.Name_2 = "OID";
oidFieldEdit.Type_2 = esriFieldType.esriFieldTypeOID;
fieldsEdit.AddField(oidFieldEdit);
... View more
07-26-2011
01:51 PM
|
0
|
0
|
2208
|
|
POST
|
The ILocatorManager2 interface does not have a method called GetLocator. However, you can look at the developer help for that type of information.
... View more
07-20-2011
10:42 AM
|
0
|
0
|
429
|
|
POST
|
That is code to register an addin. The code for registering COM components is different. Imports System.ComponentModel
Imports System.Configuration.Install
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Imports System.IO
Imports System.Security.AccessControl
Public Class Installer1
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add initialization code after the call to InitializeComponent
End Sub
Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)
Dim pRegSvr As New RegistrationServices
Try
MyBase.Install(stateSaver)
If Not pRegSvr.RegisterAssembly(MyBase.GetType().Assembly, AssemblyRegistrationFlags.SetCodeBase) Then
Throw New InstallException("COM registration failed. Some or all of the application classes are not properly registered in the ESRI component categories.")
End If
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message, "Install Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Public Overrides Sub Uninstall(ByVal savedState As System.Collections.IDictionary)
Dim pRegSvr As New RegistrationServices
Try
MyBase.Uninstall(savedState)
If Not pRegSvr.UnregisterAssembly(MyBase.GetType().Assembly) Then
Throw New InstallException("COM unregistration failed. Some or all of the application classes were not properly removed from the ESRI component categories.")
End If
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message, "Uninstall Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
End Class
... View more
07-20-2011
06:58 AM
|
0
|
0
|
1651
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-20-2014 05:29 AM | |
| 1 | 02-01-2011 04:18 AM | |
| 1 | 02-04-2011 04:15 AM | |
| 1 | 01-17-2014 03:57 AM | |
| 1 | 10-07-2010 07:37 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|