首页 / 浏览问题 / 三维GIS / 问题详情
三位网络数据集导出成了二维
20EXP 2018年08月11日
  /// 路径分析
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Analyst_Click(object sender, EventArgs e)
        {
            try
            {
                if (point3ds.Count <2)
                {
                    MessageBox.Show("请选择两个以上经过点");
                    return;
                }
                DatasetVector datasetvector = workspace.Datasources[0].Datasets["ResultNetWork"] as DatasetVector;
                
                TransportationAnalystSetting3D transportationAnalystSetting = new TransportationAnalystSetting3D();
                transportationAnalystSetting.NetworkDataset = datasetvector;
                transportationAnalystSetting.NodeIDField = "SmNodeID";
                transportationAnalystSetting.EdgeIDField = "SmEdgeID";
                transportationAnalystSetting.FNodeIDField = "SmFNode";
                transportationAnalystSetting.TNodeIDField = "SmTNode";
                transportationAnalystSetting.Tolerance = 20;

                //设置权重信息
                WeightFieldInfo3D weightFieldInfo = new WeightFieldInfo3D();
                weightFieldInfo.Name = "SmLength";
                weightFieldInfo.FTWeightField = "SmLength";
                weightFieldInfo.TFWeightField = "SmLength";
                WeightFieldInfos3D weightFieldInfos = new WeightFieldInfos3D();
                weightFieldInfos.Add(weightFieldInfo);
                transportationAnalystSetting.WeightFieldInfos = weightFieldInfos;

                //构造一个三维交通网络分析对象,并设置分析环境
                TransportationAnalyst3D transportationAnalyst = new TransportationAnalyst3D();
                transportationAnalyst.AnalystSetting = transportationAnalystSetting;

                //加载网络模型
                Boolean isLoad = transportationAnalyst.Load();

                if (isLoad)
                {
                    //构造三维交通网络分析参数对象,并设置相关参数
                    TransportationAnalystParameter3D parameter = new TransportationAnalystParameter3D();
                    parameter.Points = point3ds;
                    parameter.WeightName = "SmLength";
                    parameter.IsNodesReturn = true;
                    parameter.IsEdgesReturn = true;
                    parameter.IsRoutesReturn = true;
                    parameter.IsStopIndexesReturn = true;

                    //进行最佳路径分析
                    TransportationAnalystResult3D result = transportationAnalyst.FindPath(parameter);
                    GeoLine3D geoline3d = result.Routes[0];
                    GeoStyle3D geostyle3d = new GeoStyle3D();
                    geostyle3d.LineColor = Color.Blue;
                    geostyle3d.AltitudeMode = AltitudeMode.ClampToGround;
                    geostyle3d.LineWidth = 5;
                    geoline3d.Style3D = geostyle3d;
                    scenecontrol.Scene.TrackingLayer.Add(geoline3d,"line");
                }
                
            }
            catch
            { 

2 个回答

您好,这不是二维,而是平面场景,也是三维场景的一种类型。
5,985EXP 2018年08月13日
您好!AltitudeMode.ClampToGround是贴地表模式,高度为零。您如果想让它有高度,可以将高度模式设置为绝对高度或相对高度。
3,362EXP 2018年08月13日
...