我正在实现轨迹点的插值。所以,基本上,我需要沿着从起点到终点的方位角创建几个点。问题是,我无法将创建的点添加到集合中:
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);
但是,当我运行它时,集合大小不会改变,并且不会将任何内容添加到该集合中。我不确定这里有什么问题。
谢谢,