Select to view content in your preferred language

Custom text background in java arcobjects

1316
7
02-21-2014 12:05 AM
KevinLECOCQ
Deactivated User
Hi,
I use the ArcObjects SDK 10.2 Java Platform.
I have made a custom text background based on the sample Filled leader callout in order to improve the leader position of a line callout text background. In my AddIn for ArcMap, I managed to replace the text background of some text symbols by my custom text background, and it works well on the map.

Now, I'm faced to several problems:

1. I need a custom property page for this custom text background. According to API, it's possible to implement custom renderer or layer property pages. How could we make it for text background ? The idea would be to create a new type in the text background property page, in addition to "Balloon Callout", "Line Callout", "Marker Text Background" and "Simple Line Callout".

2. How to save my custom text background in a MXD ? Currently, when a custom text background is applied to features, the text symbol is lost when I save and reopen the MXD.

3. I use Maplex for the placement of labels. I have set Maplex in order to labels using Line Callout do not overlap. But when I apply my custom text background, it overlap. However, in my custom text background class, I have well implemented the functions queryBoundary, getGeometry, queryEnvelope and queryMargins but they are never called when Maplex is labelling (tested in debug).

I would be very grateful to help me on some of this 3 points.
0 Kudos
7 Replies
LeoDonahue
Deactivated User
0 Kudos
LeoDonahue
Deactivated User


1. According to API, it's possible to implement custom renderer or layer property pages. How could we make it for text background ?

I don't think text is "rendered" in ArcMap, but I could be wrong.  I did a search in the Java API for the word Renderer and other than ArcIMS Labels, the only renderers I saw were for features, legends, datasets or rasters.


2. How to save my custom text background in a MXD ? Currently, when a custom text background is applied to features, the text symbol is lost when I save and reopen the MXD.

Any of the classes that support persistence will have the writeExternal method.

Looking at TextElement, it says it will accept geometry of type esriGeometryPoint, esriGeometryPolyline, or  esriGeometryBag.  Maybe you could look at implementing a custom feature renderer and apply that renderer to a TextElement's symbol?  Or a ParagraphTextElement's symbol?
0 Kudos
KevinLECOCQ
Deactivated User
Thanks for your reply.

I don't think text is "rendered" in ArcMap, but I could be wrong. I did a search in the Java API for the word Renderer and other than ArcIMS Labels, the only renderers I saw were for features, legends, datasets or rasters.


Yes, I think so TextSymbols and TextBackgrounds are not renderers. So, we cannot extend BaseCustomRendererPropertyPage to create custom text background's property page. But for example, if I extend BasePropertyPage, how could I add my new property page to the text background default property page ?

Any of the classes that support persistence will have the writeExternal method.

Looking at TextElement, it says it will accept geometry of type esriGeometryPoint, esriGeometryPolyline, or esriGeometryBag. Maybe you could look at implementing a custom feature renderer and apply that renderer to a TextElement's symbol? Or a ParagraphTextElement's symbol?


My custom text background is applied to a FormattedTextSymbol, which is get from the ILabelEngineLayerProperties. Maybe it's not the best method.
Nevertheless, my custom text background class will extend Externalizable and I will implement the writeExternal and readExternal methods.
0 Kudos
LeoDonahue
Deactivated User
Textbackground as found here?

[ATTACH=CONFIG]31701[/ATTACH]

You want it added to the properties page in the lower right?  In other words, you want to add a 5th option in the dropdown in addition to Balloon Callout, Line Callout, Marker Text Background, Simple Line Callout?
0 Kudos
KevinLECOCQ
Deactivated User
Exactly, I want to add my custom text background as a 5th option of the 'Type' combobox.
0 Kudos
LeoDonahue
Deactivated User
A.[INDENT]I'm not sure it's possible.
Have you looked at this? http://help.arcgis.com/en/sdk/10.0/java_ao_adf/conceptualhelp/engine/0001/0001000002zt000000.htm
I don't see where you can build property pages for symbols.  The only examples I see are for custom feature renderers and custom layers.
[/INDENT]


B.[INDENT]Why do you want the user to drill down into four screens to be able to use your custom text background *after they have already placed text?  Why not just create a tool that interacts with the map to place your custom text + text background?  I wrote a tool that does that, places text from a feature next to the point where you identify, the popup is a custom text box, yellow background, gray border, custom text, etc.. And it becomes a graphic element that you can manually reposition if you want.
[/INDENT]
0 Kudos
KevinLECOCQ
Deactivated User
Neither do I, after looking arround the API, I don't think it's possible to extend text background property page right now. Maybe in the future !
Then, as my custom text background is an improvement of the "Line Callout" type, what I'll do is two add-in buttons. The first button convert a Line Callout to my custom line callout, and the second one convert back to Line Callout (useful if the user wants to change margins, borders or colors).
On the other side, I still have a problem with Maplex:
3. I use Maplex for the placement of labels. I have set Maplex in order to labels using Line Callout do not overlap. But when I apply my custom text background, it overlap. However, in my custom text background class, I have well implemented the functions queryBoundary, getGeometry, queryEnvelope and queryMargins but they are never called when Maplex is labelling (tested in debug).
0 Kudos