public Result UpdateSelectPoints()
        {
            Hashtable ht = new Hashtable();

            ht["fromName"] = this.virname;
            DataTable spinfo = IbatisHelper.ExecuteQueryForDataTable("GetSelectedPoint", ht);

            Point endavg = new Point(this.inflon, this.inflat, 0);

            PointConvertByProj.Instance.GetProjectPoint(endavg);

            if (spinfo.Rows.Count < 1)
            {
                return(new Result(false, "无初始选点数据"));
            }
            for (int i = 0; i < spinfo.Rows.Count; i++)
            {
                int    ci      = Convert.ToInt32(spinfo.Rows[i]["CI"].ToString());
                double x       = Convert.ToDouble(spinfo.Rows[i]["x"].ToString());
                double y       = Convert.ToDouble(spinfo.Rows[i]["y"].ToString());
                Point  start   = new Point(x, y, 0);
                double Azimuth = LTE.Geometric.GeometricUtilities.getPolarCoord(start, endavg).theta / Math.PI * 180;
                Azimuth = GeometricUtilities.ConvertGeometricArithmeticAngle(Azimuth + 1);
                Hashtable htupdate = new Hashtable();
                htupdate["fromName"] = this.virname;
                htupdate["CI"]       = ci;
                htupdate["Azimuth"]  = Azimuth;
                IbatisHelper.ExecuteUpdate("UpdatetbSelectedPointByCI", htupdate);
            }
            return(new Result(true, "更新成功"));
        }
        private void ComputeInitParams(DataTable dtinfo)
        {
            double avgx = 0, avgy = 0;

            for (int i = 0; i < dtinfo.Rows.Count; i++)
            {
                double x = Convert.ToDouble(dtinfo.Rows[i]["x"]);
                double y = Convert.ToDouble(dtinfo.Rows[i]["y"]);
                avgx += x;
                avgy += y;
            }
            avgx /= dtinfo.Rows.Count;
            avgy /= dtinfo.Rows.Count;
            Debug.WriteLine("路测中点:x" + avgx + "路测中点:x" + avgy);
            Geometric.Point endavg = new Geometric.Point(avgx, avgy, 0);

            double minx = double.MaxValue, miny = double.MaxValue, maxx = double.MinValue, maxy = double.MinValue;

            for (int i = 0; i < dtinfo.Rows.Count; i++)
            {
                //Debug.WriteLine(i);
                double          x     = Convert.ToDouble(dtinfo.Rows[i]["x"]);
                double          y     = Convert.ToDouble(dtinfo.Rows[i]["y"]);
                Geometric.Point start = new Geometric.Point(x, y, 0);

                double aziavg = LTE.Geometric.GeometricUtilities.getPolarCoord(start, endavg).theta / Math.PI * 180;
                aziavg = GeometricUtilities.ConvertGeometricArithmeticAngle(aziavg + 1);
                //Debug.WriteLine("路测中点计算角度:" + aziavg);
                dtinfo.Rows[i]["Azimuth"]  = aziavg;
                dtinfo.Rows[i]["Distance"] = distanceXY(start.X, start.Y, endavg.X, endavg.Y) + 300;
            }
        }
