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;
        }

-------------------------------------------------------------------------
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
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to