实现二三维同步多选,高亮显示

0 投票
76 浏览
下面代码只是实现了,单选二维路段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);
            }
        }
最新提问 12月 24, 2018 分类:  76次浏览 | 用户: 1471817656 才疏学浅 (13 分)

1个回答

0 投票
 
已采纳
您好!用Selection.count获取选择的个数,然后用for循环直接将selection直接转成对应的recordset即可。
最新回答 12月 24, 2018 用户: 胡延南 名扬四海 (2,464 分)
采纳于 12月 24, 2018 用户:1471817656
麻烦您具体的代码可以写下吗
...