예제 #3
0
        public static List <int> getSelectedBuildings(LTE.Geometric.Point p, double fromAngle, double toAngle, double radius)
        {
            IPoint centralPoint = GeometryUtilities.ConstructPoint2D(p.X, p.Y);

            double arithmeticToAngle = GeometricUtilities.GetRadians(GeometricUtilities.ConvertGeometricArithmeticAngle(toAngle));
            double angle             = (toAngle - fromAngle + 360) % 360;
            bool   isCCW             = true;

            if (angle > 180)
            {
                angle = 360 - angle;
                isCCW = false;
            }
            else if (angle == 0)
            {
                angle = 360;
            }

            double arcDistance = radius * GeometricUtilities.GetRadians(angle);

            IPoint       fromPoint   = GeometryUtilities.ConstructPoint_AngleDistance(centralPoint, arithmeticToAngle, radius);
            ICircularArc circularArc = GeometryUtilities.ConstructCircularArc(centralPoint, fromPoint, isCCW, arcDistance); //逆时针
            IPoint       toPoint     = circularArc.ToPoint;

            ISegment fromSegment = GeometryUtilities.ConstructLine(centralPoint, fromPoint) as ISegment;
            ISegment toSegment   = GeometryUtilities.ConstructLine(toPoint, centralPoint) as ISegment;

            ISegment[]          segmentArray = new ISegment[] { fromSegment, circularArc as ISegment, toSegment };
            IGeometryCollection polygon      = GeometryUtilities.ConstructPolygon(segmentArray);
            IPolygon            pPolygon     = polygon as IPolygon;

            IGeometry pGeometry = GeometryUtilities.ConvertProjToGeo(pPolygon as IGeometry);

            IFeatureLayer pFeatureLayer = GISMapApplication.Instance.GetLayer(LayerNames.Projecton) as IFeatureLayer;
            IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;

            ISpatialFilter spatialFilter = new SpatialFilterClass();

            spatialFilter.Geometry      = pGeometry;
            spatialFilter.GeometryField = pFeatureClass.ShapeFieldName;
            spatialFilter.SpatialRel    = esriSpatialRelEnum.esriSpatialRelIntersects;

            //Execute the spatialfilter
            IFeatureCursor featureCursor = pFeatureClass.Search(spatialFilter, false);

            IFeature   pFeature = null;
            List <int> bids     = new List <int>();

            while ((pFeature = featureCursor.NextFeature()) != null)
            {
                bids.Add(pFeature.OID);
            }

            return(bids);
        }
        /// <summary>
        /// 角度约束
        /// </summary>
        /// <param name="dtinfo"></param>
        /// <param name="num"></param>
        /// <param name="angle"></param>
        /// <returns></returns>
        private DataTable ComputePointByA(DataTable dtinfo, int num, double angle)
        {
            //找到当前路测区域的中心点
            double centerx = (maxLon + minLon) / 2;
            double centery = (maxLat + minLat) / 2;

            Geometric.Point start = new Geometric.Point(centerx, centery, 0);
            LTE.Utils.PointConvertByProj.Instance.GetProjectPoint(start);
            DataTable ans = dtinfo.Clone();

            if (dtinfo.Rows.Count < num)
            {
                //MessageBox.Show(this, "ComputePointByA所筛选出的结果不足最小选点数", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(ans);
            }
            int len    = dtinfo.Rows.Count;
            int acount = 0;//已满足条件的数量

            for (int i = 0; i < len - 1 && acount < num; i++)
            {
                double x      = Convert.ToDouble(dtinfo.Rows[i]["x"]);
                double y      = Convert.ToDouble(dtinfo.Rows[i]["y"]);
                Point  curend = new Point(x, y, 0);
                double cura   = GeometricUtilities.getPolarCoord(start, curend).theta / Math.PI * 180;
                cura = GeometricUtilities.ConvertGeometricArithmeticAngle(cura + 1);
                bool flag = true;

                //与之前的每个点进行比较
                for (int j = ans.Rows.Count - 1; j >= 0; j--)
                {
                    flag = true;
                    double xf     = Convert.ToDouble(ans.Rows[j]["x"]);
                    double yf     = Convert.ToDouble(ans.Rows[j]["y"]);
                    Point  hisend = new Point(xf, yf, 0);
                    double hisa   = GeometricUtilities.getPolarCoord(start, hisend).theta / Math.PI * 180;
                    hisa = GeometricUtilities.ConvertGeometricArithmeticAngle(hisa + 1);
                    if (Math.Abs(hisa - cura) < angle)
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag)
                {
                    DataRow thisrow = ans.NewRow();
                    thisrow["x"]         = x;
                    thisrow["y"]         = y;
                    thisrow["ReceivePW"] = Convert.ToDouble(dtinfo.Rows[i]["ReceivePW"]);
                    thisrow["CI"]        = Convert.ToInt32(dtinfo.Rows[i]["CI"]);
                    ans.Rows.Add(thisrow);
                    acount++;
                }
            }
            return(ans);
        }
