]>
git.argeo.org Git - gpl/argeo-suite.git/blob - org.argeo.app.geo/src/org/argeo/app/api/geo/FeatureAdapter.java
1 package org
.argeo
.app
.api
.geo
;
3 import javax
.xml
.namespace
.QName
;
5 import org
.argeo
.api
.acr
.Content
;
6 import org
.argeo
.api
.acr
.search
.AndFilter
;
7 import org
.argeo
.app
.api
.EntityType
;
8 import org
.argeo
.app
.geo
.acr
.GeoEntityUtils
;
9 import org
.locationtech
.jts
.geom
.Geometry
;
11 import jakarta
.json
.stream
.JsonGenerator
;
13 public interface FeatureAdapter
{
14 default Geometry
getDefaultGeometry(Content c
, QName targetFeature
) {
15 // TODO deal with more defaults
16 // TODO deal with target feature
17 if (c
.hasContentClass(EntityType
.geopoint
)) {
18 return getGeoPointGeometry(c
);
23 void writeProperties(JsonGenerator g
, Content content
, QName targetFeature
);
25 void addConstraintsForFeature(AndFilter filter
, QName targetFeature
);
27 static Geometry
getGeoPointGeometry(Content c
) {
28 if (c
.hasContentClass(EntityType
.geopoint
)) {
29 return GeoEntityUtils
.toPoint(c
);
30 // double latitude = c.get(WGS84PosName.lat, Double.class).get();
31 // double longitude = c.get(WGS84PosName.lon, Double.class).get();
33 // Coordinate coordinate = new Coordinate(longitude, latitude);
34 // Point the_geom = JTS.GEOMETRY_FACTORY.createPoint(coordinate);