|
POST
|
Hi Luke, We have to edit the unique value renderer itself, once it has been made. I have provided some code below. Note: I encourage you to look at the samples for the CIM at https://github.com/esri/arcgis-pro-sdk-community-samples/tree/master/Map-Authoring/CIMExamples. I based the code snippet below on the source code in 'CreateCIMRendererFromScratch.cs'. It uses the U.S. States dataset available with the samples. internal class SetLabelsOnUniqueValueRenderer : Button { protected async override void OnClick() { var usStatesLayer = MapView.Active.Map.GetLayersAsFlattenedList().FirstOrDefault((fl) => fl.Name == "States") as FeatureLayer; if (usStatesLayer == null) { MessageBox.Show("Please add the 'States' layer to the TOC - with a 'STATE_NAME' field containing state names.", "Cannot find US States"); return; } //make a unique value renderer await CreateUniqueValueRendererOnStatesAsync(usStatesLayer); SetLabelsOnStatesRendererAsync(usStatesLayer); } private Task CreateUniqueValueRendererOnStatesAsync(FeatureLayer fl) { return QueuedTask.Run(() => { var uvrDef = new UniqueValueRendererDefinition() { ValueFields = new string[] {"STATE_ABBR"}, SymbolTemplate = SymbolFactory.DefaultPolygonSymbol.MakeSymbolReference(), //Simple ramp ColorRamp = new CIMLinearContinuousColorRamp() { FromColor = CIMColor.CreateRGBColor(0, 255, 0, 60),//Green, partially transparent ToColor = CIMColor.CreateRGBColor(255, 0, 0, 60),//Red, partially transparent ColorSpace = new CIMICCColorSpace() { URL = "Default RGB" } } }; fl.SetRenderer(fl.CreateRenderer(uvrDef)); }); } private Task SetLabelsOnStatesRendererAsync(FeatureLayer fl) { return QueuedTask.Run(() => { var renderer = fl.GetRenderer() as CIMUniqueValueRenderer; //A UniqueValue renderer has one or more CIMUniqueValueGroups. In this example //there is only one CIMUniqueValueGroup (otherwise use a 'foreach(var group in ....)' var group = renderer.Groups[0]; //Each group has one or more CIMUniqueValueClasses - in this case we have one class per //STATE_ABBR value. Note: The default value and label are on the renderer itself //(renderer.DefaultLabel, renderer.DefaultSymbol) and are NOT in a class. foreach (var valClass in group.Classes) { //Each CIMUniqueValueClass has a Label (what you are after 😉 and an array of CIMUniqueValues //As our values are unique, we have one CIMUniqueValue per class. //Get its field value (read from STATE_ABBR) and change the label to be the state name if (valClass.Values[0].FieldValues[0] == "AK") valClass.Label = "Alaska"; else if (valClass.Values[0].FieldValues[0] == "AL") valClass.Label = "Alabama"; else if (valClass.Values[0].FieldValues[0] == "AR") valClass.Label = "Arkansas"; else if (valClass.Values[0].FieldValues[0] == "AZ") valClass.Label = "Arizona"; //etc,etc } fl.SetRenderer(renderer); }); } }
... View more
04-07-2016
10:52 AM
|
0
|
1
|
1119
|
|
POST
|
Ted, try this (from http://converter.telerik.com/) Protected Overrides Sub OnToolMouseDown(e As MapViewMouseButtonEventArgs) If e.ChangedButton = MouseButton.Left Then e.Handled = True End If 'Let Framework know we want to handle MouseDown asynchronously End Sub Private _lastClickedMapPoint As MapPoint = Nothing Protected Overrides Function HandleKeyDownAsync(k As MapViewKeyEventArgs) As Task _lastClickedMapPoint = Await QueuedTask.Run(Function() ActiveMapView.ClientToMap(k.ClientPoint)) 'TODO - do something with _lastClickedMapPoint End Function Oh - I think also you are looking for the starting point - In Visual Studio, add a new project of type Module (within ArcGIS folder). In the project, right-click Add New Item, again in the ArcGIS folder pick MapTool or SketchTool.. There is more info here: https://github.com/esri/arcgis-pro-sdk/wiki/ProGuide-Build-Your-First-Add-in
... View more
03-25-2016
09:23 AM
|
1
|
0
|
2754
|
|
POST
|
The easiest way would be to create the layer using LayerFactory and then apply the symbology to the layer (you just created) using Geoprocessing.ExecuteToolAsync() and the layer file. Something like: var gpresult = await Geoprocessing.ExecuteToolAsync("ApplySymbologyFromLayer_management", new string[] {theNewLayerName,@"C:\Location\my_layer_file.lyr"}); Here are some links that might help: Apply Symbology From Layer Performing Geoprocessing Create and Add a Layer to the Active Map
... View more
03-03-2016
03:54 PM
|
0
|
1
|
1465
|
|
POST
|
Hi Luke, you might find these links helpful: Map Exploration Samples MapTool concepts
... View more
02-25-2016
08:59 AM
|
0
|
0
|
938
|
|
POST
|
Hi Ted, Good question. Comes down to priorities basically - we templatized the most commonly used controls (20 templates at 1.2) and the controls that are more obscure we did not. If lots of people want to use checkboxes or spinners on custom tabs we can look at adding templates for them. Otherwise, as you noted, just add them by hand. On the core tabs they are rarely used.
... View more
02-19-2016
11:13 AM
|
0
|
0
|
575
|
|
POST
|
Hi Luke, currently access to the item metadata you describe is not supported. We are targeting support in the API for 2016.
... View more
02-17-2016
10:42 AM
|
1
|
2
|
2601
|
|
POST
|
It's a bug at 1.1. It is fixed at 1.2. Your code looks fine.
... View more
02-12-2016
11:34 AM
|
0
|
0
|
651
|
|
POST
|
For 10x: the following SDKs are available: .NET (C#, VB) Visual C++ Java Cross Platform C++ (mostly for Linux developers) VBA is supported via the VBA Compatibility setup Additionally, Add-ins for 10x can be written using Python. This includes ICommand. (eg Python Add-ins) There are no plans to retire any of the SDKs. All SDKs will be released again at 10.4.1 same as was done at 10.4 and previously.
... View more
02-08-2016
09:55 AM
|
2
|
0
|
6463
|
|
BLOG
|
From time to time I need to delete all the Pro Add-ins off my machine - especially if I am developing/testing/debugging and end up cluttering Pro's ribbons with all kinds of Add-ins - all in varying states of completion. To do it by hand, you navigate to your C:\Users\-- your username --\Documents\ArcGIS\AddIns\ArcGISPro folder and delete all the guid-ed subfolders. That gets to be tedious so I wrote this shell script. To use it, create a .bat or .cmd file and add a shortcut to it on your desktop. Add this code into it - be sure to replace the "-- your username --" placeholder with your username. DeleteProAddins.cmd: echo off rem http://stackoverflow.com/questions/1502913/how-to-delete-all-files-and-folders-in-a-folder-by-cmd-call rem echo Executing del /q "C:\Users\-- your username --\Documents\ArcGIS\AddIns\ArcGISPro\*" echo for /d %%x in ("C:\Users\-- your username --\Documents\ArcGIS\AddIns\ArcGISPro\*") do @rd /s /q %%x del /q "C:\Users\-- your username --\Documents\ArcGIS\AddIns\ArcGISPro\*" for /d %%x in ("C:\Users\-- your username --\Documents\ArcGIS\AddIns\ArcGISPro\*") do @rd /s /q %%x echo echo Done pause
... View more
01-06-2016
05:03 PM
|
1
|
1
|
1942
|
|
POST
|
Hi Shohei, So let me also provide some guidance. First: the documentation you reference is not clear on use of DelegateCommands and we need to do a better job of explaining them and we will do that for 1.2. Second: the DelegateCommand update must be a property, not a method. It must be a property that returns bool. You can actually see that in the Module1.cs class file that Thomas points out in the sample in his reply. This is a subtlety that is not clearly documented. So, to get your code working please try this implementation: internal static void OnMyCustomButtonClick() { System.Diagnostics.Debug.WriteLine("OnClick called"); } internal static bool CanOnMyCustomButtonClick { get { System.Diagnostics.Debug.WriteLine("OnUpdate called"); return true; } } Notice that CanOnMyCustomButtonClick is a bool property. Also, I have not used QueuedTask as this is not really necessary and would be inefficient in the Update property given the frequency with which it is called but I get it that you were probably just experimenting with different API characteristics and what-not in your code. Last, to a point Thomas raises with regards to conditions and also an Update implementation. Use of the condition in daml is much more efficient than coding update logic (whether via an OnUpdate override or a "Can..." update property. However, if you do have both, the condition in daml and are updating your enabled state via Update code, then the Update code wins with one exception: The initial enabled state of the button as shown on the ribbon. Before the button has been clicked, the Framework will use the condition in the daml to show its initial enabled state. Once the button has been clicked then the button state is controlled by its Update logic and the condition is ignored. You can observe this behavior with your implementation: Return false from your update property and keep your "esri_mapping_onlyFeatureLayersSelectedCondition" condition in the DAML. Before clicking the button, select and unselect a feature layer in the TOC. You should notice the button's enabled state toggling based on the condition true/false. Once you click the button it will always be disabled regardless of the condition. (Note also that your OnClick logic is never called....why?) This would be akin to coding this for an OnUpdate override: protected override void OnUpdate() { this.Enabled = false;//disable the button the moment it is clicked. }
... View more
12-15-2015
01:27 PM
|
1
|
0
|
1305
|
|
POST
|
Hi Shohei, To add the ids to your project use the ArcGIS Pro SDK for .NET Utilities, Pro Generate DAML IDs utility. It is shown here. After you have run it, the ids will show up in Intellisense within a csharp or vb code window. At 1.2 we will include a complete listing of DAML ids on the ArcGIS Pro SDK wiki
... View more
12-14-2015
10:47 AM
|
0
|
1
|
2206
|
|
POST
|
Hi Joseph, I wrote one for you. Please go to the Pro community samples on the github at https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Geometry/CoordinateSystemDialog There is no API call currently to get the list of SpatialReferences so I had to use arcpy.ListSpatialReferences. We will look at adding that capability into the DotNET API for Pro at 1.3
... View more
11-19-2015
10:28 PM
|
0
|
0
|
655
|
|
POST
|
Hi Jorg, I think you will find what you are after here: https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-content-and-image-resources#document-content, "ProGuide Content and Image Resources" section "Document Content" Please let me know if you have other questions
... View more
11-17-2015
08:55 AM
|
0
|
0
|
768
|
|
POST
|
Hi Sean, Backstage is what we refer to as the Project tab in Pro. Licensing is found on the Project tab, Licensing option.
... View more
11-10-2015
10:17 AM
|
0
|
1
|
1361
|
|
POST
|
Hi Sean, First, only classes in ArcGIS.Core can be used in a console application. These are Geodatabase and Geometry classes. None of the classes in any of the ArcGIS.Desktop.xxxx assemblies can be run using CoreHost so even if you get past the license check in CoreHost at runtime your console app will crash in spectacular fashion. Second, the message you are getting is coming from the Pro license check (I assume you are on Backstage in Pro?). From the error message content it seems you have already taken Pro offline on another machine. You must check in that license first (on that machine or device). You can find more information here: http://pro.arcgis.com/en/pro-app/get-started/view-software-licenses.htm Topic "Authorize ArcGIS Pro to work offline" If this is not the case and you do not have your license offline on another machine or device then you will need to call ESRI tech support to resolve the issue.
... View more
11-09-2015
07:16 PM
|
0
|
3
|
1361
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-14-2025 05:01 PM | |
| 1 | 10-14-2025 05:06 PM | |
| 2 | 10-02-2025 03:40 PM | |
| 1 | 07-02-2025 03:50 PM | |
| 1 | 10-27-2022 10:32 PM |
| Online Status |
Offline
|
| Date Last Visited |
Monday
|