polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [3/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:14 GMT
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 additions to Core API.
WARNING; may not compile at the moment.


Project: http://git-wip-us.apache.org/repos/asf/zest-qi4j/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-qi4j/commit/c1d327e2
Tree: http://git-wip-us.apache.org/repos/asf/zest-qi4j/tree/c1d327e2
Diff: http://git-wip-us.apache.org/repos/asf/zest-qi4j/diff/c1d327e2

Branch: refs/heads/ramtej-fb/spatial.queries
Commit: c1d327e2d3bc8aa5af979c834b3caa14e6b3e135
Parents: a105374
Author: Niclas Hedhman <niclas@hedhman.org>
Authored: Thu Jun 4 00:21:55 2015 +0800
Committer: Niclas Hedhman <niclas@hedhman.org>
Committed: Thu Jun 4 00:21:55 2015 +0800

----------------------------------------------------------------------
 .../java/org/qi4j/api/geometry/Coordinate.java  | 210 ++++++++++++++++
 .../qi4j/api/geometry/GeometryCollections.java  |  96 ++++++++
 .../main/java/org/qi4j/api/geometry/TCRS.java   |  10 +-
 .../java/org/qi4j/api/geometry/TCircle.java     | 121 ++++++++++
 .../java/org/qi4j/api/geometry/TFeature.java    |  57 ++---
 .../qi4j/api/geometry/TFeatureCollection.java   |  36 +--
 .../java/org/qi4j/api/geometry/TGeometry.java   | 238 +++++++++++++++++++
 .../org/qi4j/api/geometry/TGeometryFactory.java |  67 ------
 .../java/org/qi4j/api/geometry/TLineString.java |  95 ++++----
 .../java/org/qi4j/api/geometry/TLinearRing.java |  41 ++++
 .../org/qi4j/api/geometry/TMultiLineString.java |  35 +--
 .../java/org/qi4j/api/geometry/TMultiPoint.java |  46 ++--
 .../org/qi4j/api/geometry/TMultiPolygon.java    |  36 +--
 .../main/java/org/qi4j/api/geometry/TPoint.java | 110 ++++-----
 .../java/org/qi4j/api/geometry/TPolygon.java    |  95 ++++----
 .../main/java/org/qi4j/api/geometry/TShape.java |  20 ++
 .../main/java/org/qi4j/api/geometry/TUnit.java  |   3 +-
 .../qi4j/api/geometry/internal/Coordinate.java  | 189 ---------------
 .../geometry/internal/GeometryCollections.java  | 100 --------
 .../org/qi4j/api/geometry/internal/TCircle.java | 116 ---------
 .../qi4j/api/geometry/internal/TGeometry.java   | 223 -----------------
 .../qi4j/api/geometry/internal/TLinearRing.java |  40 ----
 .../org/qi4j/api/geometry/internal/TShape.java  |  20 --
 .../geometry/internal/builders/TCRSBuilder.java |  39 ---
 .../internal/builders/TFeatureBuilder.java      |  57 -----
 .../builders/TFeatureCollectionBuilder.java     |  57 -----
 .../internal/builders/TLineStringBuilder.java   |  68 ------
 .../internal/builders/TLinearRingBuilder.java   |  62 -----
 .../builders/TMultiLineStringBuilder.java       |  68 ------
 .../internal/builders/TMultiPointBuilder.java   |  64 -----
 .../builders/TMultiPolygonsBuilder.java         |  69 ------
 .../internal/builders/TPointBuilder.java        |  88 -------
 .../internal/builders/TPolygonBuilder.java      |  64 -----
 .../spatial/SpatialQueryExpressions.java        |  86 ++++---
 .../convert/ST_GeomFromTextSpecification.java   |  11 +-
 .../convert/SpatialConvertSpecification.java    |  16 +-
 .../predicate/ST_DisjointSpecification.java     |  45 ++--
 .../predicate/ST_IntersectsSpecification.java   |  45 ++--
 .../predicate/ST_WithinSpecification.java       |  51 ++--
 .../SpatialPredicatesSpecification.java         |  26 +-
 .../main/java/org/qi4j/api/type/ValueType.java  |   2 +-
 .../qi4j/api/geometry/TGeometryFactoryTest.java |   3 -
 .../org/qi4j/api/geometry/TGeometryTest.java    |   4 -
 .../test/indexing/AbstractAnyQueryTest.java     |   6 +-
 .../qi4j/test/indexing/AbstractQueryTest.java   |   7 +-
 .../test/indexing/AbstractSpatialQueryTest.java | 140 +++++------
 .../elasticsearch/ElasticSearchFinder.java      |  11 +-
 .../elasticsearch/ElasticSearchIndexer.java     |   2 +-
 .../spatial/ElasticSearchSpatialIndexer.java    |   2 +-
 .../SpatialFunctionsSupportMatrix.java          |   2 +-
 .../functions/predicates/ST_Disjoint.java       |   2 +-
 .../functions/predicates/ST_Intersects.java     |   2 +-
 .../spatial/functions/predicates/ST_Within.java |   2 +-
 .../AbstractElasticSearchSpatialFunction.java   |   4 +-
 .../spatial/internal/InternalUtils.java         |   2 +-
 .../spatial/mappings/SpatialIndexMapper.java    |   2 +-
 libraries/geometry/build.gradle                 |  13 +
 libraries/geometry/dev-status.xml               |  19 ++
 .../qi4j/library/geometry/TGeometryBuilder.java |  31 +++
 .../qi4j/library/geometry/TGeometryFactory.java |  95 ++++++++
 .../library/geometry/builders/TCRSBuilder.java  |  31 +++
 .../geometry/builders/TFeatureBuilder.java      |  45 ++++
 .../builders/TFeatureCollectionBuilder.java     |  46 ++++
 .../geometry/builders/TLineStringBuilder.java   |  57 +++++
 .../geometry/builders/TLinearRingBuilder.java   |  51 ++++
 .../builders/TMultiLineStringBuilder.java       |  58 +++++
 .../geometry/builders/TMultiPointBuilder.java   |  54 +++++
 .../builders/TMultiPolygonsBuilder.java         |  58 +++++
 .../geometry/builders/TPointBuilder.java        |  75 ++++++
 .../geometry/builders/TPolygonBuilder.java      |  56 +++++
 .../spatial/assembly/TGeometryAssembler.java    |   8 +-
 .../formats/conversions/from/FromHelper.java    |   2 +-
 .../conversions/from/GeoJsonFromConverter.java  |   4 +-
 .../from/TGeometryFromConverter.java            |   2 +-
 .../conversions/from/WKTFromConverter.java      |   4 +-
 .../conversions/to/GeoJsonToConverter.java      |   2 +-
 .../conversions/to/Spatial4JToConverter.java    |   4 +-
 .../conversions/to/TGeometryToConverter.java    |   2 +-
 .../formats/conversions/to/ToHelper.java        |   2 +-
 .../transformations/fromto/FromHelper.java      |   2 +-
 .../transformations/fromto/ToHelper.java        |   4 +-
 settings.gradle                                 |   1 +
 82 files changed, 1937 insertions(+), 1902 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/Coordinate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/Coordinate.java b/core/api/src/main/java/org/qi4j/api/geometry/Coordinate.java
new file mode 100644
index 0000000..07f2425
--- /dev/null
+++ b/core/api/src/main/java/org/qi4j/api/geometry/Coordinate.java
@@ -0,0 +1,210 @@
+/*
+ * 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.api.geometry;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.qi4j.api.common.Optional;
+import org.qi4j.api.injection.scope.This;
+import org.qi4j.api.mixin.Mixins;
+import org.qi4j.api.property.Property;
+import org.qi4j.api.value.ValueComposite;
+
+/**
+ * Represents one single n-Dimensional coordinate in the n-Dimensional "space"
+ */
+
+@Mixins( Coordinate.Mixin.class )
+public interface Coordinate extends Comparable, ValueComposite
+{
+
+    public static final int X = 0;
+    public static final int Y = 1;
+    public static final int Z = 2;
+
+    // single coordinate store
+    @Optional
+    Property<List<Double>> coordinate();
+
+    Coordinate of();
+
+    Coordinate of( double x, double y, double z );
+
+    Coordinate of( double... coordinates );
+
+    Coordinate x( double x );
+
+    Coordinate y( double y );
+
+    Coordinate z( double z );
+
+    double x();
+
+    double y();
+
+    double z();
+
+    double getOrdinate( int ordinateIndex );
+
+    int compareTo( Object o );
+
+    double[] source();
+
+    public abstract class Mixin implements Coordinate
+    {
+
+        List<Double> EMPTY = new ArrayList<>( X + Y + Z );
+        @This
+        Coordinate self;
+
+        private void init()
+        {
+            if( isEmpty() )
+            {
+                EMPTY.add( new Double( 0.0 ) );
+                EMPTY.add( new Double( 0.0 ) );
+                EMPTY.add( new Double( 0.0 ) );
+
+                self.coordinate().set( EMPTY );
+            }
+        }
+
+        private boolean isEmpty()
+        {
+            return ( self.coordinate() == null ) || ( self.coordinate().get() == null ) || ( self.coordinate()
+                                                                                                 .get()
+                                                                                                 .isEmpty() ) ? true : false;
+        }
+
+        public Coordinate of()
+        {
+            return self.of( 0.0d, 0.0d, 0.0d );
+        }
+
+        public Coordinate of( double x, double y, double z )
+        {
+            init();
+            self.x( x );
+            self.y( y );
+            self.z( z );
+            return self;
+        }
+
+        public double x()
+        {
+            return getOrdinate( X );
+        }
+
+        public double y()
+        {
+            return getOrdinate( Y );
+        }
+
+        public double z()
+        {
+            return getOrdinate( Z );
+        }
+
+        public Coordinate x( double x )
+        {
+            init();
+            if( !Double.isNaN( x ) && !Double.isInfinite( x ) )
+            {
+                self.coordinate().get().set( X, x );
+            }
+            return self;
+        }
+
+        public Coordinate y( double y )
+        {
+            init();
+            if( !Double.isNaN( y ) && !Double.isInfinite( y ) )
+            {
+                self.coordinate().get().set( Y, y );
+            }
+            return self;
+        }
+
+        public Coordinate z( double z )
+        {
+            init();
+            if( !Double.isNaN( z ) && !Double.isInfinite( z ) )
+            {
+                self.coordinate().get().set( Z, z );
+            }
+            return self;
+        }
+
+        public int compareTo( Object o )
+        {
+            Coordinate other = (Coordinate) o;
+            if( self.coordinate().get().get( X ) < other.coordinate().get().get( X ) )
+            {
+                return -1;
+            }
+            if( self.coordinate().get().get( X ) > other.coordinate().get().get( X ) )
+            {
+                return 1;
+            }
+            if( self.coordinate().get().get( Y ) < other.coordinate().get().get( Y ) )
+            {
+                return -1;
+            }
+            if( self.coordinate().get().get( Y ) > other.coordinate().get().get( Y ) )
+            {
+                return 1;
+            }
+            return 0;
+        }
+
+        public double getOrdinate( int ordinateIndex )
+        {
+            switch( ordinateIndex )
+            {
+            case X:
+                return self.coordinate().get().get( X );
+            case Y:
+                return self.coordinate().get().get( Y );
+            case Z:
+                return self.coordinate().get().get( Z );
+            }
+            throw new IllegalArgumentException( "Invalid ordinate index: " + ordinateIndex );
+        }
+
+        public double[] source()
+        {
+            double[] source = new double[ X + Y + Z ];
+            source[ X ] = getOrdinate( X );
+            source[ Y ] = getOrdinate( Y );
+            source[ Z ] = getOrdinate( Z );
+            return source;
+        }
+
+        public Coordinate of( double... coordinates )
+        {
+            List<Double> l = new ArrayList<Double>( coordinates.length );
+            for( double xyzn : coordinates )
+            {
+                // only values that makes "sense"
+                if( !Double.isNaN( xyzn ) && !Double.isInfinite( xyzn ) )
+                {
+                    l.add( new Double( xyzn ) );
+                }
+            }
+            self.coordinate().set( l );
+            return self;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/GeometryCollections.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/GeometryCollections.java b/core/api/src/main/java/org/qi4j/api/geometry/GeometryCollections.java
new file mode 100644
index 0000000..8607187
--- /dev/null
+++ b/core/api/src/main/java/org/qi4j/api/geometry/GeometryCollections.java
@@ -0,0 +1,96 @@
+/*
+ * 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.api.geometry;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.qi4j.api.injection.scope.This;
+import org.qi4j.api.property.Property;
+
+public interface GeometryCollections extends TGeometry
+{
+
+    Property<List<TGeometry>> geometries();
+
+    TGeometry getGeometryN( int n );
+
+    int getNumGeometries();
+
+    boolean isEmpty();
+
+    public abstract class Mixin extends TGeometry.Mixin implements GeometryCollections
+    {
+
+        @This
+        GeometryCollections self;
+
+        protected void init()
+        {
+            if( self.geometries().get() == null )
+            {
+                List<TGeometry> geometries = new ArrayList<>();
+                self.geometries().set( geometries );
+            }
+        }
+
+        public boolean isEmpty()
+        {
+            for( int i = 0; i < self.geometries().get().size(); i++ )
+            {
+                if( !self.geometries().get().get( i ).isEmpty() )
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        public int getNumGeometries()
+        {
+            return self.geometries().get().size();
+        }
+
+        public TGeometry getGeometryN( int n )
+        {
+            return self.geometries().get().get( n );
+        }
+
+        public Coordinate[] getCoordinates()
+        {
+            Coordinate[] coordinates = new Coordinate[ self.getNumPoints() ];
+            int k = -1;
+            for( int i = 0; i < self.getNumGeometries(); i++ )
+            {
+                Coordinate[] childCoordinates = self.geometries().get().get( i ).getCoordinates();
+                for( int j = 0; j < childCoordinates.length; j++ )
+                {
+                    k++;
+                    coordinates[ k ] = childCoordinates[ j ];
+                }
+            }
+            return coordinates;
+        }
+
+        public int getNumPoints()
+        {
+            int numPoints = 0;
+            for( int i = 0; i < self.geometries().get().size(); i++ )
+            {
+                numPoints += self.geometries().get().get( i ).getNumPoints();
+            }
+            return numPoints;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/TCRS.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/TCRS.java b/core/api/src/main/java/org/qi4j/api/geometry/TCRS.java
index 67c605c..663dfde 100644
--- a/core/api/src/main/java/org/qi4j/api/geometry/TCRS.java
+++ b/core/api/src/main/java/org/qi4j/api/geometry/TCRS.java
@@ -21,11 +21,13 @@ import org.qi4j.api.property.Property;
 import org.qi4j.api.structure.Module;
 import org.qi4j.api.value.ValueComposite;
 
-@Mixins(TCRS.Mixin.class)
+@Mixins( TCRS.Mixin.class )
 public interface TCRS extends ValueComposite
 {
     Property<String> definition();
-    TCRS of(String crs);
+
+    TCRS of( String crs );
+
     String crs();
 
     public abstract class Mixin implements TCRS
@@ -35,9 +37,9 @@ public interface TCRS extends ValueComposite
         @This
         TCRS self;
 
-        public TCRS of(String crs)
+        public TCRS of( String crs )
         {
-            self.definition().set(crs);
+            self.definition().set( crs );
             return self;
         }
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/TCircle.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/TCircle.java b/core/api/src/main/java/org/qi4j/api/geometry/TCircle.java
new file mode 100644
index 0000000..caf91bd
--- /dev/null
+++ b/core/api/src/main/java/org/qi4j/api/geometry/TCircle.java
@@ -0,0 +1,121 @@
+package org.qi4j.api.geometry;
+
+import org.qi4j.api.injection.scope.Structure;
+import org.qi4j.api.injection.scope.This;
+import org.qi4j.api.mixin.Mixins;
+import org.qi4j.api.property.Property;
+import org.qi4j.api.structure.Module;
+
+@Mixins( TCircle.Mixin.class )
+public interface TCircle extends TGeometry
+{
+    Property<TPoint> point();
+
+    Property<Double> radius();
+
+    TCircle of( TPoint point, double radius );
+
+    TCircle of( double x, double y, double radius );
+
+    TCircle of( TPoint point );
+
+    TCircle of();
+
+    TCircle yx( double y, double x );
+
+    TCircle yx( double y, double x, double radius );
+
+    TCircle radius( double r );
+
+    TPoint getCentre();
+
+    TPolygon polygonize( int numOfPoints );
+
+    public abstract class Mixin implements TCircle
+    {
+        @This
+        TCircle self;
+
+        @Structure
+        Module module;
+
+        public TCircle of()
+        {
+            return self;
+        }
+
+        public TCircle of( TPoint point )
+        {
+            self.point().set( point );
+            return self;
+        }
+
+        public TCircle of( double x, double y, double radius )
+        {
+            yx( y, x ).radius( radius );
+            return self;
+        }
+
+        public TCircle yx( double y, double x )
+        {
+            of( module.newValueBuilder( TPoint.class ).prototype().x( x ).y( y ) );
+            return self;
+        }
+
+        public TCircle yx( double y, double x, double radius )
+        {
+            of( module.newValueBuilder( TPoint.class ).prototype().x( x ).y( y ) ).radius( radius );
+            return self;
+        }
+
+        public TCircle of( TPoint point, double r )
+        {
+            of( point ).radius( r );
+            return self;
+        }
+
+        public TPoint getCentre()
+        {
+            return self.point().get();
+        }
+
+        public TCircle radius( double r )
+        {
+            self.radius().set( r );
+            return self;
+        }
+
+        public TPolygon polygonize( int numOfPoints )
+        {
+            double xRadius = self.radius().get();
+            double yRadius = self.radius().get();
+
+            double centreX = self.getCentre().x();
+            double centreY = self.getCentre().y();
+
+            TPoint[] pts = new TPoint[ numOfPoints + 1 ];
+            int pt = 0;
+            for( int i = 0; i < numOfPoints; i++ )
+            {
+                double ang = i * ( 2 * Math.PI / numOfPoints );
+                double x = xRadius * Math.cos( ang ) + centreX;
+                double y = yRadius * Math.sin( ang ) + centreY;
+                pts[ pt++ ] = module.newValueBuilder( TPoint.class ).prototype().of().x( x ).y( y );
+            }
+
+            pts[ pt++ ] = module.newValueBuilder( TPoint.class ).prototype().of( pts[ 0 ].getCoordinates() );
+            TLinearRing tLinearRing = (TLinearRing) module.newValueBuilder( TLinearRing.class ).prototype().of( pts );
+
+            if( tLinearRing.isValid() )
+            {
+                TPolygon tPolygon = module.newValueBuilder( TPolygon.class ).prototype().of( tLinearRing );
+                tPolygon.setCRS( self.getCRS() );
+                return module.newValueBuilder( TPolygon.class ).prototype().of( tLinearRing );
+            }
+            else
+            {
+                return null;
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/TFeature.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/TFeature.java b/core/api/src/main/java/org/qi4j/api/geometry/TFeature.java
index b47abec..67d7799 100644
--- a/core/api/src/main/java/org/qi4j/api/geometry/TFeature.java
+++ b/core/api/src/main/java/org/qi4j/api/geometry/TFeature.java
@@ -14,26 +14,21 @@
 
 package org.qi4j.api.geometry;
 
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import org.qi4j.api.common.Optional;
-import org.qi4j.api.geometry.internal.Coordinate;
-import org.qi4j.api.geometry.internal.TGeometry;
 import org.qi4j.api.injection.scope.Structure;
 import org.qi4j.api.injection.scope.This;
 import org.qi4j.api.mixin.Mixins;
 import org.qi4j.api.property.Property;
 import org.qi4j.api.structure.Module;
 
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-
-@Mixins(TFeature.Mixin.class)
+@Mixins( TFeature.Mixin.class )
 public interface TFeature extends TGeometry
 {
 
-
     @Optional
     Property<Map<String, List<String>>> properties();
 
@@ -42,18 +37,16 @@ public interface TFeature extends TGeometry
 
     Property<TGeometry> geometry();
 
+    TFeature of( TGeometry geometry );
 
-    TFeature of(TGeometry geometry);
-
-    TFeature withProperties(Map<String, List<String>> properties);
+    TFeature withProperties( Map<String, List<String>> properties );
 
-    TFeature addProperty(String name, String value);
+    TFeature addProperty( String name, String value );
 
     TGeometry asGeometry();
 
     Map<String, List<String>> asProperties();
 
-
     public abstract class Mixin implements TFeature
     {
 
@@ -63,41 +56,44 @@ public interface TFeature extends TGeometry
         @This
         TFeature self;
 
-        public TFeature of(TGeometry geometry)
+        public TFeature of( TGeometry geometry )
         {
-            self.geometryType().set(TGEOMETRY_TYPE.FEATURE);
-            self.geometry().set(geometry);
+            self.geometryType().set( TGEOMETRY_TYPE.FEATURE );
+            self.geometry().set( geometry );
 
             return self;
         }
 
-        public TFeature withProperties(Map<String, List<String>> properties)
+        public TFeature withProperties( Map<String, List<String>> properties )
         {
-            self.properties().set(properties);
+            self.properties().set( properties );
             return self;
         }
 
-        public TFeature addProperty(String name, String value)
+        public TFeature addProperty( String name, String value )
         {
-            if (self.properties() == null || self.properties().get() == null || !self.properties().get().containsKey(name))
+            if( self.properties() == null || self.properties().get() == null || !self.properties()
+                .get()
+                .containsKey( name ) )
             {
                 Map<String, List<String>> properties = new HashMap<>();
-                properties.put(name, Arrays.asList(value));
-                self.properties().set(properties);
-            } else
+                properties.put( name, Arrays.asList( value ) );
+                self.properties().set( properties );
+            }
+            else
             {
-                self.properties().get().get(name).add(value);
+                self.properties().get().get( name ).add( value );
             }
             return self;
         }
 
-
         public boolean isEmpty()
         {
-            return (self.geometry() == null) || (self.geometry().get() == null) || (self.geometry().get().isEmpty()) ? true : false;
+            return ( self.geometry() == null ) || ( self.geometry().get() == null ) || ( self.geometry()
+                                                                                             .get()
+                                                                                             .isEmpty() ) ? true : false;
         }
 
-
         public Coordinate[] getCoordinates()
         {
             return self.geometry().get().getCoordinates();
@@ -108,7 +104,6 @@ public interface TFeature extends TGeometry
             return isEmpty() ? 0 : self.geometry().get().getNumPoints();
         }
 
-
         public TGeometry asGeometry()
         {
             return self.geometry().get();
@@ -118,7 +113,5 @@ public interface TFeature extends TGeometry
         {
             return self.properties().get();
         }
-
     }
-
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/TFeatureCollection.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/TFeatureCollection.java b/core/api/src/main/java/org/qi4j/api/geometry/TFeatureCollection.java
index 99593d3..afe3e6c 100644
--- a/core/api/src/main/java/org/qi4j/api/geometry/TFeatureCollection.java
+++ b/core/api/src/main/java/org/qi4j/api/geometry/TFeatureCollection.java
@@ -14,22 +14,20 @@
 
 package org.qi4j.api.geometry;
 
-import org.qi4j.api.geometry.internal.GeometryCollections;
-import org.qi4j.api.geometry.internal.TGeometry;
+import java.util.ArrayList;
+import java.util.List;
 import org.qi4j.api.injection.scope.Structure;
 import org.qi4j.api.injection.scope.This;
 import org.qi4j.api.mixin.Mixins;
 import org.qi4j.api.structure.Module;
 
-import java.util.ArrayList;
-import java.util.List;
-
-@Mixins(TFeatureCollection.Mixin.class)
+@Mixins( TFeatureCollection.Mixin.class )
 public interface TFeatureCollection extends GeometryCollections
 {
 
-    TFeatureCollection of(TFeature... features);
-    TFeatureCollection of(List<TFeature> features);
+    TFeatureCollection of( TFeature... features );
+
+    TFeatureCollection of( List<TFeature> features );
 
     public abstract class Mixin extends GeometryCollections.Mixin implements TFeatureCollection
     {
@@ -39,27 +37,31 @@ public interface TFeatureCollection extends GeometryCollections
         @This
         TFeatureCollection self;
 
-        public TFeatureCollection of(List<TFeature> features)
+        public TFeatureCollection of( List<TFeature> features )
         {
-            of(features.toArray(new TFeature[features.size()]));
+            of( features.toArray( new TFeature[ features.size() ] ) );
             return self;
         }
 
-        public TFeatureCollection of(TFeature... features)
+        public TFeatureCollection of( TFeature... features )
         {
-            self.geometryType().set(TGEOMETRY_TYPE.FEATURECOLLECTION);
+            self.geometryType().set( TGEOMETRY_TYPE.FEATURECOLLECTION );
             init();
             List<TGeometry> l = new ArrayList<>();
 
-            for (TFeature f : features)
+            for( TFeature f : features )
             {
-                l.add(f);
+                l.add( f );
             }
 
-            if (self.isEmpty())
-                self.geometries().set(l);
+            if( self.isEmpty() )
+            {
+                self.geometries().set( l );
+            }
             else
-                self.geometries().get().addAll(l);
+            {
+                self.geometries().get().addAll( l );
+            }
 
             return self;
         }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/TGeometry.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/TGeometry.java b/core/api/src/main/java/org/qi4j/api/geometry/TGeometry.java
new file mode 100644
index 0000000..463fa93
--- /dev/null
+++ b/core/api/src/main/java/org/qi4j/api/geometry/TGeometry.java
@@ -0,0 +1,238 @@
+/*
+ * 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.api.geometry;
+
+import org.qi4j.api.common.Optional;
+import org.qi4j.api.common.UseDefaults;
+import org.qi4j.api.injection.scope.Structure;
+import org.qi4j.api.injection.scope.This;
+import org.qi4j.api.mixin.Mixins;
+import org.qi4j.api.property.Property;
+import org.qi4j.api.structure.Module;
+import org.qi4j.api.value.ValueComposite;
+
+@Mixins( TGeometry.Mixin.class )
+public interface TGeometry extends ValueComposite
+{
+    enum TGEOMETRY_TYPE
+    {
+        POINT, MULTIPOINT, LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON, FEATURE, FEATURECOLLECTION, INVALID
+    }
+
+    Property<TGEOMETRY_TYPE> geometryType();
+
+    @Optional
+    @UseDefaults
+    Property<String> CRS();
+
+    String getCRS();
+
+    void setCRS( String crs );
+
+    abstract Coordinate[] getCoordinates();
+
+    abstract int getNumPoints();
+
+    abstract boolean isEmpty();
+
+    TGEOMETRY_TYPE getType();
+
+    boolean isPoint();
+
+    boolean isPoint( TGeometry tGeometry );
+
+    boolean isMultiPoint();
+
+    boolean isMultiPoint( TGeometry tGeometry );
+
+    boolean isLineString();
+
+    boolean isLineString( TGeometry tGeometry );
+
+    boolean isMultiLineString();
+
+    boolean isMultiLineString( TGeometry tGeometry );
+
+    boolean isPolygon();
+
+    boolean isPolygon( TGeometry tGeometry );
+
+    boolean isMultiPolygon();
+
+    boolean isMultiPolygon( TGeometry tGeometry );
+
+    boolean isFeature();
+
+    boolean isFeature( TGeometry tGeometry );
+
+    boolean isFeatureCollection();
+
+    boolean isFeatureCollection( TGeometry tGeometry );
+
+    boolean isGeometry();
+
+    boolean isGeometry( Object tGeometry );
+
+    public abstract class Mixin implements TGeometry
+    {
+
+        @Structure
+        Module module;
+
+        @This
+        TGeometry self;
+
+        public String getCRS()
+        {
+            return self.CRS().get();
+        }
+
+        public void setCRS( String crs )
+        {
+            self.CRS().set( crs );
+        }
+
+        public int getNumPoints()
+        {
+            return 0;
+        }
+
+        public Coordinate[] getCoordinates()
+        {
+            throw new RuntimeException( "Should never be called" );
+        }
+
+        public boolean isEmpty()
+        {
+            throw new RuntimeException( "Should never be called" );
+        }
+
+        public TGEOMETRY_TYPE getType()
+        {
+            // "strong typing" - type & instanceOf must match
+            switch( self.geometryType().get() )
+            {
+            case POINT:
+                return self.isPoint() == false ? TGEOMETRY_TYPE.INVALID : TGEOMETRY_TYPE.POINT;
+            case MULTIPOINT:
+                return self.isMultiPoint() == false ? TGEOMETRY_TYPE.INVALID : TGEOMETRY_TYPE.MULTIPOINT;
+            case LINESTRING:
+                return self.isLineString() == false ? TGEOMETRY_TYPE.INVALID : TGEOMETRY_TYPE.LINESTRING;
+            case MULTILINESTRING:
+                return self.isMultiLineString() == false ? TGEOMETRY_TYPE.INVALID : TGEOMETRY_TYPE.MULTILINESTRING;
+            case POLYGON:
+                return self.isPolygon() == false ? TGEOMETRY_TYPE.INVALID : TGEOMETRY_TYPE.POLYGON;
+            case MULTIPOLYGON:
+                return self.isMultiPolygon() == false ? TGEOMETRY_TYPE.INVALID : TGEOMETRY_TYPE.MULTIPOLYGON;
+            case FEATURE:
+                return self.isFeature() == false ? TGEOMETRY_TYPE.INVALID : TGEOMETRY_TYPE.FEATURE;
+            case FEATURECOLLECTION:
+                return self.isFeatureCollection() == false ? TGEOMETRY_TYPE.INVALID : TGEOMETRY_TYPE.FEATURECOLLECTION;
+            default:
+                return TGEOMETRY_TYPE.INVALID;
+            }
+        }
+
+        public boolean isPoint()
+        {
+            return self instanceof TPoint ? true : false;
+        }
+
+        public boolean isPoint( TGeometry tGeometry )
+        {
+            return tGeometry instanceof TPoint ? true : false;
+        }
+
+        public boolean isMultiPoint()
+        {
+            return self instanceof TMultiPoint ? true : false;
+        }
+
+        public boolean isMultiPoint( TGeometry tGeometry )
+        {
+            return tGeometry instanceof TMultiPoint ? true : false;
+        }
+
+        public boolean isLineString()
+        {
+            return self instanceof TLineString ? true : false;
+        }
+
+        public boolean isLineString( TGeometry tGeometry )
+        {
+            return tGeometry instanceof TLineString ? true : false;
+        }
+
+        public boolean isMultiLineString()
+        {
+            return self instanceof TMultiLineString ? true : false;
+        }
+
+        public boolean isMultiLineString( TGeometry tGeometry )
+        {
+            return tGeometry instanceof TMultiLineString ? true : false;
+        }
+
+        public boolean isPolygon()
+        {
+            return self instanceof TPolygon ? true : false;
+        }
+
+        public boolean isPolygon( TGeometry tGeometry )
+        {
+            return tGeometry instanceof TPolygon ? true : false;
+        }
+
+        public boolean isMultiPolygon()
+        {
+            return self instanceof TMultiPolygon ? true : false;
+        }
+
+        public boolean isMultiPolygon( TGeometry tGeometry )
+        {
+            return tGeometry instanceof TMultiPolygon ? true : false;
+        }
+
+        public boolean isFeature()
+        {
+            return self instanceof TFeature ? true : false;
+        }
+
+        public boolean isFeature( TGeometry tGeometry )
+        {
+            return tGeometry instanceof TFeature ? true : false;
+        }
+
+        public boolean isFeatureCollection()
+        {
+            return self instanceof TFeatureCollection ? true : false;
+        }
+
+        public boolean isFeatureCollection( TGeometry tGeometry )
+        {
+            return tGeometry instanceof TFeatureCollection ? true : false;
+        }
+
+        public boolean isGeometry()
+        {
+            return self instanceof TGeometry ? true : false;
+        }
+
+        public boolean isGeometry( Object tGeometry )
+        {
+            return tGeometry instanceof TGeometry ? true : false;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/TGeometryFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/TGeometryFactory.java b/core/api/src/main/java/org/qi4j/api/geometry/TGeometryFactory.java
deleted file mode 100644
index 7292e28..0000000
--- a/core/api/src/main/java/org/qi4j/api/geometry/TGeometryFactory.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.api.geometry;
-
-import org.qi4j.api.geometry.internal.builders.*;
-import org.qi4j.api.structure.Module;
-
-
-public class TGeometryFactory
-{
-
-
-    public static TCRSBuilder TCrs(Module module)
-    {
-        return new TCRSBuilder(module);
-    }
-    public static TPointBuilder TPoint(Module module)
-    {
-        return new TPointBuilder(module);
-    }
-
-    public static TMultiPointBuilder TMultiPoint(Module module)
-    {
-        return new TMultiPointBuilder(module);
-    }
-    public static TLinearRingBuilder TLinearRing(Module module)
-    {
-        return new TLinearRingBuilder(module);
-    }
-    public static TLineStringBuilder TLineString(Module module)
-    {
-        return new TLineStringBuilder(module);
-    }
-    public static TMultiLineStringBuilder TMultiLineString(Module module)
-    {
-        return new TMultiLineStringBuilder(module);
-    }
-
-    public static TPolygonBuilder TPolygon(Module module)
-    {
-        return new TPolygonBuilder(module);
-    }
-    public static TMultiPolygonsBuilder TMultiPolygon(Module module)
-    {
-        return new TMultiPolygonsBuilder(module);
-    }
-    public static TFeatureBuilder TFeature(Module module)
-    {
-        return new TFeatureBuilder(module);
-    }
-    public static TFeatureCollectionBuilder TFeatureCollection(Module module)
-    {
-        return new TFeatureCollectionBuilder(module);
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/TLineString.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/TLineString.java b/core/api/src/main/java/org/qi4j/api/geometry/TLineString.java
index d9b0959..b6e60e8 100644
--- a/core/api/src/main/java/org/qi4j/api/geometry/TLineString.java
+++ b/core/api/src/main/java/org/qi4j/api/geometry/TLineString.java
@@ -14,42 +14,44 @@
 
 package org.qi4j.api.geometry;
 
-import org.qi4j.api.geometry.internal.Coordinate;
-import org.qi4j.api.geometry.internal.TGeometry;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 import org.qi4j.api.injection.scope.Structure;
 import org.qi4j.api.injection.scope.This;
 import org.qi4j.api.mixin.Mixins;
 import org.qi4j.api.property.Property;
 import org.qi4j.api.structure.Module;
 
-import java.util.ArrayList;
-import java.util.List;
-
-
-@Mixins(TLineString.Mixin.class)
+@Mixins( TLineString.Mixin.class )
 public interface TLineString extends TGeometry
 {
 
     Property<List<TPoint>> points();
 
-    TLineString of(TPoint... points);
-    TLineString of(List<TPoint> points);
+    TLineString of( TPoint... points );
+
+    TLineString of( List<TPoint> points );
+
     TLineString of();
 
-    TLineString yx(double y, double x);
+    TLineString yx( double y, double x );
 
     boolean isEmpty();
 
     int getNumPoints();
 
-    TPoint getPointN(int n);
+    TPoint getPointN( int n );
+
     TPoint getStartPoint();
+
     TPoint getEndPoint();
 
     boolean isClosed();
+
     boolean isRing();
 
-    int compareTo(TLineString line);
+    int compareTo( TLineString line );
 
     public abstract class Mixin implements TLineString
     {
@@ -59,26 +61,25 @@ public interface TLineString extends TGeometry
         @Structure
         Module module;
 
-        public TLineString of(List<TPoint> points)
+        public TLineString of( List<TPoint> points )
         {
-            of(points.toArray(new TPoint[points.size()]));
+            of( points.toArray( new TPoint[ points.size() ] ) );
             return self;
         }
 
-
-        public TLineString of(TPoint... points)
+        public TLineString of( TPoint... points )
         {
-
             List<TPoint> l = new ArrayList<>();
-            for (TPoint p : points)
+            Collections.addAll( l, points );
+            if( self.isEmpty() )
             {
-                l.add(p);
+                self.points().set( l );
             }
-            if (self.isEmpty())
-                self.points().set(l);
             else
-                self.points().get().addAll(l);
-            self.geometryType().set(TGEOMETRY_TYPE.LINESTRING);
+            {
+                self.points().get().addAll( l );
+            }
+            self.geometryType().set( TGEOMETRY_TYPE.LINESTRING );
             return self;
         }
 
@@ -87,15 +88,17 @@ public interface TLineString extends TGeometry
             return self;
         }
 
-        public TLineString yx(double y, double x)
+        public TLineString yx( double y, double x )
         {
-            of(module.newValueBuilder(TPoint.class).prototype().x(x).y(y));
+            of( module.newValueBuilder( TPoint.class ).prototype().x( x ).y( y ) );
             return self;
         }
 
         public boolean isEmpty()
         {
-            return (self.points() == null) || (self.points().get() == null) || (self.points().get().isEmpty()) ? true : false;
+            return ( self.points() == null ) ||
+                   ( self.points().get() == null ) ||
+                   ( self.points().get().isEmpty() );
         }
 
         public int getNumPoints()
@@ -103,40 +106,40 @@ public interface TLineString extends TGeometry
             return isEmpty() ? 0 : self.points().get().size();
         }
 
-        public TPoint getPointN(int n)
+        public TPoint getPointN( int n )
         {
-            return self.points().get().get(n);
+            return self.points().get().get( n );
         }
 
         public TPoint getStartPoint()
         {
-            if (isEmpty())
+            if( isEmpty() )
             {
                 return null;
             }
-            return getPointN(0);
+            return getPointN( 0 );
         }
 
         public TPoint getEndPoint()
         {
-            if (isEmpty())
+            if( isEmpty() )
             {
                 return null;
             }
-            return getPointN(getNumPoints() - 1);
+            return getPointN( getNumPoints() - 1 );
         }
 
         public Coordinate[] getCoordinates()
         {
             int k = -1;
-            Coordinate[] coordinates = new Coordinate[getNumPoints()];
-            for (int i = 0; i < getNumPoints(); i++)
+            Coordinate[] coordinates = new Coordinate[ getNumPoints() ];
+            for( int i = 0; i < getNumPoints(); i++ )
             {
-                Coordinate[] childCoordinates = getPointN(i).getCoordinates();
-                for (int j = 0; j < childCoordinates.length; j++)
+                Coordinate[] childCoordinates = getPointN( i ).getCoordinates();
+                for( Coordinate childCoordinate : childCoordinates )
                 {
                     k++;
-                    coordinates[k] = childCoordinates[j];
+                    coordinates[ k ] = childCoordinate;
                 }
             }
             return coordinates;
@@ -144,11 +147,11 @@ public interface TLineString extends TGeometry
 
         public boolean isClosed()
         {
-            if (isEmpty())
+            if( isEmpty() )
             {
                 return false;
             }
-            return getStartPoint().compareTo(getEndPoint()) == 0 ? true : false;
+            return getStartPoint().compareTo( getEndPoint() ) == 0;
         }
 
         public boolean isRing()
@@ -156,32 +159,30 @@ public interface TLineString extends TGeometry
             return isClosed();
         }
 
-        public int compareTo(TLineString line)
+        public int compareTo( TLineString line )
         {
 
             int i = 0;
             int j = 0;
-            while (i < self.getNumPoints() && j < line.getNumPoints())
+            while( i < self.getNumPoints() && j < line.getNumPoints() )
             {
-                int comparison = self.getPointN(i).compareTo(line.getPointN(j));
-                if (comparison != 0)
+                int comparison = self.getPointN( i ).compareTo( line.getPointN( j ) );
+                if( comparison != 0 )
                 {
                     return comparison;
                 }
                 i++;
                 j++;
             }
-            if (i < self.getNumPoints())
+            if( i < self.getNumPoints() )
             {
                 return 1;
             }
-            if (j < line.getNumPoints())
+            if( j < line.getNumPoints() )
             {
                 return -1;
             }
             return 0;
         }
-
     }
-
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/TLinearRing.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/TLinearRing.java b/core/api/src/main/java/org/qi4j/api/geometry/TLinearRing.java
new file mode 100644
index 0000000..d669589
--- /dev/null
+++ b/core/api/src/main/java/org/qi4j/api/geometry/TLinearRing.java
@@ -0,0 +1,41 @@
+/*
+ * 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.api.geometry;
+
+import org.qi4j.api.injection.scope.This;
+import org.qi4j.api.mixin.Mixins;
+
+@Mixins( TLinearRing.Mixin.class )
+public interface TLinearRing extends TLineString
+{
+
+    boolean isValid();
+
+    public abstract class Mixin extends TLineString.Mixin implements TLinearRing //, TLineString
+    {
+        @This
+        TLinearRing self;
+
+        @Override
+        public boolean isValid()
+        {
+            if( self.getStartPoint() == null || self.getEndPoint() == null )
+            {
+                return false;
+            }
+            return self.getStartPoint().compareTo( self.getEndPoint() ) == 0 ? true : false;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/TMultiLineString.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/TMultiLineString.java b/core/api/src/main/java/org/qi4j/api/geometry/TMultiLineString.java
index 3d8ba09..5c15785 100644
--- a/core/api/src/main/java/org/qi4j/api/geometry/TMultiLineString.java
+++ b/core/api/src/main/java/org/qi4j/api/geometry/TMultiLineString.java
@@ -14,23 +14,20 @@
 
 package org.qi4j.api.geometry;
 
-import org.qi4j.api.geometry.internal.GeometryCollections;
-import org.qi4j.api.geometry.internal.TGeometry;
+import java.util.ArrayList;
+import java.util.List;
 import org.qi4j.api.injection.scope.Structure;
 import org.qi4j.api.injection.scope.This;
 import org.qi4j.api.mixin.Mixins;
 import org.qi4j.api.structure.Module;
 
-import java.util.ArrayList;
-import java.util.List;
-
-@Mixins(TMultiLineString.Mixin.class)
+@Mixins( TMultiLineString.Mixin.class )
 public interface TMultiLineString extends GeometryCollections
 {
 
-    TMultiLineString of(TLineString... lines);
+    TMultiLineString of( TLineString... lines );
 
-    TMultiLineString of(List<TLineString> lines);
+    TMultiLineString of( List<TLineString> lines );
 
     public abstract class Mixin extends GeometryCollections.Mixin implements TMultiLineString
     {
@@ -40,26 +37,30 @@ public interface TMultiLineString extends GeometryCollections
         @This
         TMultiLineString self;
 
-        public TMultiLineString of(List<TLineString> lines)
+        public TMultiLineString of( List<TLineString> lines )
         {
-            of(lines.toArray(new TLineString[lines.size()]));
+            of( lines.toArray( new TLineString[ lines.size() ] ) );
             return self;
         }
 
-        public TMultiLineString of(TLineString... lines)
+        public TMultiLineString of( TLineString... lines )
         {
-            self.geometryType().set(TGEOMETRY_TYPE.MULTILINESTRING);
+            self.geometryType().set( TGEOMETRY_TYPE.MULTILINESTRING );
             init();
             List<TGeometry> l = new ArrayList<>();
 
-            for (TLineString p : lines)
+            for( TLineString p : lines )
             {
-                l.add(p);
+                l.add( p );
+            }
+            if( self.isEmpty() )
+            {
+                self.geometries().set( l );
             }
-            if (self.isEmpty())
-                self.geometries().set(l);
             else
-                self.geometries().get().addAll(l);
+            {
+                self.geometries().get().addAll( l );
+            }
             return self;
         }
     }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/TMultiPoint.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/TMultiPoint.java b/core/api/src/main/java/org/qi4j/api/geometry/TMultiPoint.java
index 00e0a6f..7433034 100644
--- a/core/api/src/main/java/org/qi4j/api/geometry/TMultiPoint.java
+++ b/core/api/src/main/java/org/qi4j/api/geometry/TMultiPoint.java
@@ -14,23 +14,21 @@
 
 package org.qi4j.api.geometry;
 
-import org.qi4j.api.geometry.internal.GeometryCollections;
-import org.qi4j.api.geometry.internal.TGeometry;
+import java.util.ArrayList;
+import java.util.List;
 import org.qi4j.api.injection.scope.Structure;
 import org.qi4j.api.injection.scope.This;
 import org.qi4j.api.mixin.Mixins;
 import org.qi4j.api.structure.Module;
 
-import java.util.ArrayList;
-import java.util.List;
-
-
-@Mixins(TMultiPoint.Mixin.class)
+@Mixins( TMultiPoint.Mixin.class )
 public interface TMultiPoint extends GeometryCollections
 {
-    TMultiPoint of(TPoint... points);
-    TMultiPoint of(List<TPoint> points);
-    TMultiPoint yx(double y, double x);
+    TMultiPoint of( TPoint... points );
+
+    TMultiPoint of( List<TPoint> points );
+
+    TMultiPoint yx( double y, double x );
 
     public abstract class Mixin extends GeometryCollections.Mixin implements TMultiPoint
     {
@@ -39,29 +37,35 @@ public interface TMultiPoint extends GeometryCollections
         @Structure
         Module module;
 
-        public TMultiPoint of(List<TPoint> points)
+        public TMultiPoint of( List<TPoint> points )
         {
-            of(points.toArray(new TPoint[points.size()]));
+            of( points.toArray( new TPoint[ points.size() ] ) );
             return self;
         }
-        public TMultiPoint yx(double y, double x)
+
+        public TMultiPoint yx( double y, double x )
         {
-            of(module.newValueBuilder(TPoint.class).prototype().x(x).y(y));
+            of( module.newValueBuilder( TPoint.class ).prototype().x( x ).y( y ) );
             return self;
         }
-        public TMultiPoint of(TPoint... points)
+
+        public TMultiPoint of( TPoint... points )
         {
-            self.geometryType().set(TGEOMETRY_TYPE.MULTIPOINT);
+            self.geometryType().set( TGEOMETRY_TYPE.MULTIPOINT );
             init();
             List<TGeometry> l = new ArrayList<>();
-            for (TPoint p : points)
+            for( TPoint p : points )
             {
-                l.add(p);
+                l.add( p );
+            }
+            if( self.isEmpty() )
+            {
+                self.geometries().set( l ); // points().set(l);
             }
-            if (self.isEmpty())
-                self.geometries().set(l); // points().set(l);
             else
-                self.geometries().get().addAll(l);
+            {
+                self.geometries().get().addAll( l );
+            }
 
             return self;
         }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/TMultiPolygon.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/TMultiPolygon.java b/core/api/src/main/java/org/qi4j/api/geometry/TMultiPolygon.java
index 4eb37c1..ec487bb 100644
--- a/core/api/src/main/java/org/qi4j/api/geometry/TMultiPolygon.java
+++ b/core/api/src/main/java/org/qi4j/api/geometry/TMultiPolygon.java
@@ -14,23 +14,20 @@
 
 package org.qi4j.api.geometry;
 
-import org.qi4j.api.geometry.internal.GeometryCollections;
-import org.qi4j.api.geometry.internal.TGeometry;
+import java.util.ArrayList;
+import java.util.List;
 import org.qi4j.api.injection.scope.Structure;
 import org.qi4j.api.injection.scope.This;
 import org.qi4j.api.mixin.Mixins;
 import org.qi4j.api.structure.Module;
 
-import java.util.ArrayList;
-import java.util.List;
-
-@Mixins(TMultiPolygon.Mixin.class)
+@Mixins( TMultiPolygon.Mixin.class )
 public interface TMultiPolygon extends GeometryCollections
 {
 
-    TMultiPolygon of(TPolygon... polygons);
+    TMultiPolygon of( TPolygon... polygons );
 
-    TMultiPolygon of(List<TPolygon> polygons);
+    TMultiPolygon of( List<TPolygon> polygons );
 
     public abstract class Mixin extends GeometryCollections.Mixin implements TMultiPolygon
     {
@@ -40,28 +37,31 @@ public interface TMultiPolygon extends GeometryCollections
         @This
         TMultiPolygon self;
 
-        public TMultiPolygon of(List<TPolygon> polygons)
+        public TMultiPolygon of( List<TPolygon> polygons )
         {
-            of(polygons.toArray(new TPolygon[polygons.size()]));
+            of( polygons.toArray( new TPolygon[ polygons.size() ] ) );
             return self;
         }
 
-        public TMultiPolygon of(TPolygon... polygons)
+        public TMultiPolygon of( TPolygon... polygons )
         {
             init();
-            self.geometryType().set(TGEOMETRY_TYPE.MULTIPOLYGON);
+            self.geometryType().set( TGEOMETRY_TYPE.MULTIPOLYGON );
             List<TGeometry> l = new ArrayList<>();
 
-            for (TPolygon p : polygons)
+            for( TPolygon p : polygons )
             {
-                l.add(p);
+                l.add( p );
+            }
+            if( self.isEmpty() )
+            {
+                self.geometries().set( l );
             }
-            if (self.isEmpty())
-                self.geometries().set(l);
             else
-                self.geometries().get().addAll(l);
+            {
+                self.geometries().get().addAll( l );
+            }
             return self;
         }
-
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/TPoint.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/TPoint.java b/core/api/src/main/java/org/qi4j/api/geometry/TPoint.java
index 268d78c..0ac2b06 100644
--- a/core/api/src/main/java/org/qi4j/api/geometry/TPoint.java
+++ b/core/api/src/main/java/org/qi4j/api/geometry/TPoint.java
@@ -14,17 +14,15 @@
 
 package org.qi4j.api.geometry;
 
-import org.qi4j.api.geometry.internal.Coordinate;
-import org.qi4j.api.geometry.internal.TGeometry;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 import org.qi4j.api.injection.scope.Structure;
 import org.qi4j.api.injection.scope.This;
 import org.qi4j.api.mixin.Mixins;
 import org.qi4j.api.property.Property;
 import org.qi4j.api.structure.Module;
 
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * Lat = Y Lon = X
  *
@@ -34,23 +32,23 @@ import java.util.List;
  * additional dimensions are allowed, and interpretation and meaning of these coordinates is beyond the scope of
  * this specification.
  */
-@Mixins(TPoint.Mixin.class)
+@Mixins( TPoint.Mixin.class )
 public interface TPoint extends TGeometry
 {
 
     Property<List<Coordinate>> coordinates();
 
-    TPoint of(Coordinate... coordinates);
+    TPoint of( Coordinate... coordinates );
 
-    TPoint of(double x, double y, double z);
+    TPoint of( double x, double y, double z );
 
     TPoint of();
 
-    TPoint x(double x);
+    TPoint x( double x );
 
-    TPoint y(double y);
+    TPoint y( double y );
 
-    TPoint z(double z);
+    TPoint z( double z );
 
     double x();
 
@@ -60,102 +58,108 @@ public interface TPoint extends TGeometry
 
     Coordinate getCoordinate();
 
-    int compareTo(Object o);
-
+    int compareTo( Object o );
 
     public abstract class Mixin implements TPoint
     {
 
         @Structure
-        Module module;
+        private Module module;
+
         @This
-        TPoint self;
+        private TPoint self;
 
         private void init()
         {
-            if (self.coordinates().get() == null)
+            if( self.coordinates().get() == null )
             {
-
                 List<Coordinate> c = new ArrayList<Coordinate>();
-                c.add(module.newValueBuilder(Coordinate.class).prototype().x(0).y(0).z(0));
-                self.coordinates().set(c);
-                self.geometryType().set(TGEOMETRY_TYPE.POINT);
+                c.add( module.newValueBuilder( Coordinate.class ).prototype().x( 0 ).y( 0 ).z( 0 ) );
+                self.coordinates().set( c );
+                self.geometryType().set( TGEOMETRY_TYPE.POINT );
             }
         }
 
         @Override
         public boolean isEmpty()
         {
-            return (self.coordinates() == null) || (self.coordinates().get() == null) || (self.coordinates().get().isEmpty()) ? true : false;
+            return ( self.coordinates() == null ) ||
+                   ( self.coordinates().get() == null ) ||
+                   ( self.coordinates().get().isEmpty() );
         }
 
-
         public TPoint of()
         {
-            if (isEmpty())
-                return self.of(0.0d, 0.0d, 0.0d);
+            if( isEmpty() )
+            {
+                return self.of( 0.0d, 0.0d, 0.0d );
+            }
             else
+            {
                 return self;
+            }
         }
-        public TPoint of(double x, double y, double z)
+
+        public TPoint of( double x, double y, double z )
         {
             init();
-            self.x(x).y(y).z(z);
-            self.geometryType().set(TGEOMETRY_TYPE.POINT);
+            self.x( x ).y( y ).z( z );
+            self.geometryType().set( TGEOMETRY_TYPE.POINT );
             return self;
         }
 
-        public TPoint of(Coordinate... coordinates)
+        public TPoint of( Coordinate... coordinates )
         {
             List<Coordinate> c = new ArrayList<Coordinate>();
-
-            for (Coordinate xyzn : coordinates)
-            {
-                c.add(xyzn);
-            }
-            self.coordinates().set(c);
-            self.geometryType().set(TGEOMETRY_TYPE.POINT);
+            Collections.addAll( c, coordinates );
+            self.coordinates().set( c );
+            self.geometryType().set( TGEOMETRY_TYPE.POINT );
             return self;
         }
 
-        public TPoint x(double x)
+        public TPoint x( double x )
         {
             init();
-            self.coordinates().get().get(0).x(x);
+            self.coordinates().get().get( 0 ).x( x );
             return self;
         }
 
         public double x()
         {
-            return self.coordinates().get().get(0).getOrdinate(Coordinate.X);
+            return self.coordinates().get().get( 0 ).getOrdinate( Coordinate.X );
         }
-        public TPoint y(double y)
+
+        public TPoint y( double y )
         {
             init();
-            self.coordinates().get().get(0).y(y);
+            self.coordinates().get().get( 0 ).y( y );
             return self;
         }
+
         public double y()
         {
-            return self.coordinates().get().get(0).getOrdinate(Coordinate.Y);
+            return self.coordinates().get().get( 0 ).getOrdinate( Coordinate.Y );
         }
+
         public double z()
         {
-            return self.coordinates().get().get(0).getOrdinate(Coordinate.Z);
+            return self.coordinates().get().get( 0 ).getOrdinate( Coordinate.Z );
         }
-        public TPoint z(double z)
+
+        public TPoint z( double z )
         {
             init();
-            self.coordinates().get().get(0).z(z);
+            self.coordinates().get().get( 0 ).z( z );
             return self;
         }
 
-        public TPoint of(List<Double> coordinates)
+        public TPoint of( List<Double> coordinates )
         {
+            // TODO; [niclas] Must be something wrong here...
             List<Coordinate> c = new ArrayList<Coordinate>();
-            for (Double xyzn : coordinates)
+            for( Double xyzn : coordinates )
             {
-                c.add(module.newValueBuilder(Coordinate.class).prototype().of(xyzn));
+                c.add( module.newValueBuilder( Coordinate.class ).prototype().of( xyzn ) );
             }
             return null;
         }
@@ -164,13 +168,13 @@ public interface TPoint extends TGeometry
         public Coordinate[] getCoordinates()
         {
             List<Coordinate> coordinates = new ArrayList<>();
-            coordinates.add(getCoordinate());
-            return coordinates.toArray(new Coordinate[coordinates.size()]);
+            coordinates.add( getCoordinate() );
+            return coordinates.toArray( new Coordinate[ coordinates.size() ] );
         }
 
         public Coordinate getCoordinate()
         {
-            return self.coordinates().get().size() != 0 ? self.coordinates().get().get(0) : null;
+            return self.coordinates().get().size() != 0 ? self.coordinates().get().get( 0 ) : null;
         }
 
         public int getNumPoints()
@@ -178,12 +182,10 @@ public interface TPoint extends TGeometry
             return isEmpty() ? 0 : 1;
         }
 
-        public int compareTo(Object other)
+        public int compareTo( Object other )
         {
             TPoint point = (TPoint) other;
-            return getCoordinate().compareTo(point.getCoordinate());
+            return getCoordinate().compareTo( point.getCoordinate() );
         }
-
     }
-
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/TPolygon.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/TPolygon.java b/core/api/src/main/java/org/qi4j/api/geometry/TPolygon.java
index 7c2b627..bee5e65 100644
--- a/core/api/src/main/java/org/qi4j/api/geometry/TPolygon.java
+++ b/core/api/src/main/java/org/qi4j/api/geometry/TPolygon.java
@@ -14,22 +14,17 @@
 
 package org.qi4j.api.geometry;
 
+import java.util.ArrayList;
+import java.util.List;
 import org.qi4j.api.common.Optional;
-import org.qi4j.api.geometry.internal.Coordinate;
-import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.geometry.internal.TLinearRing;
-import org.qi4j.api.geometry.internal.TShape;
 import org.qi4j.api.injection.scope.Structure;
 import org.qi4j.api.injection.scope.This;
 import org.qi4j.api.mixin.Mixins;
 import org.qi4j.api.property.Property;
 import org.qi4j.api.structure.Module;
 
-import java.util.ArrayList;
-import java.util.List;
-
-@Mixins(TPolygon.Mixin.class)
-public interface TPolygon extends TShape, TGeometry
+@Mixins( TPolygon.Mixin.class )
+public interface TPolygon extends TShape
 {
 
     Property<TLinearRing> shell();
@@ -37,58 +32,68 @@ public interface TPolygon extends TShape, TGeometry
     @Optional
     Property<List<TLinearRing>> holes();
 
-    TPolygon of(TLinearRing shell);
-    TPolygon of(TLinearRing shell, @Optional TLinearRing... holes);
-    TPolygon withHole(TLinearRing hole);
-    TPolygon withHoles(@Optional TLinearRing... holes);
+    TPolygon of( TLinearRing shell );
+
+    TPolygon of( TLinearRing shell, @Optional TLinearRing... holes );
+
+    TPolygon withHole( TLinearRing hole );
+
+    TPolygon withHoles( @Optional TLinearRing... holes );
+
     boolean isEmpty();
 
     public abstract class Mixin implements TPolygon
     {
         @Structure
-        Module module;
+        private Module module;
 
         @This
-        TPolygon self;
+        private TPolygon self;
 
         private void init()
         {
-            if (self.holes().get() == null)
+            if( self.holes().get() == null )
             {
                 List<TLinearRing> ring = new ArrayList<>();
-                self.holes().set(ring);
-                self.geometryType().set(TGEOMETRY_TYPE.POINT);
+                self.holes().set( ring );
+                self.geometryType().set( TGEOMETRY_TYPE.POINT );
             }
         }
 
-        public TPolygon of(TLinearRing shell)
+        public TPolygon of( TLinearRing shell )
         {
-            return of(shell, null);
+            return of( shell, null );
         }
 
-        public TPolygon of(TLinearRing shell, TLinearRing... holes)
+        public TPolygon of( TLinearRing shell, TLinearRing... holes )
         {
             init();
-            if (shell != null)
+            if( shell != null )
             {
-                self.shell().set(shell);
+                self.shell().set( shell );
             }
-            withHoles(holes);
-            self.geometryType().set(TGEOMETRY_TYPE.POLYGON);
+            withHoles( holes );
+            self.geometryType().set( TGEOMETRY_TYPE.POLYGON );
             return self;
         }
 
-        public TPolygon withHole(TLinearRing hole)
+        public TPolygon withHole( TLinearRing hole )
         {
-            if (hole != null) self.holes().get().add(hole);
+            if( hole != null )
+            {
+                self.holes().get().add( hole );
+            }
             return self;
         }
-        public TPolygon withHoles(TLinearRing... holes)
+
+        public TPolygon withHoles( TLinearRing... holes )
         {
-            if (holes != null && holes.length != 0)
+            if( holes != null && holes.length != 0 )
             {
-                for (TLinearRing hole : holes)
-                    withHole(hole);
+                for( TLinearRing hole : holes )
+                {
+                    withHole( hole );
+                }
             }
             return self;
         }
@@ -96,25 +101,23 @@ public interface TPolygon extends TShape, TGeometry
         @Override
         public Coordinate[] getCoordinates()
         {
-            if (isEmpty())
+            if( isEmpty() )
             {
                 return new Coordinate[]{};
             }
-            Coordinate[] coordinates = new Coordinate[getNumPoints()];
-            int k = -1;
+            Coordinate[] coordinates = new Coordinate[ getNumPoints() ];
             Coordinate[] shellCoordinates = self.shell().get().getCoordinates();
-            for (int x = 0; x < shellCoordinates.length; x++)
+            int k = 0;
+            for( Coordinate shellCoordinate : shellCoordinates )
             {
-                k++;
-                coordinates[k] = shellCoordinates[x];
+                coordinates[ k++ ] = shellCoordinate;
             }
-            for (int i = 0; i < self.holes().get().size(); i++)
+            for( int i = 0; i < self.holes().get().size(); i++ )
             {
-                Coordinate[] childCoordinates = self.holes().get().get(i).getCoordinates();
-                for (int j = 0; j < childCoordinates.length; j++)
+                Coordinate[] childCoordinates = self.holes().get().get( i ).getCoordinates();
+                for( Coordinate childCoordinate : childCoordinates )
                 {
-                    k++;
-                    coordinates[k] = childCoordinates[j];
+                    coordinates[ k++ ] = childCoordinate;
                 }
             }
             return coordinates;
@@ -122,16 +125,18 @@ public interface TPolygon extends TShape, TGeometry
 
         public boolean isEmpty()
         {
-            return (self.shell() == null) || (self.shell().get() == null) || (self.shell().get().isEmpty()) ? true : false;
+            return ( self.shell() == null ) ||
+                   ( self.shell().get() == null ) ||
+                   ( self.shell().get().isEmpty() );
         }
 
         public int getNumPoints()
         {
 
             int numPoints = self.shell().get().getNumPoints();
-            for (int i = 0; i < self.holes().get().size(); i++)
+            for( int i = 0; i < self.holes().get().size(); i++ )
             {
-                numPoints += self.holes().get().get(i).getNumPoints();
+                numPoints += self.holes().get().get( i ).getNumPoints();
             }
             return numPoints;
         }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/TShape.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/TShape.java b/core/api/src/main/java/org/qi4j/api/geometry/TShape.java
new file mode 100644
index 0000000..70de84b
--- /dev/null
+++ b/core/api/src/main/java/org/qi4j/api/geometry/TShape.java
@@ -0,0 +1,20 @@
+/*
+ * 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.api.geometry;
+
+public interface TShape extends TGeometry
+{
+    // marking interface
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/TUnit.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/TUnit.java b/core/api/src/main/java/org/qi4j/api/geometry/TUnit.java
index 308fd9b..0099189 100644
--- a/core/api/src/main/java/org/qi4j/api/geometry/TUnit.java
+++ b/core/api/src/main/java/org/qi4j/api/geometry/TUnit.java
@@ -32,6 +32,5 @@ public enum TUnit
     USFOOT,
     YARD,
     UNIT,
-    SECOND,
-
+    SECOND
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/internal/Coordinate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/internal/Coordinate.java b/core/api/src/main/java/org/qi4j/api/geometry/internal/Coordinate.java
deleted file mode 100644
index e49e96e..0000000
--- a/core/api/src/main/java/org/qi4j/api/geometry/internal/Coordinate.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * 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.api.geometry.internal;
-
-import org.qi4j.api.common.Optional;
-import org.qi4j.api.injection.scope.This;
-import org.qi4j.api.mixin.Mixins;
-import org.qi4j.api.property.Property;
-import org.qi4j.api.value.ValueComposite;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Represents one single n-Dimensional coordinate in the n-Dimensional "space"
- */
-
-@Mixins(Coordinate.Mixin.class)
-public interface Coordinate extends Comparable, ValueComposite
-{
-
-    public static final int X = 0;
-    public static final int Y = 1;
-    public static final int Z = 2;
-
-    // single coordinate store
-    @Optional
-    Property<List<Double>> coordinate();
-
-    Coordinate of();
-    Coordinate of(double x, double y, double z);
-    Coordinate of(double... coordinates);
-
-    Coordinate x(double x);
-    Coordinate y(double y);
-    Coordinate z(double z);
-
-    double x();
-    double y();
-    double z();
-
-    double getOrdinate(int ordinateIndex);
-    int compareTo(Object o);
-    double[] source();
-
-    public abstract class Mixin implements Coordinate
-    {
-
-        List<Double> EMPTY = new ArrayList<>(X + Y + Z);
-        @This
-        Coordinate self;
-
-        private void init()
-        {
-            if (isEmpty())
-            {
-                EMPTY.add(new Double(0.0));
-                EMPTY.add(new Double(0.0));
-                EMPTY.add(new Double(0.0));
-
-                self.coordinate().set(EMPTY);
-            }
-        }
-
-        private boolean isEmpty()
-        {
-            return (self.coordinate() == null) || (self.coordinate().get() == null) || (self.coordinate().get().isEmpty()) ? true : false;
-        }
-
-        public Coordinate of()
-        {
-            return self.of(0.0d, 0.0d, 0.0d);
-        }
-
-        public Coordinate of(double x, double y, double z)
-        {
-            init();
-            self.x(x);
-            self.y(y);
-            self.z(z);
-            return self;
-        }
-
-
-        public double x()
-        {
-            return getOrdinate(X);
-        }
-        public double y()
-        {
-            return getOrdinate(Y);
-        }
-        public double z()
-        {
-            return getOrdinate(Z);
-        }
-
-        public Coordinate x(double x)
-        {
-            init();
-            if (!Double.isNaN(x) && !Double.isInfinite(x))
-            {
-                self.coordinate().get().set(X, x);
-            }
-            return self;
-        }
-
-        public Coordinate y(double y)
-        {
-            init();
-            if (!Double.isNaN(y) && !Double.isInfinite(y))
-            {
-                self.coordinate().get().set(Y, y);
-            }
-            return self;
-        }
-
-        public Coordinate z(double z)
-        {
-            init();
-            if (!Double.isNaN(z) && !Double.isInfinite(z))
-            {
-                self.coordinate().get().set(Z, z);
-            }
-            return self;
-        }
-
-        public int compareTo(Object o)
-        {
-            Coordinate other = (Coordinate) o;
-            if (self.coordinate().get().get(X) < other.coordinate().get().get(X)) return -1;
-            if (self.coordinate().get().get(X) > other.coordinate().get().get(X)) return 1;
-            if (self.coordinate().get().get(Y) < other.coordinate().get().get(Y)) return -1;
-            if (self.coordinate().get().get(Y) > other.coordinate().get().get(Y)) return 1;
-            return 0;
-        }
-
-        public double getOrdinate(int ordinateIndex)
-        {
-            switch (ordinateIndex)
-            {
-                case X:
-                    return self.coordinate().get().get(X);
-                case Y:
-                    return self.coordinate().get().get(Y);
-                case Z:
-                    return self.coordinate().get().get(Z);
-            }
-            throw new IllegalArgumentException("Invalid ordinate index: " + ordinateIndex);
-        }
-
-        public double[] source()
-        {
-            double[] source = new double[X + Y + Z];
-            source[X] = getOrdinate(X);
-            source[Y] = getOrdinate(Y);
-            source[Z] = getOrdinate(Z);
-            return source;
-        }
-
-
-        public Coordinate of(double... coordinates)
-        {
-            List<Double> l = new ArrayList<Double>(coordinates.length);
-            for (double xyzn : coordinates)
-            {
-                // only values that makes "sense"
-                if (!Double.isNaN(xyzn) && !Double.isInfinite(xyzn))
-                    l.add(new Double(xyzn));
-            }
-            self.coordinate().set(l);
-            return self;
-        }
-
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/internal/GeometryCollections.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/internal/GeometryCollections.java b/core/api/src/main/java/org/qi4j/api/geometry/internal/GeometryCollections.java
deleted file mode 100644
index 7f9d5a8..0000000
--- a/core/api/src/main/java/org/qi4j/api/geometry/internal/GeometryCollections.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.api.geometry.internal;
-
-import org.qi4j.api.injection.scope.This;
-import org.qi4j.api.property.Property;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-public interface GeometryCollections extends TGeometry
-{
-
-    Property<List<TGeometry>> geometries();
-    TGeometry getGeometryN(int n);
-
-
-    int getNumGeometries();
-
-    boolean isEmpty();
-
-    public abstract class Mixin extends TGeometry.Mixin implements GeometryCollections
-    {
-
-        @This
-        GeometryCollections self;
-
-
-        protected void init()
-        {
-            if (self.geometries().get() == null)
-            {
-                List<TGeometry> geometries = new ArrayList<>();
-                self.geometries().set(geometries);
-            }
-        }
-
-        public boolean isEmpty()
-        {
-            for (int i = 0; i < self.geometries().get().size(); i++)
-            {
-                if (!self.geometries().get().get(i).isEmpty())
-                {
-                    return false;
-                }
-            }
-            return true;
-        }
-
-        public int getNumGeometries()
-        {
-            return self.geometries().get().size();
-        }
-
-        public TGeometry getGeometryN(int n)
-        {
-            return self.geometries().get().get(n);
-        }
-        public Coordinate[] getCoordinates()
-        {
-            Coordinate[] coordinates = new Coordinate[self.getNumPoints()];
-            int k = -1;
-            for (int i = 0; i < self.getNumGeometries(); i++)
-            {
-                Coordinate[] childCoordinates = self.geometries().get().get(i).getCoordinates();
-                for (int j = 0; j < childCoordinates.length; j++)
-                {
-                    k++;
-                    coordinates[k] = childCoordinates[j];
-                }
-            }
-            return coordinates;
-        }
-
-        public int getNumPoints()
-        {
-            int numPoints = 0;
-            for (int i = 0; i < self.geometries().get().size(); i++)
-            {
-                numPoints += self.geometries().get().get(i).getNumPoints();
-            }
-            return numPoints;
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/c1d327e2/core/api/src/main/java/org/qi4j/api/geometry/internal/TCircle.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/geometry/internal/TCircle.java b/core/api/src/main/java/org/qi4j/api/geometry/internal/TCircle.java
deleted file mode 100644
index b52b28d..0000000
--- a/core/api/src/main/java/org/qi4j/api/geometry/internal/TCircle.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.qi4j.api.geometry.internal;
-
-
-import org.qi4j.api.geometry.TPoint;
-import org.qi4j.api.geometry.TPolygon;
-import org.qi4j.api.injection.scope.Structure;
-import org.qi4j.api.injection.scope.This;
-import org.qi4j.api.mixin.Mixins;
-import org.qi4j.api.property.Property;
-import org.qi4j.api.structure.Module;
-
-@Mixins(TCircle.Mixin.class)
-public interface TCircle extends TGeometry
-{
-    Property<TPoint> point();
-
-    Property<Double> radius();
-
-    TCircle of(TPoint point, double radius);
-    TCircle of(double x, double y, double radius);
-    TCircle of(TPoint point);
-    TCircle of();
-
-    TCircle yx(double y, double x);
-    TCircle yx(double y, double x, double radius);
-
-    TCircle radius(double r);
-    TPoint getCentre();
-    TPolygon polygonize(int numOfPoints);
-
-    public abstract class Mixin implements TCircle
-    {
-        @This
-        TCircle self;
-
-        @Structure
-        Module module;
-
-        public TCircle of()
-        {
-            return self;
-        }
-
-        public TCircle of(TPoint point)
-        {
-            self.point().set(point);
-            return self;
-        }
-
-        public TCircle of(double x, double y, double radius)
-        {
-            yx(y, x).radius(radius);
-            return self;
-        }
-
-        public TCircle yx(double y, double x)
-        {
-            of(module.newValueBuilder(TPoint.class).prototype().x(x).y(y));
-            return self;
-        }
-
-        public TCircle yx(double y, double x, double radius)
-        {
-            of(module.newValueBuilder(TPoint.class).prototype().x(x).y(y)).radius(radius);
-            return self;
-        }
-
-        public TCircle of(TPoint point, double r)
-        {
-            of(point).radius(r);
-            return self;
-        }
-
-        public TPoint getCentre()
-        {
-            return self.point().get();
-        }
-
-        public TCircle radius(double r)
-        {
-            self.radius().set(r);
-            return self;
-        }
-
-
-        public TPolygon polygonize(int numOfPoints)
-        {
-            double xRadius = self.radius().get();
-            double yRadius = self.radius().get();
-
-            double centreX = self.getCentre().x();
-            double centreY = self.getCentre().y();
-
-            TPoint[] pts = new TPoint[numOfPoints + 1];
-            int pt = 0;
-            for (int i = 0; i < numOfPoints; i++)
-            {
-                double ang = i * (2 * Math.PI / numOfPoints);
-                double x = xRadius * Math.cos(ang) + centreX;
-                double y = yRadius * Math.sin(ang) + centreY;
-                pts[pt++] = module.newValueBuilder(TPoint.class).prototype().of().x(x).y(y);
-            }
-
-            pts[pt++] = module.newValueBuilder(TPoint.class).prototype().of(pts[0].getCoordinates());
-            TLinearRing tLinearRing = (TLinearRing) module.newValueBuilder(TLinearRing.class).prototype().of(pts);
-
-            if (tLinearRing.isValid())
-            {
-                TPolygon tPolygon = module.newValueBuilder(TPolygon.class).prototype().of(tLinearRing);
-                tPolygon.setCRS(self.getCRS());
-                return module.newValueBuilder(TPolygon.class).prototype().of(tLinearRing);
-            } else
-                return null;
-        }
-    }
-}


Mime
View raw message