/// <summary>
        /// 进行网络分析分析
        /// </summary>
        public void BeginNetworkAnalyst()
        {
            try
            {
                mAnalystResult = mAnalyst.FindTSPPath(mAnalystParameter, false);
                if (mAnalystResult != null)
                {
                    int[][] EdgeId = new int[mAnalystResult.Edges.Length][];
                    //拿到交错数组中第一行元素ID
                    int[] IDedge = new int[mAnalystResult.Edges[0].Length];
                    for (int i = 0; i < IDedge.Length; i++)
                    {
                        IDedge[i] = mAnalystResult.Edges[0][i];
                    }
                    //拿到弧段ID后查询路名
                    string[]  RodeName  = new string[IDedge.Length];
                    Recordset recordset = null;
                    for (int i = 0; i < IDedge.Length; i++)
                    {
                        recordset         = mRodeNetWork.Query("SmID =" + IDedge[i], CursorType.Static);
                        RodeName[i]       = recordset.GetFieldValue("RodeName").ToString().Trim();
                        mRodeTotalLength += Convert.ToInt32(recordset.GetFieldValue("SmLength"));
                    }
                    //编辑路名显示形式
                    string mStartRode = "起点→";
                    string mNewRode   = null;
                    for (int i = 0; i < RodeName.Length; i++)
                    {
                        if (i == 0)
                        {
                            mNewRode = mStartRode.Insert(mStartRode.Length, RodeName[i] + "→");
                        }
                        else
                        {
                            mNewRode = mNewRode.Insert(mNewRode.Length, RodeName[i] + "→");
                        }
                    }
                    mTextBoxRodeName = mNewRode + "终点";
                }
                GeoLine line = mAnalystResult.Routes[0].ConvertToLine();
                if (mLine3D == null)
                {
                    mLine3D = new GeoLine3D();
                }

                for (Int32 i = 0; i < line.PartCount; i++)
                {
                    mLine3D.AddPart(line[i].ToPoint3Ds());
                }
                mLine3D[0].Insert(0, new Point3D(mStartPoint.X, mStartPoint.Y, 0));
                mLine3D[0].Add(new Point3D(mEndPoint.X, mEndPoint.Y, 0));
                DisplayFlyRoute();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }
Exemplo n.º 2
0
        private void SetGeoLine3DToTrackingLayer(Point2Ds point2Ds, Int32 count)
        {
            Int32 index = scontrol.Scene.TrackingLayer.IndexOf("line");

            GeoCardinal geoCardinal = new GeoCardinal(point2Ds);
            GeoLine     geoLine     = geoCardinal.ConvertToLine(count);

            if (m_geoLine3D.Length > 0)
            {
                m_geoLine3D.RemovePart(0);
            }
            m_geoLine3D.AddPart(ConvertPoint2DsToPoint3Ds(geoLine[0]));

            if (index > 0)
            {
                scontrol.Scene.TrackingLayer.Set(index, m_geoLine3D);
            }
            else
            {
                scontrol.Scene.TrackingLayer.Add(m_geoLine3D, "line");
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 获取两点之间的距离
 /// </summary>
 /// <param name="point3D1"></param>
 /// <param name="point3D2"></param>
 /// <returns></returns>
 public double GetLengthBy2Point(Point3D point3D1, Point3D point3D2)
 {
     double tempR = 0.0;
     GeoLine3D tempL = new GeoLine3D();
     Point3Ds temp3Ds = new Point3Ds();
     temp3Ds.Add(point3D1);
     temp3Ds.Add(point3D2);
     tempL.AddPart(temp3Ds);
     tempR = Geometrist.ComputeLength(tempL, new PrjCoordSys(PrjCoordSysType.EarthLongitudeLatitude));
     return tempR == 0.0 ? 10000.0 : tempR;
 }