public MemoryDataSource(string name, enumShapeType shapeType, enumCoordinateType coordType, Envelope fullEnvelope, string[] filedNames ) : base(name) { _shapeType = shapeType; _coordType = enumCoordinateType.Geographic; _gridDefinition = new GridDefinition((float)(fullEnvelope.Width + float.Epsilon), (float)(fullEnvelope.Height + float.Epsilon)); _fullEnvelope = fullEnvelope; _gridStateIndicator = new GridStateIndicator(_fullEnvelope.Clone() as Envelope, _gridDefinition); _fullGridCount = _gridStateIndicator.Width * _gridStateIndicator.Height; _grid = new Grid(0, _fullEnvelope.Clone() as Envelope, new Feature[] { }); _fields = filedNames; }
private bool HitTestByPoint(ShapePoint shapePoint, double tolerance) { if (this is ShapePoint) { Envelope evp = Envelope.Clone() as Envelope; evp = evp.Expand((float)tolerance); return(evp.Contains(shapePoint.Envelope)); } else if (this is ShapePolyline) { return(GeometryMathLib.GetDistance(this as ShapePolyline, shapePoint) < tolerance); } else if (this is ShapePolygon) { return((this as ShapePolygon).Contains(shapePoint)); } else { throw new NotSupportedException("暂不支持对\"" + this.GetType().ToString() + "\"进行点击测试。"); } }