Select to view content in your preferred language

X and Y Offsets

454
1
11-17-2023 12:39 PM
AndrewAlexander1
Emerging Contributor

Hello,

I have some points plotted and they have a callout attached.  I can use whatever X and Y offsets I want to place the callouts.  But we want the user to be able to move the callout with the mouse if they want, and then be able to save the new offset location so that it will show up in the location the next time they bring up the points.

I see that we can see the offset location via the property window of the callout in the UI.  However, I haven't found a way to get at that information via code.  How to drill down to that via the objects in the code.

How can I get at that information?

I also noticed in the UI that if I do move the callout with the mouse, while looking at the offsets, it does not update in real time with the new offset location (as it does the XY coordinates when moving it).  It still shows the offsets I originally set it to.  So I might also need to be able to refresh that before I get it in the code?

This is in Visual Studio, C#.

Thanks
Andy

 

0 Kudos
1 Reply
Wolf
by Esri Regular Contributor
Esri Regular Contributor

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/arcg...

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):

Wolf_0-1701392259114.png

This tool allows you to click on the callout and reposition it.  

Wolf_1-1701392406562.png

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);
}

 

 

 

0 Kudos