Labels not displaying (WAS Re: Animated drawing)

9 messages Options
Embed this post
Permalink
mbedward

Labels not displaying (WAS Re: Animated drawing)

Reply Threaded More More options
Print post
Permalink
Hello Guy,

I'm replying to the labels question in your post (I'll reply to the
animated drawing bit separately after I've had a think about it).

> For another situation I tried this also but the result wasen't better:
>
>                 PolygonSymbolizer ps = sb.createPolygonSymbolizer(color1,
> color2, 2);
>                 FilterFactory ff =
> FilterFactoryFinder.createFilterFactory();
>                 Font font = FontImpl.createDefault(ff);
>                 TextSymbolizer ts = sb.createTextSymbolizer(Color.BLACK,
> font, "quartier");
>                 newStyle.addFeatureTypeStyle(sb.createFeatureTypeStyle(ps));
>                 MapLayer maplayer = new DefaultMapLayer(sourceM, newStyle);
>
> If there is something I'm doing wrong please just tell me. I need to have
> this project very soon but still stuck on 'basic' issues.

You are creating a TextSymbolizer but don't seem to be using it at
all, ie. you don't pass it into your feature type style along with the
PolygonSymbolizer.

Here is your example modified slightly...

        PolygonSymbolizer ps = sb.createPolygonSymbolizer(color1, color2, 2);

        Font font = sb.createFont("Serif", 10.0);
        TextSymbolizer ts = sb.createTextSymbolizer(Color.BLACK, font,
"quartier");

        Rule rule = sb.createRule(new Symbolizer[]{ps, ts});

        String typeName = ...
        FeatureTypeStyle fts = sb.createFeatureTypeStyle(typeName, rule);

        Style newStyle = sb.createStyle();
        newStyle.addFeatureTypeStyle(fts);

        MapLayer maplayer = new DefaultMapLayer(sourceM, newStyle);

See if that gets better results for you.

Michael

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Guy PENDA

Re: Labels not displaying (WAS Re: Animated drawing)

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Hi Micheal!
Thanks for your sample code it works well now. About the drawing I forgot to let you know
that I finally succeed drawing my routes on the JMapPane by exending the JMapPane class itself
but still need to do more by having an animated drawing as posted before. Is it possibe to make it with
graph class of geotools??? I have never used it before.

Once more thanks for the label issue and still looking forward for your answer about the animated drawing.

Cheers!


>
> Here is your example modified slightly...
>
> PolygonSymbolizer ps = sb.createPolygonSymbolizer(color1, color2, 2);
>
> Font font = sb.createFont("Serif", 10.0);
> TextSymbolizer ts = sb.createTextSymbolizer(Color.BLACK, font,
> "quartier");
>
> Rule rule = sb.createRule(new Symbolizer[]{ps, ts});
>
> String typeName = ...
> FeatureTypeStyle fts = sb.createFeatureTypeStyle(typeName, rule);
>
> Style newStyle = sb.createStyle();
> newStyle.addFeatureTypeStyle(fts);
>
> MapLayer maplayer = new DefaultMapLayer(sourceM, newStyle);
>
> See if that gets better results for you.
>
> Michael


Messenger débarque dans Hotmail ! Essayez-le !
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
aaime

Re: Labels not displaying (WAS Re: Animated drawing)

Reply Threaded More More options
Print post
Permalink
Guy PENDA ha scritto:

> Hi Micheal!
> Thanks for your sample code it works well now. About the drawing I
> forgot to let you know
> that I finally succeed drawing my routes on the JMapPane by exending the
> JMapPane class itself
> but still need to do more by having an animated drawing as posted
> before. Is it possibe to make it with
> graph class of geotools??? I have never used it before.
>
> Once more thanks for the label issue and still looking forward for your
> answer about the animated drawing.

GeoTools has no support whatsoever for animated drawing, it would
require a new renderer and a custom panel that caches the static part
of the map and just redraws the dynamic one.

Cheers
Andrea


--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
mbedward

Re: Labels not displaying (WAS Re: Animated drawing)

Reply Threaded More More options
Print post
Permalink
In reply to this post by Guy PENDA
Hello Guy,

> Thanks for your sample code it works well now.

It's always nice to hear about things working :-)

> About the drawing I forgot to let you know
> that I finally succeed drawing my routes on the JMapPane by exending the
> JMapPane class itself
> but still need to do more by having an animated drawing as posted before.

I've written a little animated map demo to illustrate one possible approach.

http://svn.osgeo.org/geotools/trunk/demo/example/src/main/java/org/geotools/demo/swing/AnimatedMapPane.java

The application first prompts you for a shapefile to display. Then,
when you click on the map anywhere it generates a little random walk
path and draws it, in animated fashion, over the shapefile.

