首页 / 浏览问题 / 组件GIS / 问题详情
实现二三维同步多选,高亮显示
38EXP 2018年12月24日
下面代码只是实现了,单选二维路段ID 后,三维相应路段高亮显示,如何实现多选二维路段,对应三维高亮显示?

private void mapControllian_GeometrySelected(object sender, GeometrySelectedEventArgs e)
        {         
            try
            {

                Selection[] selection = mapControllian.Map.FindSelection(true);
                if (selection != null && selection.Length != 0)
                {
                    Recordset recordset = selection[0].ToRecordset();
                    object A = recordset.GetObject("ID");
                    C = A.ToString();
                    int B = Convert.ToInt32(C);                                   
                    if (B == 1)
                    {
                        for (int i = 0; i < 57; i++)
                        {
                            int[] X = { B + i };
                            Layer3DDataset layer3DDataset = m_sceneControl.Scene.Layers[0] as Layer3DDataset;
                            Selection3D selection3D = layer3DDataset.Selection;
                            selection3D.AddRange(X);
                            layer3DDataset.Selection.UpdateData();
                        }
                    }
                    else if (B == 2)
                    {
                        for (int i = 0; i < 57; i++)
                        {
                            int[] X = { B + i };
                            Layer3DDataset layer3DDataset = m_sceneControl.Scene.Layers[0] as Layer3DDataset;
                            Selection3D selection3D = layer3DDataset.Selection;
                            selection3D.AddRange(X);
                            layer3DDataset.Selection.UpdateData();
                        }
                    }                                                                             
                   
                  }
                                                                                             
                }
           
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
        }

1个回答

您好!用Selection.count获取选择的个数,然后用for循环直接将selection直接转成对应的recordset即可。
3,362EXP 2018年12月24日
麻烦您具体的代码可以写下吗
...