首页 / 浏览问题 / 组件GIS / 问题详情
路径分析中的设施点
6EXP 2018年08月06日

<!--StartFragment -->

我在窗体程序的添加设施点和事件点功能不知为什么每次点都会把下面的道路选中,请问有什么解决方法吗?

是在 m_sceneControl_MouseClick里面设置吗?

1个回答

您好!是在m_sceneControl_MouseClick里设置。您在MouseClick事件里的if语句画点的条件是什么?是为左键且为选择状态吗?如果是建议您再加一个条件,比如一个常量,来区分系统默认的为左键且为选择状态时选择场景中的对象。
3,362EXP 2018年08月06日

不好意思我是个新手,条件已经没问题了 ,具体怎么区分呢?

 void m_sceneControl_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e)
        {
                switch (_addPoints)
                {
                    case AddPoints.AddNull:
                        m_sceneControl.Action = Action3D.Pan;
                        break;
                    case AddPoints.AddFacilityPoints:
                        if (e.Button == MouseButtons.Left && _addPoints == AddPoints.AddFacilityPoints)
                        {
                            Point3D point3D = m_sceneControl.Scene.PixelToGlobe(e.Location);
                            Point2D point = new Point2D(point3D.X, point3D.Y);
                            GeoPoint3D geoPoint3D = new GeoPoint3D(point3D);
                            GeoStyle3D style3D = new GeoStyle3D();
                            style3D.MarkerSize = 5;
                            style3D.MarkerColor = Color.DarkGreen;
                            style3D.AltitudeMode = AltitudeMode.RelativeToGround;
                            style3D.BottomAltitude = 1.1;
                            geoPoint3D.Style3D = style3D;
                            
                            
                            //添加设施点的标签
                            TextPart3D textPart3D = new TextPart3D("设施点", point3D);
                            GeoText3D text3D = new GeoText3D(textPart3D);
                            TextStyle textStyle = new TextStyle();
                            textStyle.ForeColor = Color.GreenYellow;
                            textStyle.FontName = "等线";
                            text3D.TextStyle = textStyle;

                            points.Add(point);

                            m_sceneControl.Scene.TrackingLayer.Add(geoPoint3D, "设施点");
                            m_sceneControl.Scene.TrackingLayer.Add(text3D, "设施点文本");
                            m_sceneControl.Scene.Refresh();
                        }
                        else
                        {
                            m_sceneControl.Action = Action3D.Pan;
                            m_sceneControl.Scene.Refresh();
                        }
                        break;
                   }
            }

        }

您好!我这样问您吧,您画点时鼠标是选择状态还是十字状态?
是选择状态
那建议您改成十字,代码

sceneControl.IsCursorCustomized = true;

sceneControl.Cursor = System.Windows.Forms.Cursors.Cross;
...