Exemple #1
0
        public List <Feature> GetHitObjects(RgPoint point, double tolerance)
        {
            List <Feature> selected = new List <Feature>();

            if (this.Visible == false)
            {
                return(null);
            }
            foreach (Feature drawobject in mGeometries)
            {
                if (ShapeType == RgEnumShapeType.RgPoint)
                {
                    RgPoint pt = drawobject.Shape as RgPoint;
                    if (RDistanceMeasure.Dist_Point_to_Point(pt, point) < tolerance)
                    {
                        selected.Add(drawobject);
                        // drawobject.IsSelected = true;
                    }
                }
                else if (ShapeType == RgEnumShapeType.RgLineString)
                {
                    LineString lineString = drawobject.Shape as LineString;
                    if (lineString.PointInObject(point))
                    {
                        selected.Add(drawobject);
                        //drawobject.IsSelected = true;
                    }
                }
                else if (ShapeType == RgEnumShapeType.RgPolygon)
                {
                    Polygon polygon = drawobject.Shape as Polygon;
                    if (!polygon.IsEmpty())
                    {
                        if (Geometries.RgTopologicRelationship.IsInPolygon(point, polygon))
                        {
                            selected.Add(drawobject);
                            //drawobject.IsSelected = true;
                        }
                    }
                }
            }
            return(selected);
        }
Exemple #2
0
        /// <summary>
        /// 几何对象集合执行的获取捕捉点的方法
        /// </summary>
        /// <param name="canvas"></param>
        /// <param name="point"></param>
        /// <param name="runningsnaptypes"></param>
        /// <param name="usersnaptype"></param>
        /// <returns></returns>
        public ISnapPoint SnapPoint(RgPoint point, Type[] runningsnaptypes, Type usersnaptype)
        {
            for (int i = 0; i < Layers.Count; i++)
            {
                ILayer lry = Layers[i];
                if (lry is FetureLayer)
                {
                    FetureLayer    featlyr = lry as FetureLayer;
                    List <Feature> objects = featlyr.GetHitObjects(point, tolerance);
                    if (objects.Count == 0)
                    {
                        return(null);
                    }

                    foreach (Feature obj in objects)
                    {
                        IGeometry geo = obj.Shape as IGeometry;
                        if (geo is RgPoint)
                        {
                            RgPoint pt = geo as RgPoint;
                            if (RDistanceMeasure.Dist_Point_to_Point(pt, point) < tolerance)
                            {
                                return(new SnapPointBase(pt, pt));
                            }
                            // ISnapPoint snap = obj.SnapPoint(point, objects, runningsnaptypes, usersnaptype);
                        }
                        if (geo is LinearRing)
                        {
                        }
                        if (geo is Polygon)
                        {
                        }
                        // ISnapPoint snap = obj.SnapPoint( point, objects, runningsnaptypes, usersnaptype);
                        //if (snap != null)
                        //    return snap;
                    }
                }
            }

            return(null);
        }