Esempio n. 1
0
 private void LoadCar(IDynamicObject dynamicObject)
 {
     if (renderModelPoint == null)
     {
         // 构造ModelPoint
         mp = geoFac.CreateGeometry(gviGeometryType.gviGeometryModelPoint, gviVertexAttribute.gviVertexAttributeZ) as IModelPoint;
         string modelName = (strMediaPath + @"\osg\Vehicles\Car\TCJ006.osg");
         mp.ModelName  = modelName;
         mp.SpatialCRS = dataset_Road.SpatialReference;
         // 设置位置
         IMatrix matrix = new Matrix();
         matrix.MakeIdentity();
         IPoint startPoint = null;
         double speed      = 0.0;
         dynamicObject.GetWaypoint2(0, out startPoint, out speed);
         matrix.SetTranslate(startPoint.Position);
         mp.FromMatrix(matrix);
         mp.SelfScale(0.05, 0.05, 0.05);
         // 创建骨骼动画
         renderModelPoint = this.axRenderControl1.ObjectManager.CreateRenderModelPoint(mp, null, rootId);
         renderModelPoint.MaxVisibleDistance = 10000;
         renderModelPoint.ViewingDistance    = 200;
         // 绑定到运动路径
         IMotionable m = renderModelPoint as IMotionable;
         pos.Set(0, 0, 0);
         m.Bind2(dynamicObject, pos, 90, 0, 0);
     }
 }
Esempio n. 2
0
        private void ToolStripMenuItemCreateComplexParticleEffect_Click(object sender, EventArgs e)
        {
            IComplexParticleEffect p = this.axRenderControl1.ObjectManager.CreateComplexParticleEffect(gviComplexParticleEffectType.gviComplexParticleEffectFire_3, selectedId);

            p.ScalingFactor = 5;
            p.Name          = "粒子火Fire_0";

            IPoint pos = new GeometryFactory().CreatePoint(gviVertexAttribute.gviVertexAttributeZ) as IPoint;

            pos.SetCoords(fireX, fireY, fireZ, 0, 0);
            p.Position = pos;
            this.axRenderControl1.Camera.FlyToObject(p.Guid, gviActionCode.gviActionFlyTo);

            TreeNode node = new TreeNode("粒子火Fire_0", 1, 1);

            node.Tag     = p.Guid;
            node.Checked = true;
            selectedNode.Nodes.Add(node);
            this.treeView1.UpdateView();

            //this.axRenderControl1.InteractMode = gviInteractMode.gviInteractSelect;
            //this.axRenderControl1.MouseSelectObjectMask = gviMouseSelectObjectMask.gviSelectParticleEffect;
            //this.axRenderControl1.MouseSelectMode = gviMouseSelectMode.gviMouseSelectClick;

            //this.axRenderControl1.RcMouseClickSelect += new Gvitech.CityMaker.Controls._IRenderControlEvents_RcMouseClickSelectEventHandler(axRenderControl1_RcMouseClickSelect);

            if (motionPath != null)
            {
                IMotionable m = p as IMotionable;
                position.Set(0, 0, 0);
                m.Bind(motionPath, position, 0, 45, 90);
                motionPath.Play();
                this.axRenderControl1.Camera.FlyToObject(p.Guid, gviActionCode.gviActionFollowBehindAndAbove);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 加载MotionPath
 /// </summary>
 private void LoadMotionPath()
 {
     motionPath        = CommonUnity.RenderHelper.ObjectManager.CreateMotionPath(rootId);
     motionPath.CrsWKT = datasetCRS.AsWKT();
     //为MotionPath添加第一个点
     position.SetCoords(firstX, firstY, firstZ, 0, 0);
     angle.Set(firstH, firstP, firstR);
     scale.Set(firstSX, firstSY, firstSZ);
     motionPath.AddWaypoint2(position, angle, scale, firtWhen);
     //为MotionPath添加第二个点
     position.SetCoords(secondX, secondY, secondZ, 0, 0);
     angle.Set(secondH, secondP, secondR);
     scale.Set(secondSX, secondSY, secondSZ);
     motionPath.AddWaypoint2(position, angle, scale, secondWhen);
     //为MotionPath添加第三个点
     position.SetCoords(thirdX, thirdY, thirdZ, 0, 0);
     angle.Set(thirdH, thirdP, thirdR);
     scale.Set(thirdSX, thirdSY, thirdSZ);
     motionPath.AddWaypoint2(position, angle, scale, thirdWhen);
     //为MotionPath添加第四个点
     position.SetCoords(fourthX, fourthY, fourthZ, 0, 0);
     angle.Set(fourthH, fourthP, fourthR);
     scale.Set(fourthSX, fourthSY, fourthSZ);
     motionPath.AddWaypoint2(position, angle, scale, fourthWhen);
 }
Esempio n. 4
0
        private bool OnLocation()
        {
            if (d3 == null)
            {
                return(false);
            }
            bool bX = double.TryParse(this.te_X.Text, out x);
            bool bY = double.TryParse(this.te_Y.Text, out y);

            if (!bX || !bY)
            {
                return(false);
            }
            IVector3    vect  = null;
            IEulerAngle angle = null;

            d3.Camera.GetCamera(out vect, out angle);
            if (d3.Terrain.IsRegistered)
            {
                double z = d3.Terrain.GetElevation(x, y, Gvitech.CityMaker.RenderControl.gviGetElevationType.gviGetElevationFromDatabase);
                vect.Set(x, y, z);
            }
            else
            {
                vect.Set(x, y, vect.Z);
            }

            IImagePointSymbol imagePointSymbol = new ImagePointSymbolClass();

            imagePointSymbol.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\POI\\Location.png");
            imagePointSymbol.Size      = SystemInfo.Instance.SymbolSize;
            imagePointSymbol.Alignment = gviPivotAlignment.gviPivotAlignBottomCenter;
            IPoint pt = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);

            pt.SetCoords(vect.X, vect.Y, vect.Z, 0, 0);
            IRenderPoint renderPoint = d3.ObjectManager.CreateRenderPoint(pt, imagePointSymbol, d3.ProjectTree.RootID);

            renderPoint.MaxVisibleDistance = 10000000000.0;

            ITextSymbol textSymbol = new TextSymbolClass();

            textSymbol.TextAttribute = new TextAttributeClass
            {
                TextColor = Convert.ToUInt32(SystemInfo.Instance.TextColor, 16),
                TextSize  = SystemInfo.Instance.TextSize
            };
            textSymbol.PivotAlignment = gviPivotAlignment.gviPivotAlignTopCenter;
            ILabel label = d3.ObjectManager.CreateLabel(d3.ProjectTree.RootID);

            label.Position           = pt;
            label.MaxVisibleDistance = 10000000000.0;
            label.TextSymbol         = textSymbol;
            label.Text = this.te_X.Text + "," + this.te_Y.Text;
            this.listRender.Add(renderPoint);
            this.listRender.Add(label);

            d3.Camera.LookAt(vect, 500, angle);
            return(true);
        }
Esempio n. 5
0
        /// <summary>
        /// 加载人物骨骼动画
        /// </summary>
        private void LoadXFileCharacter()
        {
            string fileName = (strMediaPath + @"\x\Character\QiYeYuanGong.X");

            if (skinMeshCharacter == null)
            {
                // 构造ModelPoint
                IGeometryFactory gf = new GeometryFactory();
                IModelPoint      mp = gf.CreateGeometry(gviGeometryType.gviGeometryModelPoint, gviVertexAttribute.gviVertexAttributeZ) as IModelPoint;
                mp.ModelName  = fileName;
                mp.SpatialCRS = datasetCRS;
                // 设置位置
                IMatrix matrix = new Matrix();
                matrix.MakeIdentity();
                v3.Set(gugeX, gugeY, gugeZ);
                matrix.SetTranslate(v3);
                mp.FromMatrix(matrix);
                // 创建骨骼动画
                skinMeshCharacter = CommonUnity.RenderHelper.ObjectManager.CreateSkinnedMesh(mp, rootId);
                if (skinMeshCharacter == null)
                {
                    MessageBox.Show("骨骼动画创建失败!");
                    return;
                }
                skinMeshCharacter.Duration = 1;  //人物的那个骨骼动画播放速度调快一倍
                skinMeshCharacter.Loop     = true;
                skinMeshCharacter.Play();
                skinMeshCharacter.MaxVisibleDistance = 1000;
            }
        }
Esempio n. 6
0
        private void LoadMotionPathAndLineFromFile()
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(Application.StartupPath + @"MotionPath.xml");
            wkt = xmlDoc.SelectSingleNode("root/WKT").InnerText;
            // 指定坐标系与xml里的相同
            motionPath.CrsWKT = xmlDoc.SelectSingleNode("root/WKT").InnerText;
            point.SpatialCRS  = new CRSFactory().CreateFromWKT(motionPath.CrsWKT) as ISpatialCRS;
            line.SpatialCRS   = new CRSFactory().CreateFromWKT(motionPath.CrsWKT) as ISpatialCRS;

            XmlNodeList nodes = xmlDoc.SelectNodes("root/Waypoint");
            int         i     = 0;

            foreach (XmlNode node in nodes)
            {
                double x       = double.Parse(node.SelectSingleNode("X").InnerText);
                double y       = double.Parse(node.SelectSingleNode("Y").InnerText);
                double z       = double.Parse(node.SelectSingleNode("Z").InnerText);
                double heading = double.Parse(node.SelectSingleNode("Heading").InnerText);
                double tilt    = double.Parse(node.SelectSingleNode("Tilt").InnerText);
                double roll    = double.Parse(node.SelectSingleNode("Roll").InnerText);
                double when    = double.Parse(node.SelectSingleNode("When").InnerText);
                position.Set(x, y, z);
                point.Position = position;
                if (line.PointCount == 0)
                {
                    line.StartPoint = point;
                }
                else
                {
                    line.AddPointAfter(i - 1, point);
                }
                i++;
                angle.Set(heading, tilt, roll);
                scale.Set(1, 1, 1);
                motionPath.AddWaypoint2(point, angle, scale, when);
                this.axRenderControl1.ObjectManager.CreateRenderPoint(point, null, rootId);
            }

            ICurveSymbol cur = new CurveSymbol();

            cur.Color = System.Drawing.Color.Red;
            cur.Width = -2;
            rline     = this.axRenderControl1.ObjectManager.CreateRenderPolyline(line, cur, rootId);
        }
