示例#1
0
        private void trackZoom_ValueChanged(object sender, EventArgs e)
        {
            IPosition66 ipos = sgworld.Window.CenterPixelToWorld().Position;
            double      x, y, z, dir;
            //var cPos = sgworld.Navigate.GetPosition(AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE);
            double       meters;
            double       dist;
            CRailwayLine crwline = gRWScene.mMiddleLines.getMeterbyPos(marker.Position.Lng, marker.Position.Lat, out meters, out dist);

            gRWScene.mMiddleLines.getPosbyDKCode(crwline.mDKCode, meters, out x, out y, out z, out dir);
            double dis = Math.Pow(10, trackZoom.Value + 1);

            if (trackZoom.Value == 5)
            {
                dis = dis / 2;
            }
            IPosition66 dPos = sgworld.Creator.CreatePosition(x, y, 0, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, dir, -70, 0, dis);

            //CRailwayScene.mMiddleLine.findNearestPos(cPos);
            sgworld.Navigate.FlyTo(dPos);

            //double t = (double)(trackZoom.Value - trackZoom.Minimum) / (trackZoom.Maximum - trackZoom.Minimum);

            //int t2 = (int)((eTime.DayOfYear - sTime.DayOfYear) * t);
            //DateTime dt = sTime.AddDays(t2);
            //trackZoom.Tooltip = dt.ToString();

            //sgworld.DateTime.Current = dt;
            //trackZoom.ShowToolTip();
        }
