示例#1
0
        private void Coordinates_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (_ignoreCoordChanged)
            {
                return;
            }
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                foreach (ICoordinate item in e.NewItems)
                {
                    switch (item.Dimension)
                    {
                    case 2:
                        OgrGeometry.AddPoint_2D(item.X, item.Y);
                        break;

                    case 3:
                        OgrGeometry.AddPoint(item.X, item.Y, item.Z);
                        break;

                    case 4:
                        OgrGeometry.AddPointZM(item.X, item.Y, item.Z, item.M);
                        break;
                    }
                }
                break;

            default:
                throw new NotImplementedException();
            }
        }
示例#2
0
        public double Distance(ICoordinate coord)
        {
            double ret = 0;

            if (coord != null)
            {
                ret = OgrGeometry.Distance(coord.ToOgrPoint());
            }
            return(ret);
        }
示例#3
0
        public double Distance(IGeometry g)
        {
            double ret = 0;

            if (g != null)
            {
                ret = OgrGeometry.Distance(g.ToGeometry());
            }
            return(ret);
        }
示例#4
0
        public IGeometry Intersection(IGeometry other)
        {
            IGeometry destGeometry = null;

            if (other != null)
            {
                destGeometry = OgrGeometry.Intersection(other.ToGeometry()).ToGeometry();
            }
            return(destGeometry);
        }
示例#5
0
        public bool Intersects(IGeometry g)
        {
            bool ret = false;

            if (g is Geometry geometry)
            {
                ret = OgrGeometry.Intersects(geometry.OgrGeometry);
            }
            return(ret);
        }
示例#6
0
        public bool Contains(IGeometry g)
        {
            bool ret = false;

            if (g != null)
            {
                ret = OgrGeometry.Contains(g.ToGeometry());
            }
            return(ret);
        }
示例#7
0
        public IGeometry Union(IGeometry other)
        {
            IGeometry destGeometry = null;

            if (other != null)
            {
                var geometry = OgrGeometry.Union(other.ToGeometry());
                destGeometry = geometry.ToGeometry();
            }
            return(destGeometry);
        }
示例#8
0
        private void Geometries_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (_ignoreGeoChanged)
            {
                return;
            }
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                foreach (Geometry item in e.NewItems)
                {
                    OgrGeometry.AddGeometry(item.OgrGeometry);
                }
                break;

            default:
                throw new NotImplementedException();
            }
        }
示例#9
0
        public override int GetHashCode()
        {
            int hashCode = GeometryType.GetHashCode() ^ OgrGeometry.GetHashCode();

            return(hashCode);
        }
示例#10
0
 public bool IsEmpty() => OgrGeometry == null ? true : OgrGeometry.IsEmpty();
示例#11
0
 public double Length() => OgrGeometry == null ? 0 : OgrGeometry.Length();
示例#12
0
 public double Area() => OgrGeometry == null ? 0 : OgrGeometry.Area();