Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. // Activate the tool
  2. var documentBars = ((IDocument)ArcMap.Document).CommandBars;
  3. var cmdItem = documentBars.Find(new UIDClass { Value = ThisAddIn.IDs.PolylineTool });
  4. ArcMap.Application.CurrentTool = cmdItem;
  5.  
  6. // The tool's OnMouseDown event
  7. protected override void OnMouseDown(MouseEventArgs arg)
  8. {
  9. var rubberBand = new RubberLineClass();
  10. var geometry = rubberBand.TrackNew(ArcMap.Document.ActiveView.ScreenDisplay, new SimpleLineSymbolClass { Color = new RgbColorClass { Red = 255 } });
  11. geometry.SpatialReference = ArcMap.Document.FocusMap.SpatialReference;
  12.  
  13. if (!geometry.IsEmpty)
  14. {
  15. var container = (IGraphicsContainer)ArcMap.Document.FocusMap;
  16. container.AddElement(new LineElementClass { Geometry = geometry }, 0);
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement