首页 / 浏览问题 / 组件GIS / 问题详情
三维ObjectSelected 及Bubble的问题
13EXP 2018年05月04日

想实现这么个功能,选择某个要素,然后弹出气泡,气泡中显示该要素的基本信息,类似identify功能,在这个功能中用到了SceneControl.ObjectSelected 及Bubble几个主要相关接口与方法,首先说说ObjectSelected的问题,感觉很多时候ObjectSelected不敏感,一会儿选的中一会儿选不中,我地图上的要素是一个模型点符号,特别是在地形不平的地方,当此模型浮在空中不贴地的情况很难选中。其次问题是气泡的选中问题,大部分时间气泡总是显示在选中的要素旁边,但有时候莫名其妙不见显示,体验太差,不知是代码有问题还是什么原因,调试没发现问题。上代码:

  private void ScenceControl_ObjectSelected(object sender, ObjectSelectedEventArgs e)
        {
           
            Selection3D selection = sitelayer.Selection;
            if(selection.Count > 0)
            {
                scenceControl.Bubbles.Clear();
                Recordset rs= selection.ToRecordset();
                rs.MoveFirst();
                Feature feature = rs.GetFeature();
                Geometry geo = feature.GetGeometry();

                siteinfo.LabelSiteNO.Text = feature.GetString("SITENO");
            
                siteinfo.picpath = String.Format("pic\\{0}.JPG", feature.GetString("SITENO"));
                Bubble bubble = new Bubble();

                scenceControl.Bubbles.Add(bubble);
                bubble.Visible = true;
                Point3D point3D = new Point3D(geo.InnerPoint.X,
                    geo.InnerPoint.Y, 30);
                bubble.Pointer = point3D;
                scenceControl.Scene.Refresh();
               // bubble.Title = "站点信息";
                bubble.RoundQuality = 1;
                bubble.IsAutoHide = true;
                bubble.FrameWidth = 10;
                bubble.BackColor = Color.FromArgb(100, 185, 230, 253);
                bubble.ClientWidth = siteinfo.Width;
                bubble.ClientHeight = siteinfo.Height;

                TextStyle textStyle = new TextStyle();
                textStyle.Alignment = SuperMap.Data.TextAlignment.TopCenter;
                textStyle.FontName = "黑体";
             
                textStyle.ForeColor = Color.Black;
                bubble.TitleTextStyle = textStyle;
                System.Drawing.Point point = new Point(bubble.ClientLeft, bubble.ClientTop);
                siteinfo.Visible = true;
                siteinfo.Location = point;
                rs.Close();
                rs.Dispose();
            }

 private void ScenceControl_BubbleClose(object sender, BubbleEventArgs e)
        {
            siteinfo.Visible = false;
        }

        private void ScenceControl_BubbleResize(object sender, BubbleEventArgs e)
        {
            System.Drawing.Point point = new Point(e.Bubble.ClientLeft, e.Bubble.ClientTop);
            siteinfo.Location = point;
            siteinfo.Visible = true;
        }

        private void ScenceControl_BubbleInitialize(object sender, BubbleEventArgs e)
        {
            System.Drawing.Point point = new Point(e.Bubble.ClientLeft, e.Bubble.ClientTop);
            siteinfo.Location = point;
            siteinfo.Visible = true;
        }

总的来说,体验好差,求大神指导,坐等

1个回答

您好,看您的问题就是对象不容易选中。但我这边按你说的添加地形,给三维点赋予模型,选中来说没有什么问题,所以只能请你提供数据,看能否重现对象不容易选中的问题。您可以把数据上传百度云,然后把下载地址私信给我。

5,985EXP 2018年05月04日
...