Esempio n. 7
0
        private void ToolStripMenuItemCreateRenderPolyline_Click(object sender, EventArgs e)
        {
            motionPath = this.axRenderControl1.ObjectManager.CreateMotionPath(rootId);

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(Application.StartupPath + @"\MotionPath.xml");
            string wkt = xmlDoc.SelectSingleNode("root/WKT").InnerText;

            motionPath.CrsWKT = wkt;
            IPoint point = new GeometryFactory().CreatePoint(gviVertexAttribute.gviVertexAttributeZ);

            point.SpatialCRS = new CRSFactory().CreateFromWKT(wkt) as ISpatialCRS;
            IPolyline line = new GeometryFactory().CreateGeometry(gviGeometryType.gviGeometryPolyline, gviVertexAttribute.gviVertexAttributeZ) as IPolyline;

            line.SpatialCRS = new CRSFactory().CreateFromWKT(wkt) as ISpatialCRS;

            XmlNodeList nodes = xmlDoc.SelectNodes("root/Waypoint");
            int         i     = 0;

            foreach (XmlNode node in nodes)
            {
                double x = double.Parse(node.SelectSingleNode("X").InnerText);
                double y = double.Parse(node.SelectSingleNode("Y").InnerText);
                double z = double.Parse(node.SelectSingleNode("Z").InnerText);
                position.Set(x, y, z);
                point.Position = position;
                if (line.PointCount == 0)
                {
                    line.StartPoint = point;
                }
                else
                {
                    line.AddPointAfter(i - 1, point);
                }
                i++;

                double heading = double.Parse(node.SelectSingleNode("Heading").InnerText);
                double tilt    = double.Parse(node.SelectSingleNode("Tilt").InnerText);
                double roll    = double.Parse(node.SelectSingleNode("Roll").InnerText);
                double when    = double.Parse(node.SelectSingleNode("When").InnerText);
                angle.Set(heading, tilt, roll);
                scale.Set(1, 1, 1);
                motionPath.AddWaypoint2(point, angle, scale, when);
            }

            IRenderPolyline rpl = this.axRenderControl1.ObjectManager.CreateRenderPolyline(line, null, selectedId);

            rpl.Name = "RenderPolyline";
            TreeNode treeNode = new TreeNode("RenderPolyline", 1, 1);

            treeNode.Tag     = rpl.Guid;
            treeNode.Checked = true;
            selectedNode.Nodes.Add(treeNode);
            this.treeView1.UpdateView();
        }
