World Wind Forums

Go Back   World Wind Forums > WorldWind JAVA forums > Development Help

Development Help Help for building applications or diagnosing problems with WWJ

Reply
 
Thread Tools Display Modes
Old 08-08-2012, 11:17 AM   #1
BuM
Member
 
Join Date: Jan 2012
Posts: 94
BuM is on a distinguished road
Question How to change LabelLayouts?

Hi there,

I have the requirement to implement some tactical symbols with additional labels, for example the point graphic "Point of Interest". I would like to define my own symbol ID code with its own LabelLayouts as in DefaultLabelLayouts.java, but what would be the best way to do this without changing existing WorldWind code?
I could override DefaultLabelLayouts, but TacticalGraphicSymbol uses it as a static field which I would have to reset.
In theory it would also be possible to add a LabelLayout from the outside per DefaultLabelLayouts.addLayout(). However, this method is protected.

Not quite sure how to handle this, yet...
BuM is offline   Reply With Quote
Old 08-10-2012, 04:59 PM   #2
pabercrombie
WW Dev. Team
 
Join Date: Sep 2010
Location: Boston, MA, USA
Posts: 325
pabercrombie is on a distinguished road
Default

Is there a reason that you're using TacticalGraphicSymbol instead of MilStd2525TacticalSymbol? The latter is the "normal" symbol implementation, and the former is a slightly different implementation used for point tactical graphics in 2525C.

If you can use MilStd2525TacticalSymbol, you can override the layoutTextModifiers method to add any additional labels that you require.

If you must use TacticalGraphicSymbol, you could override layoutTextModifiers and duplicate the logic for the loop that iterates through the layouts. I'll look into changing that implementation to make it easier to extend the class and add new layouts.
pabercrombie is offline   Reply With Quote
Old 08-13-2012, 11:39 AM   #3
BuM
Member
 
Join Date: Jan 2012
Posts: 94
BuM is on a distinguished road
Default

There was no specific reason to use TacticalGraphicSymbol over MilStd2525TacticalSymbol, it was just the first that we noticed.

I looked through the codes, but I do not understand why there are those two approaches for the same thing. Is there any advantage to use MilStd2525TacticalSymbol over TacticalGraphicSymbol?

Quote:
...you could override layoutTextModifiers and duplicate the logic for the loop that iterates through the layouts.
That's what I already did now, and it works. It requires code changes/overriding at about 5 different classes, though.
BuM is offline   Reply With Quote
Old 08-13-2012, 06:19 PM   #4
pabercrombie
WW Dev. Team
 
Join Date: Sep 2010
Location: Boston, MA, USA
Posts: 325
pabercrombie is on a distinguished road
Default

I've added a method to TacticalGraphicSymbol to look up the layout for a graphic. You can override just this one method to insert your custom layout:
Code:
@Override
protected List<LabelLayout> getLayouts(String sidc)
{
   if (needCustomLayout)
        // return custom layout
   else
        return super.getLayouts(sidc);
}
MilStd2525TacticalSymbol handles symbols from 2525 appendices A, D, E, and G. I consider this the "normal" symbol implementation. TacticalGraphicSymbol handles the point graphics in appendices B and C. The two use cases are different enough that we felt the implementation required two classes. The main difference is that the "normal" symbols all use the same modifier layout, and the point graphics use many different layouts.

Looking at your first point again, it sounds like you do want to use TacticalGraphicSymbol, since it sounds like you are trying to change the layout of some of the point graphics. I also added a public method to MilStd2525GraphicFactory to allow you to change the implementation class that the factory instantiates without extending the factory itself. Hopefully that will eliminate one of the classes that you need to override.
pabercrombie is offline   Reply With Quote
Old 08-14-2012, 09:07 AM   #5
BuM
Member
 
Join Date: Jan 2012
Posts: 94
BuM is on a distinguished road
Default

Thanks a lot, this is very convenient!
In some point in the future we will probably migrate our system to a newer version of WWJ, until then I will have to do without those changes. Still nice to see such courtesy here!
BuM is offline   Reply With Quote
Old 08-14-2012, 11:07 AM   #6
nlneilson
Super Moderator
 
Join Date: Nov 2006
Location: Mojave & Oxnard California
Posts: 2,621
nlneilson is on a distinguished road
Default

To update I just:

delete src/gov
paste in latest gov

It took a while to set it up so it could be done that way.
Some of the latest changes may be missing but have not seen a problem yet.
__________________
Neil
http://www.nlneilson.com
nlneilson is offline   Reply With Quote
Reply

Tags
defaultlabellayout, labellayout, symbology


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change to DRAG select event handling tag Feature Discussion 1 06-22-2011 11:41 PM
WW1.3.2-Plugin: Layer Edit canosso Add-ons & Scripts 21 02-27-2010 04:37 AM
Change to WorldWind.cs James_In_Utah Developers' Corner 10 03-19-2008 11:51 PM
zoom and latitude change haddazi Development Help 1 11-14-2007 04:04 AM
WW 1.3.2-Plugin: Skripter canosso Add-ons & Scripts 33 03-22-2007 02:06 PM


All times are GMT +1. The time now is 11:55 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.