POST
|
This worked for me: protected override async void OnClick()
{
try
{
//get selected layer in toc
var featLayer = MapView.Active.GetSelectedLayers().First() as FeatureLayer;
if (featLayer == null)
return;
CIMBaseLayer baseLayer = await QueuedTask.Run (() => featLayer.GetDefinition());
var definitionSetURI = GetDefinitionSetURI(baseLayer);
var isSelectionLayer = !string.IsNullOrEmpty(definitionSetURI);
MessageBox.Show($@"Is selection layer: {isSelectionLayer}");
}
catch (Exception ex)
{
MessageBox.Show($@"Error: {ex.Message}\n{ex.StackTrace}");
}
}
... View more
12-19-2023
09:25 AM
|
0
|
0
|
964
|
POST
|
I think you should be able to use Geodatabase DDL to modify that table using schemaBuilder.Modify(modifiedTableDescription); ProConcepts DDL · Esri/arcgis-pro-sdk Wiki (github.com) To create an object ID field use this code snippet: ProSnippets Geodatabase · Esri/arcgis-pro-sdk Wiki (github.com)
... View more
12-11-2023
02:05 PM
|
0
|
2
|
642
|
POST
|
This must be a Mac specific issue because the search on my Window 11 OS with Visual Studio 2022 17.8 works as expected:
... View more
12-05-2023
06:25 AM
|
0
|
0
|
624
|
POST
|
In order to place your callouts differently for each point (manually or programmatically) you have to use either an annotation class or a graphics layer. If you create a callout annotation feature programmatically you can take a look at this 'AnnoTools' example: arcgis-pro-sdk-community-samples/Editing/AnnoTools/Modify/SimpleLineCallout.cs at master · Esri/arcgis-pro-sdk-community-samples (github.com) The sample modifies the selected annotation feature and uses SetAnnotationProperties to store the changes to the annotation properties (including the text symbol). This means that each annotation feature can have a different offset and/or position of the callout. Once callouts have been added to the annotation feature class they can be 'edited' (for repositioning) using Pro's out-of-box tools (Edit | Modify | Annotation): This tool allows you to click on the callout and reposition it. To add your own button to invoke this tool you can simply call on the existing tool: protected override void OnClick()
{
var command = FrameworkApplication.GetPlugInWrapper("esri_editing_EditVerticesText") as ICommand;
if (command.CanExecute(null))
command.Execute(null);
}
... View more
11-30-2023
05:07 PM
|
0
|
0
|
321
|
POST
|
If you use EditOperation your changes and additions end up in undo/redo stacks and the data is not saved until Project.SaveEditsAsync is called. The ArcGIS Pro API doesn't support selective saving of changes in the undo/redo stacks. You can't select the changes in one feature class and leave other changes on the redo/undo stack. If you have edits to a particular featureclass you could try Geodatabase.ApplyEdits as documented here: ProConcepts Geodatabase · Esri/arcgis-pro-sdk Wiki (github.com) ApplyEdits is only recommended for "Editing in stand-alone mode" but last time i tried it works on Add-ins as well. I think this is the only option for your particular use case.
... View more
11-27-2023
10:24 AM
|
1
|
1
|
707
|
POST
|
In order to consider left-handedness, you can use this code snippet (i didn't test this one): [DllImport("user32.dll")]
public static extern short GetAsyncKeyState(UInt16 virtualKeyCode);
public const int VK_LBUTTON = 0x01;
public const int VK_RBUTTON = 0x02;
private short _lastMouseButtonState = -1;
[DllImport("user32.dll")]
public static extern Int32 GetSystemMetrics(Int32 bSwap);
public const int SM_SWAPBUTTON = 23;
...
var logicalLeftButton = Convert.ToUInt16(GetSystemMetrics(SM_SWAPBUTTON) != 0 ? VK_RBUTTON : VK_LBUTTON);
var mouseButtonState = GetAsyncKeyState(logicalLeftButton);
... View more
11-15-2023
07:12 AM
|
0
|
0
|
513
|
POST
|
This custom tool did the pan of the map for me: internal class MousePanTool : MapTool
{
[DllImport("user32.dll")]
public static extern short GetAsyncKeyState(UInt16 virtualKeyCode);
public const int VK_LBUTTON = 0x01;
private short _lastMouseButtonState = -1;
private System.Windows.Point _fromMousePoint = new() { X = double.NaN, Y = double.NaN };
private System.Windows.Point _toMousePoint = new() { X = double.NaN, Y = double.NaN };
public MousePanTool()
{
SketchOutputMode = SketchOutputMode.Map;
}
/// <summary>
/// Called when the mouse button is clicked in the view.
/// </summary>
protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
{
if (e.ChangedButton == System.Windows.Input.MouseButton.Left)
{
_fromMousePoint = e.ClientPoint;
e.Handled = true;
System.Diagnostics.Trace.WriteLine("!!! OnToolMouseDown");
}
base.OnToolMouseDown(e);
}
/// <summary>
/// Called when the mouse button is released in the view.
/// </summary>
protected override void OnToolMouseUp(MapViewMouseButtonEventArgs e)
{
if (e.ChangedButton == System.Windows.Input.MouseButton.Left)
{
e.Handled = true;
_fromMousePoint = new() { X = double.NaN, Y = double.NaN };
System.Diagnostics.Trace.WriteLine("!!! OnToolMouseUp");
}
base.OnToolMouseUp(e);
}
private bool _isPanning = false;
protected override async void OnToolMouseMove(MapViewMouseEventArgs e)
{
var mapView = MapView.Active;
if (mapView == null || _isPanning)
return;
var mouseButtonState = GetAsyncKeyState(VK_LBUTTON);
if ((mouseButtonState & 0x8000) == 0x0)
{
// the physical left button is not down anymore - stop panning
_fromMousePoint = new() { X = double.NaN, Y = double.NaN };
if (_lastMouseButtonState != mouseButtonState)
{
System.Diagnostics.Trace.WriteLine("!!! MouseUp during mouse move");
_lastMouseButtonState = mouseButtonState;
}
return;
}
_lastMouseButtonState = mouseButtonState;
if (_fromMousePoint.X != double.NaN)
{
_toMousePoint = e.ClientPoint;
_isPanning = true;
try
{
await QueuedTask.Run(() =>
{
var fromPoint = mapView.ClientToMap(_fromMousePoint);
var toPoint = mapView.ClientToMap(_toMousePoint);
var deltaX = toPoint.X - fromPoint.X;
var deltaY = toPoint.Y - fromPoint.Y;
var camera = mapView.Camera;
camera.X -= deltaX;
camera.Y -= deltaY;
mapView.PanTo(camera);
_fromMousePoint = _toMousePoint;
});
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(ex);
}
finally
{
_isPanning = false;
}
_isPanning = false;
e.Handled = true;
}
}
protected override Task OnToolActivateAsync(bool active)
{
_fromMousePoint = new() { X = double.NaN, Y = double.NaN };
return base.OnToolActivateAsync(active);
}
protected override Task OnToolDeactivateAsync(bool active)
{
_fromMousePoint = new() { X = double.NaN, Y = double.NaN };
return base.OnToolActivateAsync(active);
}
} This sample only works for 'right-handed' mouse configurations, meaning the left mouse button is the 'physical' left mouse button. To consider a 'left-handed' mouse configuration you can determine the system's current mapping of physical mouse buttons to logical mouse buttons by calling GetSystemMetrics(SM_SWAPBUTTON) which returns TRUE if the mouse buttons were swapped. Instead of writing your own custom navigation you can also reuse the map navigation functionality that's built into ArcGIS Pro: var command = FrameworkApplication.GetPlugInWrapper("esri_mapping_exploreTool") as ICommand;
if (command.CanExecute(null))
command.Execute(null);
... View more
11-15-2023
06:55 AM
|
0
|
1
|
513
|
POST
|
There is a community sample that shows different variations of reusing ProCommands: arcgis-pro-sdk-community-samples/Framework/ReusingProCommands at master · ArcGIS/arcgis-pro-sdk-community-samples (github.com)
... View more
11-13-2023
01:54 PM
|
0
|
0
|
640
|
POST
|
Sorry i got a bit derailed with 3.2 release issues (upcoming in the next couple of weeks). Anyways, i am back on it now. I will take a look at your test as well. Thanks much.
... View more
10-23-2023
01:20 PM
|
0
|
0
|
623
|
POST
|
So far i was not able to duplicate your observation for Annotation Features, but i did notice some different oddities: For RowCreatedEvent: For each row created (via inspector) there is ONE RowChangedEvent that fires. For RowChangedEvent: For each row modified (via inspector) there are TWO RowChangedEvents that fire. i think that the two RowChangedEvents firing for each row update might be an issue, we are still looking at this issue. I tested this for File GDB, Enterprise Direct Connect (not versioned) and Enterprise Direct Connect (traditional versioned). I didn't test Branched version yet. If i ran the same test on a point feature class each modification of a row would only yield a single RowChanged event. I will test utility network and branched version next.
... View more
10-17-2023
11:12 AM
|
0
|
1
|
657
|
POST
|
Instead of creating the data on the fly for your memory GDB feature classes, you could have additional fields that hold the result of your custom logic. This way you can code your custom logic in .Net and use the custom field for display or filtering. Otherwise, you have to use different definition queries (and Map layers) for each 'custom logic' variant (as mentioned above by @GKmieliauskas )
... View more
10-11-2023
02:15 PM
|
0
|
0
|
437
|
POST
|
i am not sure what you mean with: "By focus I mean the blue line across the map tool's dockpane or embeddable control. " However, in essence you would have to monitor feature selection and if your data selection conditions are useable by your tool you can then switch the current tool to your tool (or enable the tool button).
... View more
10-11-2023
02:03 PM
|
0
|
2
|
808
|
POST
|
This article explains the reasons why support for personal geodatabases was dropped with ArcGIS Pro: It's Not Personal: A quick history of the geodatabase and why personal geodatabases are not in ArcGIS Pro (esri.com) What release of ArcGIS Pro are you using? You can write a 'Plug-in Datasource' extension using the Pro SDK to implement a reader for your .MDB access database (aka 'personal geodatabase'). 'Plug-in Datasources' only allow read access to the data and hence there is no easy way to write to an access database. I would suggest writing your ArcGIS Pro add-in so that it reads and writes to a File Geodatabase instead of the old 'personal geodatabase'. Let me know if you're interested in the 'personal geodatabase Plug-in DataSource' for ArcGIS Pro. I can probably find the code for that. I think the Plug-in DataSource is using this NuGet to access the .MDB files: NuGet Gallery | System.Data.OleDb 7.0.0 This will work in you x64 Add-in but is limited to access of tabular data only (no spatial data).
... View more
10-06-2023
05:03 PM
|
0
|
0
|
673
|
POST
|
The tool is called: esri_editing_EditVerticesRotate This is how to programmatically execute the rotate tool; however, the subject polygon has to be selected. var commandId = @"esri_editing_EditVerticesRotate";
var iCommand = FrameworkApplication.GetPlugInWrapper(commandId) as ICommand;
if (iCommand != null)
{
if (iCommand.CanExecute(null)) iCommand.Execute(null);
}
... View more
10-02-2023
01:15 PM
|
1
|
1
|
608
|
Title | Kudos | Posted |
---|---|---|
1 | 06-03-2020 09:11 AM | |
1 | 11-27-2023 10:24 AM | |
1 | 04-13-2023 03:09 PM | |
1 | 07-22-2024 03:36 PM | |
1 | 05-24-2024 10:13 AM |
Online Status |
Offline
|
Date Last Visited |
Tuesday
|