1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| for (DcPersonArea area : dcPersonAreas) { FeatureJSON featureJson = new FeatureJSON(new GeometryJSON(15)); try { FeatureCollection featureCollection = featureJson.readFeatureCollection(area.getAreaVector()); SimpleFeatureIterator featureIterator = (SimpleFeatureIterator) featureCollection.features(); while (featureIterator.hasNext()) { Geometry defaultGeometry = (Geometry) featureIterator.next().getDefaultGeometry(); for (DcUserGpsVo person : latestLocationVoList) { Point point = new GeometryFactory().createPoint(new Coordinate(person.getLat().doubleValue(), person.getLon().doubleValue())); if (defaultGeometry.contains(point)) { area.setCurrentPerson(area.getCurrentPerson() + 1); } } } } catch (IOException e) { e.printStackTrace(); } resultList.add(area); }
|