![]() |
|
|||||||
| Development Help Help for building applications or diagnosing problems with WWJ |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: May 2010
Location: Layton, UT
Posts: 23
![]() |
So I have a ScreenRelativeAnnotation object and for the project I need to set a certain size for it instead of just letting it wrap the text. Which works fine except for one thing, the text is no longer centered vertically, and I can't for the life of me figure out how to fix that?
Here's a simple example: Code:
import gov.nasa.worldwind.BasicModel;
import gov.nasa.worldwind.awt.WorldWindowGLCanvas;
import gov.nasa.worldwind.layers.AnnotationLayer;
import gov.nasa.worldwind.render.ScreenRelativeAnnotation;
import java.awt.Dimension;
import javax.swing.JFrame;
public class RelativeAnnotationTest {
public static void main(String[] args) {
JFrame frame = new JFrame();
WorldWindowGLCanvas worldWindow = new WorldWindowGLCanvas();
worldWindow.setPreferredSize(new Dimension(600, 600));
worldWindow.setModel(new BasicModel());
AnnotationLayer annotationLayer = new AnnotationLayer();
worldWindow.getModel().getLayers().add(annotationLayer);
{
ScreenRelativeAnnotation annotation = new ScreenRelativeAnnotation("Tall", 0, .5);
annotation.getAttributes().setSize(new Dimension(100, 100));
annotationLayer.addAnnotation(annotation);
}
{
ScreenRelativeAnnotation annotation = new ScreenRelativeAnnotation("Normal", 1, .5);
annotationLayer.addAnnotation(annotation);
}
frame.add(worldWindow);
frame.pack();
frame.setVisible(true);
}
}
|
|
|
|
|
|
#2 |
|
Junior Member
Join Date: May 2010
Location: Layton, UT
Posts: 23
![]() |
Been digging through the source code of AbstractAnnotation and MultiLineTextRenderer and it's not looking good... I don't think there is anything that affects the y location where the text is being drawn. Bleh. Might have to add this myself! Still open to suggestions!
|
|
|
|
|
|
#3 |
|
Junior Member
Join Date: May 2010
Location: Layton, UT
Posts: 23
![]() |
Alright well for future reference in case anybody else runs into this, I ended up having to implement a vertical alignment myself in the AbstractAnnotation and MultiLineRenderer classes to get this to work. I'm using HTML for my text so I only implemented it in the drawHTML call, not the drawPlainText call. But yeah.
|
|
|
|
|
|
#4 | ||
|
Senior Member
Join Date: Feb 2008
Location: Melbourne, FL, USA
Posts: 675
![]() |
not exactly answering your question, but here is an info box i implemented on a previous application.
PHP Code:
__________________
Junior Member
Join Date: May 2010
Location: Layton, UT
Posts: 23
![]() |
Quote:
|
|
|
|
|
![]() |
| Tags |
| alignment, screenrelativeannotation, vertical |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shape objects and vertical exaggeration | Dario Saccavino | Development Help | 0 | 11-15-2011 03:29 PM |
| Problem picking terrain with vertical exaggeration set to 0 | NathanKronenfeld | Development Help | 3 | 01-21-2011 04:50 PM |
| How to add Chinese annotation on ScreenAnnotation | yedaya | Development Help | 2 | 03-07-2010 03:09 PM |
| KML AltitudeMode and Vertical Exaggeration question... | James_In_Utah | Developers' Corner | 5 | 07-18-2008 09:20 PM |
| Vertical Exaggeration | James_In_Utah | Suggestion Box | 16 | 05-13-2006 02:36 AM |