Esempio n. 8
0
        private void LoadSkinMeshAndViewshed()
        {
            string fileName = (strMediaPath + @"\x\Character\QiYeYuanGong.X");

            if (skinMesh == null)
            {
                // 构造ModelPoint
                IGeometryFactory gf = new GeometryFactory();
                IModelPoint      mp = gf.CreateGeometry(gviGeometryType.gviGeometryModelPoint, gviVertexAttribute.gviVertexAttributeZ) as IModelPoint;
                mp.ModelName  = fileName;
                mp.SpatialCRS = new CRSFactory().CreateFromWKT(wkt) as ISpatialCRS;
                // 设置位置
                IMatrix matrix = new Matrix();
                matrix.MakeIdentity();
                matrix.SetTranslate(line.GetPoint(0).Position);
                mp.FromMatrix(matrix);
                // 创建骨骼动画
                skinMesh = this.axRenderControl1.ObjectManager.CreateSkinnedMesh(mp, rootId);
                if (skinMesh == null)
                {
                    MessageBox.Show("骨骼动画创建失败!");
                    return;
                }
                skinMesh.Loop = true;
                skinMesh.Play();
                skinMesh.MaxVisibleDistance = 1000;
                skinMesh.ViewingDistance    = 50;

                // 绑定到运动路径
                IMotionable m = skinMesh as IMotionable;
                position.Set(0, 0, 0);
                m.Bind2(dynamicObject, position, 0, 0, 0);
                this.axRenderControl1.Camera.FlyToObject(skinMesh.Guid, gviActionCode.gviActionFollowBehind);
            }

            if (tv == null)
            {
                tv = this.axRenderControl1.ObjectManager.CreateViewshed(line.GetPoint(0), rootId);
                IMotionable tvm = tv as IMotionable;
                position.Set(0, 0, 0);
                tvm.Bind2(dynamicObject, position, 0, 0, 0);
            }
        }
Esempio n. 9
0
        bool axRenderControl1_RcKeyUp(uint Flags, uint Ch)
        {
            if (curVideoIndex < 0)
            {
                return(false);
            }

            switch (Ch)
            {
                #region  键调整
            case (uint)Keys.Q:
            {
                curVideo = videoList[curVideoIndex];
                cp.X    += factor;
                vector.Set(cp.X, cp.Y, cp.Z);
                positionPoint.Position = vector;
                curVideo.Position      = positionPoint;
                //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags);

                DataRow dr = dt.Rows[curRowIndex];
                dr["Location"] = cp;
            }
            break;

            case (uint)Keys.W:
            {
                curVideo = videoList[curVideoIndex];
                cp.X    -= factor;
                vector.Set(cp.X, cp.Y, cp.Z);
                positionPoint.Position = vector;
                curVideo.Position      = positionPoint;
                //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags);

                DataRow dr = dt.Rows[curRowIndex];
                dr["Location"] = cp;
            }
            break;

            case (uint)Keys.E:
            {
                curVideo = videoList[curVideoIndex];
                cp.Y    += factor;
                vector.Set(cp.X, cp.Y, cp.Z);
                positionPoint.Position = vector;
                curVideo.Position      = positionPoint;
                //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags);
                DataRow dr = dt.Rows[curRowIndex];
                dr["Location"] = cp;
            }
            break;

            case (uint)Keys.R:
            {
                curVideo = videoList[curVideoIndex];
                cp.Y    -= factor;
                vector.Set(cp.X, cp.Y, cp.Z);
                positionPoint.Position = vector;
                curVideo.Position      = positionPoint;
                //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags);
                DataRow dr = dt.Rows[curRowIndex];
                dr["Location"] = cp;
            }
            break;

            case (uint)Keys.T:
            {
                curVideo = videoList[curVideoIndex];
                cp.Z    += factor;
                vector.Set(cp.X, cp.Y, cp.Z);
                positionPoint.Position = vector;
                curVideo.Position      = positionPoint;
                //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags);
                DataRow dr = dt.Rows[curRowIndex];
                dr["Location"] = cp;
            }
            break;

            case (uint)Keys.Y:
            {
                curVideo = videoList[curVideoIndex];
                cp.Z    -= factor;
                vector.Set(cp.X, cp.Y, cp.Z);
                positionPoint.Position = vector;
                curVideo.Position      = positionPoint;
                //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags);
                DataRow dr = dt.Rows[curRowIndex];
                dr["Location"] = cp;
            }
            break;

            case (uint)Keys.U:
            {
                curVideo    = videoList[curVideoIndex];
                cp.Heading += factor;
                angle.Set(cp.Heading, cp.Tilt, cp.Roll);
                curVideo.Angle = angle;
                //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags);
                DataRow dr = dt.Rows[curRowIndex];
                dr["Location"] = cp;
            }
            break;

            case (uint)Keys.I:
            {
                curVideo    = videoList[curVideoIndex];
                cp.Heading -= factor;
                angle.Set(cp.Heading, cp.Tilt, cp.Roll);
                curVideo.Angle = angle;
                //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags);
                DataRow dr = dt.Rows[curRowIndex];
                dr["Location"] = cp;
            }
            break;

            case (uint)Keys.O:
            {
                curVideo = videoList[curVideoIndex];
                cp.Tilt += factor;
                vector.Set(cp.X, cp.Y, cp.Z);
                angle.Set(cp.Heading, cp.Tilt, cp.Roll);
                curVideo.Angle = angle;
                //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags);
                DataRow dr = dt.Rows[curRowIndex];
                dr["Location"] = cp;
            }
            break;

            case (uint)Keys.P:
            {
                curVideo = videoList[curVideoIndex];
                cp.Tilt -= factor;
                angle.Set(cp.Heading, cp.Tilt, cp.Roll);
                curVideo.Angle = angle;
                //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags);
                DataRow dr = dt.Rows[curRowIndex];
                dr["Location"] = cp;
            }
            break;

            case (uint)Keys.D:
            {
                curVideo = videoList[curVideoIndex];
                cp.Roll += factor;
                angle.Set(cp.Heading, cp.Tilt, cp.Roll);
                curVideo.Angle = angle;
                //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags);
                DataRow dr = dt.Rows[curRowIndex];
                dr["Location"] = cp;
            }
            break;

            case (uint)Keys.F:
            {
                curVideo = videoList[curVideoIndex];
                cp.Roll -= factor;
                angle.Set(cp.Heading, cp.Tilt, cp.Roll);
                curVideo.Angle = angle;
                //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags);
                DataRow dr = dt.Rows[curRowIndex];
                dr["Location"] = cp;
            }
            break;

            case (uint)Keys.G:
            {
                curVideo             = videoList[curVideoIndex];
                cp.AspectRatio      += factor;
                curVideo.AspectRatio = cp.AspectRatio;
                DataRow dr = dt.Rows[curRowIndex];
                dr["Location"] = cp;
            }
            break;

            case (uint)Keys.H:
            {
                curVideo             = videoList[curVideoIndex];
                cp.AspectRatio      -= factor;
                curVideo.AspectRatio = cp.AspectRatio;
                DataRow dr = dt.Rows[curRowIndex];
                dr["Location"] = cp;
            }
            break;

            case (uint)Keys.J:
            {
                curVideo             = videoList[curVideoIndex];
                cp.FieldOfView      += factor;
                curVideo.FieldOfView = cp.FieldOfView;
                DataRow dr = dt.Rows[curRowIndex];
                dr["Location"] = cp;
            }
            break;

            case (uint)Keys.K:
            {
                curVideo             = videoList[curVideoIndex];
                cp.FieldOfView      -= factor;
                curVideo.FieldOfView = cp.FieldOfView;
                DataRow dr = dt.Rows[curRowIndex];
                dr["Location"] = cp;
            }
            break;

            case (uint)Keys.D1:
            {
                factor = 10;
            }
            break;

            case (uint)Keys.D2:
            {
                factor = 1;
            }
            break;

            case (uint)Keys.D3:
            {
                factor = 0.1;
            }
            break;

            case (uint)Keys.D4:
            {
                factor = 0.01;
            }
            break;

                #endregion
            case (uint)Keys.S:
            {
                String str = cp.PropertyStrings();
                streamWriter.WriteLine(str);
                streamWriter.Flush();
            }
            break;

            case (uint)Keys.C:
            {
                curVideo             = videoList[curVideoIndex];
                curVideo.VisibleMask = gviViewportMask.gviViewAllNormalView;
            }
            break;

            case (uint)Keys.V:
            {
                curVideo             = videoList[curVideoIndex];
                curVideo.VisibleMask = gviViewportMask.gviViewNone;
            }
            break;
            }

            return(true);
        }
