5

I am new to GeoTools and I have been reading some examples and some tutorials.

I am currently implementing a Map where I need to have a sprite moving through coordinates. I found an example right [here][1]

[1]: http://svn.osgeo.org/geotools/tags/2.7.1/demo/example/src/main/java/org/geotools/demo/swing/FlyingSaucer.java [] but it's very old and some methods have changed specifically these ones:

public void onRenderingCompleted() {
    super.onRenderingCompleted();
    System.out.println("hi");
    spriteBackground = null;
    animationTimer.start();
}

This method has changed and doesn't allow me to @Override JMapPane method and it also now requires a parameter. I tried to replace it but it didn't work. Here is my replacement:

public void onRenderingCompleted() {
    super.onRenderingCompleted(null);
    spriteBackground = null;
    animationTimer.start();
}

There are other minor changes as well (MapContext is deprecated so I must use MapContent).

Could someone tell me how to replace those methods to make this tutorial work or post a link here with a recent example?

3

The short answer is to change `onRenderingCompleted(...) to be:

@Override
  public void onRenderingCompleted(RenderingExecutorEvent event) {

    super.onRenderingCompleted(event);

    spriteBackground = null;
    animationTimer.start();

  }

But you should take the FAQ answer into account and consider doing this properly with two (or more) buffers to save redrawing whole map each time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.