@@ -16,7 +16,7 @@ public interface IGeoShapeQuery : IFieldNameQuery
1616 PropertyPathMarker Field { get ; set ; }
1717
1818 [ JsonProperty ( "shape" ) ]
19- GeoShapeVector Shape { get ; set ; }
19+ GeoShape Shape { get ; set ; }
2020 }
2121
2222 public class GeoShapeQuery : PlainQuery , IGeoShapeQuery
@@ -39,60 +39,51 @@ void IFieldNameQuery.SetFieldName(string fieldName)
3939 }
4040
4141 public PropertyPathMarker Field { get ; set ; }
42- public GeoShapeVector Shape { get ; set ; }
42+
43+ public GeoShape Shape { get ; set ; }
4344 }
4445
4546 public class GeoShapeQueryDescriptor < T > : IGeoShapeQuery where T : class
4647 {
48+ IGeoShapeQuery Self { get { return this ; } }
49+
4750 PropertyPathMarker IGeoShapeQuery . Field { get ; set ; }
4851
49- GeoShapeVector IGeoShapeQuery . Shape { get ; set ; }
50-
52+ GeoShape IGeoShapeQuery . Shape { get ; set ; }
53+
5154 bool IQuery . IsConditionless
5255 {
5356 get
5457 {
55- return ( ( IGeoShapeQuery ) this ) . Field . IsConditionless ( ) || ( ( ( IGeoShapeQuery ) this ) . Shape == null || ! ( ( IGeoShapeQuery ) this ) . Shape . Coordinates . HasAny ( ) ) ;
58+ return this . Self . Field . IsConditionless ( ) || this . Self . Shape == null ;
5659 }
5760
5861 }
5962 void IFieldNameQuery . SetFieldName ( string fieldName )
6063 {
61- ( ( IGeoShapeQuery ) this ) . Field = fieldName ;
64+ this . Self . Field = fieldName ;
6265 }
6366 PropertyPathMarker IFieldNameQuery . GetFieldName ( )
6467 {
65- return ( ( IGeoShapeQuery ) this ) . Field ;
68+ return this . Self . Field ;
6669 }
6770
6871 public GeoShapeQueryDescriptor < T > OnField ( string field )
6972 {
70- ( ( IGeoShapeQuery ) this ) . Field = field ;
73+ this . Self . Field = field ;
7174 return this ;
7275 }
7376 public GeoShapeQueryDescriptor < T > OnField ( Expression < Func < T , object > > objectPath )
7477 {
75- ( ( IGeoShapeQuery ) this ) . Field = objectPath ;
78+ this . Self . Field = objectPath ;
7679 return this ;
7780 }
78-
7981
80- public GeoShapeQueryDescriptor < T > Type ( string type )
82+ public GeoShapeQueryDescriptor < T > Shape < TCoordinates > ( IGeometryObject < TCoordinates > shape )
8183 {
82- if ( ( ( IGeoShapeQuery ) this ) . Shape == null )
83- ( ( IGeoShapeQuery ) this ) . Shape = new GeoShapeVector ( ) ;
84- ( ( IGeoShapeQuery ) this ) . Shape . Type = type ;
84+ shape . ThrowIfNull ( "shape" ) ;
85+ this . Self . Shape = shape . ToGeoShape ( ) ;
8586 return this ;
8687 }
87-
88- public GeoShapeQueryDescriptor < T > Coordinates ( IEnumerable < IEnumerable < double > > coordinates )
89- {
90- if ( ( ( IGeoShapeQuery ) this ) . Shape == null )
91- ( ( IGeoShapeQuery ) this ) . Shape = new GeoShapeVector ( ) ;
92- ( ( IGeoShapeQuery ) this ) . Shape . Coordinates = coordinates ;
93- return this ;
94- }
95-
9688 }
97-
9889}
0 commit comments