Esempio n. 10
0
        /// <summary>
        /// 参数化建模
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDriveModel_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (polyline != null)
                {
                    center = polyline.Envelope.Center;
                    IModelPoint mp = new GeometryFactory().CreateGeometry(gviGeometryType.gviGeometryModelPoint, gviVertexAttribute.gviVertexAttributeZ) as IModelPoint;
                    mp.SpatialCRS = datasetCRS;
                    mp.Position   = center;

                    IModel         model     = new ResourceFactory().CreateModel();
                    IDrawGroup     group     = new DrawGroup();
                    IDrawPrimitive primitive = new DrawPrimitive();
                    IDrawMaterial  material  = new DrawMaterial();
                    material.TextureName = (strMediaPath + @"\shp\road\textrure.jpg");
                    material.CullMode    = gviCullFaceMode.gviCullNone;
                    material.WrapModeS   = gviTextureWrapMode.gviTextureWrapRepeat;
                    material.WrapModeT   = gviTextureWrapMode.gviTextureWrapRepeat;
                    IFloatArray va = new FloatArray();
                    IFloatArray ta = new FloatArray();
                    // 逐点外扩
                    for (int i = 0; i < polyline.PointCount; i++)
                    {
                        #region 单独处理最后一个点
                        if (i == polyline.PointCount - 1)
                        {
                            curPoint  = polyline.GetPoint(i);
                            vecCurPos = curPoint.Position;
                            // 最后一个点重用最后的方向向量
                            vecTarget = vecDirect.CrossProduct(vecZ);
                            vecTarget.Normalize();
                            vecTarget.MultiplyByScalar(width / 2);
                            vecP = vecCurPos.Add(vecTarget);
                            vecTarget.MultiplyByScalar(-1);
                            vecQ = vecCurPos.Add(vecTarget);
                            // 设置外扩点
                            P          = curPoint.Clone() as IPoint;
                            P.Position = vecP;
                            Q          = curPoint.Clone() as IPoint;
                            Q.Position = vecQ;
                            // 把点坐标加进顶点数组
                            va.Append((float)(vecP.X - center.X));
                            va.Append((float)(vecP.Y - center.Y));
                            va.Append((float)(vecP.Z - center.Z));
                            va.Append((float)(vecQ.X - center.X));
                            va.Append((float)(vecQ.Y - center.Y));
                            va.Append((float)(vecQ.Z - center.Z));
                            // 加纹理坐标
                            ta.Append(0);  //P点纹理
                            if (i == 0)
                            {
                                lastV = 0.0;
                            }
                            else
                            {
                                lastV = lastV + length / 10;  //v方向上每隔10米重复一次
                            }
                            ta.Append((float)lastV);
                            ta.Append(1);  //Q点纹理
                            ta.Append((float)lastV);

                            {
                                ISimplePointSymbol ps = new SimplePointSymbol();
                                ps.FillColor = System.Drawing.Color.Yellow;
                                ps.Size      = 5;
                                rPointToDelList.Add(this.axRenderControl1.ObjectManager.CreateRenderPoint(P, ps, rootId));
                                rPointToDelList.Add(this.axRenderControl1.ObjectManager.CreateRenderPoint(Q, ps, rootId));
                            }

                            break;
                        }
                        #endregion

                        // 当不是最后一个点时:
                        curPoint   = polyline.GetPoint(i);
                        nextPoint  = polyline.GetPoint(i + 1);
                        vecCurPos  = curPoint.Position;
                        vecNextPos = nextPoint.Position;
                        // 运算
                        vecNextPos.MultiplyByScalar(-1);
                        vecDirect = vecCurPos.Add(vecNextPos);  //方向向量
                        vecZ.Set(0, 0, 1);
                        vecTarget = vecDirect.CrossProduct(vecZ);
                        vecTarget.Normalize();
                        vecTarget.MultiplyByScalar(width / 2);
                        vecP = vecCurPos.Add(vecTarget);
                        vecTarget.MultiplyByScalar(-1);
                        vecQ = vecCurPos.Add(vecTarget);
                        // 设置外扩点
                        P          = curPoint.Clone() as IPoint;
                        P.Position = vecP;
                        Q          = curPoint.Clone() as IPoint;
                        Q.Position = vecQ;
                        // 把点坐标加进顶点数组
                        va.Append((float)(vecP.X - center.X));
                        va.Append((float)(vecP.Y - center.Y));
                        va.Append((float)(vecP.Z - center.Z));
                        va.Append((float)(vecQ.X - center.X));
                        va.Append((float)(vecQ.Y - center.Y));
                        va.Append((float)(vecQ.Z - center.Z));
                        // 加纹理坐标
                        ta.Append(0);  //P点纹理
                        if (i == 0)
                        {
                            lastV = 0.0;
                        }
                        else
                        {
                            lastV = lastV + length / 5; //v方向上每隔10米重复一次
                        }
                        length = vecDirect.Length;      //计算长度给奇数点用
                        ta.Append((float)lastV);
                        ta.Append(1);                   //Q点纹理
                        ta.Append((float)lastV);

                        {
                            ISimplePointSymbol ps = new SimplePointSymbol();
                            ps.FillColor = System.Drawing.Color.Yellow;
                            ps.Size      = 5;
                            rPointToDelList.Add(this.axRenderControl1.ObjectManager.CreateRenderPoint(P, ps, rootId));
                            rPointToDelList.Add(this.axRenderControl1.ObjectManager.CreateRenderPoint(Q, ps, rootId));
                        }
                    }
                    // 计算索引坐标
                    IUInt16Array ia = new UInt16Array();
                    for (int i = 0; i < va.Length / 6 - 1; i++)
                    {
                        ia.Append((ushort)(2 * i));
                        ia.Append((ushort)(2 * i + 1));
                        ia.Append((ushort)(2 * i + 2));
                        ia.Append((ushort)(2 * i + 1));
                        ia.Append((ushort)(2 * i + 3));
                        ia.Append((ushort)(2 * i + 2));
                    }
                    primitive.VertexArray   = va;
                    primitive.TexcoordArray = ta;
                    primitive.IndexArray    = ia;
                    primitive.Material      = material;
                    group.AddPrimitive(primitive);
                    model.AddGroup(group);

                    // 在内存中临时存储模型
                    string modelName = fid.ToString();
                    this.axRenderControl1.ObjectManager.AddModel(modelName, model);
                    mp.ModelName     = modelName;
                    mp.ModelEnvelope = model.Envelope;
                    // 可视化临时模型
                    IRenderModelPoint rmp = this.axRenderControl1.ObjectManager.CreateRenderModelPoint(mp, null, rootId);
                    rmp.MaxVisibleDistance = 100000;
                    rmp.MouseSelectMask    = gviViewportMask.gviViewNone;
                    rModelpointToDelList.Add(rmp);
                }
            }
            catch (System.Exception ex)
            {
                if (ex.GetType().Name.Equals("UnauthorizedAccessException"))
                {
                    MessageBox.Show("需要标准runtime授权");
                }
                else
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Esempio n. 11
0
        private void LoadDynamicTableLabel()
        {
            #region 加载一个标签
            dynamicTableLabel = axRenderControl1.ObjectManager.CreateTableLabel(2, 2, rootId);

            dynamicTableLabel.TitleText = "消防车当前位置";
            dynamicTableLabel.SetRecord(0, 0, "X:");
            dynamicTableLabel.SetRecord(0, 1, firstX.ToString());
            dynamicTableLabel.SetRecord(1, 0, "Y:");
            dynamicTableLabel.SetRecord(1, 1, firstY.ToString());

            position.Set(firstX, firstY, firstZ + 2.4);
            if (fde_point == null)
            {
                fde_point = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
            }
            fde_point.Position         = position;
            dynamicTableLabel.Position = fde_point;

            dynamicTableLabel.BorderColor          = System.Drawing.Color.White;
            dynamicTableLabel.BorderWidth          = 2;
            dynamicTableLabel.TableBackgroundColor = System.Drawing.Color.Gray;
            dynamicTableLabel.TitleBackgroundColor = System.Drawing.Color.Red;

            // 表头样式
            TextAttribute headerTextAttribute = new TextAttribute();
            headerTextAttribute.TextColor              = System.Drawing.Color.Black;
            headerTextAttribute.OutlineColor           = System.Drawing.Color.Red;
            headerTextAttribute.Font                   = "黑体";
            headerTextAttribute.Bold                   = true;
            headerTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
            dynamicTableLabel.SetColumnTextAttribute(0, headerTextAttribute);

            // 内容样式
            TextAttribute contentTextAttribute = new TextAttribute();
            contentTextAttribute.TextColor              = System.Drawing.Color.Black;
            contentTextAttribute.OutlineColor           = System.Drawing.Color.Red;
            contentTextAttribute.Font                   = "黑体";
            contentTextAttribute.Bold                   = false;
            contentTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
            dynamicTableLabel.SetColumnTextAttribute(1, contentTextAttribute);

            // 标题样式
            TextAttribute capitalTextAttribute = new TextAttribute();
            capitalTextAttribute.TextColor              = System.Drawing.Color.White;
            capitalTextAttribute.OutlineColor           = System.Drawing.Color.Gray;
            capitalTextAttribute.Font                   = "华文新魏";
            capitalTextAttribute.TextSize               = 14;
            capitalTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineCenter;
            capitalTextAttribute.Bold                   = true;
            dynamicTableLabel.TitleTextAttribute        = capitalTextAttribute;

            angle.Set(0, -20, 0);
            axRenderControl1.Camera.LookAt(position, 30, angle);
            #endregion

            #region 加载一个模型
            if (renderModelPoint == null)
            {
                string           modelName  = (strMediaPath + @"\osg\Vehicles\XiaoFangChe\xiaoFangChe3.OSG");
                IGeometryFactory geoFactory = new GeometryFactory();
                IModelPoint      modePoint  = (IModelPoint)geoFactory.CreateGeometry(gviGeometryType.gviGeometryModelPoint, gviVertexAttribute.gviVertexAttributeZ);
                modePoint.ModelName = modelName;
                modePoint.SetCoords(firstX, firstY, firstZ, 0, 0);
                renderModelPoint = axRenderControl1.ObjectManager.CreateRenderModelPoint(modePoint, null, rootId);
            }
            #endregion

            #region 加载一个运动路径
            if (motionPath == null)
            {
                motionPath = axRenderControl1.ObjectManager.CreateMotionPath(rootId);
                // 为MotionPath添加第一个点
                position.Set(firstX, firstY, firstZ);
                angle.Set(firstH, firstP, firstR);
                scale.Set(firstSX, firstSY, firstSZ);
                motionPath.AddWaypoint(position, angle, scale, firtWhen);
                //为MotionPath添加第二个点
                position.Set(secondX, secondY, secondZ);
                angle.Set(secondH, secondP, secondR);
                scale.Set(secondSX, secondSY, secondSZ);
                motionPath.AddWaypoint(position, angle, scale, secondWhen);
                //为MotionPath添加第三个点
                position.Set(thirdX, thirdY, thirdZ);
                angle.Set(thirdH, thirdP, thirdR);
                scale.Set(thirdSX, thirdSY, thirdSZ);
                motionPath.AddWaypoint(position, angle, scale, thirdWhen);
                //为MotionPath添加第四个点
                position.Set(fourthX, fourthY, fourthZ);
                angle.Set(fourthH, fourthP, fourthR);
                scale.Set(fourthSX, fourthSY, fourthSZ);
                motionPath.AddWaypoint(position, angle, scale, fourthWhen);
            }
            #endregion

            #region 将模型和标牌同时绑定在路径上
            m = renderModelPoint as IMotionable;
            //将模型绑定到路径上

            v3.Set(0, 0, 0);
            m.Bind(motionPath, v3, 0, 0, 0);

            // 将标牌绑定到路径上
            if (dynamicTableLabel != null && motionPath != null)
            {
                m = dynamicTableLabel as IMotionable;
                v3.Set(0, 0, 6);
                m.Bind(motionPath, v3, 0, 0, 0);
            }
            #endregion
        }
Esempio n. 12
0
        /// <summary>
        /// 加载第一种样式的静态指示标签
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnFirstLabel_Click(object sender, EventArgs e)
        {
            // 创建一个有3行2列的TableLabel
            tableLabel = axRenderControl1.ObjectManager.CreateTableLabel(3, 2, rootId);
            // 设定表头文字
            tableLabel.TitleText = "大楼信息展示";
            // 设定表格中第1行,第1列的显示文字
            tableLabel.SetRecord(0, 0, "大楼层数");
            // 第1行,第2列
            tableLabel.SetRecord(0, 1, "2");
            // 第2行,第1列
            tableLabel.SetRecord(1, 0, "大楼高度");
            // 第2行,第2列
            tableLabel.SetRecord(1, 1, "5米");
            // 第3行,第1列
            tableLabel.SetRecord(2, 0, "施工单位");
            // 第3行,第2列
            tableLabel.SetRecord(2, 1, "金隅集团");

            //标牌的位置
            position.Set(15293.62, 35805.17, 17.92);
            if (fde_point == null)
            {
                fde_point = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
            }
            fde_point.Position  = position;
            tableLabel.Position = fde_point;

            // 列宽度
            tableLabel.SetColumnWidth(0, 80);
            tableLabel.SetColumnWidth(1, 80);

            // 表的边框颜色
            tableLabel.BorderColor = System.Drawing.Color.White;
            // 表的边框的宽度
            tableLabel.BorderWidth = 2;
            // 表的背景色
            tableLabel.TableBackgroundColor = System.Drawing.Color.Gray;

            // 标题背景色
            tableLabel.TitleBackgroundColor = System.Drawing.Color.Red;

            // 第一列文本样式
            TextAttribute headerTextAttribute = new TextAttribute();

            headerTextAttribute.TextColor              = System.Drawing.Color.White;
            headerTextAttribute.OutlineColor           = System.Drawing.Color.Red;
            headerTextAttribute.Font                   = "黑体";
            headerTextAttribute.Bold                   = true;
            headerTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
            tableLabel.SetColumnTextAttribute(0, headerTextAttribute);

            // 第二列文本样式
            TextAttribute contentTextAttribute = new TextAttribute();

            contentTextAttribute.TextColor              = System.Drawing.Color.Black;
            contentTextAttribute.OutlineColor           = System.Drawing.Color.Red;
            contentTextAttribute.Font                   = "黑体";
            contentTextAttribute.Bold                   = false;
            contentTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineLeft;
            tableLabel.SetColumnTextAttribute(1, contentTextAttribute);

            // 标题文本样式
            TextAttribute capitalTextAttribute = new TextAttribute();

            capitalTextAttribute.TextColor              = System.Drawing.Color.White;
            capitalTextAttribute.OutlineColor           = System.Drawing.Color.Gray;
            capitalTextAttribute.Font                   = "华文新魏";
            capitalTextAttribute.TextSize               = 14;
            capitalTextAttribute.MultilineJustification = gviMultilineJustification.gviMultilineCenter;
            capitalTextAttribute.Bold                   = true;
            tableLabel.TitleTextAttribute               = capitalTextAttribute;

            switch (cbDepthTestMode.SelectedIndex)
            {
            case 0:
                tableLabel.DepthTestMode = gviDepthTestMode.gviDepthTestEnable;
                break;

            case 1:
                tableLabel.DepthTestMode = gviDepthTestMode.gviDepthTestDisable;
                break;

            case 2:
                tableLabel.DepthTestMode = gviDepthTestMode.gviDepthTestAdvance;
                break;
            }

            angle.Set(0, -20, 0);
            axRenderControl1.Camera.LookAt(position, 30, angle);
        }
Esempio n. 13
0
        public MainForm()
        {
            InitializeComponent();

            // 初始化RenderControl控件
            IPropertySet ps = new PropertySet();

            ps.SetProperty("RenderSystem", gviRenderSystem.gviRenderOpenGL);
            this.axRenderControl1.Initialize(true, ps);
            this.axRenderControl1.Camera.FlyTime = 1;
            rootId = this.axRenderControl1.ObjectManager.GetProjectTree().RootID;

            // 设置天空盒

            if (System.IO.Directory.Exists(strMediaPath))
            {
                string  tmpSkyboxPath = strMediaPath + @"\skybox";
                ISkyBox skybox        = this.axRenderControl1.ObjectManager.GetSkyBox(0);
                skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageBack, tmpSkyboxPath + "\\1_BK.jpg");
                skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageBottom, tmpSkyboxPath + "\\1_DN.jpg");
                skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageFront, tmpSkyboxPath + "\\1_FR.jpg");
                skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageLeft, tmpSkyboxPath + "\\1_LF.jpg");
                skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageRight, tmpSkyboxPath + "\\1_RT.jpg");
                skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageTop, tmpSkyboxPath + "\\1_UP.jpg");
            }
            else
            {
                MessageBox.Show("请不要随意更改SDK目录名");
                return;
            }

            // 加载FDB场景
            try
            {
                IConnectionInfo ci = new ConnectionInfo();
                ci.ConnectionType = gviConnectionType.gviConnectionFireBird2x;
                string tmpFDBPath = (strMediaPath + @"\BIMTIME.FDB");
                ci.Database = tmpFDBPath;
                IDataSourceFactory dsFactory = new DataSourceFactory();
                IDataSource        ds        = dsFactory.OpenDataSource(ci);
                string[]           setnames  = (string[])ds.GetFeatureDatasetNames();
                if (setnames.Length == 0)
                {
                    return;
                }
                IFeatureDataSet dataset = ds.OpenFeatureDataset(setnames[0]);
                string[]        fcnames = (string[])dataset.GetNamesByType(gviDataSetType.gviDataSetFeatureClassTable);
                if (fcnames.Length == 0)
                {
                    return;
                }
                fcMap = new Hashtable(fcnames.Length);
                foreach (string name in fcnames)
                {
                    IFeatureClass fc = dataset.OpenFeatureClass(name);
                    // 找到空间列字段
                    List <string>        geoNames   = new List <string>();
                    IFieldInfoCollection fieldinfos = fc.GetFields();
                    for (int i = 0; i < fieldinfos.Count; i++)
                    {
                        IFieldInfo fieldinfo = fieldinfos.Get(i);
                        if (null == fieldinfo)
                        {
                            continue;
                        }
                        IGeometryDef geometryDef = fieldinfo.GeometryDef;
                        if (null == geometryDef)
                        {
                            continue;
                        }
                        geoNames.Add(fieldinfo.Name);
                    }
                    fcMap.Add(fc, geoNames);

                    bool bHasTemp = fc.HasTemporal();
                    if (bHasTemp)
                    {
                        ITemporalManager tm = fc.TemporalManager;
                        if (tm != null)
                        {
                            try
                            {
                                DateTime[] times = tm.GetKeyDatetimes();
                                for (int i = 0; i < times.Length; i++)
                                {
                                    if (keyDatetimesList.Contains(times[i]))
                                    {
                                        continue;
                                    }
                                    keyDatetimesList.Add(times[i]);
                                }
                            }
                            catch (COMException)
                            {
                            }
                        }
                    }
                }
            }
            catch (COMException ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message);
                return;
            }

            // 设置时间轴
            keyDatetimesList.Sort();
            if (keyDatetimesList.Count > 3)
            {
                TimeSpan tsmin = keyDatetimesList[0] - dayLongLongAgo;
                this.trackBarTime.Minimum        = tsmin.Days - 1;
                this.trackBarTimeCompare.Minimum = tsmin.Days - 1;
                TimeSpan tsmax = keyDatetimesList[keyDatetimesList.Count - 2] - dayLongLongAgo;
                this.trackBarTime.Maximum        = tsmax.Days + 1;
                this.trackBarTimeCompare.Maximum = tsmax.Days + 1;
            }

            // CreateFeautureLayer
            bool hasfly = false;

            foreach (IFeatureClass fc in fcMap.Keys)
            {
                List <string> geoNames = (List <string>)fcMap[fc];
                foreach (string geoName in geoNames)
                {
                    IFeatureLayer featureLayer = this.axRenderControl1.ObjectManager.CreateFeatureLayer(
                        fc, geoName, null, null, rootId);
                    if (featureLayer == null)
                    {
                        continue;
                    }

                    #region 设置时态
                    featureLayer.EnableTemporal = true;
                    layerList.Add(featureLayer);

                    //设置curLayer的时刻
                    this.trackBarTime.Value = this.trackBarTime.Minimum;
                    DateTime d = dayLongLongAgo.AddDays((double)this.trackBarTime.Value);
                    this.labelTime.Text = d.ToString();
                    featureLayer.Time   = d;
                    #endregion

                    #region 比较规则
                    pset.SetProperty("提前", "$(starttime)");
                    featureLayer.CompareRenderRuleVariants = pset;

                    IValueMapGeometryRender render = new ValueMapGeometryRender();
                    {
                        IGeometryRenderScheme scheme = new GeometryRenderScheme();
                        IComparedRenderRule   rule   = new ComparedRenderRule();
                        rule.LookUpField     = "实际开始时间";
                        rule.CompareVariant  = "提前";
                        rule.CompareOperator = gviCompareType.gviCompareLess;
                        scheme.AddRule(rule);
                        IModelPointSymbol symbol = new ModelPointSymbol();
                        symbol.EnableColor = true;
                        symbol.Color       = System.Drawing.Color.Green;
                        scheme.Symbol      = symbol;
                        render.AddScheme(scheme);
                    }
                    {
                        IGeometryRenderScheme scheme = new GeometryRenderScheme();
                        IComparedRenderRule   rule   = new ComparedRenderRule();
                        rule.LookUpField     = "实际开始时间";
                        rule.CompareVariant  = "提前";
                        rule.CompareOperator = gviCompareType.gviCompareGreaterOrEqual;
                        scheme.AddRule(rule);
                        IModelPointSymbol symbol = new ModelPointSymbol();
                        symbol.EnableColor = false;
                        scheme.Symbol      = symbol;
                        render.AddScheme(scheme);
                    }
                    featureLayer.SetGeometryRender(render);
                    #endregion

                    if (!hasfly)
                    {
                        IFieldInfoCollection fieldinfos  = fc.GetFields();
                        IFieldInfo           fieldinfo   = fieldinfos.Get(fieldinfos.IndexOf(geoName));
                        IGeometryDef         geometryDef = fieldinfo.GeometryDef;
                        IEnvelope            env         = geometryDef.Envelope;
                        if (env == null || (env.MaxX == 0.0 && env.MaxY == 0.0 && env.MaxZ == 0.0 &&
                                            env.MinX == 0.0 && env.MinY == 0.0 && env.MinZ == 0.0))
                        {
                            continue;
                        }
                        angle.Set(0, -52, 0);
                        position.Set(-13.44, -88.77, 59.28);
                        this.axRenderControl1.Camera.LookAt(position, 100, angle);
                        hasfly = true;
                    }
                }
            }

            {
                this.helpProvider1.SetShowHelp(this.axRenderControl1, true);
                this.helpProvider1.SetHelpString(this.axRenderControl1, "");
                this.helpProvider1.HelpNamespace = "FiveDShow.html";
            }
        }
