How to use add layer for PointPlacemarks?

1.1k views Asked by At

I am using World Wind for an application I am building for my employer. I've been following a tutorial recommended by the official website, but while it's very simple to follow it is not very detailed. The method he is using in his tutorial for adding place markers won't work for me in my application because I don't want to be using an ApplicationTemplate.

I have created my WorldWindowGLCanvas object and have it centered in a JPanel using BorderLayout, like so;

wwd = new WorldWindowGLCanvas();
wwd.setPreferredSize(this.getPreferredSize());
wwd.setModel(new BasicModel());
wwd.getView().setEyePosition(Position.fromDegrees(53.044516, -1.659794, 65e4)); // Set initial view position. ie over England.
layer = new RenderableLayer();
...
this.setLayout(new BorderLayout());
this.add(wwd, BorderLayout.CENTER);

Then (in a method from another class) I have created PointPlacemark objects and added them to layer...

pointPosition = Position.fromDegrees(periodical.getLatitude(), periodical.getLongitude());
placeMark = new PointPlacemark(pointPosition);
placeMark.setValue(AVKey.DISPLAY_NAME, periodical.getReference());
thisOne.layer.addRenderable(placeMark);

But now I can't figure out how to add that layer to my WorldWindowGLCanvas so that the PointPlacemarks will show up, or even if that is what I need to do. I have tried a whole host of (terrible) ideas, but so far nothing.

How can this be done?

1

There are 1 answers

3
jmclellan On BEST ANSWER

Adding layers is pretty simple.

wwd.getModel().getLayers().add(layer);

Edit: Are you setting the image for the PointPlacemark by setting its Attributes?

PointPlacemarkAttributes atts = new PointPlacemarkAttributes();
atts.setImageAddress(String address);
placeMark.setAttributes(atts);