三维:飞行至对象为什么没有效果

0 投票
在三维开发中我遇到下面的情况:我查询到多个三维对象,并存在一个表中。用户选中一个后,需要在三维场景中显示,我的问题:

1. 我用 scene.Fly(Geometry, FlyMode) 实现这个功能,是不是正确的?

2. 上述语句编译没有问题,可在场景中没有效果:场景没有变化,是什么原因?

开发环境:iObjects 9.1.0 .NET

代码片段:

             if (lastBillboard != null)
                {
                    this.m_sceneControl.Scene.Fly(lastBillboard.Geometry, FlyingMode.FlyingTo);
                    this.m_sceneControl.Scene.Refresh();
                }

多谢!
11月 16, 2018 分类:  327次浏览 | 用户: 匿名

1个回答

0 投票
您好!scene.Fly(Geometry, FlyMode)实现这个功能没问题,请您先确保您的lastBillboard有值并且执行到这句this.m_sceneControl.Scene.Fly(lastBillboard.Geometry, FlyingMode.FlyingTo);还有您的lastBillboard是什么意思?
11月 19, 2018 用户: 胡延南 名扬四海 (3,302 分)
感谢您的回答!

lastBillboard 是 Feature3D 类, 本意是生成一个GeoBillboard,通过下面的函数生成的:

private Feature3D CreateBillboard(Point3D position, string boardName, double distH, double distV)
        {
            Feature3D ret = null;
            try
            {
                GeoBillboard billboard = new GeoBillboard();
                billboard.Height = 8;
                billboard.Width = 6;
                billboard.Position = position;

                GeoStyle3D billboardStyle = GetBillingboardStyle();
                billboardStyle.AltitudeMode = AltitudeMode.Absolute;
                billboardStyle.IsMarkerSizeFixed = true;
                billboardStyle.MarkerBillboardMode = MarkerBillboardMode.None;
                billboard.Style3D = billboardStyle;

                // Add pictures to the Billboard
                String picturePath = InternalHelper.BILLBOARD_PICTURE_STANDARD;
                GeoPicture3D picture3D = new GeoPicture3D(picturePath, new Point3D(0.0, 0.0, 0), 1.0, 1.0, 0);

                //GeoText3D
                TextStyle txtStyle = GetBillboardTextStyle();
                string msg = "Collision" + "\n" + "Horizontal: " + distH.ToString("0.00") + "\n" + "Vertical: " + distV.ToString("0.00");
                GeoText3D geoText3D = new GeoText3D(new TextPart3D(msg, 0.2, 0.1, 0));
                geoText3D.TextStyle = txtStyle;

                billboard.Add(geoText3D, "SubText");
                billboard.Add(picture3D, "SubPicture");

                string strName = boardName;
                GeoPlacemark placemark = new GeoPlacemark(strName, billboard);
                Feature3D feature3D = new Feature3D();
                feature3D.Name = strName;
                feature3D.Geometry = placemark;
                ret = feature3D;
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message);
            }

            return ret;
        }

我刚才又debug了一下,lastBillboard不为空,但有下面的情况需说明:

1. SceneControl 是 Plane scene, 不是 Spherical scene;

2. lastBillboard 是平面坐标,但我注意到其BoundingBox 并不是平面坐标(见图),也许这是错误原因?

...