POST
|
Why ArcMap.Application.Document is null on run? There is my addin. It consist of tool and docWindow. DocWindow opens when tool is selected. When I run ArcMap with selected myTool and opened window, ArcMap.Application.Document is null. If I call this from DockPanelClass (or other class) : IMxDocument doc = ArcMap.Application.Document as IMxDocument; IMap map = doc.FocusMap; map contains 0 layers; But when I call it from MyToolClass it becomes valid and contains all my map layers. What happens?
... View more
10-31-2014
03:44 AM
|
0
|
1
|
3159
|
POST
|
How can I check, if the point belongs to polygon? I want to create curstom identify tool with edit option. My idea is to click on the polygon ( building/park/etc) in ArcMap and, if cursor coordinates belongs to polygon, get its parameters from building_layer for further changing (number of building, street name etc). Or maybe there's a more easy way to solve my problem, I use C# and ArcMap 10. public IPoint GetMapCoordinatesFromScreenCoordinates(IPoint screenPoint, IActiveView activeView) { if (screenPoint == null | screenPoint.IsEmpty | activeView == null) { return null; } IScreenDisplay screenDisplay = activeView.ScreenDisplay; IDisplayTransformation displayTransformation = screenDisplay.DisplayTransformation; double x, y; screenPoint.QueryCoords(out x, out y); MessageBox.Show(string.Format("X:{0} - Y:{1}", x.ToString(), y.ToString())); return displayTransformation.ToMapPoint((System.Int32)screenPoint.X, (System.Int32)screenPoint.Y); } protected override void OnMouseDown(MouseEventArgs arg) { IMxDocument doc = ArcMap.Application.Document as IMxDocument; IActiveView activeView1 = doc.ActiveView; var mouse_click_coords = new ESRI.ArcGIS.Geometry.Point() { X = arg.X, Y = arg.Y }; var p = GetMapCoordinatesFromScreenCoordinates(mouse_click_coords, activeView1); }
... View more
09-30-2014
03:58 AM
|
0
|
1
|
4091
|
POST
|
I've tried this snippet: ///<summary>Find a specific tool (or command) in a toolbar and set it to be active.</summary> /// ///<param name="application">An IApplication interface.</param> ///<param name="toolName">A System.String that is the name of the command to return. Example: "esriFramework.HelpContentsCommand"</param> /// ///<remarks>Refer to the EDN document http://edndoc.esri.com/arcobjects/9.1/default.asp?URL=/arcobjects/9.1/ArcGISDevHelp/TechnicalDocuments/Guids/ArcMapIds.htm for a listing of available CLSID's and ProgID's that can be used as the toolName parameter.</remarks> public void SetToolActiveInToolBar(ESRI.ArcGIS.Framework.IApplication application, System.String toolName) { ESRI.ArcGIS.Framework.ICommandBars commandBars = application.Document.CommandBars; ESRI.ArcGIS.esriSystem.UID commandID = new ESRI.ArcGIS.esriSystem.UIDClass(); commandID.Value = toolName; // example: "esriArcMapUI.ZoomInTool"; ESRI.ArcGIS.Framework.ICommandItem commandItem = commandBars.Find(commandID, false, false); if (commandItem != null) application.CurrentTool = commandItem; } Buuuut, I have no idea, how run it. What should I get to ESRI.ArcGIS.Framework.IApplication application?
... View more
09-17-2014
03:22 AM
|
0
|
3
|
2594
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|