예제 #5
0
        /// <summary>
        /// 获取扇区与地面栅格交集内的栅格中心点
        /// </summary>
        /// <param name="source"></param>
        /// <param name="distance">单位米</param>
        /// <param name="fromAngle">方位角</param>
        /// <param name="toAngle">方位角</param>
        /// <param name="DisAngle">需要排除的区域,角度坐标为极坐标, 如果没有要排除的区域,则传null</param>
        /// <returns></returns>
        public static List <Point> getGGridCenterBySector(Point source, double distance, double fromAngle, double toAngle, List <TriangleBound> DisAngle)
        {
            double minX = 0, minY = 0, maxX = 0, maxY = 0;

            GridHelper.getInstance().getMinXY(ref minX, ref minY);
            GridHelper.getInstance().getMaxXY(ref maxX, ref maxY);

            //边界,大地坐标
            double minx = Math.Max(minX, source.X - distance);
            double miny = Math.Max(minY, source.Y - distance);
            double maxx = Math.Min(maxX, source.X + distance);
            double maxy = Math.Min(maxY, source.Y + distance);

            //double minx = source.X - distance;
            //double miny = source.Y - distance;
            //double maxx = source.X + distance;
            //double maxy = source.Y + distance;
            //便于比较边缘地带
            distance += 0.1;

            double from = GeometricUtilities.ConvertGeometricArithmeticAngle(toAngle + 1);
            double to   = GeometricUtilities.ConvertGeometricArithmeticAngle(fromAngle - 1);

            from = GeometricUtilities.GetRadians(from);
            to   = GeometricUtilities.GetRadians(to);

            List <Point> ret = new List <Point>();
            Point        p;
            Polar        pr;

            foreach (KeyValuePair <string, Point> kv in ggrids)
            {
                p = kv.Value;
                if (p.X > minx && p.X < maxx && p.Y > miny && p.Y < maxy)
                {
                    pr = GeometricUtilities.getPolarCoord(source, p);

                    // 将位于扇区覆盖范围内,且不在建筑物内的地面栅格加进来 ;接收点加入海拔高度后,同时判断地面高度低于小区高度 ,jinhj
                    if (pr.r < distance && isInRange(pr.theta, from, to) && p.Z < source.Z)//&& !isInBuilding(p, ref DisAngle))
                    //if (pr.r < distance && isInRange(pr.theta, from, to) && !isInRange(pr, p, source, ref DisAngle))
                    {
                        ret.Add(p);
                    }
                }
            }
            return(ret);
        }
예제 #6
0
        /// <summary>
        /// 获取扇区内的点  2018.12.18
        /// </summary>
        /// <param name="source"></param>
        /// <param name="distance">单位米</param>
        /// <param name="fromAngle">方位角</param>
        /// <param name="toAngle">方位角</param>
        /// <param name="DisAngle">需要排除的区域,角度坐标为极坐标, 如果没有要排除的区域,则传null</param>
        /// <returns></returns>
        public static List <Point> getPointBySector(Point source, double distance, double fromAngle, double toAngle, double interval)
        {
            double minX = 0, minY = 0, maxX = 0, maxY = 0;

            GridHelper.getInstance().getMinXY(ref minX, ref minY);
            GridHelper.getInstance().getMaxXY(ref maxX, ref maxY);

            //边界,大地坐标
            double minx = Math.Max(minX, source.X - distance);
            double miny = Math.Max(minY, source.Y - distance);
            double maxx = Math.Min(maxX, source.X + distance);
            double maxy = Math.Min(maxY, source.Y + distance);

            //double minx = source.X - distance;
            //double miny = source.Y - distance;
            //double maxx = source.X + distance;
            //double maxy = source.Y + distance;
            //便于比较边缘地带
            distance += 0.1;

            double from = GeometricUtilities.ConvertGeometricArithmeticAngle(toAngle + 1);
            double to   = GeometricUtilities.ConvertGeometricArithmeticAngle(fromAngle - 1);

            from = GeometricUtilities.GetRadians(from);
            to   = GeometricUtilities.GetRadians(to);

            List <Point> ret = new List <Point>();

            for (double x = minx; x < maxx; x += interval)
            {
                for (double y = miny; y < maxy; y += interval)
                {
                    Point p  = new Point(x, y, 0);
                    Polar pr = GeometricUtilities.getPolarCoord(source, p);

                    // 将位于扇区覆盖范围内的点加进来
                    if (pr.r < distance && isInRange(pr.theta, from, to))
                    {
                        ret.Add(p);
                    }
                }
            }
            return(ret);
        }
