Improve WFS queries
[gpl/argeo-suite.git] / org.argeo.app.geo / src / org / argeo / app / api / geo / FeatureAdapter.java
index d00a2c092952c1a79850ec0c2cd5f01a9005c9c1..03ca1ce4bd8fd5a0b670e410fd962453a7172270 100644 (file)
@@ -17,6 +17,17 @@ public interface FeatureAdapter {
        default Geometry getDefaultGeometry(Content c, QName targetFeature) {
                // TODO deal with more defaults
                // TODO deal with target feature
+               if (c.hasContentClass(EntityType.geopoint)) {
+                       return getGeoPointGeometry(c);
+               }
+               return null;
+       }
+
+       void writeProperties(JsonGenerator g, Content content, QName targetFeature);
+
+       void addConstraintsForFeature(AndFilter filter, QName targetFeature);
+
+       static Geometry getGeoPointGeometry(Content c) {
                if (c.hasContentClass(EntityType.geopoint)) {
                        double latitude = c.get(WGS84PosName.lat, Double.class).get();
                        double longitude = c.get(WGS84PosName.lon, Double.class).get();
@@ -27,8 +38,4 @@ public interface FeatureAdapter {
                }
                return null;
        }
-
-       void writeProperties(JsonGenerator g, Content content, QName targetFeature);
-
-       void addConstraintsForFeature(AndFilter filter, QName targetFeature);
 }