@Override public SimpleFeatureCollection getFeatures(final Query query) throws IOException { Filter filter = query.getFilter(); if (filter == null) { filter = Filter.INCLUDE; } if (Filter.EXCLUDE.equals(filter)) { return new EmptyFeatureCollection(type); } final Query query2 = reprojectFilter(query); filter = query2.getFilter(); final ObjectDatabase lookupDatabase = dataStore.getGeogit().getRepository().getIndex().getDatabase(); final RevTree typeTree = getCurrentVersion(); GeoGitSimpleFeatureCollection featureCollection; featureCollection = new GeoGitSimpleFeatureCollection( type, filter, lookupDatabase, typeTree, dataStore.getGeogit()); final int maxFeatures = query2.getMaxFeatures(); if (maxFeatures > 0 && maxFeatures != Query.DEFAULT_MAX) { featureCollection.setMaxFeatures(maxFeatures); } // if (null != query.getHints().get(Hints.JTS_GEOMETRY_FACTORY)) { // GeometryFactory gfac = (GeometryFactory) query.getHints().get( // Hints.JTS_GEOMETRY_FACTORY); // featureCollection.setGeometryFactory(gfac); // } else if (null != // query.getHints().get(Hints.JTS_COORDINATE_SEQUENCE_FACTORY)) { // CoordinateSequenceFactory csf = (CoordinateSequenceFactory) // query.getHints().get( // Hints.JTS_COORDINATE_SEQUENCE_FACTORY); // GeometryFactory gfac = new GeometryFactory(csf); // featureCollection.setGeometryFactory(gfac); // } return featureCollection; }
/** @return the tree of feature references for this type */ public RevTree getCurrentVersion() { // assume HEAD is at MASTER try { final Name typeName = this.type.getName(); GeoGIT geogit = dataStore.getGeogit(); RevTree typeTree = geogit .getRepository() .getWorkingTree() .getHeadVersion(new QName(typeName.getNamespaceURI(), typeName.getLocalPart())); return typeTree; } catch (Exception e) { throw new RuntimeException(e); } }
/** * @return the id of the root tree. Defaults to the repository's root, but {@link * GeoGitFeatureStore} shall override to account for whether there's a transaction in progress */ protected ObjectId getRootTreeId() { GeoGIT geogit = dataStore.getGeogit(); ObjectId rootTreeId = geogit.getRepository().getRootTreeId(); return rootTreeId; }