polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [1/3] zest-qi4j git commit: Moving things around to keep the Core API as small as possible. Also considering if it is possible to make the Query Fluent API extensible, so that these kind of things would actually only be an Extension and not require addit
Date Wed, 03 Jun 2015 16:22:12 GMT
Repository: zest-qi4j
Updated Branches:
  refs/heads/ramtej-fb/spatial.queries a1053748f -> c1d327e2d


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/SpatialIndexMapper.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/SpatialIndexMapper.java
b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/SpatialIndexMapper.java
index 87e7a08..ad597d6 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/SpatialIndexMapper.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/SpatialIndexMapper.java
@@ -14,7 +14,7 @@
 
 package org.qi4j.index.elasticsearch.extensions.spatial.mappings;
 
-import org.qi4j.api.geometry.internal.TGeometry;
+import org.qi4j.api.geometry.TGeometry;
 import org.qi4j.index.elasticsearch.ElasticSearchSupport;
 import org.qi4j.index.elasticsearch.extensions.spatial.configuration.SpatialConfiguration;
 import org.qi4j.index.elasticsearch.extensions.spatial.mappings.cache.MappingsCachesTable;

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/geometry/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/geometry/build.gradle b/libraries/geometry/build.gradle
new file mode 100644
index 0000000..8bfe036
--- /dev/null
+++ b/libraries/geometry/build.gradle
@@ -0,0 +1,13 @@
+description = "Qi4j library for add-ons to the GeoSpatial support in Qi4j Core."
+
+jar { manifest { name = "Qi4j Library - GeoSpatial" }}
+
+dependencies {
+  compile(project(":org.qi4j.core:org.qi4j.core.api"))
+  compile(project(":org.qi4j.core:org.qi4j.core.bootstrap"))
+
+  testCompile(project(":org.qi4j.core:org.qi4j.core.testsupport"))
+
+  testRuntime(project(":org.qi4j.core:org.qi4j.core.runtime"))
+  testRuntime(libraries.logback)
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/geometry/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/geometry/dev-status.xml b/libraries/geometry/dev-status.xml
new file mode 100644
index 0000000..55cc45b
--- /dev/null
+++ b/libraries/geometry/dev-status.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://www.qi4j.org/schemas/2008/dev-status/1
+        http://www.qi4j.org/schemas/2008/dev-status/1/dev-status.xsd">
+  <status>
+    <!--none,early,beta,stable,mature-->
+    <codebase>early</codebase>
+
+    <!-- none, brief, good, complete -->
+    <documentation>none</documentation>
+
+    <!-- none, some, good, complete -->
+    <unittests>none</unittests>
+  </status>
+  <licenses>
+    <license>ALv2</license>
+  </licenses>
+</module>

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/geometry/src/main/java/org/qi4j/library/geometry/TGeometryBuilder.java
----------------------------------------------------------------------
diff --git a/libraries/geometry/src/main/java/org/qi4j/library/geometry/TGeometryBuilder.java
b/libraries/geometry/src/main/java/org/qi4j/library/geometry/TGeometryBuilder.java
new file mode 100644
index 0000000..e1aa85f
--- /dev/null
+++ b/libraries/geometry/src/main/java/org/qi4j/library/geometry/TGeometryBuilder.java
@@ -0,0 +1,31 @@
+package org.qi4j.library.geometry;
+
+import org.qi4j.api.geometry.TFeature;
+import org.qi4j.api.injection.scope.Structure;
+import org.qi4j.api.structure.Module;
+import org.qi4j.api.value.ValueBuilder;
+
+public class TGeometryBuilder<T>
+{
+    @Structure
+    private Module module;
+
+    private ValueBuilder<T> builder;
+    private T geometry;
+
+    public TGeometryBuilder(Class<T> type)
+    {
+        builder = module.newValueBuilder( type );
+        geometry = builder.prototype();
+    }
+
+    public T geometry()
+    {
+        return geometry;
+    }
+
+    public T newInstance()
+    {
+        return builder.newInstance();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/geometry/src/main/java/org/qi4j/library/geometry/TGeometryFactory.java
----------------------------------------------------------------------
diff --git a/libraries/geometry/src/main/java/org/qi4j/library/geometry/TGeometryFactory.java
b/libraries/geometry/src/main/java/org/qi4j/library/geometry/TGeometryFactory.java
new file mode 100644
index 0000000..bc2bb0b
--- /dev/null
+++ b/libraries/geometry/src/main/java/org/qi4j/library/geometry/TGeometryFactory.java
@@ -0,0 +1,95 @@
+package org.qi4j.library.geometry;
+
+import org.qi4j.api.injection.scope.Structure;
+import org.qi4j.api.mixin.Mixins;
+import org.qi4j.api.structure.Module;
+import org.qi4j.library.geometry.builders.TCRSBuilder;
+import org.qi4j.library.geometry.builders.TFeatureBuilder;
+import org.qi4j.library.geometry.builders.TFeatureCollectionBuilder;
+import org.qi4j.library.geometry.builders.TLineStringBuilder;
+import org.qi4j.library.geometry.builders.TLinearRingBuilder;
+import org.qi4j.library.geometry.builders.TMultiLineStringBuilder;
+import org.qi4j.library.geometry.builders.TMultiPointBuilder;
+import org.qi4j.library.geometry.builders.TMultiPolygonsBuilder;
+import org.qi4j.library.geometry.builders.TPointBuilder;
+import org.qi4j.library.geometry.builders.TPolygonBuilder;
+
+@Mixins( TGeometryFactory.Mixin.class )
+public interface TGeometryFactory
+{
+    TCRSBuilder TCrs();
+
+    TPointBuilder TPoint();
+
+    TMultiPointBuilder TMultiPoint();
+
+    TLinearRingBuilder TLinearRing();
+
+    TLineStringBuilder TLineString();
+
+    TMultiLineStringBuilder TMultiLineString();
+
+    TPolygonBuilder TPolygon();
+
+    TMultiPolygonsBuilder TMultiPolygon();
+
+    TFeatureBuilder TFeature();
+
+    TFeatureCollectionBuilder TFeatureCollection();
+
+    class Mixin implements TGeometryFactory
+    {
+        @Structure
+        private Module module;
+
+        public TCRSBuilder TCrs()
+        {
+            return new TCRSBuilder( module );
+        }
+
+        public TPointBuilder TPoint()
+        {
+            return new TPointBuilder( module );
+        }
+
+        public TMultiPointBuilder TMultiPoint()
+        {
+            return new TMultiPointBuilder( module );
+        }
+
+        public TLinearRingBuilder TLinearRing()
+        {
+            return new TLinearRingBuilder( module );
+        }
+
+        public TLineStringBuilder TLineString()
+        {
+            return new TLineStringBuilder( module );
+        }
+
+        public TMultiLineStringBuilder TMultiLineString()
+        {
+            return new TMultiLineStringBuilder( module );
+        }
+
+        public TPolygonBuilder TPolygon()
+        {
+            return new TPolygonBuilder( module );
+        }
+
+        public TMultiPolygonsBuilder TMultiPolygon()
+        {
+            return new TMultiPolygonsBuilder( module );
+        }
+
+        public TFeatureBuilder TFeature()
+        {
+            return new TFeatureBuilder( module );
+        }
+
+        public TFeatureCollectionBuilder TFeatureCollection()
+        {
+            return new TFeatureCollectionBuilder( module );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TCRSBuilder.java
----------------------------------------------------------------------
diff --git a/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TCRSBuilder.java
b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TCRSBuilder.java
new file mode 100644
index 0000000..211aba1
--- /dev/null
+++ b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TCRSBuilder.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.qi4j.library.geometry.builders;
+
+import org.qi4j.api.geometry.TCRS;
+import org.qi4j.library.geometry.TGeometryBuilder;
+
+public class TCRSBuilder extends TGeometryBuilder<TCRS>
+{
+    public TCRSBuilder()
+    {
+        super( TCRS.class );
+    }
+
+    public TCRS crs( String crs )
+    {
+        return geometry().of( crs );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TFeatureBuilder.java
----------------------------------------------------------------------
diff --git a/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TFeatureBuilder.java
b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TFeatureBuilder.java
new file mode 100644
index 0000000..0df7fd9
--- /dev/null
+++ b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TFeatureBuilder.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.qi4j.library.geometry.builders;
+
+import org.qi4j.api.geometry.TFeature;
+import org.qi4j.api.geometry.TGeometry;
+import org.qi4j.library.geometry.TGeometryBuilder;
+
+public class TFeatureBuilder  extends TGeometryBuilder<TFeature>
+{
+    public TFeatureBuilder()
+    {
+        super( TFeature.class );
+    }
+
+    public TFeatureBuilder of( TGeometry feature )
+    {
+        geometry().of( feature );
+        return this;
+    }
+
+    public TFeatureBuilder addProperty( String name, String value )
+    {
+        geometry().addProperty( name, value );
+        return this;
+    }
+
+
+    public TFeature geometry( int srid )
+    {
+        return geometry();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TFeatureCollectionBuilder.java
----------------------------------------------------------------------
diff --git a/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TFeatureCollectionBuilder.java
b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TFeatureCollectionBuilder.java
new file mode 100644
index 0000000..39897de
--- /dev/null
+++ b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TFeatureCollectionBuilder.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.qi4j.library.geometry.builders;
+
+import java.util.List;
+import org.qi4j.api.geometry.TFeature;
+import org.qi4j.api.geometry.TFeatureCollection;
+import org.qi4j.api.structure.Module;
+import org.qi4j.library.geometry.TGeometryBuilder;
+
+public class TFeatureCollectionBuilder extends TGeometryBuilder<TFeatureCollection>
+{
+    public TFeatureCollectionBuilder()
+    {
+        super(TFeatureCollection.class);
+    }
+
+    public TFeatureCollectionBuilder of( List<TFeature> features )
+    {
+        geometry().of( features );
+        return this;
+    }
+
+    public TFeatureCollectionBuilder of( TFeature... features )
+    {
+        geometry().of( features );
+        return this;
+    }
+
+    public TFeatureCollection geometry( int srid )
+    {
+        return geometry();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TLineStringBuilder.java
----------------------------------------------------------------------
diff --git a/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TLineStringBuilder.java
b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TLineStringBuilder.java
new file mode 100644
index 0000000..aa0499b
--- /dev/null
+++ b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TLineStringBuilder.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.qi4j.library.geometry.builders;
+
+import org.qi4j.api.geometry.TLineString;
+import org.qi4j.api.geometry.TPoint;
+import org.qi4j.library.geometry.TGeometryBuilder;
+
+public class TLineStringBuilder extends TGeometryBuilder<TLineString>
+{
+    public TLineStringBuilder()
+    {
+        super( TLineString.class );
+    }
+
+    public TLineStringBuilder points( double[][] points )
+    {
+        for( double yx[] : points )
+        {
+            if( yx.length < 2 )
+            {
+                return null;
+            }
+            geometry().yx( yx[ 0 ], yx[ 1 ] );
+        }
+        return this;
+    }
+
+    public TLineStringBuilder of( TPoint... points )
+    {
+        geometry().of( points );
+        return this;
+    }
+
+    public TLineStringBuilder of()
+    {
+        geometry().of();
+        return this;
+    }
+
+    public TLineString geometry( int srid )
+    {
+        return geometry();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TLinearRingBuilder.java
----------------------------------------------------------------------
diff --git a/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TLinearRingBuilder.java
b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TLinearRingBuilder.java
new file mode 100644
index 0000000..0af807a
--- /dev/null
+++ b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TLinearRingBuilder.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.qi4j.library.geometry.builders;
+
+import org.qi4j.api.geometry.TPoint;
+import org.qi4j.api.geometry.TLinearRing;
+import org.qi4j.library.geometry.TGeometryBuilder;
+
+public class TLinearRingBuilder extends TGeometryBuilder<TLinearRing>
+{
+    public TLinearRingBuilder()
+    {
+        super( TLinearRing.class );
+    }
+
+    public TLinearRingBuilder ring( double[][] ring )
+    {
+        for( double xy[] : ring )
+        {
+            if( xy.length < 2 )
+            {
+                return null;
+            }
+            geometry().yx( xy[ 0 ], xy[ 1 ] );
+        }
+        return this;
+    }
+
+    public TLinearRingBuilder of( TPoint... points )
+    {
+        geometry().of( points );
+        return this;
+    }
+
+    public TLinearRing geometry( int srid )
+    {
+        return geometry();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TMultiLineStringBuilder.java
----------------------------------------------------------------------
diff --git a/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TMultiLineStringBuilder.java
b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TMultiLineStringBuilder.java
new file mode 100644
index 0000000..eb16d6a
--- /dev/null
+++ b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TMultiLineStringBuilder.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.qi4j.library.geometry.builders;
+
+import java.util.List;
+import org.qi4j.api.geometry.TLineString;
+import org.qi4j.api.geometry.TMultiLineString;
+import org.qi4j.api.structure.Module;
+import org.qi4j.library.geometry.TGeometryBuilder;
+
+public class TMultiLineStringBuilder extends TGeometryBuilder<TMultiLineString>
+{
+    public TMultiLineStringBuilder( )
+    {
+        super( TMultiLineString.class );
+    }
+
+    public TMultiLineStringBuilder points( double[][][] points )
+    {
+        for( double xy[][] : points )
+        {
+            if( xy.length < 2 )
+            {
+                return null;
+            }
+        }
+        return this;
+    }
+
+    public TMultiLineStringBuilder of( List<TLineString> lines )
+    {
+        geometry().of( lines );
+        return this;
+    }
+
+    public TMultiLineStringBuilder of( TLineString... lines )
+    {
+        geometry().of( lines );
+        return this;
+    }
+
+    public TMultiLineString geometry( int srid )
+    {
+        return geometry();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TMultiPointBuilder.java
----------------------------------------------------------------------
diff --git a/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TMultiPointBuilder.java
b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TMultiPointBuilder.java
new file mode 100644
index 0000000..c5311fb
--- /dev/null
+++ b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TMultiPointBuilder.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.qi4j.library.geometry.builders;
+
+import org.qi4j.api.geometry.TMultiPoint;
+import org.qi4j.api.geometry.TPoint;
+import org.qi4j.api.structure.Module;
+import org.qi4j.library.geometry.TGeometryBuilder;
+
+public class TMultiPointBuilder extends TGeometryBuilder<TMultiPoint>
+{
+    public TMultiPointBuilder( Module module )
+    {
+        super( TMultiPoint.class );
+    }
+
+    // Format { lat, lon }
+    public TMultiPointBuilder points( double[][] points )
+    {
+        for( double yx[] : points )
+        {
+            if( yx.length < 2 )
+            {
+                return null;
+            }
+            geometry().yx( yx[ 0 ], yx[ 1 ] );
+        }
+        return this;
+    }
+
+    public TMultiPointBuilder of( TPoint... points )
+    {
+        geometry().of( points );
+        return this;
+    }
+
+    public TMultiPoint geometry( String CRS )
+    {
+        geometry().setCRS( CRS );
+        return geometry();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TMultiPolygonsBuilder.java
----------------------------------------------------------------------
diff --git a/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TMultiPolygonsBuilder.java
b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TMultiPolygonsBuilder.java
new file mode 100644
index 0000000..26be8ea
--- /dev/null
+++ b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TMultiPolygonsBuilder.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.qi4j.library.geometry.builders;
+
+import java.util.List;
+import org.qi4j.api.geometry.TMultiPolygon;
+import org.qi4j.api.geometry.TPolygon;
+import org.qi4j.api.structure.Module;
+import org.qi4j.library.geometry.TGeometryBuilder;
+
+public class TMultiPolygonsBuilder extends TGeometryBuilder<TMultiPolygon>
+{
+    public TMultiPolygonsBuilder(  )
+    {
+        super(TMultiPolygon.class);
+    }
+
+    public TMultiPolygonsBuilder points( double[][][] points )
+    {
+        for( double xy[][] : points )
+        {
+            if( xy.length < 2 )
+            {
+                return null;
+            }
+        }
+        return this;
+    }
+
+    public TMultiPolygonsBuilder of( List<TPolygon> polygons )
+    {
+        geometry().of( polygons );
+        return this;
+    }
+
+    public TMultiPolygonsBuilder of( TPolygon... polygons )
+    {
+        geometry().of( polygons );
+        return this;
+    }
+
+    public TMultiPolygon geometry( int srid )
+    {
+        return geometry();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TPointBuilder.java
----------------------------------------------------------------------
diff --git a/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TPointBuilder.java
b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TPointBuilder.java
new file mode 100644
index 0000000..f12acfb
--- /dev/null
+++ b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TPointBuilder.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.qi4j.library.geometry.builders;
+
+import org.qi4j.api.geometry.TPoint;
+import org.qi4j.api.geometry.TGeometry;
+import org.qi4j.api.structure.Module;
+import org.qi4j.library.geometry.TGeometryBuilder;
+
+public class TPointBuilder  extends TGeometryBuilder<TPoint>
+{
+    public TPointBuilder( Module module )
+    {
+        super(TPoint.class);
+    }
+
+    public TPointBuilder x( double x )
+    {
+        geometry().x( x );
+        return this;
+    }
+
+    public TPointBuilder y( double y )
+    {
+        geometry().y( y );
+        return this;
+    }
+
+    public TPointBuilder z( double u )
+    {
+        geometry().z( u );
+        return this;
+    }
+
+    public TPointBuilder lat( double lat )
+    {
+        geometry().y( lat );
+        return this;
+    }
+
+    public TPointBuilder lon( double lon )
+    {
+        geometry().x( lon );
+        return this;
+    }
+
+    public TPointBuilder alt( double alt )
+    {
+        geometry().z( alt );
+        return this;
+    }
+
+    public boolean isPoint( TGeometry tGeometry )
+    {
+        return tGeometry instanceof TPoint;
+    }
+
+    public TPoint geometry( String CRS )
+    {
+        geometry().setCRS( CRS );
+        return geometry();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TPolygonBuilder.java
----------------------------------------------------------------------
diff --git a/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TPolygonBuilder.java
b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TPolygonBuilder.java
new file mode 100644
index 0000000..873c522
--- /dev/null
+++ b/libraries/geometry/src/main/java/org/qi4j/library/geometry/builders/TPolygonBuilder.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.qi4j.library.geometry.builders;
+
+import org.qi4j.api.geometry.TPolygon;
+import org.qi4j.api.geometry.TLinearRing;
+import org.qi4j.api.injection.scope.Structure;
+import org.qi4j.api.structure.Module;
+import org.qi4j.library.geometry.TGeometryBuilder;
+
+public class TPolygonBuilder extends TGeometryBuilder<TPolygon>
+{
+    @Structure
+    private Module module;
+
+    public TPolygonBuilder()
+    {
+        super( TPolygon.class );
+    }
+
+    public TPolygonBuilder shell( TLinearRing shell )
+    {
+        geometry().of( shell );
+        return this;
+    }
+
+    public TPolygonBuilder shell( double[][] shell )
+    {
+        geometry().of( module.newObject( TLinearRingBuilder.class ).ring( shell ).geometry()
);
+        return this;
+    }
+
+    public TPolygonBuilder withHoles( TLinearRing... holes )
+    {
+        geometry().withHoles( holes );
+        return this;
+    }
+
+    public TPolygon geometry( String CRS )
+    {
+        geometry().setCRS( CRS );
+        return geometry();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/spatial/src/main/java/org/qi4j/library/spatial/assembly/TGeometryAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/assembly/TGeometryAssembler.java
b/libraries/spatial/src/main/java/org/qi4j/library/spatial/assembly/TGeometryAssembler.java
index 815e198..2ff1c0b 100644
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/assembly/TGeometryAssembler.java
+++ b/libraries/spatial/src/main/java/org/qi4j/library/spatial/assembly/TGeometryAssembler.java
@@ -21,10 +21,10 @@ package org.qi4j.library.spatial.assembly;
 import org.cts.crs.CRSException;
 import org.cts.crs.CoordinateReferenceSystem;
 import org.qi4j.api.geometry.*;
-import org.qi4j.api.geometry.internal.Coordinate;
-import org.qi4j.api.geometry.internal.TCircle;
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.geometry.internal.TLinearRing;
+import org.qi4j.api.geometry.Coordinate;
+import org.qi4j.api.geometry.TCircle;
+import org.qi4j.api.geometry.TGeometry;
+import org.qi4j.api.geometry.TLinearRing;
 import org.qi4j.bootstrap.Assemblers;
 import org.qi4j.bootstrap.AssemblyException;
 import org.qi4j.bootstrap.ModuleAssembly;

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/FromHelper.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/FromHelper.java
b/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/FromHelper.java
index 68ab3d9..1ff57da 100644
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/FromHelper.java
+++ b/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/FromHelper.java
@@ -19,7 +19,7 @@
 package org.qi4j.library.spatial.formats.conversions.from;
 
 import org.geojson.GeoJsonObject;
-import org.qi4j.api.geometry.internal.TGeometry;
+import org.qi4j.api.geometry.TGeometry;
 import org.qi4j.api.structure.Module;
 import org.qi4j.library.spatial.formats.conversions.to.ToHelper;
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/GeoJsonFromConverter.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/GeoJsonFromConverter.java
b/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/GeoJsonFromConverter.java
index 70bbdb0..149ef02 100644
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/GeoJsonFromConverter.java
+++ b/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/GeoJsonFromConverter.java
@@ -20,8 +20,8 @@ package org.qi4j.library.spatial.formats.conversions.from;
 
 import org.geojson.*;
 import org.qi4j.api.geometry.*;
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.geometry.internal.TLinearRing;
+import org.qi4j.api.geometry.TGeometry;
+import org.qi4j.api.geometry.TLinearRing;
 import org.qi4j.api.structure.Module;
 
 import java.util.List;

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/TGeometryFromConverter.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/TGeometryFromConverter.java
b/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/TGeometryFromConverter.java
index 2c05866..f5637d4 100644
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/TGeometryFromConverter.java
+++ b/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/TGeometryFromConverter.java
@@ -18,7 +18,7 @@
 
 package org.qi4j.library.spatial.formats.conversions.from;
 
-import org.qi4j.api.geometry.internal.TGeometry;
+import org.qi4j.api.geometry.TGeometry;
 import org.qi4j.api.structure.Module;
 
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/WKTFromConverter.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/WKTFromConverter.java
b/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/WKTFromConverter.java
index 5719376..0223802 100644
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/WKTFromConverter.java
+++ b/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/from/WKTFromConverter.java
@@ -32,8 +32,8 @@ import com.vividsolutions.jts.geom.MultiPolygon;
 import com.vividsolutions.jts.geom.Polygon;
 import org.qi4j.api.geometry.TPoint;
 import org.qi4j.api.geometry.TPolygon;
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.geometry.internal.TLinearRing;
+import org.qi4j.api.geometry.TGeometry;
+import org.qi4j.api.geometry.TLinearRing;
 import org.qi4j.api.structure.Module;
 import org.qi4j.api.value.ValueBuilder;
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/GeoJsonToConverter.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/GeoJsonToConverter.java
b/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/GeoJsonToConverter.java
index 366c98f..17af07a 100644
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/GeoJsonToConverter.java
+++ b/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/GeoJsonToConverter.java
@@ -21,7 +21,7 @@ package org.qi4j.library.spatial.formats.conversions.to;
 import org.geojson.GeoJsonObject;
 import org.geojson.Point;
 import org.qi4j.api.geometry.TPoint;
-import org.qi4j.api.geometry.internal.TGeometry;
+import org.qi4j.api.geometry.TGeometry;
 import org.qi4j.api.structure.Module;
 
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/Spatial4JToConverter.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/Spatial4JToConverter.java
b/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/Spatial4JToConverter.java
index 27e2237..525dbbb 100644
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/Spatial4JToConverter.java
+++ b/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/Spatial4JToConverter.java
@@ -30,8 +30,8 @@ import com.vividsolutions.jts.util.GeometricShapeFactory;
 import org.geojson.GeoJsonObject;
 import org.geojson.Point;
 import org.qi4j.api.geometry.TPoint;
-import org.qi4j.api.geometry.internal.TCircle;
-import org.qi4j.api.geometry.internal.TGeometry;
+import org.qi4j.api.geometry.TCircle;
+import org.qi4j.api.geometry.TGeometry;
 import org.qi4j.api.structure.Module;
 
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/TGeometryToConverter.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/TGeometryToConverter.java
b/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/TGeometryToConverter.java
index c80c06c..9602a5a 100644
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/TGeometryToConverter.java
+++ b/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/TGeometryToConverter.java
@@ -18,7 +18,7 @@
 
 package org.qi4j.library.spatial.formats.conversions.to;
 
-import org.qi4j.api.geometry.internal.TGeometry;
+import org.qi4j.api.geometry.TGeometry;
 import org.qi4j.api.structure.Module;
 
 /**

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/ToHelper.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/ToHelper.java
b/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/ToHelper.java
index 4103075..eca8bc6 100644
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/ToHelper.java
+++ b/libraries/spatial/src/main/java/org/qi4j/library/spatial/formats/conversions/to/ToHelper.java
@@ -19,7 +19,7 @@
 package org.qi4j.library.spatial.formats.conversions.to;
 
 import org.geojson.GeoJsonObject;
-import org.qi4j.api.geometry.internal.TGeometry;
+import org.qi4j.api.geometry.TGeometry;
 import org.qi4j.api.structure.Module;
 
 import static org.qi4j.library.spatial.projections.transformations.TTransformations.Transform;

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/transformations/fromto/FromHelper.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/transformations/fromto/FromHelper.java
b/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/transformations/fromto/FromHelper.java
index f3ebe56..089f074 100644
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/transformations/fromto/FromHelper.java
+++ b/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/transformations/fromto/FromHelper.java
@@ -18,7 +18,7 @@
 
 package org.qi4j.library.spatial.projections.transformations.fromto;
 
-import org.qi4j.api.geometry.internal.TGeometry;
+import org.qi4j.api.geometry.TGeometry;
 import org.qi4j.api.structure.Module;
 import org.qi4j.library.spatial.formats.conversions.from.TGeometryFromConverter;
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/transformations/fromto/ToHelper.java
----------------------------------------------------------------------
diff --git a/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/transformations/fromto/ToHelper.java
b/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/transformations/fromto/ToHelper.java
index eb49068..d95f3c9 100644
--- a/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/transformations/fromto/ToHelper.java
+++ b/libraries/spatial/src/main/java/org/qi4j/library/spatial/projections/transformations/fromto/ToHelper.java
@@ -23,8 +23,8 @@ import org.cts.crs.GeodeticCRS;
 import org.cts.op.CoordinateOperation;
 import org.cts.op.CoordinateOperationFactory;
 import org.qi4j.api.geometry.*;
-import org.qi4j.api.geometry.internal.Coordinate;
-import org.qi4j.api.geometry.internal.TGeometry;
+import org.qi4j.api.geometry.Coordinate;
+import org.qi4j.api.geometry.TGeometry;
 import org.qi4j.api.structure.Module;
 import org.qi4j.library.spatial.projections.ProjectionsRegistry;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index 2779ea2..c2d3d40 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -14,6 +14,7 @@ include "core:functional",
         'libraries:eventsourcing-jdbm',
         'libraries:eventsourcing-rest',
         'libraries:fileconfig',
+        'libraries:geometry',
         'libraries:http',
         'libraries:invocation-cache',
         'libraries:lang-beanshell',


Mime
View raw message