예제 #7
0
        /// <summary>
        /// 根据覆盖扇形获取建筑物id
        /// </summary>
        /// <param name="source"></param>
        /// <param name="distance"></param>
        /// <param name="fromAngle"></param>
        /// <param name="toAngle"></param>
        /// <returns></returns>
        public static List <int> getBuildingIDBySector(Point source, double distance, double fromAngle, double toAngle)
        {
            double minX = 0, minY = 0, maxX = 0, maxY = 0;

            GridHelper.getInstance().getMinXY(ref minX, ref minY);
            GridHelper.getInstance().getMaxXY(ref maxX, ref maxY);

            //边界,大地坐标
            double minx = Math.Max(minX, source.X - distance);
            double miny = Math.Max(minY, source.Y - distance);
            double maxx = Math.Min(maxX, source.X + distance);
            double maxy = Math.Min(maxY, source.Y + distance);

            distance += 0.1;

            // (450-oldAngle)%360;
            double from = GeometricUtilities.ConvertGeometricArithmeticAngle(toAngle + 1);
            double to   = GeometricUtilities.ConvertGeometricArithmeticAngle(fromAngle - 1);

            //Console.WriteLine("from: {0}", from);
            //Console.WriteLine("to: {0}", to);

            from = GeometricUtilities.GetRadians(from);
            to   = GeometricUtilities.GetRadians(to);

            List <int> ret = new List <int>();
            Point      p;
            Polar      pr;

            foreach (KeyValuePair <int, Point> kv in buildingCenter)
            {
                p = kv.Value;
                if (p.X > minx && p.X < maxx && p.Y > miny && p.Y < maxy)
                {
                    pr = GeometricUtilities.getPolarCoord(source, p);
                    if (pr.r < distance && (isInRange(pr.theta, from, to))) // || isInRange(pr.theta + Math.PI * 2, from, to)))
                    {
                        ret.Add(Convert.ToInt32(kv.Key));
                    }
                }
            }
            return(ret);
        }
예제 #8
0
        public static void drawSector(LTE.Geometric.Point p, double fromAngle, double toAngle, double radius)
        {
            IPoint centralPoint = GeometryUtilities.ConstructPoint2D(p.X, p.Y);

            double arithmeticToAngle = GeometricUtilities.GetRadians(GeometricUtilities.ConvertGeometricArithmeticAngle(toAngle));

            double angle = (toAngle - fromAngle) % 360;
            bool   isCCW = true;

            if (angle > 180)
            {
                angle = 360 - angle;
                isCCW = false;
            }
            if (angle == 0)
            {
                angle = 360;
            }
            double arcDistance = radius * GeometricUtilities.GetRadians(angle);

            IPoint       fromPoint   = GeometryUtilities.ConstructPoint_AngleDistance(centralPoint, arithmeticToAngle, radius);
            ICircularArc circularArc = GeometryUtilities.ConstructCircularArc(centralPoint, fromPoint, isCCW, arcDistance);
            IPoint       toPoint     = circularArc.ToPoint;

            ISegment fromSegment = GeometryUtilities.ConstructLine(centralPoint, fromPoint) as ISegment;
            ISegment toSegment   = GeometryUtilities.ConstructLine(toPoint, centralPoint) as ISegment;

            ISegment[]          segmentArray = new ISegment[] { fromSegment, circularArc as ISegment, toSegment };
            IGeometryCollection polygon      = GeometryUtilities.ConstructPolygon(segmentArray);

            //画扇形
            IGraphicsContainer3D graphicsContainer3D = GISMapApplication.Instance.GetLayer(LayerNames.Rays) as IGraphicsContainer3D;
            IPolygonElement      polygonElement      = new PolygonElementClass();
            IElement             element             = polygonElement as IElement;

            element.Geometry = polygon as IGeometry;
            graphicsContainer3D.AddElement(element);
        }
        //MessageBox.Show(this, "入库完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);


        /// <summary>
        /// 用目标干扰源计算方位角
        /// </summary>
        /// <param name="dtinfo"></param>
        /// <returns></returns>
        private Boolean CompleteAzimuthVir(DataTable dtinfo)
        {
            Hashtable ht = new Hashtable();

            ht["BtsName"] = this.virname;
            DataTable tbcell = IbatisHelper.ExecuteQueryForDataTable("GettbSource", ht);

            if (tbcell.Rows[0]["x"] == DBNull.Value || tbcell.Rows[0]["y"] == DBNull.Value)
            {
                Debug.WriteLine("未找到对应的小区地理信息");
                return(false);
            }
            double endx = Convert.ToDouble(tbcell.Rows[0]["x"]);
            double endy = Convert.ToDouble(tbcell.Rows[0]["y"]);
            Point  end  = new Point(endx, endy, 0);

            tb.Clear();
            for (int i = 0; i < dtinfo.Rows.Count; i++)
            {
                Debug.WriteLine(i);
                double x       = Convert.ToInt32(dtinfo.Rows[i]["x"]);
                double y       = Convert.ToInt32(dtinfo.Rows[i]["y"]);
                Point  start   = new Point(x, y, 0);
                double azimuth = GeometricUtilities.getPolarCoord(start, end).theta / Math.PI * 180;
                azimuth = GeometricUtilities.ConvertGeometricArithmeticAngle(azimuth + 1);
                DataRow thisrow = tb.NewRow();
                thisrow["fromName"]  = this.virname;
                thisrow["x"]         = x;
                thisrow["y"]         = y;
                thisrow["ReceivePW"] = dtinfo.Rows[i]["ReceivePW"];
                thisrow["CI"]        = dtinfo.Rows[i]["CI"];
                thisrow["Azimuth"]   = azimuth;
                thisrow["Distance"]  = distanceXY(start.X, start.Y, end.X, end.Y) + 300;
                tb.Rows.Add(thisrow);
            }
            return(true);
        }
