Tuesday, November 27, 2007

WWJ SurfaceImage reloaded

Don't worry this isn't Matrix ;) (I hope it)

I have made a little update on the previous update of SurfaceImage to allow reload of data.
Suppose you have an image file that can be modified by an external process and you want reload it at regular intervals of time to see its changes.
Now you can have it with SurfaceImage reloaded :)

You can get the source code here.

I have added a new reload(boolean useCache) method. Note, it has one boolean parameter to specify if the image must be reloaded from cache (if it is there, I think this option isn't very useful) or reloading it from the original source of data.

Monday, November 26, 2007

A note on LayerSet

Unfortunately I must recognize I am a newbie with my own code :P
Using LayerSet in the Balloon project I get a little headache I want to comment here.
LayerSet extends LayerList class and also implements the Layer interface (in the same way as AbstractLayer).
Take very into account, that if you create a LayerSet an adds a LayerList object, all contained layers in LayerList are copied into the LayerSet, and that's all. If later you modify the LayerList, adding or removing layers, the changes are not propagated to the LayerSet.

Friday, November 23, 2007

WWJ renderable objects

Although it seems a very big change, here I present a WWJ hack to convert more object into Renderable object, that is, objects that implements the Renderable interface.
I have made only three things to achieve this:


  1. Add the next methods to the Renderable interface:

    public boolean isEnabled();
    public void setEnabled(boolean enabled);
    public String getName();
    public void setName(String name);
    public double getOpacity();
    public void setOpacity(double opacity);

    The idea is that a any Renderable object can has a enable/disable state, an opacity value and optionally a name.



  2. Add a default implementation for this method in all affected classes and interfaces. The default implementation doesn't alter the normal behavior of this elements.

    /**
    * Default Renderable implementation.
    */
    public boolean isEnabled()
    {
    return true;
    }

    public void setEnabled(boolean enabled)
    {
    // Do nothing.
    }

    public String getName()
    {
    return null;
    }

    public void setName(String name)
    {
    // Do nothing.
    }

    public double getOpacity()
    {
    return 1;
    }

    public void setOpacity(double opacity)
    {
    // Do nothing.
    }




  3. Added a new class RenderableListLayer, similar to LayerList that can contain any "new" Renderable object, that is, Layers, Icons, Images, etc.
    Here are a peace of code using this class:

    LayerList ll = new LayerList();
    RenderableListLayer main = new RenderableListLayer();

    main.add(new BMNGSurfaceLayer());
    main.add(new LandsatI3());
    main.add(new ScalebarLayer());

    RenderableListLayer rll = new RenderableListLayer();
    rll.add(si1);
    rll.add(si2);
    rll.add(si3);
    rll.add(new CompassLayer());
    rll.add(new WorldMapLayer());

    main.add(rll);
    main.setPickEnabled(false);

    ll.add(main);




Source code can be found here.

Finally it must be necessary to implement the appropriate mechanism to render images, nodes and other Renderable object taking into account its opacity and enable values.

Wednesday, November 21, 2007

WWJ Movable SurfaceImage

Finally I have modified the SurfaceImage class to implement the Movable interface too.
The source code can be found here.

Sunday, November 18, 2007

WWJ remote SurfaceImage updated

Well, after a couple of days improving some things finally here is the until now best version of SurfaceImage ;)

The new features are:
* Local and remote images (except BufferedImage's) are loaded in a separate thread.
* Remote images are cached on disk, to avoid network overhead.
* Added a 'setSector' method to change the image sector position.

You can find the source code here.

JOGL mipmap problem

Working on WWJ SurfaceImage class I get an strange phenomenon with the mipmap option. Here are the differences between using:

textureData = TextureIO.newTextureData(iconStream, false, null);
(mipmap option set to 'false')



textureData = TextureIO.newTextureData(iconStream, true, null);
(mipmap option set to 'true')



All three are PNG images.

Following Ken answer I report it as a possible JOGL bug.

Wednesday, November 14, 2007

WWJ and remote SurfaceImage

Yesterday and today afternoon I was working on the SurfaceImage class. I was modify a bit to allow load remote HTTP images on a Retriever thread. Now you can make things like:

SurfaceImage img = new SurfaceImage("http://openclipart.org/people/yeKcim/yeKcim_pirats_boat.png", Sector.fromDegrees(40, 43, 0, 5));


You can found the code here.

Sunday, November 11, 2007

WWJ The needle of the compass

Here are a modified version of CompassLayer to allow compass with needle.
You can choose between the classic compass or a compass with a needle inside it. Also you can make the compass fixed and see how only rolls the needle.



As you can imagine you can set the images for the compass and the needle.



Saturday, November 10, 2007

WWJ LayerSet updated

I put here the link to the updated version.

Basically I have added a couple of useful methods to query if an object or a class is contained by the LayerSet or some other contained Layer.


@Override
public boolean contains(Object o) {

if (super.contains(o)) {
return true;
}

for (Iterator it = this.iterator(); it.hasNext();) {
Layer layer = it.next();
if (layer instanceof LayerList) {
if (((LayerList) layer).contains(o)) {
return true;
}
}
}

return false;
}


Finally, I have added the mothod 'indexOf' that given a class returns the first instance ocurrence in the list (the search is not recursively).

Tuesday, November 06, 2007

WWJ Temporality updated

Today I have modified a bit the Temporality related classes. The TemporalityAdaptar has changed to TemporalityRenderableAdaptar and also I have created a TemporalityLayerAdapter to work with layers.
You can find the changes here.

Saturday, November 03, 2007

As farewell of Core API...

As I say in a previous post, I continue working on the Balloon Project but instead of build, improve and maintain my own 3D API, so called Balloon Core API, I change to use WWJ as 3D API.

It would not be fair for my lovely Balloon Core API not shown some videos with the latest improvements achieved.
I upload three videos to YouTube but also I upload them to my personal page with better quality. I only have 100mb of personal space and I don't know until when I store them, because this I have uploaded them to YouTube.
As usual, remember the animation in my laptop (with only 64mb graphics card) is very good although the captured screens seems poor.

The quality videos are cutted by my blog CSS, you can see completely HERE.

The first video shows three improvements: (1) the camera object can return the camera position and mouse coordinates (as you can see in the status bar). (2) Rotation was improved to move the world in a WWJ way. (3) Every layer informs the user with an "Uploading..." message in the status bar.



The second and third videos show the improvements in drag and drop object. Any object (images, points, polygons, ...) can be moved trough the globe, change its dimensions or change its elevation.






The low quality youtube videos are: