2

軌跡点の補間を実装しています。したがって、基本的には、出発点から目的地までの方位角に沿っていくつかのポイントを作成する必要があります。問題は、作成したポイントをコレクションに追加できないことです。

SimpleFeatureType featureType = featureSource.getSchema(); 

GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); 
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(featureType); 

SimpleFeatureCollection collection = featureSource.getFeatures(); 

/* Irrelevant code here 
----------------------- 
*/ 

Point2D newPt = setPointByAzimuth(startingPointCoords, azimuth, distance_to_next_point); 

Point pointToCollection = geometryFactory.createPoint(new Coordinate(newPt.getX(), newPt.getY())); 

featureBuilder.add(pointToCollection); //not quite sure what this does 

SimpleFeature feature = featureBuilder.buildFeature(null);       

collection.add(feature); 

ただし、これを実行すると、コレクションのサイズは変更されず、このコレクションには何も追加されません。ここで何が問題なのかわかりません。

ありがとう、

4

1 に答える 1

3

のすべての実装SimpleFeatureCollectionが mutableであるとは限りません。

別の方法を試してください:

于 2012-04-14T11:50:20.803 に答える