コード例 #1
0
        /// <summary>
        /// <para xml:lang="en">Internal method, do not call directly.</para>
        /// <para xml:lang="zh">内部方法,不可直接调用。</para>
        /// </summary>
        internal void HostSparseSpatialMap(SparseSpatialMapController controller, string name, Optional <Image> preview, Action <SparseSpatialMapController.SparseSpatialMapInfo, bool, string> callback)
        {
            SpatialMapServiceConfig config = new SpatialMapServiceConfig();

            if (UseGlobalServiceConfig)
            {
                if (EasyARController.Settings)
                {
                    config = EasyARController.Settings.GlobalSpatialMapServiceConfig;
                }
            }
            else
            {
                config = ServiceConfig;
            }
            NotifyEmptyConfig(config);

            Manager.host(sparseSpatialMapWorker, config.APIKey.Trim(), config.APISecret.Trim(), config.SparseSpatialMapAppID.Trim(), name, preview, EasyARController.Scheduler, (status, id, error) =>
            {
                var mapInfo = new SparseSpatialMapController.SparseSpatialMapInfo()
                {
                    Name = name, ID = id
                };
                if (MapHost != null)
                {
                    MapHost(controller, mapInfo, status, error);
                }
                if (callback != null)
                {
                    callback(mapInfo, status, error);
                }
            });
        }
コード例 #2
0
        /// <summary>
        /// <para xml:lang="en">Internal method, do not call directly.</para>
        /// <para xml:lang="zh">内部方法,不可直接调用。</para>
        /// </summary>
        internal void LoadSparseSpatialMap(SparseSpatialMapController controller, Action <SparseSpatialMapController.SparseSpatialMapInfo, bool, string> callback)
        {
            SpatialMapServiceConfig config = new SpatialMapServiceConfig();

            if (UseGlobalServiceConfig)
            {
                if (EasyARController.Settings)
                {
                    config = EasyARController.Settings.GlobalSpatialMapServiceConfig;
                }
            }
            else
            {
                config = ServiceConfig;
            }
            NotifyEmptyConfig(config);

            var id = controller.MapInfo.ID;

            Manager.load(sparseSpatialMapWorker, id.Trim(), config.APIKey.Trim(), config.APISecret.Trim(), config.SparseSpatialMapAppID.Trim(), EasyARController.Scheduler, (status, error) =>
            {
                if (MapLoad != null)
                {
                    MapLoad(controller, controller.MapInfo, status, error);
                }
                if (callback != null)
                {
                    callback(controller.MapInfo, status, error);
                }
            });
            mapControllers[id]          = controller;
            controller.transform.parent = mapRoot.transform;
            WorkingMode = Mode.Localize;
            Builder     = null;
        }
コード例 #3
0
 private void NotifyEmptyConfig(SpatialMapServiceConfig config)
 {
     if (string.IsNullOrEmpty(config.APIKey) ||
         string.IsNullOrEmpty(config.APISecret) ||
         string.IsNullOrEmpty(config.SparseSpatialMapAppID))
     {
         throw new UIPopupException(
                   "Service config (for authentication) NOT set, please set" + Environment.NewLine +
                   "globally on <EasyAR Settings> Asset or" + Environment.NewLine +
                   "locally on <SparseSpatialMapWorkerFrameFilter> Component." + Environment.NewLine +
                   "Get from EasyAR Develop Center (www.easyar.com) -> SpatialMap -> Database Details.");
     }
 }