/// <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;

            if (UseGlobalServiceConfig)
            {
                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);
                }
            });
        }
        /// <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;

            if (UseGlobalServiceConfig)
            {
                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;
        }
 /// <summary>
 /// <para xml:lang="en">Internal method, do not call directly.</para>
 /// <para xml:lang="zh">内部方法,不可直接调用。</para>
 /// </summary>
 internal void UnloadSparseSpatialMapBuild(SparseSpatialMapController controller)
 {
     if (BuilderMapController == controller && controller)
     {
         BuilderMapController = null;
         controller.OnLocalization(false);
     }
 }
 /// <summary>
 /// <para xml:lang="en">Unload map.</para>
 /// <para xml:lang="zh">卸载地图。</para>
 /// </summary>
 public void UnloadMap(SparseSpatialMapController map)
 {
     if (!TryGetMapController(map.MapInfo.ID) && BuilderMapController != map)
     {
         return;
     }
     map.MapWorker = null;
 }
 /// <summary>
 /// <para xml:lang="en">Load map.</para>
 /// <para xml:lang="zh">加载地图。</para>
 /// </summary>
 public void LoadMap(SparseSpatialMapController map)
 {
     if (TryGetMapController(map.MapInfo.ID) || BuilderMapController == map)
     {
         return;
     }
     map.MapWorker = this;
 }
 /// <summary>
 /// <para xml:lang="en">Internal method, do not call directly.</para>
 /// <para xml:lang="zh">内部方法,不可直接调用。</para>
 /// </summary>
 internal void LoadSparseSpatialMapBuild(SparseSpatialMapController controller)
 {
     UnloadSparseSpatialMapBuild(BuilderMapController);
     BuilderMapController = controller;
     if (controller && mapRoot)
     {
         BuilderMapController.transform.parent = mapRoot.transform;
     }
 }
        /// <summary>
        /// <para xml:lang="en">Internal method, do not call directly.</para>
        /// <para xml:lang="zh">内部方法,不可直接调用。</para>
        /// </summary>
        internal void UnloadSparseSpatialMap(SparseSpatialMapController controller, Action <SparseSpatialMapController.SparseSpatialMapInfo, bool, string> callback)
        {
            var id = controller.MapInfo.ID;

            if (mapControllers.Remove(id))
            {
                controller.OnLocalization(false);
                sparseSpatialMapWorker.unloadMap(controller.MapInfo.ID, EasyARController.Scheduler, (Action <bool>)((status) =>
                {
                    if (MapUnload != null)
                    {
                        MapUnload(controller, controller.MapInfo, status, string.Empty);
                    }
                    if (callback != null)
                    {
                        callback(controller.MapInfo, status, string.Empty);
                    }
                }));
            }
        }
 /// <summary>
 /// <para xml:lang="en">Create and upload map.</para>
 /// <para xml:lang="zh">创建并上传地图。</para>
 /// </summary>
 public void HostMap(SparseSpatialMapController map, string name, Optional <Image> preview)
 {
     map.Host(name, preview);
 }