예제 #1
0
 public static void updatePresentationSpeed(IPresentation66 pre)
 {
     if (pre == null)
     {
         return;
     }
     if (CGisDataSettings.AppSpeed == 1)
     {
         pre.PlaySpeedFactor = PresentationPlaySpeed.PPS_VERYSLOW;
     }
     else if (CGisDataSettings.AppSpeed == 2)
     {
         pre.PlaySpeedFactor = PresentationPlaySpeed.PPS_SLOW;
     }
     else if (CGisDataSettings.AppSpeed == 3)
     {
         pre.PlaySpeedFactor = PresentationPlaySpeed.PPS_NORMAL;
     }
     else if (CGisDataSettings.AppSpeed == 4)
     {
         pre.PlaySpeedFactor = PresentationPlaySpeed.PPS_FAST;
     }
     else
     {
         pre.PlaySpeedFactor = PresentationPlaySpeed.PPS_VERYFAST;
     }
 }
예제 #2
0
        public static void showPoint(SGWorld66 sgworld, double cx, double cy, double cz, double cdir)
        {
            if (mPresentation == null)
            {
                mPresentationGroupID = sgworld.ProjectTree.FindItem("Presentation");
                if (string.IsNullOrEmpty(mPresentationGroupID))
                {
                    mPresentationGroupID = sgworld.ProjectTree.CreateGroup("Presentation");
                }
                mPresentation = sgworld.Creator.CreatePresentation(mPresentationGroupID, "PointNav");
                sgworld.OnPresentationFlyToReachedDestination += Sgworld_OnPresentationFlyToReachedDestination;
            }
            mPresentation = sgworld.Creator.CreatePresentation(mPresentationGroupID, "Navigating");

            mPresentation.PlayAlgorithm = PresentationPlayAlgorithm.PPA_SPLINE;
            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;
            }
            mPresentation.PlaySpeedFactor = PresentationPlaySpeed.PPS_NORMAL;

            mPresentation.PlayMode  = PresentationPlayMode.PPM_AUTOMATIC;
            mPresentation.LoopRoute = true;


            double[] x   = { 1, -1, 0, 0 };
            double[] y   = { 0, 0, 1, -1 };
            Random   ran = new Random();

            //double[] z = { cz, cz, cz, cz };
            //double[] d = { cdir, cdir, cdir, cdir };
            if (mPointNear[0] == null)
            {
                //* (1 + ran.NextDouble())
                //mPointNav = sgworld.Creator.CreatePosition(x, y, z, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, dir, 0, 0, 350);
                for (int i = 0; i < x.Length; i++)
                {
                    mPointNear[i] = sgworld.Creator.CreatePosition(cx + x[i] * 0.005,
                                                                   cy + y[i] * 0.005, 350 + ran.Next(1, 100), AltitudeTypeCode.ATC_TERRAIN_RELATIVE, -i * 90, -60, 0, 1300);
                }
            }
            else
            {
                for (int i = 0; i < x.Length; i++)
                {
                    mPointNear[i].X        = cx + x[i] * 0.005;
                    mPointNear[i].Y        = cy + y[i] * 0.005;
                    mPointNear[i].Altitude = 350 + ran.Next(1, 100);
                }
            }
            for (int i = mPresentation.Steps.Count - 1; i >= 0; i--)
            {
                mPresentation.DeleteStep(i);
            }

            for (int i = 0; i < mPointNear.Length; i++)
            {
                mPresentation.CreateLocationStep(PresentationStepContinue.PSC_WAIT, 0, "Starting", mPointNear[i]);
            }
            mPresentation.CreateLocationStep(PresentationStepContinue.PSC_WAIT, 0, "Ended", mPointNear[0]);
            mPresentation.Play(0);
        }
