Wiki

Clone wiki

Terramenta / plugins

Plugin development FAQ

Can I use the Terramenta iconsets within my plugin?
Yep. You can reference any of the images provided by the core Terramenta modules for use in your plugin.

//image from the terramenta-core module
ImageUtilities.loadImageIcon("com/terramenta/images/options.png",false)
//image from the terramenta-globe module
ImageUtilities.loadImageIcon("com/terramenta/globe/images/show-globe.png",false)

All Terramenta icons are also available via the Themes and Artwork project. This project contains the default Terramenta illustrator project as well as an extras section containing extended use graphics. The downloads section includes pre-cut, packaged releases of iconsets for general use (i.e., Terramenta-1.3.1-icons-default.zip & Terramenta-1.3.1-icons-extra.zip)

How do I gain access to the core Globe component's WorldWindow instance?
You will need access to the WorldWindManager to add custom layers or control the globe.

private static final WorldWindManager wwm = Lookup.getDefault().lookup(WorldWindManager.class);
...
wwm.getWorldWindow(); 

visit http://goworldwind.org for information on World Wind

How do I get get my Renderable to be visible based on the display date?
Take a look at TerramentaPlacemark and the DateBasedVisibilitySupport utilitly as an example:
com.terramenta.globe.renderables.TerramentaPlacemark.java

setValue("DISPLAY_DATE", date);
...
@Override
public void preRender(DrawContext dc) {
    boolean isVisible = DateBasedVisibilitySupport.determineVisibility(dc, this);
    setVisible(isVisible);
}

com.terramenta.globe.utilities.DateBasedVisibilitySupport.java

public static boolean determineVisibility(DrawContext dc, AVList avlist) {
    if (dc != null && avlist != null && avlist.hasKey("DISPLAY_DATE") && dc.hasKey("DISPLAY_DATEINTERVAL")) {
        Date displayDate = (Date) avlist.getValue("DISPLAY_DATE");
        DateInterval displayDateInterval = (DateInterval) dc.getValue("DISPLAY_DATEINTERVAL");

        if (displayDate != null && displayDateInterval != null) {
            //does this displayDate exist within the displayDateInterval?
            long displayDateMillis = displayDate.getTime();
            return (displayDateMillis >= displayDateInterval.getStartMillis() && displayDateMillis <= displayDateInterval.getEndMillis());
        }
    }

    //if we have no date restrictions then its always visible
    return true;
}

How do I implement the Globes DnD for Renderables?
The abstract RenderableProvider class takes care of all the Transferable stuff, just extend it.

public class DropMe extends RenderableProvider{

    @Override
    public String getLayerName() {
        return "DropMe Layer";
    }

    @Override
    public Renderable getRenderable(Position pos) {
        if (pos == null) {
            return null;
        }

        return new PointPlacemark(pos);
    }
}

Updated