예제 #10
0
        /// <summary>
        /// 获取扇形与地面网格相交的网格中心点
        /// </summary>
        /// <param name="p"></param>
        /// <param name="fromAngle"></param>
        /// <param name="toAngle"></param>
        /// <param name="radius"></param>
        /// <returns></returns>
        public static List <LTE.Geometric.Point> getSelectedGridsCenterPoints(LTE.Geometric.Point p, double fromAngle, double toAngle, double radius)
        {
            IPoint centralPoint = GeometryUtilities.ConstructPoint2D(p.X, p.Y);

            double arithmeticToAngle = GeometricUtilities.GetRadians(GeometricUtilities.ConvertGeometricArithmeticAngle(toAngle));

            double angle = (toAngle - fromAngle) % 360;
            bool   isCCW = true;

            if (angle > 180)
            {
                angle = 360 - angle;
                isCCW = false;
            }
            if (angle == 0)
            {
                angle = 360;
            }
            double arcDistance = radius * GeometricUtilities.GetRadians(angle);


            IPoint       fromPoint   = GeometryUtilities.ConstructPoint_AngleDistance(centralPoint, arithmeticToAngle, radius);
            ICircularArc circularArc = GeometryUtilities.ConstructCircularArc(centralPoint, fromPoint, isCCW, arcDistance);
            IPoint       toPoint     = circularArc.ToPoint;

            ISegment fromSegment = GeometryUtilities.ConstructLine(centralPoint, fromPoint) as ISegment;
            ISegment toSegment   = GeometryUtilities.ConstructLine(toPoint, centralPoint) as ISegment;

            ISegment[]          segmentArray = new ISegment[] { fromSegment, circularArc as ISegment, toSegment };
            IGeometryCollection polygon      = GeometryUtilities.ConstructPolygon(segmentArray);

            //画扇形
            //IGraphicsContainer3D graphicsContainer3D = GISMapApplication.Instance.GetLayer(LayerNames.Rays) as IGraphicsContainer3D;
            //IPolygonElement polygonElement = new PolygonElementClass();
            //IElement element = polygonElement as IElement;
            //element.Geometry = polygon as IGeometry;
            //graphicsContainer3D.AddElement(element);

            IGeometry pGeometry = GeometryUtilities.ConvertProjToGeo(polygon as IGeometry);
            //地面网格图层是经纬度
            IFeatureLayer groundFeatureLayer = GISMapApplication.Instance.GetLayer(LayerNames.GroundGrids) as IFeatureLayer;
            IFeatureClass groundFeatureClass = groundFeatureLayer.FeatureClass;

            ISpatialFilter spatialFilter = new SpatialFilterClass();

            spatialFilter.Geometry = pGeometry;
            //spatialFilter.Geometry = pPolygon as IGeometry;
            spatialFilter.GeometryField = groundFeatureClass.ShapeFieldName;
            spatialFilter.SpatialRel    = esriSpatialRelEnum.esriSpatialRelIntersects;
            IFeatureCursor featureCursor = groundFeatureClass.Search(spatialFilter, false);

            int CenterXIndex = groundFeatureClass.Fields.FindField("CenterX");
            int CenterYIndex = groundFeatureClass.Fields.FindField("CenterY");
            int xindex       = groundFeatureClass.Fields.FindField("GXID");
            int yindex       = groundFeatureClass.Fields.FindField("GYID");

            IFeature pFeature;
            List <LTE.Geometric.Point> centerPoints = new List <LTE.Geometric.Point>();

            while ((pFeature = featureCursor.NextFeature()) != null)
            {
                int    gxid    = (int)pFeature.get_Value(xindex);
                int    gyid    = (int)pFeature.get_Value(yindex);
                double centerX = double.Parse(pFeature.get_Value(CenterXIndex).ToString());
                double centerY = double.Parse(pFeature.get_Value(CenterYIndex).ToString());

                IPoint crossWithGround = GeometryUtilities.ConstructPoint3D(centerX, centerY, 0);
                double lng = crossWithGround.X, lat = crossWithGround.Y;
                crossWithGround = (IPoint)GeometryUtilities.ConvertGeoToProj(crossWithGround as IGeometry);

                centerPoints.Add(new LTE.Geometric.Point(crossWithGround.X, crossWithGround.Y, crossWithGround.Z));
            }

            System.Runtime.InteropServices.Marshal.ReleaseComObject(featureCursor);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(groundFeatureLayer);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(groundFeatureClass);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(spatialFilter);
            System.Runtime.InteropServices.Marshal.ReleaseThreadCache();

            return(centerPoints);
        }
        private Boolean CompleteAzimuth(DataTable dtinfo)
        {
            tb.Clear();
            double avgx = 0, avgy = 0;

            for (int i = 0; i < dtinfo.Rows.Count; i++)
            {
                double x = Convert.ToDouble(dtinfo.Rows[i]["x"]);
                double y = Convert.ToDouble(dtinfo.Rows[i]["y"]);
                avgx += x;
                avgy += y;
            }
            avgx /= dtinfo.Rows.Count;
            avgy /= dtinfo.Rows.Count;
            Debug.WriteLine("路测中点:x" + avgx + "路测中点:x" + avgy);
            Geometric.Point endavg = new Geometric.Point(avgx, avgy, 0);

            double minx = double.MaxValue, miny = double.MaxValue, maxx = double.MinValue, maxy = double.MinValue;

            for (int i = 0; i < dtinfo.Rows.Count; i++)
            {
                //Debug.WriteLine(i);
                double x = Convert.ToDouble(dtinfo.Rows[i]["x"]);
                double y = Convert.ToDouble(dtinfo.Rows[i]["y"]);

                if (x < minx)
                {
                    minx = x;
                }
                if (x > maxx)
                {
                    maxx = x;
                }
                if (y < miny)
                {
                    miny = y;
                }
                if (y > maxy)
                {
                    maxy = y;
                }

                Geometric.Point start = new Geometric.Point(x, y, 0);

                double aziavg = LTE.Geometric.GeometricUtilities.getPolarCoord(start, endavg).theta / Math.PI * 180;
                aziavg = GeometricUtilities.ConvertGeometricArithmeticAngle(aziavg + 1);
                Debug.WriteLine("路测中点计算角度:" + aziavg);
                DataRow thisrow = tb.NewRow();
                thisrow["fromName"]  = this.virname;
                thisrow["x"]         = x;
                thisrow["y"]         = y;
                thisrow["ReceivePW"] = dtinfo.Rows[i]["ReceivePW"];
                thisrow["CI"]        = dtinfo.Rows[i]["CI"];
                thisrow["Azimuth"]   = aziavg;
                thisrow["Distance"]  = distanceXY(start.X, start.Y, endavg.X, endavg.Y) + 300;
                tb.Rows.Add(thisrow);
            }
            if (maxx - minx < 100 || maxy - maxx < 100)
            {
                tb.Clear();
                return(false);
            }
            return(true);
        }