|
BLOG
|
This blog will discuss defining custom Project and Application level settings using the Pro SDK. Project and Application settings can be accessed off the ArcGIS Pro Options property page dialog. Custom project settings Custom project settings are saved in the project and can be accessed each time the project is reopened. This is accomplished by the Module class’ overrides OnReadSettingsAsync and OnWriteSettingsAsync methods. A Property Sheet should be added to the Options dialog in ArcGIS Pro to provide a UI for users to view and modify these settings. Add an ArcGIS Pro Property sheet item using the Pro SDK to your add-in project. Add any UI elements you need such as check boxes, radio buttons etc that define specific project settings. Insert your custom property sheet into the Options dialog by adding it to the property sheet collection of the "esri_core_optionsPropertySheet" (as shown below) in your Config.daml. Set the "group" attribute on your "insertPage" DAML element to "Project". …
</modules>
<propertySheets>
<updateSheet refID="esri_core_optionsPropertySheet">
<!--Use group=Project for the options to appear under the Project section in the settings-->
<!--assign the viewModel class to the className attribute; assign the view class to the
className attribute in the content tag-->
<insertPage id="esri_sdk_PropertyPageProjectSettings" caption="Sample Project Settings"
className="ProjectSettingsViewModel" group="Project">
<content className="ProjectSettingsView" />
</insertPage>
</updateSheet>
</propertySheets>
</ArcGIS> The ViewModel of your property sheet should be updated whenever the module OnReadSettingsAsync override gets called. Conversely, the property sheet ViewModel should be queried for its current settings whenever the module OnWriteSettingsAsync override gets called (which is on every project save). The settings themselves are persisted as strings in the project and so must be seriailizable. Custom application settings ArcGIS Pro Application level custom settings can be added to the existing Pro application settings via a .NET application settings file. Settings are modified via a Properties.Settings class that you define with your own custom properties and values. Settings are persisted to a user.config file in the logged-on user’s AppData folder and will be read at add-in initialization when the Settings class instance (in your add-in) is instantiated. Settings are saved when you explicitly call “save” on your Settings class instance (e.g. in response to a user changing settings on your custom application property sheet). To expose custom application settings in the UI, add another property sheet to the "esri_core_optionsPropertySheet" collection (as before for Project settings). This time set its "group" attribute to “Application”. …
</modules>
<propertySheets>
<updateSheet refID="esri_core_optionsPropertySheet">
<!--Use group=Application for the options to appear under the Application section in the settings-->
<!--assign the viewModel class to the className attribute; assign the view class to the className attribute in the content tag-->
<insertPage id="esri_sdk_PropertyPageAppSettings" caption="Sample App Settings" className="ApplicationSettingsViewModel" group="Application">
<content className="ApplicationSettingsView" />
</insertPage>
</updateSheet>
</propertySheets>
</ArcGIS> To read step by step instructions on how to develop an add-in that creates custom project and application settings in ArcGIS Pro refer to the new ProGuide: Custom settings in the arcgis-pro-sdk-wiki.
... View more
10-09-2017
12:28 PM
|
1
|
5
|
4634
|
|
POST
|
Hi Taner You can get the inheritance hierarchy for classes from the Pro API Reference guide. For example, if you look at the class "Overview" page for BasicFeatureLayer, you can see all the classes it derives from. PDF versions of the ArcGIS Pro API is not available out of the box with the Pro SDK. Thanks Uma
... View more
09-26-2017
08:13 AM
|
0
|
1
|
1081
|
|
POST
|
Hi Drew You are correct, all the breakpoints seem OK. I am attaching a simple Add-in with a pane and a button. If you run this sample, you will see a Close Pane button. Please check if this sample works. Thanks Uma
... View more
09-20-2017
09:41 AM
|
1
|
1
|
2148
|
|
POST
|
Hi Drew Just a couple of things that could be checked - 1. The _viewPaneID property holds the ID from the DAML for your pane, correct? It should be "ClosePane_Pane1" from the example snippet from config.daml below. <panes>
<pane id="ClosePane_Pane1" caption="Pane 1" className="Pane1ViewModel" smallImage="Images\GenericButtonGreen16.png" defaultTab="esri_mapping_homeTab" defaultTool="esri_mapping_navigateTool">
<content className="Pane1View" />
</pane>
</panes> 2. While debugging your add-in when you place a breakpoint on this line below does it get hit? How many panes were open with that the _viewPaneID? When a wrong InstanceID is passed to ClosePane method, I do see that nothing happens (seems to crash silently with no exceptions). myPaneInstanceIDs.Add(pane.InstanceID); //InstanceID of your pane, could be multiple, so build the collection Thanks Uma
... View more
09-20-2017
08:24 AM
|
0
|
1
|
2148
|
|
POST
|
Hi Drew Can you please share the code where you get the instanceID of the pane?
... View more
09-19-2017
03:02 PM
|
0
|
1
|
2148
|
|
POST
|
i Drew You could have multiple instances (InstanceIDs) of your pane. So you can iterate through the Panes to get "your" panes only and then close them like this: private static async Task OnProjectClosingAsync(CancelEventArgs arg)
{
IList<uint> myPaneInstanceIDs = new List<uint>();
foreach (Pane pane in FrameworkApplication.Panes)
{
if (pane.ContentID == _viewPaneID) //this is the DAML id of your pane.
{
myPaneInstanceIDs.Add(pane.InstanceID); //InstanceID of your pane, could be multiple, so build the collection
}
}
foreach (var instanceID in myPaneInstanceIDs) //close each of "your" panes.
{
FrameworkApplication.Panes.ClosePane(instanceID);
}
await Project.Current.SaveAsync(); //save the project.
}
... View more
09-19-2017
10:20 AM
|
0
|
1
|
2148
|
|
POST
|
Hi Drew You can accomplish this by using the ProjectClosingEvent. This is the code that worked for me - private static async Task OnProjectClosingAsync(CancelEventArgs arg)
{
FrameworkApplication.Panes.ClosePane(MyPaneID);
await Project.Current.SaveAsync();
} Thanks Uma
... View more
09-19-2017
09:29 AM
|
0
|
3
|
2148
|
|
POST
|
Hi Max Max These properties are not available in the Pro API at this time. We hope to add them to the API. Thanks! The SpatialReference definition can be obtained from its Wkt property. Thanks Uma
... View more
09-08-2017
03:23 PM
|
0
|
0
|
558
|
|
POST
|
Hi Brian To accomplish what you are doing, I would listen to the following events: * You need to know when a map is initialized and the TOC is available. This event will help with that - MapViewInitializedEvent * You will have to also listen to the ActiveMapViewChangedEvent to see when the active map view changes. * Finally you can listen to MapMemberPropertiesChangedEvent to see if new layers being added\removed affects your tool. * You might have to check the MapClosedEvent also. The ProceduralSymbolLayers sample does something very similar - If you check the Module class file of this sample. Thanks Uma
... View more
09-08-2017
09:57 AM
|
1
|
0
|
660
|
|
POST
|
Glad you found it! The IDs are listed in the Pro SDK wiki pages in this page: ArcGIS Pro DAML ID Reference You can also see them in Pro when you enable the control IDs to be displayed. Also, there is a Pro SDK Utility that you could use to get the DAML ids directly into you Add-in solution. ArcGIS Pro SDK for .NET utilities
... View more
09-08-2017
09:17 AM
|
1
|
0
|
2003
|
|
POST
|
To enable/disable your tool based on layers, you can use states and conditions. There is ConstructMarkerFromFont sample that demonstrates this.
... View more
09-07-2017
12:14 PM
|
0
|
3
|
1206
|
|
POST
|
Hi You could use a ListBox WPF control for this. There are a few samples with Dockpanes with ListBox controls in the arcgis-pro-sdk-community-samples repo. The DockPaneBookmarkAdvanced sample will help since it has logic with zooming to bookmarks. Thanks Uma
... View more
09-07-2017
10:22 AM
|
0
|
1
|
758
|
|
POST
|
Hi Brian If you use EditOperation's Modify method you can move the point to a specific coordinate - QueuedTask.Run(() =>
{
//Get all of the selected ObjectIDs from the layer.
var abLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
var selection = abLayer.GetSelection();
var oid = selection.GetObjectIDs().FirstOrDefault();
var moveToPoint = new MapPointBuilder(1.0, 2.0, 3.0, 4.0, MapView.Active.Map.SpatialReference); //can pass in coordinates.
var modifyFeature = new EditOperation();
modifyFeature.Name = "Move features";
modifyFeature.Modify(abLayer, oid, moveToPoint.ToGeometry()); //Modify the feature to the new geometry
modifyFeature.Execute();
}); Also, the GeometryEngine has a "Distance" method that could be used to calculate the offset distance between 2 points (to plug into the "Move" method - For the original Move method snippet). Thanks Uma
... View more
09-05-2017
03:26 PM
|
2
|
6
|
2499
|
|
POST
|
Hi Alexander, The Pro Snippets are available on our GitHub wiki pages here. The snippets are not integrated into Visual Studio. Thanks Uma
... View more
08-25-2017
12:12 PM
|
1
|
1
|
1169
|
|
POST
|
Hi Brian, This snippet below worked for me. The Move method has a couple of overrides you can use. Move method from Pro API Reference guide QueuedTask.Run(() =>
{
//Get all of the selected ObjectIDs from the layer.
var abLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
var selection = abLayer.GetSelection();
// set up a dictionary to store the layer and the object IDs of the selected features
var selectionDictionary = new Dictionary<MapMember, List<long>>();
selectionDictionary.Add(abLayer as MapMember, selection.GetObjectIDs().ToList());
var moveFeature = new EditOperation();
moveFeature.Name = "Move features";
moveFeature.Move(selectionDictionary, 10, 10); //specify your units along axis to move the geometry
moveFeature.Execute();
});
... View more
08-25-2017
12:10 PM
|
0
|
8
|
2499
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-18-2025 03:09 PM | |
| 1 | 11-04-2025 08:25 AM | |
| 1 | 09-23-2025 09:31 AM | |
| 1 | 11-20-2024 10:50 AM | |
| 1 | 04-28-2025 03:06 PM |
| Online Status |
Online
|
| Date Last Visited |
yesterday
|