private static string Write(IGeoShape shape, StringBuilder builder)
		{
			switch (shape)
			{
				case IPointGeoShape point:
					WritePoint(point, builder);
					break;
				case IMultiPointGeoShape multiPoint:
					WriteMultiPoint(multiPoint, builder);
					break;
				case ILineStringGeoShape lineString:
					WriteLineString(lineString, builder);
					break;
				case IMultiLineStringGeoShape multiLineString:
					WriteMultiLineString(multiLineString, builder);
					break;
				case IPolygonGeoShape polygon:
					WritePolygon(polygon, builder);
					break;
				case IMultiPolygonGeoShape multiPolygon:
					WriteMultiPolygon(multiPolygon, builder);
					break;
				case IGeometryCollection geometryCollection:
					WriteGeometryCollection(geometryCollection, builder);
					break;
				case IEnvelopeGeoShape envelope:
					WriteEnvelope(envelope, builder);
					break;
				default:
					throw new GeoWKTException($"Unknown geometry type: {shape.GetType().Name}");
			}

			return builder.ToString();
		}
Beispiel #2
0
 public Geofence(string id, IGeoShape geoShape, MonitoredGeofenceStates states, bool singleUse)
 {
     this.Id = id;
     this.GeoShape = geoShape;
     this.States = states;
     this.SingleUse = singleUse;
     this.LastStatus = MonitoredGeofenceStates.Exited;
 }
        private void WriteShape(IGeoShape shape, IFieldLookup indexedField, Field field, string queryType)
        {
            // ReSharper disable UnusedVariable
            switch (shape)
            {
            case null when indexedField != null:
                Write("geo_indexed_shape");
                break;

            case ICircleGeoShape circleGeoShape:
                Write("geo_shape_circle");
                break;

            case IEnvelopeGeoShape envelopeGeoShape:
                Write("geo_shape_envelope");
                break;

            case IGeometryCollection geometryCollection:
                Write("geo_shape_geometrycollection");
                break;

            case ILineStringGeoShape lineStringGeoShape:
                Write("geo_shape_linestring");
                break;

            case IMultiLineStringGeoShape multiLineStringGeoShape:
                Write("geo_shape_multi_linestring");
                break;

            case IMultiPointGeoShape multiPointGeoShape:
                Write("geo_shape_multi_point");
                break;

            case IMultiPolygonGeoShape multiPolygonGeoShape:
                Write("geo_shape_multi_polygon");
                break;

            case IPointGeoShape pointGeoShape:
                Write("geo_shape_point");
                break;

            case IPolygonGeoShape polygonGeoShape:
                Write("geo_shape_polygon");
                break;

            // ReSharper restore UnusedVariable
            default:
                Write(queryType, field);
                break;
            }
        }
Beispiel #4
0
 /// <summary>
 /// Writes a <see cref="IGeoShape" /> to Well-Known Text (WKT)
 /// </summary>
 public static string Write(IGeoShape shape) =>
 shape == null ? null : Write(shape, new StringBuilder());
Beispiel #5
0
 public static bool Within(IGeoShape shape, IGeoShape inshape)
 {
     return(false);
 }