POST
|
Is there a event in ArcGIS Pro SDK for .NET (C#) which occurs whenever a datum transformation is changed?#
... View more
10-04-2018
02:19 AM
|
0
|
1
|
372
|
POST
|
I want to add an imagery, georeference it programatically in ArcGIS Pro sdk. How can I do it?
... View more
12-03-2017
10:29 PM
|
0
|
2
|
950
|
POST
|
I want to open folder connection item pane, select an item and open its context menu programatically. How can I do it?
... View more
12-03-2017
10:26 PM
|
0
|
0
|
218
|
POST
|
Hi Jeff, Yes, it solved my purpose. Though I had to do some tricks and workarounds. So, I added 3 elements programatically after I created new Layout as described above. Those elements were MapFrame, North Arrow and Scale Bar. But, I believe similar thing can be done for other elements too. To create a Map Frame I used following : wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_newMapFrameButton"); wcommand = wrapper as ICommand; if (wcommand == null) return; if (wcommand.CanExecute(null)) wcommand.Execute(null); Then to set its property or zoom level: LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().LastOrDefault<LayoutProjectItem>(); if (layoutItem != null) { await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { Layout layout = layoutItem.GetLayout(); if (layout == null) return; MapFrame mf = layout.Elements.FirstOrDefault(item => item.Name.Equals("Map Frame")) as MapFrame; while (mf == null) //actually in large projects Loading map frames takes some time so this is just waiting for it to happen { Task.Delay(TimeSpan.FromSeconds(1)); mf = layout.Elements.FirstOrDefault(item => item.Name.Equals("Map Frame")) as MapFrame; } mf.SetCamera(camera); //camera is where ever I want to focus/zoom }); } For Scale Bar: await Task.Delay(TimeSpan.FromSeconds(6)); wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_newScaleBarButton"); wcommand = wrapper as ICommand; if (wcommand == null) return; if (wcommand.CanExecute(null)) wcommand.Execute(null); For North Arrow: wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_newNorthArrowButton"); wcommand = wrapper as ICommand; if (wcommand == null) return; if (wcommand.CanExecute(null)) wcommand.Execute(null); In the same manner as for MapFrame : NorthArrow northArrow = layout.Elements.FirstOrDefault(item => item.Name.Equals("North Arrow")) as NorthArrow; ScaleBar scaleBar = layout.Elements.FirstOrDefault(item => item.Name.Equals("Scale Bar")) as ScaleBar; Once I got these objects I played with it and set what wanted. Roughly, my test code looks like following as a whole. Its not optimized and organized yet as it was just for testing but yes it works. Camera camera = MapView.Active.Camera; int count = ArcGIS.Desktop.Framework.FrameworkApplication.Panes.Find("esri_layouts_layoutPane").Count; var wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_projectContainer_NewLayout"); var wcommand = wrapper as ICommand; if (wcommand == null) return; if (wcommand.CanExecute(null)) wcommand.Execute(null); while (ArcGIS.Desktop.Framework.FrameworkApplication.Panes.Find("esri_layouts_layoutPane").Count == count) { await Task.Delay(TimeSpan.FromSeconds(3)); } wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_newMapFrameButton"); wcommand = wrapper as ICommand; if (wcommand == null) return; if (wcommand.CanExecute(null)) wcommand.Execute(null); await Task.Delay(TimeSpan.FromSeconds(1)); LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().LastOrDefault<LayoutProjectItem>(); if (layoutItem != null) { await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { // Reference and load the layout associated with the layout item Layout layout = layoutItem.GetLayout(); if (layout == null) return; // Reference a mapframe by name MapFrame mf = layout.Elements.FirstOrDefault(item => item.Name.Equals("Map Frame")) as MapFrame; while (mf == null) { Task.Delay(TimeSpan.FromSeconds(1)); mf = layout.Elements.FirstOrDefault(item => item.Name.Equals("Map Frame")) as MapFrame; } mf.SetCamera(camera); }); } await Task.Delay(TimeSpan.FromSeconds(6)); wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_newScaleBarButton"); wcommand = wrapper as ICommand; if (wcommand == null) return; if (wcommand.CanExecute(null)) wcommand.Execute(null); layoutItem = Project.Current.GetItems<LayoutProjectItem>().LastOrDefault<LayoutProjectItem>(); await Task.Delay(TimeSpan.FromSeconds(6)); wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_newNorthArrowButton"); wcommand = wrapper as ICommand; if (wcommand == null) return; if (wcommand.CanExecute(null)) wcommand.Execute(null); await Task.Delay(TimeSpan.FromSeconds(6)); layoutItem = Project.Current.GetItems<LayoutProjectItem>().LastOrDefault<LayoutProjectItem>(); await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { while (layoutItem.GetLayout().Elements.Count() != 3) { Task.Delay(TimeSpan.FromSeconds(1)); layoutItem = Project.Current.GetItems<LayoutProjectItem>().LastOrDefault<LayoutProjectItem>(); } }); await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { // Reference and load the layout associated with the layout item Layout layout = layoutItem.GetLayout(); if (layout == null) return; // Reference a mapframe by name NorthArrow northArrow = layout.Elements.FirstOrDefault(item => item.Name.Equals("North Arrow")) as NorthArrow; ScaleBar scaleBar = layout.Elements.FirstOrDefault(item => item.Name.Equals("Scale Bar")) as ScaleBar; northArrow.IsVisible = true; northArrow.SetWidth(5); northArrow.SetX(northArrow.GetX() - 1.30); northArrow.SetY(northArrow.GetY() + 1.70); scaleBar.IsVisible = true; scaleBar.SetWidth(5); scaleBar.SetX(scaleBar.GetX() + 1.30); scaleBar.SetY(scaleBar.GetY() + 2); }); Regards, Surya
... View more
12-01-2017
03:34 AM
|
0
|
0
|
671
|
POST
|
Hi Jeff, Finally, I found a way to open new Layout Programatically in 2.0 SDK too. var wrapper = FrameworkApplication.GetPlugInWrapper("esri_layouts_projectContainer_NewLayout"); var wcommand = wrapper as ICommand; if (wcommand == null) return; if (wcommand.CanExecute(null)) wcommand.Execute(null); Once the Layout is opened LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().LastOrDefault<LayoutProjectItem>(); Then we can do whatever we want to on the Layout.
... View more
11-29-2017
09:11 PM
|
0
|
2
|
671
|
POST
|
The reason behind why I want to use property sheet is that I want to programatically open Layer properties window and programetically close that too after its opened. I am actually measuring time to open and close the layer property window.
... View more
11-23-2017
12:52 AM
|
0
|
0
|
596
|
POST
|
Hi, Thanks for the solution. Its working. I was using same approach to select layer on map. After selection I tried PropertySheet.ShowDialog method. Thus I was able to open layer properties dialog but page binding was not happening. I tried passing DAML id of layer property sheet then null for default page and Layer which is selected as a object parameter. Any Idea if I want to use that approach what parameters to pass for page binding? I know that PropertySheet is mainly used for customization but I was wondering if I can pass some parameter for layer page binding to make that working.
... View more
11-22-2017
08:52 PM
|
0
|
1
|
596
|
POST
|
How can I select a layer and open its Layer Property window programetically in ArcGIS Pro SDK?
... View more
11-20-2017
09:53 PM
|
0
|
3
|
767
|
POST
|
How to programatically create a new Layout, Open Layout Pane and Switch to Layout View in ArcGIS Pro SDK?
... View more
10-29-2017
11:52 PM
|
0
|
4
|
1098
|
Online Status |
Offline
|
Date Last Visited |
01-11-2021
02:04 AM
|