|
POST
|
Even though your constructor is public you should never call it. Framework will instantiate an instance of your tool when it is activated. It can be activated via clicking on the button on the UI or in code via: FrameworkApplication.SetCurrentToolAsync("GFXModule_PairTool") Here is a code sequence which is kind of what you are after: internal class Activate_Tool : Button
{
protected override void OnClick()
{
FrameworkApplication.SetCurrentToolAsync("ModifySketch_MapTool1");
}
}
internal class MapTool1 : MapTool
{
public MapTool1()
{
IsSketchTool = true;
SketchType = SketchGeometryType.Line;
SketchOutputMode = SketchOutputMode.Map;
}
protected override async Task OnToolActivateAsync(bool active)
{
var extent = MapView.Active.Extent;
var center = extent.Center;
var delta = extent.Width / 10.0;
await StartSketchAsync();
var polyLine = await QueuedTask.Run(() =>
{
var segment = LineBuilder.CreateLineSegment(
new Coordinate2D { X = extent.Center.X - delta, Y = extent.Center.Y - delta },
new Coordinate2D { X = extent.Center.X + delta, Y = extent.Center.Y + delta },
MapView.Active.Map.SpatialReference);
return PolylineBuilder.CreatePolyline(segment);
});
this.SetCurrentSketchAsync(polyLine);
}
protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
{
return base.OnSketchCompleteAsync(geometry);
}
}
... View more
04-20-2018
10:07 AM
|
1
|
3
|
1576
|
|
POST
|
The version of any of the Pro assemblies or executable will tell you. Something like string version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString();
"GetEntryAssembly" should be ArcGISPro.exe
... View more
04-19-2018
12:43 PM
|
0
|
0
|
790
|
|
POST
|
Thomas, can you post a slightly larger context....for example, in your code, are you creating a layout element that uses your symbol? Can you provide that too?.
... View more
04-13-2018
09:37 AM
|
0
|
1
|
1423
|
|
POST
|
Brian, generally speaking, the only UI you should use in conjunction with a QueuedTask is a progressor. Messageboxes, windows ("Dialogs'), etc should be invoked on the UI thread.
... View more
04-12-2018
09:41 AM
|
1
|
0
|
1430
|
|
POST
|
Brian, what happens if you specify no style at all? That is, you simply delete your entire <ListView.ItemContainerStyle> section and delete any Style attribute you may have added to your <ListView> parent element.
... View more
03-29-2018
04:17 PM
|
0
|
0
|
3983
|
|
POST
|
Please consult: https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Custom-settings. It contains step by step instructions.
... View more
03-20-2018
08:25 AM
|
0
|
2
|
7501
|
|
POST
|
map.SetName("name here")? Map name is the default caption. http://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic11891.html
... View more
03-02-2018
11:13 AM
|
0
|
0
|
1466
|
|
POST
|
Les, I'm assuming that the problem you are running into is because of your assumption that the annotation "tool" as you call it is. in fact, a "Tool" - as in Framework.Contracts.Tool.....which it isn't 😉 It's a button (or "ICommand" as we would have called it if we were in ArcObjects). Add this code I provide below to a button and set a breakpoint on the "if (plugin is Tool)" line...notice it returns false....meaning "SetCurrentToolAsync", if you were to call it, will be a no-op - it will do nothing. Instead, the code will drop down to "plugin.Execute" which will do what I think you want....it will show the Annotation dockpane and activate the underlying annotation text tool. Note: ICommand is a System.Windows.Input.ICommand - you will need a "using" statement accordingly. var plugin = FrameworkApplication.GetPlugInWrapper("esri_editing_EditVerticesText");
if (plugin.Enabled) {
if (plugin is Tool)
{
FrameworkApplication.SetCurrentToolAsync("esri_editing_EditVerticesText");
}
else
{
((ICommand)plugin).Execute(null);
}
}
... View more
02-27-2018
01:36 PM
|
2
|
1
|
1711
|
|
POST
|
If scenario 3 works when you run the GP from the GP dockpane but not when the tool is called inside an Add-in could mean we have a bug. However, If scenario 3 does not work when you run the GP "manually" then it won't work inside the Add-in either.
... View more
02-02-2018
08:47 AM
|
0
|
4
|
4634
|
|
POST
|
Consult: https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Content-and-Items#selecting-items
... View more
01-29-2018
08:50 AM
|
2
|
1
|
1481
|
|
POST
|
Taner, 2.1 was the first release of annotation and we are working on enhancing the API for 2.2, 2.3, etc. Currently, to make a annotation symbol similar to the above requires: An edit operation (currently you have to use the edit operation callback for 2.1) to handle the transation Modifying the CIMTextGraphic of the annotation feature to "be" the text symbol you need (a point callout in your case above) Modify the text string (using the text expression tags Ciara mentions above that can be referenced here: http://pro.arcgis.com/en/pro-app/help/mapping/text/text-formatting-tags.htm The CIM is where it can get tricky - especially for a complex symbol as you have above. This is a complete example that will change whichever annotation feature you have selected to be a circle with the text "12 00" internal class ChangeSymbol : Button
{
protected async override void OnClick()
{
var annoLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<AnnotationLayer>().FirstOrDefault();
if (annoLayer == null)
return;
await QueuedTask.Run(() => {
var select = annoLayer.GetSelection();
if (select.GetObjectIDs().Count() > 0)
{
var oid = select.GetObjectIDs().First();
QueryFilter qf = new QueryFilter()
{
WhereClause = $"OBJECTID = {oid}"
};
var rowCursor = annoLayer.GetTable().Search(qf, false);
rowCursor.MoveNext();
var annoFeature = rowCursor.Current as ArcGIS.Core.Data.Mapping.AnnotationFeature;
var graphic = annoFeature.GetGraphic();
var textGraphic = graphic as CIMTextGraphic;
var op = new EditOperation();
op.Name = "Change Anno";
op.Callback((context) => {
//make the callout for the circle
var callOut = new CIMPointSymbolCallout();
callOut.PointSymbol = new CIMPointSymbol();
//Circle outline
var circle_outline = SymbolFactory.Instance.ConstructMarker(40, "ESRI Default Marker") as CIMCharacterMarker;
circle_outline.Size = 30;
//eliminate the outline
foreach (var layer in circle_outline.Symbol.SymbolLayers)
{
if (layer is CIMSolidStroke) {
((CIMSolidStroke) layer).Width = 0;
}
}
//Circle fill
var circle_fill = SymbolFactory.Instance.ConstructMarker(172, "ESRI Default Marker") as CIMCharacterMarker;
circle_fill.Size = 30;
//eliminate the outline, make sure the fill is white
foreach (var layer in circle_fill.Symbol.SymbolLayers) {
if (layer is CIMSolidFill) {
((CIMSolidFill)layer).Color = ColorFactory.Instance.WhiteRGB;
}
else if (layer is CIMSolidStroke)
{
((CIMSolidStroke)layer).Width = 0;
}
}
var calloutLayers = new List<CIMSymbolLayer>();
calloutLayers.Add(circle_outline);
calloutLayers.Add(circle_fill);
//set the layers on the callout
callOut.PointSymbol.SymbolLayers = calloutLayers.ToArray();
//set the callout on the text symbol
var textSym = textGraphic.Symbol.Symbol as CIMTextSymbol;
textSym.Callout = callOut;
textSym.Height = 8;//adjust as needed
//now set the text
textGraphic.Text = "12 <SUP><UND>00</UND></SUP>";
annoFeature.SetGraphic(textGraphic);
annoFeature.Store();
context.Invalidate(annoFeature);
}, annoLayer.GetTable());
op.Execute();
}
});
}
}
... View more
01-26-2018
11:53 AM
|
2
|
0
|
1506
|
|
POST
|
Michael, I think what you are after is documented here: https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Content-and-Items#itemfactory-and-import
... View more
01-19-2018
09:32 AM
|
0
|
0
|
847
|
|
POST
|
Hi Stephen, your understanding is correct: "Would ArcGIS Pro check one out automatically as needed?" Yes it would. The licensing behavior of Pro is the same whether it is being exercised via its "COTS" UI or via code in a custom add-in.
... View more
01-10-2018
04:37 PM
|
1
|
7
|
4634
|
|
POST
|
Internally the builder is calling SpatialReference.IsEqual on each spatial reference. At some point, one of your spatial references is failing the equality check against the spatialreference that preceeds it. To find which one you should be able to construct your own loop on the point collection and check each spatial reference with the spatial reference that preceeds it. Note - a comparison of a spatial reference that is null with any other spatial reference is always false. http://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic8776.html (IsEqual method)
... View more
12-27-2017
12:03 PM
|
1
|
0
|
1640
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-19-2026 10:29 AM | |
| 1 | 04-29-2026 02:06 PM | |
| 1 | 01-08-2026 02:03 PM | |
| 1 | 01-08-2026 02:15 PM | |
| 3 | 12-17-2025 11:33 AM |
| Online Status |
Offline
|
| Date Last Visited |
3 weeks ago
|