On Thursday, 12 May 2011 at 9:36 PM, mil84 wrote:
thx a lot for help, i'm going to study your docs. The parts that are not
> working are mainly parts when i'm using "DefaultFeature",
> "DefaultFeatureType", "AttributeType", etc. Just few examples:
>
> 1.
> ...
> while (iterator.hasNext()) {
> DefaultFeature feature = (DefaultFeature) iterator.next();
> Number number = (Number) feature.getAttribute("THROUGH");
> MultiLineString mls = (MultiLineString)feature.getDefaultGeometry();
>
> if (1 < mls.getNumGeometries()) {
> count ++;
> }
So the big change here was we could no longer support iterator (because Java 5
introduced the for_each loop; and iterators backed onto an open inputstream
need to be closed). The class SimpleFeature matches the same assumptions as the
old DefaultFeature.
SimpleFeatureIterator iterator = featureCollection.features();
try{
while( iterator.hasNext() ){
SimpleFeature feature = iterator.next();
Number number = (Number) feature.getAttribute("THROUGH");
MultiLineString mls = (MultiLineString). feature.getDefaultGeometry();
...
}
}
finally {
iterator.close();
}
> 2.
> DefaultFeatureType type = (DefaultFeatureType) feature.getFeatureType();
SimpleFeatureType type = feature.getFeatureType();
> 3.
> AttributeType[] types = featureSource.getSchema().getAttributeTypes();
List<AttributeDescriptor> descriptors =
featureSource.getSchema().getAttributeDescriptors();
> After upgrading do 2.5 compiler doesn't know the types "DefaultFeature",
> "DefaultFeatureType" or "AttributeType" because they are not present in 2.5
> (my code is from 2.4.2, few years ago)...
Cheers,
Jody
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users