Esempio n. 14
0
        private void AxRenderControl1_RcUIWindowEvent(IUIEventArgs EventArgs, gviUIEventType EventType)
        {
            IUIMouseEventArgs args = EventArgs as IUIMouseEventArgs;

            if (args.UIEventWindow == null)
            {
                return;
            }

            if (EventType == gviUIEventType.gviUIMouseClick)
            {
                gviUIWindowType winType = args.UIEventWindow.Type;
                if (winType == gviUIWindowType.gviUIImageButton)
                {
                    switch (args.UIEventWindow.Name)
                    {
                    case "漫游":
                        this.axRenderControl1.InteractMode = gviInteractMode.gviInteractNormal;
                        break;

                    case "点选":
                        this.axRenderControl1.InteractMode = gviInteractMode.gviInteractSelect;
                        break;

                    case "location1":
                        vec.Set(15415.510188040265, 35593.117437895737, 59.003287982044796);
                        ang.Set(47.7, -30.55, 0);
                        this.axRenderControl1.Camera.SetCamera(vec, ang, gviSetCameraFlags.gviSetCameraNoFlags);
                        break;

                    case "location2":
                        vec.Set(15243.39327614102, 35593.454101290568, 19.083291340718386);
                        ang.Set(-37.01, -15.27, 0);
                        this.axRenderControl1.Camera.SetCamera(vec, ang, gviSetCameraFlags.gviSetCameraNoFlags);
                        break;

                    case "location3":
                        vec.Set(15150.53692901546, 35785.206458874149, 21.492597977763278);
                        ang.Set(-136.66, -19.68, 0);
                        this.axRenderControl1.Camera.SetCamera(vec, ang, gviSetCameraFlags.gviSetCameraNoFlags);
                        break;

                    case "location4":
                        vec.Set(15562.369345366114, 36027.787538479148, 9.5395100144668721);
                        ang.Set(-98.11, -5.3, 0);
                        this.axRenderControl1.Camera.SetCamera(vec, ang, gviSetCameraFlags.gviSetCameraNoFlags);
                        break;

                    case "location5":
                        vec.Set(15290.261360847539, 35689.443985629681, 25.558723498791508);
                        ang.Set(-34.53, -34.98, 0);
                        this.axRenderControl1.Camera.SetCamera(vec, ang, gviSetCameraFlags.gviSetCameraNoFlags);
                        break;

                    case "SunShine":
                        this.axRenderControl1.ObjectManager.GetSkyBox(0).Weather = gviWeatherType.gviWeatherSunShine;
                        imgbtn1.IsVisible = false;
                        imgbtn2.IsVisible = false;
                        imgbtn3.IsVisible = false;
                        break;

                    case "HeavyRain":
                        this.axRenderControl1.ObjectManager.GetSkyBox(0).Weather = gviWeatherType.gviWeatherHeavyRain;
                        imgbtn1.IsVisible = false;
                        imgbtn2.IsVisible = false;
                        imgbtn3.IsVisible = false;
                        break;

                    case "HeavySnow":
                        this.axRenderControl1.ObjectManager.GetSkyBox(0).Weather = gviWeatherType.gviWeatherHeavySnow;
                        imgbtn1.IsVisible = false;
                        imgbtn2.IsVisible = false;
                        imgbtn3.IsVisible = false;
                        break;
                    }
                }
                else if (winType == gviUIWindowType.gviUITextButton)
                {
                    switch (args.UIEventWindow.Name)
                    {
                    case "SunShine":
                        this.axRenderControl1.ObjectManager.GetSkyBox(0).Weather = gviWeatherType.gviWeatherSunShine;
                        imgbtn1.IsVisible = false;
                        imgbtn2.IsVisible = false;
                        imgbtn3.IsVisible = false;
                        break;

                    case "HeavyRain":
                        this.axRenderControl1.ObjectManager.GetSkyBox(0).Weather = gviWeatherType.gviWeatherHeavyRain;
                        imgbtn1.IsVisible = false;
                        imgbtn2.IsVisible = false;
                        imgbtn3.IsVisible = false;
                        break;

                    case "HeavySnow":
                        this.axRenderControl1.ObjectManager.GetSkyBox(0).Weather = gviWeatherType.gviWeatherHeavySnow;
                        imgbtn1.IsVisible = false;
                        imgbtn2.IsVisible = false;
                        imgbtn3.IsVisible = false;
                        break;
                    }
                }
            }
            else if (EventType == gviUIEventType.gviUIMouseEntersArea)
            {
                gviUIWindowType winType = args.UIEventWindow.Type;
                if (winType == gviUIWindowType.gviUIImageButton)
                {
                    switch (args.UIEventWindow.Name)
                    {
                    case "天气":
                        imgbtn1.IsVisible = true;
                        imgbtn2.IsVisible = true;
                        imgbtn3.IsVisible = true;
                        break;
                    }
                }
            }
            //else if (EventType == gviUIEventType.gviUIMouseLeavesArea)
            //{
            //    gviUIWindowType winType = args.UIEventWindow.Type;
            //    if (winType == gviUIWindowType.gviUIImageButton)
            //    {
            //        switch (args.UIEventWindow.Name)
            //        {
            //            case "天气":
            //                imgbtn1.IsVisible = false;
            //                imgbtn2.IsVisible = false;
            //                imgbtn3.IsVisible = false;
            //                break;
            //        }
            //    }
            //}
        }