POST
|
Hi, If you see the issue resolves upon deleting the Normal.mxt (thus creating a new Normal), that seems to me strange right now. I do not see the connection between the Normal.mxt and the error that Func1 has invalid number of arguments. The Normal.mxt remembers your preferences with regards to which toolbars you want to show, if you want to remove a certain command from a toolbar or menu. So it may remember if you want to show your custom toolbar and commands the next time ArcMap launches, but that's it. I wonder if a legacy custom component has not been unregistered properly. You mention the "problem started when we upgraded from ArcGis 9.3.1 to ArcGis 10", but it seems like the problem started when you "change the header of method with one parameter 'Func1(p1)' to method with two parameters 'Func1(p1,p2)'. Such an error sounds to me like a generic C# or IDE error irrespective of ArcObjects or ArcGIS. In which class is your Func1 method being defined? Does this class represent any ArcMap framework component, e.g. a toolbar, command, menu, dockable window. If not (e.g. common.cs or mySharedMethods.cs), that class does not register within any component category of ArcMap/ArcGIS Dekstop so I do not think that the issue is specific to ArcGIS Desktop. Show us a little diagram or print-screen to help illustrate the problem. I will be on vacation for the next 2 weeks but someone else may see the problem better with some type of illustration or code snippets. Thanks.
... View more
07-02-2012
12:36 PM
|
0
|
0
|
211
|
POST
|
IGlobe::AddLayerType really appears to be the only method that will properly initialize a feature layer for use with a Globe. Adding an IFeatureLayer object directly to an existing IGroupLayer object does not initialize the feature layer object properly. About your code: My code: m_GroupLayer ---> grouplayer (IgroupLayer) pFLy --> featurelayer (IFeatureLayer) m_objGlobeControl --> globecontrol ' ---------------------------------------------------------------------- First time Add FeatureLayer and GroupLayer, and Add GroupLayer to GLobe '>> Here you add a feature layer to a group layer m_GroupLayer.Add(pFLy) '>> Here you add the group layer to the globe using IGlobe::AddLayer. This initializes properly any feature layers in the group layer object being added. m_objGlobeControl.Globe.AddLayerType(m_GroupLayer, esriGlobeLayerType.esriGlobeLayerTypeDraped, True) TryCast(m_objGlobeControl.GlobeDisplay, IGlobeDisplayLayers).RefreshLayer(m_GroupLayer) ' ---------------------------------------------------------------------- Second time add other FeatureLayer to GroupLayer '>> Here you add another feature layer but directly to the existing group layer of the globe, but this does not initialize the feature layer properly for use with globe. '>> We can see this better if using similar program code in an ArcGlobe custom command or add-in button. The feature layer that got added to the exiting group '>> layer is missing all the Layer Properties tabs that are indicative of a draped, globe layer. m_GroupLayer.Add(pFLy) TryCast(m_objGlobeControl.GlobeDisplay, IGlobeDisplayLayers).RefreshLayer(m_GroupLayer) I would do one of the following workarounds: 1. Reconstruct the group layer progammatically if you need to add more layers to an existing group layer > delete the existing group layer > and add the newly constructed group layer with all the sub layers inside of it which now includes the new layer you wanted to add, using the same code you used to add the group layer first: m_objGlobeControl.Globe.AddLayerType(m_GroupLayer, esriGlobeLayerType.esriGlobeLayerTypeDraped, True) or, 2. Add the IFeatureLayer you want to add to the existing group layer directly to the globe using IGlobe::AddLayerType. This will initialize the layer as a draped, globe layer so it can display properly, but the feature layer will not be in the group layer. Programmatically "move" the newly added layer to the group layer as shown below. Unfortunately, the MoveLayer() method of IMap and IScene which you can use with a Globe will not move a layer inside a group layer. Also, the Globe object cannot be casted to IMapLayers in order to use IMapLayers.InsertLayerInGroup method so we cannot choose in which position within a group layer to insert a layer. Only the Map and Scene object can be casted to IMapLayers . With these shotcomings in mind, I only see the possibility of achieving the "move" by: a. Add a feature layer to the globe using IGlobe::AddLayerType, e.g. axGlobeControl1.Globe.AddLayerType(pLayer, esriGlobeLayerType.esriGlobeLayerTypeDraped, true); The layer displays/initialized correctly but is not inside the group layer b. Remove the same layer from the globe. The pLayer object however still lives in memory so it can be still be referenced. (axGlobeControl1.Globe as IScene).DeleteLayer(pLayer); The layer has been removed from the globe c. Now add the layer to the group layer and refresh as you are already doing m_GroupLayer.Add(pLayer); (axGlobeControl1.GlobeDisplay as IGlobeDisplayLayers).RefreshLayer(m_GroupLayer);
... View more
07-02-2012
09:18 AM
|
0
|
0
|
258
|
POST
|
Ross, I will try to create an add-in that does a similar thing. I will be out half of July so not too sure when. Check the Code Gallery where people share custom applications or custom components. It has replaced the ArcScripts webpages. http://resources.arcgis.com/gallery/file/arcobjects-net-api Oh wait, ArcGIS Online seems to now be the newer place. I just read that in the home page of the Code Gallery at the very top of the page. It has a link to ArcGIS Online.
... View more
06-28-2012
09:07 AM
|
0
|
0
|
363
|
POST
|
As I suspected, the commands you execute with ICommandItem::Execute show a window for user input. I do not think you can programmatically input data into that window and programmatically "enter". You see, the command in question has already fulfilled its job which is to display the window. That window which displays is an instance of a different class. It is not an instance of the command's class. So the window/form you see is a separate object with its own properties and methods. If anything could be done that could possibly automate the process a little more, it would be up to the developer of the command and the window. For example, the developer can put default values in the form, but that would still not help. Had this been a geoprocessing tool (in a toolbox), you could programmatically input the parameters of the tool and execute the tool in either VBA with ArcObjects or in a Python script/ModelBuilder, just like you say. But a command that sits on a toolbar is not a geoprocessing tool (GP Function), and you cannot convert a command into a GP Function. You would have to develop it in C#, VB.NET, C++ or Java using ArcObjects and make it do the same as the command and for that, you need the source code of those commands, in the first place. Perhaps there are already equivalent HecGeoRas geoprocessing tools out there. I remember having worked with some of the USACE commands a good while back for drainage/flood studies. Anyway, programmatically executing a command with ICommandItem::Execute the way you are doing is intended more for those commands that just do something without showing a form for input, like executing the Full Extent command, which avoids having to use finer-grained ArcObjects code needed for doing what an existing command already does.
... View more
06-28-2012
08:53 AM
|
0
|
0
|
466
|
POST
|
Hi Trevor, I am trying to picture why a command (an instance of a class that implements ICommand) would have arguments that would need to be passed on to it after its OnClick method has executed, which is what happens when ICommandItem.Execute() is used with that command. By the time ArcMap opens and displays a command, the code in its OnCreate() and its constructor have already executed, and the class that defines the custom command has already been instantiated. Do the commands you are executing programmatically with ICommandItem.Execute() open a form/window for user input, and does such input correspond to the arguments you want to pass? I am trying to picture the argument(s) that such commands would have.
... View more
06-27-2012
03:52 PM
|
0
|
0
|
466
|
POST
|
[...] The reason why I want to show a point construction tool for only a specific feature layer is that I want to make the construction tool do attribute population and location validation when a point of this layer is created. The logic of calculating attribute values (such as finding the parent feature ID) and verifying locations (such as cannot be too far away from another feature) are specific for the business case, rather than reusable generic logic. [...]Since the construction tools cannot be hidden, I will need to use other alternative method to automate attribute population and data verfication on feature creation. Thank you! But in addition to wanting to automate attribute writing and data verification, is your construction tool offering a custom way of constructing point features that is different from the built-in ones which are Point and Point at End of Line (for example, our developer sample called "Points along line construction tool" will add a construction tool to that list called Points Along Line)? If your construction tool is not offering a different, custom way of constructing point features then I would definitely consider a different custom component, such as an Editor Extension or a geodatabase customization, such as a Class Extension or a Workspace Extension. If your construction tool does offer a different way of constructing point features in addition to automating attribute value writing, perhaps you can combine the custom construction tool with an editor extension with which you can listen for events from IEditEvents, e.g. OnCreateFeature. But this would still leave you with a construction tool that does not apply to all point feature layers. However, a construction tool (a class that implements BaseTool, IShapeConstructorTool, ISketchTool) does not need to be added as a Construction Tool, but rather to a toolbar like a regular tool, and a toolbar can be hidden or shown based on whether your editor extension is turned on or off. But then again, this would still leave you with a tool UI that would still be shown in the toolbar (disabled or enabled).
... View more
06-26-2012
04:15 PM
|
0
|
0
|
469
|
POST
|
My thought is that you cannot control with which FeatureLayer a custom Construction Tool can be offered in the Construction Tools pane of the Create Features dockable window. It seems that the only reason why a custom Construction Tool displays is because: a) that Construction Tool has been registered with a given ESRI Editor Construction Tools component category--e.g. ESRI Editor Point Feature Construction Tools or ESRI Editor Annotation Feature Construction Tools component category--which is determined by the developer in the source code of the construction tool. b) the enduser has selected a feature template associated with a feature layer whose geometry type corresponds to the geometry type of the editor construction tool. So if an enduser selects a feature template that is associated with a point feature layer, ArcMap will load all the classes/tools that are registered in the component category called ESRI Editor Point Feature Construction Tools in the Construction Tools pane of the Create Features dockable window. This is similar to ArcMap loading all the classes/tools that are registered in the component category called ESRI Mx Commands in the Commands tab of the Customize dialog, which one can then drag onto any toolbar. I think you found a good workaround which is to disable that tool with the Enable property of the BaseCommand class. That even falls within the expected behavior of all ArcMap tools/commands (built-in or custom) which is for the tool/command to be disabled if the criteria for using it has not been met, e.g. when the Select tool becomes disabled because no feature layers have yet been added to the map. Such tool would not disappear just because its use does not apply--rather, it becomes disabled. If for example your construction tool is for using with a point feature layer, is there a specific reason you do not want to offer your custom construction tool with all point feature layers? Will your "point" construction tool run into some trouble if it is used with a point feature layer that does not have a certain attribute field? I can only think of the fields being a problem because your "point" construction tool should apply to all point feature layers.
... View more
06-26-2012
11:50 AM
|
0
|
0
|
469
|
POST
|
Hi, You cannot convert a geometry object into a FeatureClass object. Instead, you assign certain geometry objects (specifically Points, Polylines, Polygons and MultiPoints) to a Feature object and that Feature object is then added to the FeatureClass object. Common ways of doing this is either using 1) the CreateFeature and Store methods or b) using insert cursors. Both ways are discussed and demonstrated in the help document below: Creating features http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000049v000000
... View more
06-25-2012
10:04 AM
|
1
|
1
|
461
|
POST
|
Hi, It sounds like you want to export a map as an image, which you then want to use in PowerPoint or elsewhere. The following shows this being done. The active view (IActiveView) can be the PageLayout or the Map, so this can be done for a map that displays in either a MapControl or PageLayoutControl in an ArcGIS Engine application you have developed. Export active view (complete developer sample) http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Sample_Export_active_view/000100000026000000/ The following snippet is easier to start with and may be all you need for exporting an active view, with adjustments, of course: Create JPEG (hi-resolution) from ActiveView Snippet http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//0049000000nv000000 or Create JPEG from ActiveView Snippet http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/Create_JPEG_from_ActiveView_Snippet/004900000064000000/ And this can help you get started with programmatically getting the exported image in Window's Clipboard: List Files to Clipboard Snippet http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//0049000000rt000000 There is also the approach of using something like this: 1. IActiveView.Selection (returns an ISelection containing selected map features or selected graphic elements) 2. ISelection.Copy (copies the selected items to the clipboard). While I see you being able to paste graphic elements into an application other than ArcMap, I do not see map features copying. This is why I suggest you exporting the map as an image and adding that to the clipboard. 3. ISelection.Paste (copies the clipboard contents [in the activeview])
... View more
06-22-2012
09:41 AM
|
0
|
0
|
630
|
POST
|
Hi Ross, I just want to share some observations I have made with this so that if someone wants to take a stab at it, they can create an ArcMap Add-in tool that would perform the same or near same functionality, or so you can give it a try, as well. I never used this Hyperlinks VBA macro but I took a look at the ReadMe provided by the author and I took a look at the VBA code in the .bas file. The hotlinkimage you mention here (http://arcscripts.esri.com/details.asp?dbid=11848) is essentially a VBA macro which was to be imported into the Project of the VB Editor in ArcMap 9.3.1 and prior. Once imported in the Project, one would specify the name of that imported macro in Layer Properties dialog of a feature layer > Display tab > Hyperlinks section > check Support Hyperlinks using field > select Macro and specify the macro as "Project.modHotLinkImage.HotlinkImage" One would then use the Hyperlink tool of ArcMap to fire that VBA Macro. The Hyperlink tool already did the job of passing to the VBA Macro (Sub Procedure) an IHyperlink object (which contains the hyperlink string value like "C:\Images\imagA.jpg") and an IFeatureLayer object which references the selected feature layer in the TOC (a layer in the TOC highlights in blue when selected). Since the Hyperlink tool already did the job of passing the IHyperlink object to the VBA macro, it definitely looks like the Hyperlink tool took care of determining which feature in the selected feature layer was clicked in the map so that it could get the hyperlink string value from that feature's row in the attribute table. Although the VBA Macro itself is extremely simple to rewrite in VB.NET (or C#), it would not be enough to just convert it to VB.NET. One would have to develop an Add-in tool or custom component tool that would essentially perform the job I mention in the previous paragraph that the Hyperlink tool did. This is because the Hyperlink tool in 10.0 and forward does not accomodate VBA Macros anymore and we can say there is no such thing as a VB.NET macro. All you can specify now in the Hyperlinks section of a feature layer is a JScript or VBScript script and those will not work with ArcObjects (IHyperlink, ILayer, IFeatureLayer, IRasterLayer, IMxDocument etc.). Tha Add-in tool (new in 10.0) or the traditional custom component tool can both be developed in VB.NET or C# and would include the logic in the HotLinkImage VBA Macro. Add-ins are easier to deploy and for such a simple framework customization would be recommended over a traditional custom component tool. They are also slightly easier to develop. The following document walks us through creating our first Add-in tool and the link below includes an Add-in tool already developed, called SelectByLineTool.vb (click on the VB.NET tab). In the OnMouseDown sub procedure which gets fired with MouseEventArgs, we can copy some of that logic to help us get a map point of the area which an enduser clicks on the map in order to then use that point to query the feature we need to locate programmatically that will provide us with the hyperlink string. Or you may prefer to do that in the OnMouseUp instead. Building custom UI elements using add-ins (see "Creating a custom button and tool" but ignore the part that creates the button) http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Walkthrough_Building_custom_UI_elements_using_add_ins/0001000001ms000000/ Custom selection extension (complete add-in project that includes an add-in tool--you can ignore everything else and only look at the add-in tool, SelectByLineTool.vb) http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Sample_Custom_selection_extension/0001000003w2000000/ If I get a chance in the next couple of weeks, I will try to create such an add-in.
... View more
06-22-2012
08:58 AM
|
0
|
0
|
363
|
POST
|
I will try to see if I reproduce the exception with the Disconnect method today based on your details and code. Which service pack do you have for ArcGIS Engine Runtime 10.0? SP4?
... View more
05-15-2012
09:25 AM
|
0
|
0
|
607
|
POST
|
Hi Barbara, When you specify the path to a shared folder for add-ins (e.g. a folder in a network drive), you are telling ArcMap that everytime it launches, it should involve the add-ins in that folder. If tomorrow a given add-in is no longer in that shared folder because the add-in file was removed from that shared folder, ArcMap will no longer involve that add-in which is comparable to uninstalling it. Regarding: "but I don't know how to install my Add-In to this specified location" I am not sure you would install any add-in in a shared folder. Rather, you copy and paste the .esriAddin file that was compiled in the shared folder. As long as a given add-in is in a shared folder specific in the Add-In Manager, that Add-In will be "installed". Meanwhile, it is up to any ArcMap computer user to add or remove the shared folder path in the Options tab of the Add-In Manager dialog if they are interested in the Add-In(s) in that shared folder. If I as a developer want to share multiple add-ins with my organization, I will place all of my add-in files in a shared network folder. Then, I just make sure the interested computers/users have added the path to the "shared folder". I can add, remove, and even modify the add-ins in that shared folder and such changes will be reflected for everyone using my shared folder add-ins.
... View more
05-11-2012
09:53 AM
|
0
|
0
|
481
|
POST
|
thanks for the tips, I would try to remove layers first to see if lock files are deleted (and post the result asap) however, i am wondering how to close properly a map previoulsy opened on my MapControl by following code :
IMapControl3 m_mapControl3 = (IMapControl3)axMapControl.Object;
m_mapControl3.LoadMxFile(myFileName, string.Empty);
I don't see an "unloadMxFile" ! and when I use LoadMxFile to open another Map Document, the previous one still have lock files... How can i close properly with IMapDocument::Close in my case ? Well if you are using IMapControl3, that is more equivalent to IMap than to IMapDocument. IMapControl/IMapControl3 seem to be shortcuts to IMap when working with a MapControl. So you did not open a map document with IMapDocument.Open() but rather you associated your mapControl with a given map using IMapControl.LoadMxFile, would you agree? I think agray1 is on the right track, however, I am not sure you have an object variable that is referencing the first map. You only have the module-level variable m_mapControl3, but I would not comrelease that object because it is a class-level or module-level variable. Do you have any variables that may be referencing the first map, like an IMap type object? And can you confirm whether you did or did not use IMapDocument.Open(). Right now I cannot picture why you would use IMapDocument.Open() since you would not use an IMapDocument type object as an argument to IMapControl.LoadMxFile because LoadMxFile just takes 2 string values as arguments. IMapDocument is more for reading and writing a map document, which you may very well be doing in your application but as a separate workflow. Well, if you do indeed use IMapDocument.Open(), make sure you call IMapDocument.Close() when you are done so that any layers in that map document loose their lock files. As for the trickier IMapControl3 type object you have that is module-level, I do not think you can dispose of that object and it may very well be holding on to the map layers when you load a different map file. That could be a bug if you cannot comrelease your m_mapControl3 object.
... View more
05-10-2012
04:13 PM
|
0
|
0
|
607
|
POST
|
Hello, The Input Features parameter (or property of the PointsToLine class) takes a string value representing a featureclass or shapefile on disc, e.g. @"C:\MyShapefiles\myPoints.shp" or @"C:\MyGeodatabases\myGeodatabase.gdb\myPointsFC You should be able to also specify an object (ArcObjects), like objects of type IFeatureLayer, IDataset, IFeatureClass. I am not sure if you can specify a geometry bag (IGeometryBag type object) or geometry collection (IGeometryCollection type object) or feature cursor (IFeatureCursor type object) but it may be possible. If you get an exception upon specifying all of those, one at a time, of course, then that may not be possible. Using ArcObjects as tool input http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Using_ArcObjects_as_tool_input/00010000041n000000/
... View more
05-10-2012
03:41 PM
|
0
|
0
|
201
|
POST
|
I am working on a standalone application (C# VS 2010 arcGIS Engine 10) continuously running on a single computer. (this application should never stop). part of it is a simple Map Document manager with MapControl+TOCControl : so user should be able to open MXD document, change few things like layer symbology, transparency, map name, and Save the map. My map document and data files has to be stored this way : 1 folder for each Map Document containing 1 MXD file and all associated data files (vector data). So each time the user open a map document (IMapDocument.Open), lock files are created, and as the application never stop, these lock files are not (never) removed, even if the user close the map and open another one. (or maybe I do something wrong there in my code). My issue is that the user should be able to Delete a Map according this process : delete the folder containing the map document and all content : the mxd file and all data files (like shapefile). But once the map document has been opened, there are always lock files there and full delete of my folder is not possible. Shapefile, file geodatabase and personal geodatabase generate LOCK files, so what kind of data format could I use ? the important point is that my application does not allow data editing, I am only developing functionnalities for map configuration (symbols, zoom scale) and drawing temporary geometry in graphic layers... so I really don't need these LOCK files. I just need to use my vector data as basemap ! So I guess, I definitly need a read-only data format... I've tried base map layer which is not working because it's a group layer still loading data such as shapefile of feature class I've tried SDC data which is working fine, but i don't think I can generate my own SDC files with ArcGIS Desktop (is it possible ?) any solution ? Hello, If you are closing the map document, the locks (lock files) would be removed. Are you closing the map document with IMapDocument::Close? Since it is your intention to delete the map document and associated feature classes (shapefiles, geodatabase feature classes, etc.), I wonder if first removing the feature layers from the map will remove the lock files. A call to IDataLayer2.Disconnect() on a FeatureLayer object should disconnect the source data from the layer. I would follow that call with IMap.DeleteLayer(). This may help if closing the map document with IMapDocument.Close() does not remove the locks, although I think it should. Also, on a different approach, I think you can delete lingering lock files so if you explicitly delete (programmatically) the files in the folder first, you can then delete the folder. I am quite sure I saw this workaround once to lingering lock files. But you shouldn't be seeing lingering lock files in the first place if an application is no longer browsing for the file or referencing it on a map.
... View more
05-09-2012
02:24 PM
|
0
|
0
|
607
|
Title | Kudos | Posted |
---|---|---|
1 | 06-25-2012 10:04 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|