示例#2
0
        //private void buildProjectTree()
        //{
        //    TreeNode root = treeView1.Nodes.Add("蒙内铁路");
        //    root.Checked = true;
        //    TreeNode tn, leaf;
        //    root.Tag = null;

        //    tn = root.Nodes.Add("火车");
        //    tn.Checked = false;
        //    tn.ImageIndex = 6;
        //    if (CRailwayScene.mRoadList.Count > 0)
        //    {
        //        tn = root.Nodes.Add("路基");
        //        tn.Checked = true;
        //        tn.ImageIndex = 1;
        //        foreach (CRailwayProject p in CRailwayScene.mRoadList)
        //        {
        //            leaf = tn.Nodes.Add(p.mProjectName);
        //            leaf.Tag = p;
        //            leaf.ImageIndex = 1;
        //        }
        //        tn = root.Nodes.Add("桥梁");
        //        tn.Checked = true;
        //        tn.ImageIndex = 2;
        //        foreach (CRailwayProject p in CRailwayScene.mBridgeList)
        //        {
        //            leaf = tn.Nodes.Add(p.mProjectName);
        //            leaf.Tag = p;
        //            leaf.ImageIndex = 2;
        //        }
        //        tn = root.Nodes.Add("涵洞");
        //        tn.Checked = true;
        //        tn.ImageIndex = 3;
        //        foreach (CRailwayProject p in CRailwayScene.mTunnelList)
        //        {
        //            leaf = tn.Nodes.Add(p.mProjectName);
        //            leaf.Tag = p;
        //            leaf.ImageIndex = 3;
        //        }
        //        tn = root.Nodes.Add("车站工程");
        //        tn.Checked = true;
        //        tn.ImageIndex = 4;
        //        foreach (CRailwayProject p in CRailwayScene.mStationList)
        //        {
        //            leaf = tn.Nodes.Add(p.mProjectName);
        //            leaf.Tag = p;
        //            leaf.ImageIndex = 4;
        //        }
        //        tn = root.Nodes.Add("其他");
        //        tn.Checked = false;
        //        tn.ImageIndex = 5;
        //        foreach (CRailwayProject p in CRailwayScene.mOtherList)
        //        {
        //            leaf = tn.Nodes.Add(p.mProjectName);
        //            leaf.Tag = p;
        //            leaf.ImageIndex = 5;
        //        }


        //    }

        //}


        private void timerSyncronize_Tick(object sender, EventArgs e)
        {
            try
            {
                IPosition66          wp     = sgworld.Window.CenterPixelToWorld().Position;
                GMap.NET.PointLatLng LatLng = marker.Position;
                LatLng.Lat      = wp.Y;
                LatLng.Lng      = wp.X;
                marker.Position = LatLng;

                LatLng               = markerTrain.Position;
                LatLng.Lat           = GlobalVar.gScene.mDynamicTrain.Position.Y;
                LatLng.Lng           = GlobalVar.gScene.mDynamicTrain.Position.X;
                markerTrain.Position = LatLng;
                if (isFlying)
                {
                    flyingTick++;
                    if (flyingTick % 100 == 0)
                    {
                        sgworld.Navigate.FlyTo(GlobalVar.gScene.mDynamicTrain, nextFLyCode());
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Train is not ready");
            }
        }
示例#3
0
        public void Draw(ref SGWorld66 sgworld)
        {
            //绘制身:暂时用小圆点替代钻孔口模型
            double radius         = 10;
            var    Style          = SphereStyle.SPHERE_NORMAL;
            var    nLineColor     = 0xFF00FF00;
            var    nFillColor     = 0xFF646464;
            var    SegmentDensity = -1;
            string gid            = CreateGroup("地质点", ref sgworld);

            sgworld.ProjectTree.ExpandGroup(gid, true);
            IPosition66 cPos = sgworld.Creator.CreatePosition(Top.X, Top.Y, Top.Z, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE);

            SkylineBodyObj = sgworld.Creator.CreateSphere(cPos, radius, Style, nLineColor, nFillColor, SegmentDensity, gid, Name);

            //绘制旗子
            var imageFileName = Path.Combine(Directory.GetCurrentDirectory(), "flag.png");

            SkylineMouthObj = sgworld.Creator.CreateImageLabel(cPos, imageFileName, null,
                                                               sgworld.ProjectTree.HiddenGroupID);



            //绘制文字标签
            var cLabelStyle = sgworld.Creator.CreateLabelStyle();

            cLabelStyle.MultilineJustification = "Center";
            cLabelStyle.LineColor     = sgworld.Creator.CreateColor(0, 0, 0, 255);
            cLabelStyle.TextColor     = sgworld.Creator.CreateColor(0, 0, 0, 0);
            cLabelStyle.TextAlignment = "Bottom, Center";
            SkylineLabelObj           = sgworld.Creator.CreateTextLabel(cPos, Name, cLabelStyle, sgworld.ProjectTree.HiddenGroupID, Name);

            RecordLabelSkyId();
        }
示例#4
0
        /// <summary>
        /// 绘制边坡(需要用边坡模型)
        /// </summary>
        /// <param name="sgworld"></param>
        public void Draw(ref SGWorld66 sgworld, IObjData dataObj, double xOffset = 0.0, double yOffset = 0.0)
        {
            string signIsInTerrain = IsLoggingObjInTerrain(ref sgworld) ? "" : "【地图以外】";

            //绘制孔口:暂时用小圆点替代钻孔口模型
            double radius         = 10;
            var    Style          = SphereStyle.SPHERE_NORMAL;
            var    nLineColor     = 0xFF00FF00;
            var    nFillColor     = 0xFF646464;
            var    SegmentDensity = -1;
            string gid            = CreateGroup("边坡", ref sgworld);

            sgworld.ProjectTree.ExpandGroup(gid, true);

            // 在地面创建边坡中心点的坐标
            double centerX = (dataObj.Points.GetPoint(0).X +
                              dataObj.Points.GetPoint(1).X +
                              dataObj.Points.GetPoint(2).X) / 3;
            double centerY = (dataObj.Points.GetPoint(0).Y +
                              dataObj.Points.GetPoint(1).Y +
                              dataObj.Points.GetPoint(2).Y) / 3;
            IPosition66 cPos = sgworld.Creator.CreatePosition(
                centerX,
                centerY,
                0,
                AltitudeTypeCode.ATC_TERRAIN_RELATIVE);

            // 创建标记物
            SkylineMouthObj = sgworld.Creator.CreateSphere(
                cPos,
                radius,
                Style,
                nLineColor,
                nFillColor,
                SegmentDensity,
                gid,
                Name + signIsInTerrain);

            //绘制孔身
            //var arrVertices = new double[]
            //{
            //    Top.X, Top.Y, Top.Z,
            //    Bottom.X, Bottom.Y, Bottom.Z
            //};
            //var lineColor = sgworld.Creator.CreateColor(255, 0, 0, 128);
            //SkylineBodyObj = sgworld.Creator.CreatePolylineFromArray(arrVertices, lineColor, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE,
            //    sgworld.ProjectTree.HiddenGroupID, Name);


            //绘制文字标签
            var cLabelStyle = sgworld.Creator.CreateLabelStyle();

            cLabelStyle.MultilineJustification = "Center";
            cLabelStyle.LineColor     = sgworld.Creator.CreateColor(0, 0, 0, 255);
            cLabelStyle.TextColor     = sgworld.Creator.CreateColor(0, 0, 0, 0);
            cLabelStyle.TextAlignment = "Bottom, Center";
            SkylineLabelObj           = sgworld.Creator.CreateTextLabel(cPos, Name, cLabelStyle, sgworld.ProjectTree.HiddenGroupID, Name);

            RecordLabelSkyId();
        }
示例#5
0
        private void timerSyncronize_Tick(object sender, EventArgs e)
        {
            try
            {
                IPosition66          wp     = sgworld.Window.CenterPixelToWorld().Position;
                GMap.NET.PointLatLng LatLng = marker.Position;
                LatLng.Lat      = wp.Y;
                LatLng.Lng      = wp.X;
                marker.Position = LatLng;

                //LatLng = markerTrain.Position;
                //LatLng.Lat = GlobalVar.gScene.mDynamicTrain.Position.Y;
                //LatLng.Lng = GlobalVar.gScene.mDynamicTrain.Position.X;
                //markerTrain.Position = LatLng;
                //if (isFlying)
                //{
                //    flyingTick++;
                //    if (flyingTick % 100 == 0)
                //sgworld.Navigate.FlyTo(GlobalVar.gScene.mDynamicTrain, nextFLyCode());
                //}


                if (trainBack)
                {
                    sgworld.Creator.DeleteObject(mDynamicTrain.ID);
                    mDynamicTrain = sgworld.Creator.CreateDynamicObject(0, DynamicMotionStyle.MOTION_MANUAL, DynamicObjectType.DYNAMIC_3D_MODEL,
                                                                        fileName, 0.25, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, string.Empty, "Train");//创建对象

                    double[] x, y, z, d;
                    int      n;

                    n = gRWScene.mMiddleLines.getSubLineByDKCode(gRWScene.mProjectList[0].Mileage_Start_Discription, gRWScene.mProjectList[1].Mileage_Start_Discription, 70, out x, out y, out z, out d);
                    if (n > 0)
                    {
                        for (int i = 200; i < 500; i++) //CRailwayScene.mMiddleLine.mPointNum 将一个工点上所有点addWaypoint
                        {
                            if (d[i] > 180)
                            {
                                d[i] = d[i] - 180;
                            }
                            mDynamicTrain.Waypoints.AddWaypoint(sgworld.Creator.CreateRouteWaypoint(x[i], y[i], z[i], 300, d[i]));
                        }
                    }
                    mDynamicTrain.CircularRoute = false;
                    sgworld.Navigate.FlyTo(mDynamicTrain);
                    trainBack = false;
                    //trainFly = true;
                }

                if (trainFly)
                {
                    trainFly = false;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Train is not ready");
            }
        }
示例#6
0
        void btnRotate_Click(object sender, EventArgs e)
        {
            //var sgworld = new SGWorld66();
            IPosition66 resPos = sgworld.Navigate.GetPosition(AltitudeTypeCode.ATC_TERRAIN_RELATIVE);;

            resPos = sgworld.Creator.CreatePosition(resPos.X, resPos.Y, 0, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, resPos.Yaw + 5, resPos.Pitch, resPos.Roll, 1500);//resPos.Altitude
            sgworld.Navigate.FlyTo(resPos);
        }
示例#7
0
 bool OnLButtonUp(int Flags, int X, int Y)
 {
     mCurPos = sgworld.Window.PixelToWorld(X, Y).Position;
     //GlobalVar.gCurPos = sgworld.Navigate.GetPosition(AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE);
     GMap.NET.PointLatLng LatLng = marker.Position;
     LatLng.Lat      = mCurPos.Y;
     LatLng.Lng      = mCurPos.X;
     marker.Position = LatLng;
     //wp.Distance
     return(false);
 }
示例#8
0
        /// <summary>
        /// 绘制平硐洞口
        /// </summary>
        /// <param name="sgworld"></param>
        public void Draw(ref SGWorld66 sgworld, double xOffset = 0.0, double yOffset = 0.0)
        {
            string signIsInTerrain = IsLoggingObjInTerrain(ref sgworld) ? "" : "【地图以外】";
            //硐口
            double radius         = 10;
            var    Style          = SphereStyle.SPHERE_NORMAL;
            var    nLineColor     = 0xFF00FF00;
            var    nFillColor     = 0xFF64FF64;
            var    SegmentDensity = -1;
            string gid            = CreateGroup("硐探", ref sgworld);

            sgworld.ProjectTree.ExpandGroup(gid, true);
            IPosition66 cPos = sgworld.Creator.CreatePosition(
                Top.X + xOffset,
                Top.Y + yOffset,
                Top.Z,
                AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE);

            SkylineMouthObj = sgworld.Creator.CreateSphere(
                cPos,
                radius,
                Style,
                nLineColor,
                nFillColor,
                SegmentDensity,
                gid,
                Name + signIsInTerrain);

            //硐身
            List <double> ListVertices = new List <double>();

            foreach (var point in Links)
            {
                ListVertices.Add(point.X);
                ListVertices.Add(point.Y);
                ListVertices.Add(point.Z);
            }
            var lineColor = sgworld.Creator.CreateColor(255, 0, 0, 128);

            SkylineBodyObj = sgworld.Creator.CreatePolylineFromArray(ListVertices.ToArray(), lineColor, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE,
                                                                     sgworld.ProjectTree.HiddenGroupID, Name);

            //标签
            var cLabelStyle = sgworld.Creator.CreateLabelStyle();

            cLabelStyle.MultilineJustification = "Center";
            cLabelStyle.LineColor     = sgworld.Creator.CreateColor(0, 0, 0, 255);
            cLabelStyle.TextColor     = sgworld.Creator.CreateColor(0, 0, 0, 0);
            cLabelStyle.TextAlignment = "Bottom, Center";
            SkylineLabelObj           = sgworld.Creator.CreateTextLabel(cPos, Name, cLabelStyle, sgworld.ProjectTree.HiddenGroupID, Name);


            RecordLabelSkyId();
        }
示例#9
0
        /// <summary>
        /// 绘制钻孔孔口(需要用钻孔口模型)
        /// </summary>
        /// <param name="sgworld"></param>
        public void Draw(ref SGWorld66 sgworld, double xOffset = 0.0, double yOffset = 0.0)
        {
            string signIsInTerrain = IsLoggingObjInTerrain(ref sgworld) ? "" : "【地图以外】";

            //绘制孔口:暂时用小圆点替代钻孔口模型
            double radius         = 10;
            var    Style          = SphereStyle.SPHERE_NORMAL;
            var    nLineColor     = 0xFF00FF00;
            var    nFillColor     = 0xFF646464;
            var    SegmentDensity = -1;
            string gid            = CreateGroup("钻探", ref sgworld);

            sgworld.ProjectTree.ExpandGroup(gid, true);
            IPosition66 cPos = sgworld.Creator.CreatePosition(
                Top.X + xOffset,
                Top.Y + yOffset,
                Top.Z,
                AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE);

            SkylineMouthObj = sgworld.Creator.CreateSphere(
                cPos,
                radius,
                Style,
                nLineColor,
                nFillColor,
                SegmentDensity,
                gid,
                Name + signIsInTerrain);

            //绘制孔身
            var arrVertices = new double[]
            {
                Top.X, Top.Y, Top.Z,
                Bottom.X, Bottom.Y, Bottom.Z
            };
            var lineColor = sgworld.Creator.CreateColor(255, 0, 0, 128);

            SkylineBodyObj = sgworld.Creator.CreatePolylineFromArray(arrVertices, lineColor, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE,
                                                                     sgworld.ProjectTree.HiddenGroupID, Name);


            //绘制文字标签
            var cLabelStyle = sgworld.Creator.CreateLabelStyle();

            cLabelStyle.MultilineJustification = "Center";
            cLabelStyle.LineColor     = sgworld.Creator.CreateColor(0, 0, 0, 255);
            cLabelStyle.TextColor     = sgworld.Creator.CreateColor(0, 0, 0, 0);
            cLabelStyle.TextAlignment = "Bottom, Center";
            SkylineLabelObj           = sgworld.Creator.CreateTextLabel(cPos, Name, cLabelStyle, sgworld.ProjectTree.HiddenGroupID, Name);

            RecordLabelSkyId();
        }
示例#10
0
        private void gMapControl1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            marker.Position = gMapControl1.FromLocalToLatLng(e.X, e.Y);
            double x, y, z, dir;
            //var cPos = sgworld.Navigate.GetPosition(AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE);
            double meters = CRailwayScene.mMiddleLine.findMeterbyCoor(marker.Position.Lng, marker.Position.Lat);

            CRailwayScene.mMiddleLine.findPosbyMeter(meters, out x, out y, out z, out dir);
            IPosition66 dPos = sgworld.Creator.CreatePosition(x, y, z, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, dir, -70, 0, 1500);

            //CRailwayScene.mMiddleLine.findNearestPos(cPos);
            sgworld.Navigate.FlyTo(dPos);
        }
示例#11
0
        /// <summary>
        /// 创建图片标签
        /// </summary>
        private void CreateImageLabel()
        {
            IPosition66 cPos          = CreatePosition();
            string      imageFileName = @"F:\项目管理\智慧抚州\使用的Fly\data11\汽车图标\汽车整车.png";
            var         imageLabel    = this.sgWorld.Creator.CreateImageLabel(cPos, imageFileName, null, "", "1");

            imageLabel.set_ClientData("id", "1");
            imageLabel.SetParam(1, "汽车整车");
            var cFlyToPos = cPos.Copy();

            cFlyToPos.Pitch = -89.0;
            this.sgWorld.Navigate.FlyTo(cFlyToPos, ActionCode.AC_FLYTO);
        }
示例#12
0
        public override void Draw(ref SGWorld66 sgworld)
        {
            base.Draw(ref sgworld);

            //画小圆点表示(待改正)
            double      radius         = 8.0;
            var         Style          = SphereStyle.SPHERE_NORMAL;
            var         nLineColor     = 0xFFFF0000;
            var         nFillColor     = 0xFFFF6464;
            var         SegmentDensity = -1;
            string      gid            = GeoHelper.CreateGroup("地质点", ref sgworld);
            IPosition66 cPos           = sgworld.Creator.CreatePosition(X, Y, Z, AltitudeTypeCode.ATC_ON_TERRAIN);
            var         item           = sgworld.Creator.CreateSphere(cPos, radius, Style, nLineColor, nFillColor, SegmentDensity, gid, Name);

            //获取Skyline中的ID
            SetSkylineObj(item);
        }
示例#13
0
        public CTECons(ConsLocation cl, CRailwayScene s, CTEScene ss)
            : base(s, ss)
        {
            sgworld = new SGWorld66();
            consLoc = cl;
            IPosition66 p = sgworld.Creator.CreatePosition(cl.Longitude, cl.Latitude, 30, AltitudeTypeCode.ATC_TERRAIN_RELATIVE,
                                                           0, -90.0, 0, 0);

            circlePeople = sgworld.Creator.CreateCircle(p, cl.Number * 2 + 200, 0xFF0000FF, 0x00FF00FF, mGroupIDDynamic, cl.ProjName + cl.Number);
            //  circle.de
            circlePeople.LineStyle.Width = -3.0;
            circlePeople.Visibility.MinVisibilityDistance = 2000;
            //circle.SetParam

            labelSign = sgworld.Creator.CreateLabel(p, cl.Number + "", CGisDataSettings.gDataPath + @"Common\Textures\working.gif", CRWTEStandard.mLabelStyleL2, mGroupIDDynamic, "Con|" + cl.ProjName);
            //labelSign.Message.MessageID = sgworld.Creator.CreateMessage(MsgTargetPosition.MTP_POPUP, cl.ToString(), MsgType.TYPE_TEXT, true).ID;
        }
示例#14
0
        public void stopPresentation()
        {
            if (isOnOneWay)
            {
                isOnOneWay = false;
                clearTrain();
                mPresentation.Stop();
                //sgworld.OnObjectAction -= Sgworld_OnObjectAction;
            }
            else
            {
                interruptViewTEObject(); // 关掉展示窗口或者停止presentation
            }
            IPosition66 resPos = sgworld.Navigate.GetPosition(AltitudeTypeCode.ATC_TERRAIN_RELATIVE);

            resPos = sgworld.Creator.CreatePosition(resPos.X, resPos.Y, 0, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, resPos.Yaw, resPos.Pitch, resPos.Roll, 1500);//resPos.Altitude
            sgworld.Navigate.FlyTo(resPos);
        }
示例#15
0
        void OnProjectLoadFinished(bool bSuccess)
        {
            mCurPos = sgworld.Creator.CreatePosition(118.6, 36.6, 0, AltitudeTypeCode.ATC_TERRAIN_RELATIVE,
                                                     341, -90.0, 0, 445000);
            //Camera.initial_latitude, Camera.initial_longitude, Camera.initial_heading, Camera., Camera.initial_tilt
            sgworld.Navigate.FlyTo(mCurPos, ActionCode.AC_FLYTO);
            if (mTEScene == null)
            {
                mTEScene = new CTEScene(gRWScene);
            }
            mTEScene.createProjectTree();



            // mTEScene = new CTEScene()
            //GlobalVar.gScene.createProjectTree();
            timerSyncronize.Start();
        }
示例#16
0
 public void mNavTrain_OnFlyTo()
 {
     mNavIndex++;
     if (mNavIndex < gRWScene.mHotSpotList.Count)
     {
         Console.WriteLine(gRWScene.mHotSpotList.Count + " Index " + mNavIndex);
         IPosition66 resPos = sgworld.Navigate.GetPosition(AltitudeTypeCode.ATC_TERRAIN_RELATIVE);
         resPos = sgworld.Creator.CreatePosition(gRWScene.mHotSpotList[mNavIndex].CenterLongitude, gRWScene.mHotSpotList[mNavIndex].CenterLatitude, 0, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, resPos.Yaw + 5, resPos.Pitch, resPos.Roll, 1500);//resPos.Altitude
         sgworld.Navigate.FlyTo(resPos, ActionCode.AC_ARCPATTERN);
         //sgworld.Navigate.FlyTo(sgworld.Creator.CreatePosition(gRWScene.mHotSpotList[mNavIndex].CenterLongitude, gRWScene.mHotSpotList[mNavIndex].CenterLatitude, 800, AltitudeTypeCode.ATC_TERRAIN_RELATIVE,0,0,-90,0), ActionCode.AC_FOLLOWABOVE);
         timerNav.Start();
     }
     else
     {
         timerNav.Stop();
         Console.WriteLine("end jounrey" + mNavIndex);
     }
 }
示例#17
0
        /// <summary>
        /// 创建圆
        /// </summary>
        private void CreateCircle()
        {
            string      msg                   = string.Empty;
            IPosition66 cPos                  = null;
            IColor66    cFillColor            = null;
            ITerrainRegularPolygon66 cCircle  = null;
            ITerraExplorerMessage66  cMessage = null;

            try
            {
                cPos = CreatePosition();

                uint   nLineColor    = 0xFFFF0000;
                double dCircleRadius = 200;

                cCircle = this.sgWorld.Creator.CreateCircle(cPos, dCircleRadius, nLineColor, cFillColor, string.Empty, "Circle");

                double dNewCircleRadius     = 300;
                double dCurrentCircleRadius = cCircle.Radius;
                cCircle.Radius = dNewCircleRadius;
                uint   nRGB_Red   = 0xFF0000;
                double dAlpha     = 0.2;
                var    cFillStyle = cCircle.FillStyle;
                cFillStyle.Color.FromRGBColor(nRGB_Red);
                cFillStyle.Color.SetAlpha(dAlpha);

                MsgTargetPosition eMsgTarget = MsgTargetPosition.MTP_POPUP;
                string            tMessage   = "Hello Circle";
                MsgType           eMsgType   = MsgType.TYPE_TEXT;
                bool bIsBringToFront         = true;

                cMessage = this.sgWorld.Creator.CreateMessage(eMsgTarget, tMessage, eMsgType, bIsBringToFront);
                cCircle.Message.MessageID = cMessage.ID;

                var cFlyToPos = cPos.Copy();
                cFlyToPos.Pitch = -89.0;
                this.sgWorld.Navigate.FlyTo(cFlyToPos, ActionCode.AC_FLYTO);
            }
            catch (Exception ex)
            {
                msg = String.Format("CreateCircleButton_Click Exception: {0}", ex.Message);
                MessageBox.Show(msg);
            }
        }
示例#18
0
文件: CTEKML.cs 项目: xuyanning/JQGis
        public override void TECreate()
        {
            var sgworld = new SGWorld66();

            if (string.IsNullOrEmpty(mGroupIDStatic))
            {
                mGroupIDStatic = sgworld.ProjectTree.CreateGroup("KML");
            }
            ILabelStyle66 cLabelStyle = mTEStandard.mLabelStyleL3;

            //= sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_DEFAULT);

            //{
            //    uint nBGRValue = 0xFF0000;  // Blue
            //    double dAlpha = 0.5;        // 50% opacity
            //    var cBackgroundColor = cLabelStyle.BackgroundColor; // Get label style background color
            //    cBackgroundColor.FromBGRColor(nBGRValue);               // Set background to blue
            //    cBackgroundColor.SetAlpha(dAlpha);                      // Set transparency to 50%
            //    cLabelStyle.BackgroundColor = cBackgroundColor;         // Set label style background color
            //    cLabelStyle.FontName = "Arial";                         // Set font name to Arial
            //    cLabelStyle.Italic = true;                              // Set label style font to italic
            //    cLabelStyle.Scale = 3;                                  // Set label style scale
            //    cLabelStyle.TextOnImage = false;
            //}

            foreach (CRailwayLine rl in mSceneData.mMiddleLines.mLineList)
            {
                double[] x, y, z, w;
                int[]    f;
                int      num;
                num = rl.getKML(true, out x, out y, out z, out w, out f);
                for (int i = 0; i < num; i++)
                {
                    IPosition66 cp = sgworld.Creator.CreatePosition(x[i], y[i], z[i] + 1, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, w[i]);
                    sgworld.Creator.CreateTextLabel(cp, f[i] + "", cLabelStyle, mGroupIDStatic, rl.mDKCode + f[i]);
                }
            }
            //for (int i = 0; i < mSceneData.mMiddleLines.mPointNum; i += 100)
            //{
            //
            //}
        }
示例#19
0
        public CTEFirm(CRailwayFirm f, CRailwayScene s, CTEScene ss)
            : base(s, ss)
        {
            firm    = f;
            sgworld = new SGWorld66();
            if (!string.IsNullOrEmpty(firm.mPresentation))
            {
                var id = sgworld.ProjectTree.FindItem("\\Presentation\\" + firm.mPresentation);
                mPresentation = (IPresentation66)(sgworld.ProjectTree.GetObject(id));

                //if (CGisDataSettings.AppSpeed <= 2)
                //    mPresentation.PlaySpeedFactor = PresentationPlaySpeed.PPS_VERYSLOW;
                //else if (CGisDataSettings.AppSpeed < 5)
                //    mPresentation.PlaySpeedFactor = PresentationPlaySpeed.PPS_SLOW;
                //else if (CGisDataSettings.AppSpeed < 7)
                //    mPresentation.PlaySpeedFactor = PresentationPlaySpeed.PPS_NORMAL;
                //else if (CGisDataSettings.AppSpeed < 9)
                //    mPresentation.PlaySpeedFactor = PresentationPlaySpeed.PPS_FAST;
                //else
                //    mPresentation.PlaySpeedFactor = PresentationPlaySpeed.PPS_VERYFAST;
            }

            ILabelStyle66 cLabelStyle;
            IPosition66   cp = sgworld.Creator.CreatePosition(f.CenterLongitude, f.CenterLatitude, 0, AltitudeTypeCode.ATC_TERRAIN_RELATIVE);

            circlePeople = sgworld.Creator.CreateCircle(cp, f.NumStaff * 2 + 200, 0xFFFFFFFF, 0x00FF00FF, mGroupIDStatic, f.FirmName + " " + f.NumStaff);
            circlePeople.LineStyle.Width = -3.0;
            circlePeople.Visibility.MinVisibilityDistance = 5000;

            if (f.FirmType.Equals("制梁场") || f.FirmType.Equals("项目部") || f.FirmType.Equals("监理单位"))
            {
                cLabelStyle = CRWTEStandard.mLabelStyleL2;
            }
            else
            {
                cLabelStyle = CRWTEStandard.mLabelStyleL1;
            }
            labelSign = sgworld.Creator.CreateLabel(cp, f.FirmName, CGisDataSettings.gDataPath + @"Common\地标图片\" + f.mLabelImage, cLabelStyle, mGroupIDStatic, "Fir|" + f.FirmName);
            labelSign.Message.MessageID = sgworld.Creator.CreateMessage(MsgTargetPosition.MTP_POPUP, f.ToString(), MsgType.TYPE_TEXT, true).ID;
        }
示例#20
0
        /// <summary>
        /// 创建TextLabel
        /// </summary>
        private void CreateLabel()
        {
            string               msg         = String.Empty;
            IPosition66          cPos        = null;
            ILabelStyle66        cLabelStyle = null;
            ITerrainImageLabel66 cTextLabel  = null;

            try
            {
                cPos = CreatePosition();

                SGLabelStyle eLabelStyle = SGLabelStyle.LS_DEFAULT;
                cLabelStyle = this.sgWorld.Creator.CreateLabelStyle(eLabelStyle);

                uint   nBGRValue        = 0xFF0000;                    // Blue
                double dAlpha           = 0.5;                         // 50% opacity
                var    cBackgroundColor = cLabelStyle.BackgroundColor; // Get label style background color
                cBackgroundColor.FromBGRColor(nBGRValue);              // Set background to blue
                cBackgroundColor.SetAlpha(dAlpha);                     // Set transparency to 50%
                cLabelStyle.BackgroundColor = cBackgroundColor;        // Set label style background color
                cLabelStyle.FontName        = "Arial";                 // Set font name to Arial
                cLabelStyle.Italic          = true;                    // Set label style font to italic
                cLabelStyle.Scale           = 3;                       // Set label style scale

                string tText = "Skyline";
                cTextLabel = this.sgWorld.Creator.CreateTextLabel(cPos, tText, cLabelStyle, string.Empty, "TextLabel");

                //FlyTo text label
                var cFlyToPos = cPos.Copy();
                cFlyToPos.Pitch = -89.0;
                this.sgWorld.Navigate.FlyTo(cFlyToPos, ActionCode.AC_FLYTO);
            }
            catch (Exception ex)
            {
                msg = String.Format("CreateLabelButton_Click Exception: {0}", ex.Message);
                MessageBox.Show(msg);
            }
        }
示例#21
0
        private void menuSG_ItemClick(object sender, EventArgs e)
        {
            RadialMenuItem item = sender as RadialMenuItem;

            if (item != null && !string.IsNullOrEmpty(item.Text))
            {
                switch (item.Text)
                {
                case "FlyAround":
                    //var cPos = sgworld.Navigate.GetPosition(AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE);
                    IPosition66 cPos = CRailwayScene.mMiddleLine.findNearestPos();
                    this.menuSG.Visible = false;
                    //CRailwayScene.mMiddleLine.findPosbyMeter(meters, out x, out y, out z, out dir);
                    sgworld.Navigate.FlyTo(cPos, ActionCode.AC_ARCPATTERN);
                    break;

                case "NextPro":

                    break;
                }
                //MessageBox.Show(string.Format("{0} Menu item clicked: {1}\r\n", DateTime.Now, item.Text));
            }
        }
示例#22
0
        void OnProjectLoadFinished(bool bSuccess)
        {
            mInitialPosition = sgworld.Creator.CreatePosition(118.6, 36.6, 0, AltitudeTypeCode.ATC_TERRAIN_RELATIVE,
                                                              341, -90.0, 0, 445000);
            //Camera.initial_latitude, Camera.initial_longitude, Camera.initial_heading, Camera., Camera.initial_tilt
            sgworld.Navigate.FlyTo(mInitialPosition, ActionCode.AC_FLYTO);
            if (mTEScene == null)
            {
                mTEScene = new CTEScene(gRWScene, timerFlyaround);
            }
            //mTEScene.ShowFinished += MTEScene_ShowFinished;
            //mTEScene.createProjectTree();

            //sgworld.OnMouseWheel += new _ISGWorld66Events_OnMouseWheelEventHandler(OnMouseWheel);
            //sgworld.OnProjectTreeAction += new _ISGWorld66Events_OnProjectTreeActionEventHandler(OnProjectTreeAction);

            //sgworld.OnLButtonUp += OnLButtonUp;
            //sgworld.OnRButtonUp += sgworld_OnRButtonUp;
            //sgworld.OnDateTimeChanged += sgworld_OnDateTimeChanged;
            //sgworld.OnSGWorldMessage += sgworld_OnSGWorldMessage;
            //sgworld.OnObjectAction += sgworld_OnObjectAction;
            //sgworld.OnDrawHUD += sgworld_OnDrawHUD;
            timer2DSyncronize.Start();

            mNavigatioinList = gRWScene.GetDefaultNavPathByMileage();
            //curNavList.RemoveAt(0); // FIXME
            //mNavigatioinList.AddRange( gRWScene.GetContBeamNavPath());
            //mNavigatioinList = gRWScene.GetContBeamNavPath();
            mNavigationControl = new CTEPresentation(gRWScene, mTEScene, m2DProgressPanel, panelInfo1, timerFlyaround, mNavigatioinList);//,timerPresentation

            //mNavigationControl.OnToOnePlace += nav_ToOnePlace;
            //sgworld.OnPresentationFlyToReachedDestination += Sgworld_OnPresentationFlyToReachedDestination;

            //mContbeamNav.startPresentation();
            //auto_Nav(ls);
        }
示例#23
0
        // 刷新2D形象进度面板
        private void timer2DSynchronize_Tick(object sender, EventArgs e)
        {
            try
            {
                bool        isInside = true;
                IPosition66 cp       = sgworld.Window.CenterPixelToWorld().Position;// 检测屏幕中心经纬度
                centerX = cp.X;
                centerY = cp.Y;
                if (centerX < 115 || centerX > 125 || centerY < 32 || centerY > 40)
                {
                    isInside = false;
                }
                else
                {
                    isGISLoaded = true;
                }

                if (isGISLoaded && isAutoNav && mNavigationControl.readyForNext && mTEScene.prjInfoForm.ws == ShowFormStatus.eClosing)
                {
                    mTEScene.prjInfoForm.ws = ShowFormStatus.eReadyForNext;
                    mNavigationControl.startNextPresentation();
                }
                if (isGISLoaded)
                {
                    labelRoll1.Refresh();
                    //labelRoll2.Refresh();
                }

                if (!isInside)
                {
                    return;
                }

                IWorldPointInfo66 w0 = sgworld.Window.PixelToWorld(axTE3DWindow1.Size.Width - 10, axTE3DWindow1.Size.Height - 10);
                double            lx = w0.Position.X;
                double            ly = w0.Position.Y;

                double distanceOffset = CoordinateConverter.getUTMDistance(lx, ly, oldXl, oldYl);
                if (distanceOffset < 10)
                {
                    return;
                }

                oldXl = lx;
                oldYl = ly;

                double dis;
                //bool isInside;

                double mileageCenter;
                gRWScene.mMainPath.getPathMileagebyGPS(cp.X, cp.Y, out mileageCenter, out dis);
                //gRWScene.mMiddleLines.get
                mViewRadius = CoordinateConverter.getUTMDistance(cp.X, cp.Y, lx, ly);  //屏幕半径对应的实际距离
                mViewRadius = Math.Min(mViewRadius, 200000);

                if (m2DProgressPanel.Visible && !isAutoNav)  // mileageCenter >= 0 &&
                {
                    m2DProgressPanel.update2DPanel(mileageCenter, mViewRadius);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("工点状态每秒定时更新错误");
            }
        }
示例#24
0
        /// <summary>
        /// TODO 丁一明,显示聚类结果
        /// </summary>
        /// <param name="groupID"></param>
        public override void TECreate()
        {
            /* string[] usrName;
             * string[] projName;
             * string[] consDate;
             * double[] x;
             * double[] y;
             *
             * var sgworld = new SGWorld66();
             * var branch = sgworld.ProjectTree.FindItem(groupID);
             *
             * int num;
             * num = CConsLog.findLast365Cons(out usrName, out projName, out consDate, out x, out y);
             * for (int i = 0; i < num; i++)
             * {
             *   Console.WriteLine("{0} #\t: User {1}\t Project {2}\t  x {3}\t y  {4}\t  Date {5}", i, usrName[i], projName[i], x[i], y[i], consDate[i]);
             * }*/

            ///dym
            var sgworld = new SGWorld66();

            if (string.IsNullOrEmpty(mGroupIDDynamic))
            {
                mGroupIDDynamic = sgworld.ProjectTree.CreateGroup("Cons");
            }
            //var branch = sgworld.ProjectTree.FindItem(groupID);


            List <ConsLocation> ls;

            //ls = CConsLog.clusterConsByProj();
            ls = CConsLog.clusterConsFromWebByProj(mTEScene.fromDate.ToString("u"), mTEScene.toDate.ToString("u"));

            //int maxParticles = 100;
            //string imageName = "";
            //int rate = 2;
            //int shape = 0;

            //var branch = sgworld.ProjectTree.FindItem("Dying");
            //ITerrainEffect66 gParticleLabel = (ITerrainEffect66)sgworld.ProjectTree.GetObject(branch);
            //var xml = gParticleLabel.EffectXML;
            //Console.WriteLine(xml);

            //var particleText = "$$PARTICLE$$UserDefine: \r\n <?xml version='1.0' encoding='UTF-8'?> \r\n <Particle ID='Custom'>";
            //particleText += "<ParticleEmitter ID='Disc' NumParticles='130' Texture='d:\\Campfire.png'>\r\n";
            //particleText += "<Emitter Rate='13' Shape='Disc' SpeedShape='Disc' Scale='50,50,50' Speed='1,1,1' />\r\n";
            //particleText += "<Cycle Value='1' /><Sort Value='1' /><Rotation Speed='1' Time='2' Initial='0' />\r\n";
            //particleText += "<Render Value='Billboard' /><Gravity Value='0, 1, 0' /><Force Value='0' OverrideRotation='0' />\r\n";
            //particleText += "<Position Value='0, 0, 0' /><Life Value='3.06' /><Speed Value='1.41' />\r\n";
            //particleText += "<Color Value='0,0,255,255' /><Size Value='24,24' /><Drag Value='1' />\r\n";
            //particleText += "<Blend Type='' /><Fade FadeIn='0.47' FadeOut='0.65' MaxFade='0.28' /></ParticleEmitter>\r\n";
            //particleText += "</Particle>";

            //IPosition66 tp = sgworld.Creator.CreatePosition(118.086466892066, 36.9038495888797, 3, AltitudeTypeCode.ATC_TERRAIN_RELATIVE,
            //      0, -90.0, 0, 0);
            //ITerrainRegularPolygon66 tcircle = sgworld.Creator.CreateCircle(tp, 200, 0xFF0000FF, 0x00FF00FF, branch, "测试点");
            //tcircle.LineStyle.Width = -5.0;

            foreach (ConsLocation cl in ls)
            {
                IPosition66 p = sgworld.Creator.CreatePosition(cl.Longitude, cl.Latitude, 30, AltitudeTypeCode.ATC_TERRAIN_RELATIVE,
                                                               0, -90.0, 0, 0);
                ITerrainRegularPolygon66 circle = sgworld.Creator.CreateCircle(p, cl.number * 2 + 200, 0xFF0000FF, 0x00FF00FF, mGroupIDDynamic, cl.ProjName + cl.number);
                //  circle.de
                circle.LineStyle.Width = -5.0;
                circle.Visibility.MinVisibilityDistance = 100000;
                //circle.SetParam

                ITerrainLabel66 iLabel = sgworld.Creator.CreateLabel(p, cl.number + "", CGisDataSettings.gDataPath + @"Common\地标图片\worker.png", mTEStandard.mLabelStyleL2, mGroupIDDynamic, cl.ProjName);
                iLabel.Message.MessageID = sgworld.Creator.CreateMessage(MsgTargetPosition.MTP_POPUP, cl.ToString(), MsgType.TYPE_TEXT, true).ID;
                //    circle.Message.MessageID = sgworld.Creator.CreateMessage(MsgTargetPosition.MTP_POPUP, cl.ToString(), MsgType.TYPE_TEXT, true).ID;


                //particleText += "<ParticleEmitter ID='ring' NumParticles='" + maxParticles + "' Texture='" + imageName + "'>" + "\r\n" +
                //  "<Emitter Rate='" + rate + "' Shape='" + shape + "' SpeedShape='" + speedShape + "' Scale='" + scaleX + "," + scaleY + "," + scaleZ + "' Speed='" + speedX + "," + speedY + "," + speedZ + "' />" + "\r\n" + // shape:(Cone, Sphere, ShellCone, ShellSphere, Ring, Disc, Cube), scale:the size of the shape in meters,  speed:(X,Alt,Z) disform the shape like it is in radius=1.
                //  "<Cycle Value='1' />" + "\r\n" + // 0=one time , 1=loop
                //  "<Sort Value='1' />" + "\r\n" +
                //  rotationNodeConditional +

                //  "<Render Value='" + render + "' />" + "\r\n" +
                //  "<Gravity Value='" + gravityX + ", " + gravityY + ", " + gravityZ + "' />" + "\r\n" + // Gravity in X, Altitude and Z directions
                //  "<Force Value='" + force + "' OverrideRotation='" + overrideRotation + "' />" + "\r\n" + // Gravity in X, Altitude and Z directions
                //  "<Position Value='0, 0, 0' />" + "\r\n" + // doesn;t work
                //  "<Life Value='" + timeSpan + "' />" + "\r\n" + // life of each particle in seconds
                //  "<Speed Value='" + particleSpeed + "' />" + "\r\n" + // this value multiply the Emitter speed values (x,y,z)
                //  "<Color Value='20," + colorR + "," + colorG + "," + colorB + "' />" + "\r\n" +
                //  "<Size Value='" + sizeWithRatioX /*size*/ + "," + sizeWithRatioY /*size * sizeRatio*/ + "' />" + "\r\n" + // size of the particle image 1=original image size. Format: SizeX, SizeY
                //  "<Drag Value='" + drag + "' />" + "\r\n" + // drag force (units like graviy)
                //  "<Blend Type='" + blend + "' />" + "\r\n" +
                //    //***   "<Rotation Speed='0' Time='1.7' />" + "\r\n" + // optional: should be in a checkbox
                //  "<Fade FadeIn='" + fadeIn + "' FadeOut='" + fadeOut + "' MaxFade='" + maxFade + "' />" + "\r\n" + // fade of each particle. FadeIn/fade out in seconds. Max fade - the maximum fade value (alpha 0-1)
                //"</ParticleEmitter>" + "\r\n";
                //particleText += "</Particle>";

                //ITerrainEffect66 ite = sgworld.Creator.CreateEffect(p, particleText, branch, cl.name + cl.number);

                //ite.EffectXML = particleText;
                //ite.Terrain.BBox


                //Console.WriteLine("x: {0} y {1} number {2}", cl.longitude, cl.latitude, cl.number);
            }

            //DBSCAN.Cluster();

            //for (int i = 0; i < DBSCAN.center.Count; i++)
            //{
            //    IPosition66 p = sgworld.Creator.CreatePosition(DBSCAN.center[i].longitude, DBSCAN.center[i].latitude, 0, AltitudeTypeCode.ATC_TERRAIN_RELATIVE,
            //      341, -90.0, 0, 445000);
            //    ITerrainRegularPolygon66 Circle = sgworld.Creator.CreateCircle(p, DBSCAN.p_count[i], 0x00FFFF, 0x00FF00, "", "");
            //    Circle.LineStyle.Width = -5.0;
            //   // sgworld.Creator.CreateCircle(p, DBSCAN.p_count[i]*100, 0x0000FF, 0x00FF00, "", "");
            //     //sgworld.Creator.CreateEllipse(p, DBSCAN.p_count[i], DBSCAN.p_count[i], 0x00FFFF, 0x00FF00, -1, "", "");

            //}
        }
示例#25
0
        public override void TECreate()
        {
            SGWorld66 sgworld = new SGWorld66();

            if (string.IsNullOrEmpty(mGroupIDStatic))
            {
                mGroupIDStatic = sgworld.ProjectTree.CreateGroup("Firms");
            }
            ITerrainLabel66 iLabel;
            ILabelStyle66   cLabelStyle;

            //ILabelStyle66 cLabelStyle = sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_STREET);
            //ILabelStyle66 cLabelStyle = sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_STATE);

            //{
            //   //uint nBGRValue = 0xff0000;                              // Blue
            //   //double dAlpha = 0.5;                                    // 50% opacity
            //   //var cBackgroundColor = cLabelStyle.BackgroundColor;     // Get label style background color
            //   //cBackgroundColor.FromBGRColor(nBGRValue);               // Set background to blue
            //   //cBackgroundColor.SetAlpha(dAlpha);                      // Set transparency to 50%
            //   //cLabelStyle.BackgroundColor = cBackgroundColor;         // Set label style background color
            //    cLabelStyle.FontName = "Arial";                         // Set font name to Arial
            //    cLabelStyle.Italic = true;                              // Set label style font to italic
            //    cLabelStyle.Scale = 200;                                // Set label style scale
            //    cLabelStyle.TextOnImage = false;
            //    cLabelStyle.TextColor = sgworld.Creator.CreateColor(0, 255, 255, 255);
            //    //cLabelStyle.SmallestVisibleSize = 7;
            //}


            foreach (CRailwayFirm rw in mSceneData.mFirmList)
            {
                IPosition66 cp = sgworld.Creator.CreatePosition(rw.CenterLongitude, rw.CenterLatitude, 10, AltitudeTypeCode.ATC_TERRAIN_RELATIVE);
                ITerrainRegularPolygon66 circle = sgworld.Creator.CreateCircle(cp, rw.NumStaff * 2 + 200, 0xFFFFFFFF, 0x00FF00FF, mGroupIDStatic, rw.FirmName + " " + rw.NumStaff);
                circle.LineStyle.Width = -5.0;

                if (rw.FirmType.Equals("制梁场") || rw.FirmType.Equals("项目部") || rw.FirmType.Equals("监理单位"))
                {
                    cLabelStyle = mTEStandard.mLabelStyleL2;
                }
                else
                {
                    cLabelStyle = mTEStandard.mLabelStyleL1;
                }
                iLabel = sgworld.Creator.CreateLabel(cp, rw.FirmName, CGisDataSettings.gDataPath + @"Common\地标图片\" + rw.mLabelImage, cLabelStyle, mGroupIDStatic, rw.FirmName);
                iLabel.Message.MessageID = sgworld.Creator.CreateMessage(MsgTargetPosition.MTP_POPUP, rw.ToString(), MsgType.TYPE_TEXT, true).ID;
            }
            //
            // F. Add Message to created circle
            //
            //{
            //    ITerraExplorerMessage66 cMessage = null;
            //    // F1. Set message input parameters
            //    MsgTargetPosition eMsgTarget = MsgTargetPosition.MTP_POPUP;
            //    string tMessage = "Hello Circle";
            //    MsgType eMsgType = MsgType.TYPE_TEXT;
            //    bool bIsBringToFront = true;

            //    // F2. Create message and add to circle
            //    cMessage = sgworld.Creator.CreateMessage(eMsgTarget, tMessage, eMsgType, bIsBringToFront);
            //    //iLabel.Message.MessageID = cMessage.ID;
            //}
            //foreach (CRailwayStaff rs in mSceneData.mStaffList)
            //{
            //    IPosition66 cp = sgworld.Creator.CreatePosition(rs.longitude, rs.latitude, 10, AltitudeTypeCode.ATC_TERRAIN_RELATIVE);
            //    ITerrainRegularPolygon66 circle = sgworld.Creator.CreateCircle(cp, rs.numStaff * 2 + 200, 0xFFFF00FF, 0x00FF00FF, branch, rs.shorName + " " + rs.numStaff);
            //    circle.LineStyle.Width = -5.0;
            //    //circle.Tooltip = rs.shorName + " " + rs.numStaff;

            //}
        }
示例#26
0
        public bool startNextPresentation()
        {
            bool fromCurrent = true;

            if (mNavigationList == null || mNavigationList.Count == 0)
            {
                return(false);
            }

            readyForNext = false;

            // 屏幕中心坐标
            IPosition66 cp = sgworld.Window.CenterPixelToWorld().Position;
            // 视点坐标
            IPosition66 viewp = sgworld.Navigate.GetPosition(AltitudeTypeCode.ATC_TERRAIN_RELATIVE);

            //起点与目标点距离
            double len1 = mNavigationList[mNavIndex].getUTMDistance(cp.X, cp.Y) + viewp.Altitude;

            //如果漫游起点距离屏幕中心过远,从当前点漫游到起点
            double fromX, fromY, fromZ;

            //if (mRan.Next(1,20) == 10)
            //{
            //    fromX = 118.6;
            //    fromY = 36.6;
            //    fromZ = 400000;
            //    fromCurrent = false;

            //}
            //else
            if (len1 > 5000)
            {
                fromX       = cp.X;
                fromY       = cp.Y;
                fromZ       = viewp.Altitude;
                fromCurrent = false;
            }
            else  //否则从极点到下一点
            {
                fromX = mNavigationList[mNavIndex].Longitude;
                fromY = mNavigationList[mNavIndex].Latitude;
                fromZ = mNavigationList[mNavIndex].Altitude;
            }

            double length = mNavigationList[mNavNextIndex].getUTMDistance(fromX, fromY);

#if DEBUG
            Console.WriteLine(mNavNextIndex + " 目的地 " + mNavigationList[mNavNextIndex].ToString());
#endif
            if (length < 50)
            {
                ReachOnePlace();
                return(true);
            }

            mTopSpeed = Math.Max(0, Math.Min(Math.Pow(2, CGisDataSettings.AppSpeed) * 20, 350));
            double speed = Math.Min(length / 3.5, mTopSpeed);

            clearTrain();

            isOnOneWay   = true;
            mVirtualOnly = false;

            if (!fromCurrent || length > 30000)
            {
                double x, y;

                x = (fromX + mNavigationList[mNavNextIndex].Longitude) / 2;
                y = (fromY + mNavigationList[mNavNextIndex].Latitude) / 2;
                for (int i = mPresentation.Steps.Count - 1; i >= 0; i--)
                {
                    mPresentation.DeleteStep(i);
                }

                mPresentation.CreateLocationStep(PresentationStepContinue.PSC_WAIT, 1, "Starting",
                                                 sgworld.Creator.CreatePosition(fromX, fromY, 0, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, 0, -89, 0, Math.Max(350, fromZ)));

                // 如果距离过长,先到世界中心,再到当前工点
                mPresentation.CreateCaptionStep(PresentationStepContinue.PSC_WAIT, 0, "Txt", "开始漫游", 3);
                if (length > 60000)
                {
                    mPresentation.CreateLocationStep(PresentationStepContinue.PSC_WAIT, 1, "Ending",
                                                     sgworld.Creator.CreatePosition(118.6, 36.6, 0, AltitudeTypeCode.ATC_TERRAIN_RELATIVE,
                                                                                    341, -90.0, 0, 445000));
                }
                else
                {
                    mPresentation.CreateLocationStep(PresentationStepContinue.PSC_WAIT, 1, "Ending",
                                                     sgworld.Creator.CreatePosition(x, y, 0, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, 0, -89, 0, Math.Max(length, 5000)));
                }
                mPresentation.CreateLocationStep(PresentationStepContinue.PSC_WAIT, 1, "Ended",
                                                 sgworld.Creator.CreatePosition(mNavigationList[mNavNextIndex].Longitude, mNavigationList[mNavNextIndex].Latitude, 350, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, 0, -89, 0, 0));

                updatePresentationSpeed(mPresentation);

                mPresentation.Play(0);
                //mVirtualObj.Waypoints.AddWaypoint(sgworld.Creator.CreateRouteWaypoint(mPlaceList[nextIndex].Longitude, mPlaceList[nextIndex].Latitude, mPlaceList[nextIndex].Altitude + 150));

                return(true);
            }
            //isPresentation = true;

            //sgworld.OnObjectAction += Sgworld_OnObjectAction;

            mStepm   = length < 250 ? length / 5 : speed;
            mNavPath = new CSubPath(CRailwayLineList.gRealConnection, mNavigationList[mNavIndex].DKCode, mNavigationList[mNavIndex].Mileage,
                                    mNavigationList[mNavNextIndex].DKCode, mNavigationList[mNavNextIndex].Mileage, 10);

            if (!mNavPath.hasPath)
            {
                // 如果没有路径,直接飞过去
                double midx, midy, midz;
                midx = (fromX + mNavigationList[mNavNextIndex].Longitude) / 2;
                midy = (fromY + mNavigationList[mNavNextIndex].Latitude) / 2;
                midz = (fromZ + mNavigationList[mNavNextIndex].Altitude) / 2;
                mVirtualWayPointCount = 3;
                mVirtualObj.Waypoints.AddWaypoint(sgworld.Creator.CreateRouteWaypoint(fromX, fromY, fromZ + 150, speed));
                mVirtualObj.Waypoints.AddWaypoint(sgworld.Creator.CreateRouteWaypoint(midx, midy, midz + 150, speed));
                mVirtualObj.Waypoints.AddWaypoint(sgworld.Creator.CreateRouteWaypoint(mNavigationList[mNavNextIndex].Longitude, mNavigationList[mNavNextIndex].Latitude, mNavigationList[mNavNextIndex].Altitude + 150, speed));
#if DEBUG
                ModelInfo.Helper.LogHelper.WriteLog(mNavIndex + "\t" + midx + "\t" + midy + "\t" + midz);
#endif
                mVirtualOnly = true;
                mVirtualObj.CircularRoute = false;
                mVirtualObj.Pause         = false;
                mVirtualObj.RestartRoute();
                sgworld.Navigate.FlyTo(mVirtualObj, ActionCode.AC_FOLLOWABOVE);
                // ReachOnePlace();
                return(true);
            }

            panelInfo.Visible = true;
            prepareTrain(mNavPath, 0);
//            double[][] mm,mx, my, mz, md;
//            mx = new double[5][];
//            my = new double[5][];
//            mz = new double[5][];
//            md = new double[5][];
//            mm = new double[5][];
//            double[] ms = { 0, 37, 86, 135, 172 };
//            //mx[0] = mNavPath.mx;
//            //my[0] = mNavPath.my;
//            //mz[0] = mNavPath.mz;
//            //md[0] = mNavPath.md;
//            mTrainWayPointTotal = mTrainWayPointCount = mNavPath.mPointCount;
//            mDistoNext = mNavPath.mLength;
//            for (int i = 0; i< 5; i++)
//            {
//                ModelInfo.Helper.CSubLine.getSubLineByMileage(-ms[i], mNavPath.mLength-ms[i], mStepm, mNavPath.mm, mNavPath.mx, mNavPath.my, mNavPath.mz, mNavPath.md,
//                    out mm[i], out mx[i], out my[i], out mz[i], out md[i], true);

//            }

//            //mDynamicTrain.Acceleration = 1;
//            double localspeed;
//            for (int j = 0; j < 5; j++)
//            {
//                for (int i = 0; i < mTrainWayPointCount; i++)
//                {
//                    // 逐渐加速,减速
//                    localspeed = Math.Min(5 + (mTrainWayPointCount - Math.Abs(mTrainWayPointCount - i / 2)) * 10, speed);
//#if DEBUG
//                    //Console.WriteLine(curIndex + "\t" + mx[i] + "\t" + my[i] + "\t" + mz[i] + "\t" + md[i]);
//                    //ModelInfo.Helper.LogHelper.WriteLog(curIndex + "\t" + mx[i] + "\t" + my[i] + "\t" + mz[i] + "\t" + md[i]);
//                    mDynamicTrain[j].Waypoints.AddWaypoint(sgworld.Creator.CreateRouteWaypoint(mx[j][i], my[j][i], mz[j][i], speed, md[j][i]));
//#else
//                mDynamicTrain.Waypoints.AddWaypoint(sgworld.Creator.CreateRouteWaypoint(mx[j][i], my[j][i], mz[j][i], localspeed, md[j][i]));
//#endif
//                }

//                mDynamicTrain[j].CircularRoute = false;
//                mDynamicTrain[j].Pause = false;
//                mDynamicTrain[j].RestartRoute();
//            }
//            if (mTrainWayPointTotal < 15)
//            {
//                sgworld.Navigate.FlyTo(mDynamicTrain[0], ActionCode.AC_FOLLOWBEHINDANDABOVE);
//            }
//            else
//                sgworld.Navigate.FlyTo(mDynamicTrain[0], ActionCode.AC_FOLLOWCOCKPIT);


            return(true);
        }