/// <summary>
        /// Checks the spelling of the names of all maps and layers in the table of contents.
        /// </summary>
        /// <param name="maps">An <see cref="IMaps"/> collection of maps.</param>
        /// <returns>
        ///		The number of items that were spellchecked.  Zero will be returned under the following contiditions:
        ///		<list type="bullet">
        ///			<item><description>No mispelled items were detected.</description></item>
        ///			<item><description>Either <paramref name="maps"/>.</description></item>
        ///		</list>
        ///	</returns>
        private int CheckSpellingOfTocItemNames(IMaps maps)
        {
            int spellcheckedItems = 0;

            if (maps == null || maps.Count == 0 || _CancelSpellChecking)
            {
                return(spellcheckedItems);
            }

            TableOfContentsItem[] tocItems = TableOfContentsItem.GetAllTableOfContentsItems(maps);
            if (tocItems == null || tocItems.Length == 0)
            {
                return(spellcheckedItems);
            }

            foreach (TableOfContentsItem tocItem in tocItems)
            {
                if (_CancelSpellChecking)
                {
                    break;
                }

                tocItem.Name = CheckText(tocItem.Name);

                spellcheckedItems++;
            }

            return(spellcheckedItems);
        }
Exemple #2
0
 public DeadIntantKillHandler(
     IAgent <ActionEnum, GoalEnum> agent,
     IMaps <ActionEnum, GoalEnum> maps,
     IAction <ActionEnum> action)
     : base(agent, maps, action)
 {
 }
Exemple #3
0
        public void ReplaceMap(IMaps imaps_0, IMap imap_0)
        {
            if ((this.ipageLayoutControl2_0 == null) || (this.imapControl3_0 == null))
            {
                throw new Exception(
                          "ControlsSynchronizer::ReplaceMap:\r\nEither MapControl or PageLayoutControl are not initialized!");
            }
            bool flag = this.bool_0;

            this.ActivatePageLayout();
            this.bool_1 = false;
            this.ipageLayoutControl2_0.PageLayout.ReplaceMaps(imaps_0);
            this.bool_1             = true;
            this.imapControl3_0.Map = imap_0;
            this.itool_1            = null;
            this.itool_0            = null;
            if (flag)
            {
                this.ActivateMap();
                this.imapControl3_0.ActiveView.Refresh();
            }
            else
            {
                this.ActivatePageLayout();
                this.ipageLayoutControl2_0.ActiveView.Refresh();
            }
        }
        /// <summary>
        /// Gets all maps and layers that are contained in a given <see cref="IMaps"/> object.
        /// </summary>
        /// <returns>
        ///		An array of <see cref="TableOfContentsItem"/>s representing all of the maps and layers in <paramref name="maps"/>.
        ///		If <paramref name="maps"/> is <see langword="null"/> or does not contain any maps or layers, an empty array will
        ///		be returned.
        ///	</returns>
        public static TableOfContentsItem[] GetAllTableOfContentsItems(IMaps maps)
        {
            ArrayList list = new ArrayList();

            if (maps != null)
            {
                // Loop through all maps.
                for (int mapIdx = 0; mapIdx < maps.Count; mapIdx++)
                {
                    IMap currentMap = maps.get_Item(mapIdx);
                    list.Add(new TableOfContentsItem(currentMap));

                    // Create a list of all layers.
                    ArrayList layersInMap = new ArrayList();
                    for (int layerIdx = 0; layerIdx < currentMap.LayerCount; layerIdx++)
                    {
                        ILayer currentLayer = currentMap.get_Layer(layerIdx);
                        layersInMap.AddRange(GetAllLayers(currentLayer));
                    }

                    foreach (ILayer currentLayer in layersInMap)
                    {
                        list.Add(new TableOfContentsItem(currentLayer));
                    }
                }
            }

            return((TableOfContentsItem[])list.ToArray(typeof(TableOfContentsItem)));
        }
Exemple #5
0
 public AlertStateHandler(
     IAgent <ActionEnum, GoalEnum> agent,
     IMaps <ActionEnum, GoalEnum> maps,
     IAction <ActionEnum> action)
     : base(agent, maps, action)
 {
     _self  = GetGameData <GameDataKeyEnum, Transform>(GameDataKeyEnum.SELF_TRANS);
     _enemy = GetGameData <GameDataKeyEnum, Transform>(GameDataKeyEnum.ENEMY_TRANS);
 }
