[geotk] Adding GraphicBuilder to its own MapLayer
Thys Meintjes
sthysel at gmail.com
Tue Jul 26 05:00:42 EDT 2011
Sorry - its seems my previous mail with the rather large attachment were a
bit of an issue, here's the text of the message:
>
> The code looks correct (don't forget to call context.switchToDisplayCRS()
> or switchToDisplayCRS() to set the system in which you are painting), if you
> need more examples you can have a look at the
> WMS/WMTS/OSM-TMS/KML Clients modules, they all use custom subclasses of
> MapLayer and GraphicBuilders.
>
>
Hi Johann . I took your advice and created a custom MapLayer:
public class TargetMapLayer extends AbstractMapLayer {
private TargetManager manager;
private TargetGraphicBuilder builder;
// full world extend
private static final Envelope MAXEXTEND_ENV = new
Envelope2D(DefaultGeographicCRS.WGS84, -180, -90, 360, 180);
private static final MutableStyleFactory SF = (MutableStyleFactory)
FactoryFinder.getStyleFactory(
new Hints(Hints.STYLE_FACTORY, MutableStyleFactory.class));
public TargetMapLayer(TargetManager manager) {
super(new DefaultStyleFactory().style());
this.manager = manager;
//register the default graphic builder for geotk 2D engine.
builder = new TargetGraphicBuilder(manager);
graphicBuilders().add(builder);
setDescription(SF.description(manager.getName(), manager.getName() +
" Target Manager"));
}
@Override
public Envelope getBounds() {
return MAXEXTEND_ENV;
}
}
I have several implementations of my TargetProviders (radars), the attached
screenshot shows the simulated radar. The red dots are acquired targets.
My current issue is that the targets are only painted when I toggle the
"Stateful Rendering Mode" check and manually refresh. Manually refreshes
after checking
statefull does not work either - I have to cycle through the "Stateful
Rendering Mode" again.
How do I switch on auto refreshing - the refresh()methods don't seem to work
for me...
Tanks and regards
--
Thys Meintjes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geotoolkit/attachments/20110726/6018d7a5/attachment.html
More information about the Geotoolkit
mailing list