Many thanks Michael !
It indeed works very well !
Le 4 déc. 08 à 11:36, Michael Bedward a écrit :
> 2008/12/4 Benoît Thiébault <[EMAIL PROTECTED]>:
>> Thank you Michael
>> Please find attached the classes I developped from the tutorials.
>> There are four files :
>> - LinesDataStore.java
>> - LinesFeaturesReader.java
>> - LinesLab.java : the main class
>> - test_nospaces.line : the file I have to read and draw
>
> Hi Ben,
>
> If you add the method (below) to your LinesDataStore class your
> program should run and display the line features.
>
> There may well be an easier and/or better way of doing this - if so I
> hope another list member will suggest it.
>
> cheers
> Michael
>
> @Override
> public ReferencedEnvelope getBounds(Query query) throws
> IOException {
> ReferencedEnvelope env = new ReferencedEnvelope();
> String typeName = query.getTypeName();
> Filter filter = query.getFilter();
>
> FeatureReader<SimpleFeatureType, SimpleFeature> reader =
> getFeatureReader(typeName);
> try {
> while (reader.hasNext()) {
> SimpleFeature feature = reader.next();
> if (filter.evaluate(feature)) {
> Geometry geom = (Geometry)
> feature.getDefaultGeometry();
> Envelope featEnv = geom.getEnvelopeInternal();
> if (!env.contains(featEnv)) {
> env.expandToInclude(featEnv);
> }
> }
> }
> } finally {
> reader.close();
> }
>
> return env;
> }
>
Benoît Thiébault
Société Artenum
24 rue Louis Blanc, 75010 Paris
tel: +33 (0)1 46 94 67 54
Artenum - Science & Groupware - http://www.artenum.com
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users