Exemple #6
0
 public MoveHandler(IAgent <ActionEnum, GoalEnum> agent,
                    IMaps <ActionEnum, GoalEnum> maps,
                    IAction <ActionEnum> action)
     : base(agent, maps, action)
 {
     _self       = GetGameData <Transform>(GameDataKeyEnum.SELF_TRANS);
     _enemy      = GetGameData <Transform>(GameDataKeyEnum.ENEMY_TRANS);
     _controller = _self.GetComponent <CharacterController>();
 }
Exemple #7
0
 public HandlerBase(
     IAgent <ActionEnum, GoalEnum> agent,
     IMaps <ActionEnum, GoalEnum> maps,
     IAction <ActionEnum> action)
     : base(agent, maps, action)
 {
     _timer        = null;
     _model        = this.GetModel <TModel>(_maps);
     _timerService = Contexts.sharedInstance.service.gameServiceTimerService.TimerService;
 }
Exemple #8
0
 /// <summary>
 /// 构造
 /// </summary>
 /// <param name="agent">代理</param>
 /// <param name="maps">动作 和 目标 映射</param>
 /// <param name="action">动作数据</param>
 public ActionHandlerBase(IAgent <TAction, TGoal> agent, IMaps <TAction, TGoal> maps, IAction <TAction> action)
 {
     // 使用静态 _id累加 给ID赋值 防止ID重复
     ID     = _id++;
     _agent = agent;
     _maps  = maps;
     Action = action;
     //当前动作状态为 初始化
     ExcuteState     = ActionExcuteState.INIT;
     _onFinishAction = null;
 }
Exemple #9
0
        public AiViewMgr ViewMgr(IMaps <ActionEnum, GoalEnum> maps)
        {
            if (_viewMgr == null)
            {
                object audioSource = maps.GetGameData(GameDataKeyEnum.AUDIO_SOURCE);
                object self        = maps.GetGameData(GameDataKeyEnum.SELF_TRANS);
                _viewMgr = new AiViewMgr(EnemyId.EnemyPeasant.ToString(), audioSource, self);
            }

            return(_viewMgr);
        }
        /// <summary>
        /// Gets the full path name of the layer (including ancestor group layers and data frame)
        /// </summary>
        /// <param name="doc">The map document that this layer is in</param>
        /// <param name="layer">The ILayer whose name we want</param>
        /// <param name="mapSeparator">A character string used to data frame name from the group/layer names</param>
        /// <param name="layerSeparator">A character string used to the group names from the layer name</param>
        /// <returns>null if the layer does not exist in the map document, full name otherwise</returns>
        internal static string GetFullName(IMxDocument doc, ILayer layer, string mapSeparator = ":",
                                           string layerSeparator = "/")
        {
            //ILayer does not know where it is in the maps/groups heirarchy, so a search is required.
            IMaps maps = doc.Maps;

            for (int i = 0; i < maps.Count; i++)
            {
                IMap   map  = maps.Item[i];
                string name = GetFullName(map, layer, layerSeparator);
                if (name != null)
                {
                    return(map.Name + mapSeparator + name);
                }
            }
            return(null);
        }
        /// <summary>
        /// Determines whether at least one of the layers in all the maps is an HLU layer.
        /// Called by OnOpenDocument when ArcGIS determines that a document has just been opened.
        /// </summary>
        /// <param name="maps">The maps collection (i.e. active views) of the open document.</param>
        /// <returns></returns>
        public bool IsHluWorkspace(IMaps maps)
        {
            try
            {
                IMap map = null;

                UID uid = new UIDClass();
                uid.Value = typeof(IFeatureLayer).GUID.ToString("B");

                for (int i = 0; i < maps.Count; i++)
                {
                    map = maps.get_Item(i);
                    IEnumLayer layers = map.get_Layers(uid, true);
                    ILayer layer = layers.Next();
                    while (layer != null)
                    {
                        IFeatureLayer featureLayer = layer as IFeatureLayer;
                        if (IsHluLayer(featureLayer))
                        {
                            _hluView = map as IActiveView;
                            return true;
                        }
                        layer = layers.Next();
                    }
                }
            }
            catch { }

            return false;
        }