Note that it's in GeoTools 2.6 so, at the moment, if you want to
compile it you will need to use version 2.6-SNAPSHOT. However, you may
find that just examining the code and then adapting it to your own map
pane class is enough.

Please let me know how you go with it.

Michael

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
aaime

Re: Labels not displaying (WAS Re: Animated drawing)

Reply Threaded More More options
Print post
Permalink
Michael Bedward ha scritto:

> Hello Guy,
>
>> Thanks for your sample code it works well now.
>
> It's always nice to hear about things working :-)
>
>> About the drawing I forgot to let you know
>> that I finally succeed drawing my routes on the JMapPane by exending the
>> JMapPane class itself
>> but still need to do more by having an animated drawing as posted before.
>
> I've written a little animated map demo to illustrate one possible approach.
>
> http://svn.osgeo.org/geotools/trunk/demo/example/src/main/java/org/geotools/demo/swing/AnimatedMapPane.java

Doh, this is a surprise. What does it do, redraw everything at
all repaints, or can it just repaint the area affected by the
animation?

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
mbedward

Re: Labels not displaying (WAS Re: Animated drawing)

Reply Threaded More More options
Print post
Permalink
2009/10/9 Andrea Aime wrote:
> Doh, this is a surprise. What does it do, redraw everything at
> all repaints, or can it just repaint the area affected by the
> animation?

It's a very basic example - just enough to get Guy started hopefully.
It doesn't track 'dirty rectangles' etc. though that could be added.
At the moment, the pane is just redisplaying the image that the
renderer drew into and then drawing the animation.

Any suggestions to make it a funkier example will be gratefully received :-)

Michael

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
aaime

Re: Labels not displaying (WAS Re: Animated drawing)

Reply Threaded More More options
Print post
Permalink
Michael Bedward ha scritto:
> 2009/10/9 Andrea Aime wrote:
>> Doh, this is a surprise. What does it do, redraw everything at
>> all repaints, or can it just repaint the area affected by the
>> animation?
>
> It's a very basic example - just enough to get Guy started hopefully.
> It doesn't track 'dirty rectangles' etc. though that could be added.
> At the moment, the pane is just redisplaying the image that the
> renderer drew into and then drawing the animation.

Oh, so you are caching the image the renderer drew.
That's fine, I don't really have much of an improvement suggestion then
(not sure repainting only the old area covered by the animation and the
new one will provide much of a benefit, blitting an image to the screen
should be pretty fast).

Cheers
Andrea


--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Guy PENDA

Re: Labels not displaying (WAS Re: Animated drawing)

Reply Threaded More More options
Print post
Permalink
In reply to this post by mbedward
Some javascript/style in this post has been disabled (why?)
Hi Micheal! Thanks for your help, but I tried your sample code with geotools version 2.6_M3 got from sourceforge (I couldn't find the version 2.6-SNAPSHOT), and when I display the map and click on it I have o reaction. In fact nothing happends. Maybe the version of geotools is not the good one. Anyway still I'll try to figure out what is the matter.

Thanks & regards!
Guy


> Date: Fri, 9 Oct 2009 23:22:39 +1100
> Subject: Re: Labels not displaying (WAS Re: [Geotools-gt2-users] Animated drawing)
> From: [hidden email]
> To: [hidden email]; [hidden email]
>
> Hello Guy,
>
> > Thanks for your sample code it works well now.
>
> It's always nice to hear about things working :-)
>
> > About the drawing I forgot to let you know
> > that I finally succeed drawing my routes on the JMapPane by exending the
> > JMapPane class itself
> > but still need to do more by having an animated drawing as posted before.
>
> I've written a little animated map demo to illustrate one possible approach.
>
> http://svn.osgeo.org/geotools/trunk/demo/example/src/main/java/org/geotools/demo/swing/AnimatedMapPane.java
>
> The application first prompts you for a shapefile to display. Then,
> when you click on the map anywhere it generates a little random walk
> path and draws it, in animated fashion, over the shapefile.
>
> Note that it's in GeoTools 2.6 so, at the moment, if you want to
> compile it you will need to use version 2.6-SNAPSHOT. However, you may
> find that just examining the code and then adapting it to your own map
> pane class is enough.
>
> Please let me know how you go with it.
>
> Michael


Achetez un nouveau PC et bénéficiez de Windows 7 dès sa sortie ! En savoir plus
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
mbedward

Re: Labels not displaying (WAS Re: Animated drawing)

Reply Threaded More More options
Print post
Permalink
Hello Guy,

My fault - you do need to use 2.6-SNAPSHOT to run the example but I
neglected to tell you how to get it.

If you are using Maven add this repository to your pom.xml file...

        <repository>
          <id>osgeo-snapshots</id>
          <name>OSGeo snapshots repository</name>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
          <url>http://repo.osgeo.org/</url>
        </repository>

If you are adding jars manually you can download them from that url.

Hope this helps

Michael

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users