예제 #1
0
    /// 立即设置新的摄像机控制模式。
    public void Jump(CTRL_MODE eMode, object pParam_)
    {
        m_eCtrlMode = eMode;

        if (CTRL_MODE.REMOTE == eMode)
        {
            RemoteParam pParam = (RemoteParam)pParam_;
            m_nLng      = pParam.m_nLng;
            m_nLat      = pParam.m_nLat;
            m_nDistance = pParam.m_nHeight;
            m_nPitch    = 90.0f;
            m_nYaw      = 0.0f;
            m_mTarget   = Vector3.zero;
        }
        else if (CTRL_MODE.EAGLE == eMode)
        {
            EagleParam pParam = (EagleParam)pParam_;
            m_nLng      = pParam.m_nLng;
            m_nLat      = pParam.m_nLat;
            m_nDistance = pParam.m_nDistance;
            m_nPitch    = pParam.m_nPitch;
            m_nYaw      = pParam.m_nYaw;
            m_mTarget   = Vector3.zero;
        }
        else if (CTRL_MODE.PANORAMA == eMode)
        {
            PanoramaParam pParam = (PanoramaParam)pParam_;
            m_nLng      = pParam.m_nLng;
            m_nLat      = pParam.m_nLat;
            m_nDistance = pParam.m_nDistance;
            m_nPitch    = pParam.m_nPitch;
            m_nYaw      = pParam.m_nYaw;
            m_mTarget   = pParam.m_mTarget;
        }
        else if (CTRL_MODE.WANDER == eMode)
        {
            WanderParam pParam = (WanderParam)pParam_;
            m_nLng      = pParam.m_nLng;
            m_nLat      = pParam.m_nLat;
            m_nDistance = 0.0f;
            m_nPitch    = pParam.m_nPitch;
            m_nYaw      = pParam.m_nYaw;
            //m_mTarget = pParam.m_mTarget;
        }
    }
예제 #2
0
    // 初始化项目。
    private void InitProject()
    {
        EagleParam pParam = new EagleParam();

        pParam.m_nLng      = 110.20429f; //110.326477f;
        pParam.m_nLat      = 24.12514f;  //25.247935f;
        pParam.m_nDistance = 20000.0f;
        pParam.m_nPitch    = 60.0f;
        pParam.m_nYaw      = 0.0f;

        m_pCameraCtrl.Jump(CTRL_MODE.EAGLE, pParam);

        m_pGis               = Miaokit.g_pIns.gis;
        m_pGis.imageServer   = "http://t%d.tianditu.gov.cn/DataServer?T=img_c&tk=addfe5066d3d51cff95f9b58976befe0&x=%d&y=%d&l=%d";
        m_pGis.terrainServer = "https://t%d.tianditu.gov.cn/dem_sjk/DataServer?T=ele_c&tk=addfe5066d3d51cff95f9b58976befe0&x=%d&y=%d&l=%d";

        /// 添加桂林区域3D地图(请启动Plugins文件夹下的GisServer.bat服务)
        m_pGis.AddMapbox(new Vector2(110.310452f, 25.276903f), new Vector2(10000.0f, 10000.0f), new Vector3(0.0f, 160.0f, 0.0f), new Vector3(0.90f, 1.0f, 0.91f));

        /// 注册添加一个SVE工程到GIS中,实现动态管理
        m_pGis.AddSvetile("data/upload/admin/project/20191018/5da9159b2005e.txt", 1, 0, new Vector2(110.326814f, 25.248106f), new Vector2(1000.0f, 1000.0f), delegate(Tile pTile, bool bActive)
        {
            if (bActive)
            {
                Vector3 mOffset = new Vector3(-450.0f, 155.0f, -400.0f);
                Vector3 mEuler  = new Vector3(0.0f, -42 + 180.0f, 0.0f);

                int nIndex = 0;

                foreach (Scene pScene in pTile.scenes)
                {
                    if (2 != nIndex++)
                    {
                        continue;
                    }

                    Object3D pObject = pScene.object3D;
                    pObject.transform.localPosition    = mOffset;
                    pObject.transform.localEulerAngles = mEuler;

                    float nHeight = 0.0f;

                    Debug.LogError("场景:" + pScene.id + " " + pScene.layerCount);

                    foreach (Layer pLayer in pScene.layers)
                    {
                        Object3D pLayerObj = pLayer.object3D;
                        pLayerObj.transform.localPosition = new Vector3(0.0f, nHeight, 0.0f); nHeight += 9.0f;

                        Debug.LogError("楼层:" + pLayer.id + " " + pLayer.siteCount);

                        pLayer.Draw();
                    }
                }
            }
        });

        /// 注册添加一个SVE工程(仅含一个内景)到GIS中,实现动态管理
        m_pGis.AddSvetile("data/upload/admin/project/20190807/5d4a310351522.txt", 2, 0, new Vector2(110.326814f, 25.248106f), new Vector2(1000.0f, 1000.0f), delegate(Tile pTile, bool bActive)
        {
            if (bActive)
            {
                Vector3 mOffset = new Vector3(-10.0f, 164.0f, -40.0f);
                Vector3 mEuler  = new Vector3(0.0f, -42.0f, 0.0f);

                foreach (Scene pScene in pTile.scenes)
                {
                    Object3D pObject = pScene.object3D;
                    pObject.transform.localPosition    = mOffset;
                    pObject.transform.localEulerAngles = mEuler;

                    float nHeight = 0.0f;

                    Debug.LogError("2场景:" + pScene.id + " " + pScene.layerCount);

                    foreach (Layer pLayer in pScene.layers)
                    {
                        Object3D pLayerObj = pLayer.object3D;
                        pLayerObj.transform.localPosition = new Vector3(0.0f, nHeight, 0.0f); nHeight += 9.0f;

                        Debug.LogError("2楼层:" + pLayer.id + " " + pLayer.siteCount);

                        pLayer.Draw();

                        if (10.0 < nHeight)
                        {
                            break;
                        }
                    }
                }
            }
        });

        /// 注册一个实景模型到GIS中。
        m_pDioramas = Miaokit.g_pIns.CreateDioramas("file://H:/PictureModel/金秀县城/Scene/Production_1.3mx");
        m_pGis.AddGameObject(m_pDioramas.object3D, new Vector2(110.20429f, 24.12514f));
        m_pDioramas.object3D.gameObject.name = "Dioramas";
        m_pDioramas.object3D.gameObject.transform.localPosition = new Vector3(-221.5f, 800.0f - 38.7f, -116.5f);
    }