POST
|
Hi, I'm looking to get the username from the current geodatabase connection so that I can stamp modifications to features with the current time and username. Does anyone know what interface I would be able to use in an Add-In to get this information?
... View more
07-07-2011
06:13 AM
|
0
|
5
|
424
|
POST
|
Awesome; I didn't think to cast the IObjectClass to an IFeatureClass, thanks a million.
... View more
06-02-2011
11:36 AM
|
0
|
0
|
232
|
POST
|
Hello, I have a hierarchical dataset as follows: Water (Dataset) [INDENT]WAnode (FeatureClass) WBoosterStation (FeatureClass) ...[/INDENT] Address (Dataset) [INDENT]AStreetName (FeatureClass) AStreetNumber (FeatureClass) ...[/INDENT] When a new feature is created (WAnode, AStreetName, etc.), I need to get a sequence value for it. The sequence table we use depends on the Dataset in which the feature is being created. So, if I'm going to create a new WAnode, which is in the Water dataset, I should be using the A_ASSETID_SEQ sequence table. I'm building an Editor Add-In and the Events_OnCreateFeature event works nicely, as it passes in an IObject that can be cast to an IFeature; the new feature we're creating. The problem is that there's no way to get the topmost dataset for the feature. You can call newFeature.Class.AliasName to get the feature class' name (WAnode in our example), but there's no way to get the parent class (Water). I can get a reference to the current editor workspace and work the other way, since IDatasets have a Subsets attribute to descend. In that case, I work through two levels of datasets looking for "WAnode", but in this case, the names I get from the dataset are prefixed with our schema name "Managed.". I can strip this out, but ultimately, this approach forces our feature classes to be named uniquely, even across datasets (if the Address dataset had a WAnode, we cannot determine which dataset our new feature belongs to). Is there a way to get the new feature's parent dataset? Or, alternatively, is there a way to get the current schema name so that I can at least strip the "Managed." programmatically? We can deal with the unique FeatureClass names restriction, although this is definitely the inferior solution. Any comments are appreciated. Here's the snippet of code I'm using to descend into the workspace datasets to search for the new feature's parent dataset: void Events_OnCreateFeature(ESRI.ArcGIS.Geodatabase.IObject obj) {
IFeature newFeature = (IFeature)obj;
String datasetName = null;
// Iterate through all of the datasets in this workspace,
// trying to figure out the name of the dataset into which
// this new feature is being added.
IWorkspace workspace = ArcMap.Editor.EditWorkspace;
IEnumDataset datasets = workspace.get_Datasets(esriDatasetType.esriDTFeatureDataset);
IDataset dataset = datasets.Next();
while (dataset != null)
{
// Iterate through all of the child datasets.
IEnumDataset subsets = dataset.Subsets;
IDataset subset = subsets.Next();
while (subset != null)
{
// Check to see if we have a match. If so, store it and
// get the hell out of here.
if (subset.BrowseName == newFeature.Class.AliasName) {
datasetName = subset.Name;
break;
}
subset = subsets.Next();
}
if (datasetName != null)
break;
// Get the next dataset.
dataset = datasets.Next();
}
...
}
... View more
06-02-2011
10:51 AM
|
0
|
2
|
2449
|
POST
|
Thanks for the detailed explanation; it definitely helps clarify what's happening with my editor extension. As a result of your explanation I did some additional investigation and realized that I can call get_Datasets on the IWorkspace object that I do have a reference to, which will give me access to pretty much anything in the current document. Thanks a million for all of your help; it's been greatly appreciated.
... View more
04-13-2011
06:06 AM
|
0
|
0
|
288
|
POST
|
Wow, thanks, that explanation helped out a lot. There was already an OnCreate implementation in my current codebase, but it's in a file called AddEXTCLSID.cs, which is the main file that's loaded during ArcMap startup. I essentially associate this component with a feature class in the editor and my actual implementation (StreetName.cs) is used automatically when editing address points in the configured feature class. What I can't seem to find is where my implementation class is instantiated. There's no call to its constructor anywhere in my codebase, and since I don't know where it's being instantiated, I don't know how I can pass a reference to the current IApplication, which resides in the AddEXTCLSID object, to my actual implementation class. Since it's declared as a private member variable, and since my implementation class doesn't have a reference to the instantiated object anyway, I don't see how I can access this. Any ideas?
... View more
04-12-2011
11:00 AM
|
0
|
0
|
288
|
POST
|
Hello, I'm developing a customization for ArcMap 10 using C#.NET and ArcObjects and am trying to access the current map. I'm fleshing out this customization: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/0001/0001000004s8000000.htm Essentially, I'd like a high-level overview of application hooks and how they can be used to get a reference to the current map (I don't need the current application reference as of yet, but if it contains the map element itself, I can deal with that instead). I don't have any Windows development experience and this concept is new to me. I've tried adding the OnCreate method, but that didn't work, and I wasn't sure to which file it should be added. If anyone could give me any insight into how application hooks work and how they are integrated into ArcObjects customizations it'd be greatly appreciated. Thanks!
... View more
04-12-2011
05:01 AM
|
0
|
4
|
510
|
POST
|
Hi Melanie, Have a look at this example to start. In short, Add-Ins aren't the answer in this case; the attribute editor is still referenced via COM, although it has .NET bindings that are used instead. An EXTCLSID is still required, but its mechanics may be different from your pre-existing solution. I'd have a look at the above referenced sample to see if your solution can be migrated, or if you're better of writing a new one from scratch.
... View more
03-09-2011
10:26 AM
|
0
|
0
|
109
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|