예제 #1
0
		public SpatialField(string fieldName, SpatialOptions options)
		{
			this.options = options;
			ntsContext = CreateNtsContext(options);
			shapeStringReadWriter = new ShapeStringReadWriter(options, ntsContext);
			strategy = CreateStrategy(fieldName, options, ntsContext);
		}
예제 #2
0
		private NtsSpatialContext CreateNtsContext(SpatialOptions opt)
		{
			if (opt.Type == SpatialFieldType.Cartesian)
			{
				var nts = new NtsSpatialContext(new GeometryFactory(), false, new CartesianDistCalc(), null);
				nts.GetWorldBounds().Reset(opt.MinX, opt.MaxX, opt.MinY, opt.MaxY);
				return nts;
			}
			return GeoContext;
		}
예제 #3
0
		private SpatialStrategy CreateStrategy(string fieldName, SpatialOptions opt, NtsSpatialContext context)
		{
			switch (opt.Strategy)
			{
				case SpatialSearchStrategy.GeohashPrefixTree:
					return new RecursivePrefixTreeStrategyThatSupportsWithin(new GeohashPrefixTree(context, opt.MaxTreeLevel), fieldName);
				case SpatialSearchStrategy.QuadPrefixTree:
					return new RecursivePrefixTreeStrategyThatSupportsWithin(new QuadPrefixTree(context, opt.MaxTreeLevel), fieldName);
				case SpatialSearchStrategy.BoundingBox:
					return new BBoxStrategyThatSupportsAllShapes(context, fieldName);
			}
			return null;
		}
예제 #4
0
 private NtsShapeReadWriter CreateNtsShapeReadWriter(SpatialOptions opt, NtsSpatialContext ntsContext)
 {
     if (opt.Type == SpatialFieldType.Cartesian)
         return new NtsShapeReadWriter(ntsContext, false);
     return geoShapeReadWriter ?? (geoShapeReadWriter = new NtsShapeReadWriter(ntsContext, false));
 }
예제 #5
0
 public ShapeStringReadWriter(SpatialOptions options, NtsSpatialContext context)
 {
     this.options = options;
     this.ntsShapeReadWriter = CreateNtsShapeReadWriter(options, context);
     this.shapeStringConverter = new ShapeStringConverter(options);
 }
예제 #6
0
 public ShapeStringConverter(SpatialOptions options)
 {
     this.options = options;
 }