예제 #3
0
        public CTEPresentation(CRailwayScene s, CTEScene tes, PanelProgress2D p2, PanelInfo p3, Timer timer, List <CHotSpot> hp = null)//
        {
            mSceneData      = s;
            mTEScene        = tes;
            mNavigationList = hp;
            panel2D         = p2;
            panelInfo       = p3;
            if (mNavigationList == null || mNavigationList.Count <= 1)
            {
                return;
            }
            mNavIndex = mNavigationList.Count - 1;
            //mNavIndex = Math.Max(0, mNavIndex);
            mNavNextIndex = (mNavIndex + 1) % mNavigationList.Count;

            sgworld = new SGWorld66();

            timerWaitingForNext       = timer;
            timerWaitingForNext.Tick += TimerWaitingForNext_Tick;

            if (string.IsNullOrEmpty(mNavObjGroupID))
            {
                mNavObjGroupID = sgworld.ProjectTree.CreateGroup("TrainGroup");
            }
            else
            {
                sgworld.ProjectTree.DeleteItem(mNavObjGroupID);
                mNavObjGroupID = sgworld.ProjectTree.CreateGroup("TrainGroup");
            }

            mPresentationGroupID = sgworld.ProjectTree.FindItem("Presentation");
            if (string.IsNullOrEmpty(mPresentationGroupID))
            {
                mPresentationGroupID = sgworld.ProjectTree.CreateGroup("Presentation");
            }

            mPresentation = sgworld.Creator.CreatePresentation(mPresentationGroupID, "Navigating");

            mPresentation.PlayAlgorithm = PresentationPlayAlgorithm.PPA_SPLINE;
            mPresentation.PlayMode      = PresentationPlayMode.PPM_AUTOMATIC;
            mPresentation.LoopRoute     = true;

            //mPresentation.CaptionHeight = 50;

            //mWorker = (ITerrainModel66)(sgworld.ProjectTree.GetObject(sgworld.ProjectTree.FindItem("worker")));
            //mDynamicWorker =(ITerrainDynamicObject66)(sgworld.ProjectTree.GetObject(sgworld.ProjectTree.FindItem("dynamicCamera")));
            mDynamicTrain[0] = sgworld.Creator.CreateDynamicObject(0, DynamicMotionStyle.MOTION_AIRPLANE, DynamicObjectType.DYNAMIC_3D_MODEL,
                                                                   mModelName[0], 1, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, mNavObjGroupID, "TrainObj0");
            mDynamicTrain[1] = sgworld.Creator.CreateDynamicObject(0, DynamicMotionStyle.MOTION_AIRPLANE, DynamicObjectType.DYNAMIC_3D_MODEL,
                                                                   mModelName[1], 1, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, mNavObjGroupID, "TrainObj1");
            mDynamicTrain[2] = sgworld.Creator.CreateDynamicObject(0, DynamicMotionStyle.MOTION_AIRPLANE, DynamicObjectType.DYNAMIC_3D_MODEL,
                                                                   mModelName[1], 1, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, mNavObjGroupID, "TrainObj2");
            mDynamicTrain[3] = sgworld.Creator.CreateDynamicObject(0, DynamicMotionStyle.MOTION_AIRPLANE, DynamicObjectType.DYNAMIC_3D_MODEL,
                                                                   mModelName[1], 1, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, mNavObjGroupID, "TrainObj3");
            mDynamicTrain[4] = sgworld.Creator.CreateDynamicObject(0, DynamicMotionStyle.MOTION_AIRPLANE, DynamicObjectType.DYNAMIC_3D_MODEL,
                                                                   mModelName[2], 1, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, mNavObjGroupID, "TrainObj4");
            //mDynamicTrain.Acceleration =
            mVirtualObj = sgworld.Creator.CreateDynamicObject(0, DynamicMotionStyle.MOTION_MANUAL, DynamicObjectType.DYNAMIC_VIRTUAL,
                                                              "", 1, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, mNavObjGroupID, "VirtualObj");

            if (!isTEEventRegistered)
            {
                sgworld.OnObjectAction += Sgworld_OnObjectAction;
                sgworld.OnPresentationFlyToReachedDestination += Sgworld_OnPresentationFlyToReachedDestination;
                isTEEventRegistered = true;
            }
        }