Exemple #1
0
 public void MakeLayerActive(PLayer l)
 {
     if (Layers.Contains(l))
     {
         ActiveLayerIndex = Layers.IndexOf(l);
     }
 }
        private void SetVisibleLayers(WmsLayer.LayerInfo layerInfo)
        {
            if (Layers == null)
            {
                return;
            }

            bool visible = false;

            if (Layers.Contains(layerInfo.Name))
            {
                // the layer and all its children is visible
                visible = true;
                foreach (var child in Descendants(layerInfo.ChildLayers))
                {
                    child.Visible = true;
                }
            }
            else if (layerInfo.ChildLayers != null)
            {
                foreach (var child in layerInfo.ChildLayers)
                {
                    SetVisibleLayers(child);
                    visible |= child.Visible;                     // if a child is visible, all ascendants must be visible
                }
            }
            layerInfo.Visible = visible;
        }
        private void BuildLayersAttribution(LayerInfo layerInfo)
        {
            if (Layers == null)
            {
                return;
            }

            if (Layers.Contains(layerInfo.Name))
            {
                string parentAttribution = layerInfo.Attribution == null ? null : layerInfo.Attribution.Title;
                foreach (var child in Descendants(layerInfo.ChildLayers))
                {
                    string attribution = child.Attribution == null ? null : child.Attribution.Title;
                    if (!string.IsNullOrEmpty(attribution) && !copyrightText.Contains(attribution))
                    {
                        copyrightText.Add(attribution);
                    }
                }
                if (!string.IsNullOrEmpty(parentAttribution) && !copyrightText.Contains(parentAttribution))
                {
                    copyrightText.Add(parentAttribution);
                }
            }
            else if (layerInfo.ChildLayers != null)
            {
                foreach (var child in layerInfo.ChildLayers)
                {
                    BuildLayersAttribution(child);
                }
            }
        }
Exemple #4
0
 protected void SetCurrentLayer(Layer layer)
 {
     if (layer == null || Layers.Contains(layer))
     {
         _currentLayer = layer;
     }
 }
Exemple #5
0
 private void OnTriggerEnter(Collider collider)
 {
     if (Layers.Contains(layers, collider.gameObject.layer))
     {
         currentLayer = collider.gameObject.layer;
         DispatchEvent.Invoke();
     }
 }
Exemple #6
0
 public void SetLayer(int layer)
 {
     if (!Layers.Contains(layer))
     {
         throw new ArgumentOutOfRangeException(layer.ToString() + " was not contained within Layers");
     }
     _centerLocation = null;
     _layer          = layer;
 }
Exemple #7
0
        protected void Add(Layer layer, Entity entity)
        {
            Entities.Add(entity);

            if (Layers.Contains(layer))
            {
                entity.Layer = layer;
            }
        }
Exemple #8
0
 public bool IsActive(PLayer l)
 {
     if (Layers.Contains(l))
     {
         if (Layers.IndexOf(l) == ActiveLayerIndex)
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #9
0
    static public void SetLayer(string name, string layer)
    {
        LayersTagsData lt = GetLayersTagsData(name);

        if (lt == null || !Layers.Contains(layer))
        {
            Debug.Log("Name: " + name + " Data: " + lt + "  Layers.Contains(layer):" + Layers.Contains(layer));
            return;
        }
        lt.layer = layer;
    }
Exemple #10
0
    static public void SetLayerTag(string name, string layer, string tag)
    {
        LayersTagsData lt = GetLayersTagsData(name);

        if (lt == null || !Layers.Contains(layer) || !Tags.Contains(tag))
        {
            return;
        }
        lt.layer = layer;
        lt.tag   = tag;
    }
Exemple #11
0
 public void DeleteLayer(ConvNNLayerViewModel l)
 {
     if (Layers.Contains(l))
     {
         Layers.Remove(l);
         for (int i = 0; i < Layers.Count; i++)
         {
             Layers[i].LayerNumber = i + 1;
         }
     }
     canCreateTopology();
 }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (!enabled)
        {
            return;
        }

        if (Layers.Contains(collision.gameObject))
        {
            OnTrigger?.Invoke();
            OnTriggerParameter?.Invoke(collision);
        }
    }
Exemple #13
0
        /// <summary>
        /// Add the specified <typeparamref name="TLayer"/> to the collection.
        /// </summary>
        /// <typeparam name="TLayer"></typeparam>
        /// <param name="layer">The <typeparamref name="TLayer"/> to add to the collection.</param>
        /// <returns>The added <paramref name="layer"/></returns>
        public TLayer AddLayer <TLayer>(TLayer layer) where TLayer : ILayer
        {
            if (!Layers.Contains(layer))
            {
                Layers.Add(layer);
            }

            if (_isInitialized && !layer.IsInitialized)
            {
                layer.Initialize();
                layer.LoadContent(GameContext.CreateLoadContext());
            }

            return(layer);
        }
Exemple #14
0
 public GameMap(string filename)
     : base(filename)
 {
     foreach (var layer in Layers)
     {
         List <TmxLayerTile> tiles = new List <TmxLayerTile>();
         foreach (var tile in layer.Tiles)
         {
             if (tile.Gid != 0)
             {
                 tiles.Add(tile);
             }
         }
         OptLayers.Add(layer.Name, tiles);
     }
     if (Layers.Contains("Ground"))
     {
         foreach (var tile in Layers["Ground"].Tiles)
         {
             if (tile.Gid == 0)
             {
                 SolidTiles.Add(new Vector2(tile.X, tile.Y));
             }
         }
     }
     if (Layers.Contains("Solid"))
     {
         foreach (var tile in OptLayers["Solid"])
         {
             SolidTiles.Add(new Vector2(tile.X, tile.Y));
         }
     }
     if (Layers.Contains("Special"))
     {
         foreach (var tile in OptLayers["Special"])
         {
             TmxTileset tileset = Utility.GetTilesetForTile(this, tile);
             if (tileset != null && tileset.Name == "special" && tile.Gid - tileset.FirstGid == 0)
             {
                 Trees.Add(new Vector2(tile.X, tile.Y));
             }
         }
     }
 }
        private void OnLayersRemoved(LayerEventsArgs args)
        {
            foreach (var layer in args.Layers)
            {
                if (layer.Map == _activeMap)
                {
                    if (Layers.Contains(layer))
                    {
                        Layers.Remove((BasicFeatureLayer)layer);
                    }
                }
            }

            if (SelectedLayer == null)
            {
                SelectedLayer = Layers.FirstOrDefault();
                SelectedLayerChanged();
            }
        }
Exemple #16
0
        public bool AddChild(object child)
        {
            bool   added = false;
            ILayer layer = child.As <ILayer>();

            if (layer != null)
            {
                if (!Layers.Contains(layer))
                {
                    Layers.Add(layer);
                    added = true;
                }
            }
            else
            {
                IReference <IGameObject> reference = child.As <IReference <IGameObject> >();
                if (reference != null)
                {
                    if (reference.Target != null &&
                        !this.Contains(reference.Target) &&
                        !GameObjectReferences.Contains(reference))
                    {
                        GameObjectReferences.Add(reference);
                        added = true;
                    }
                }
                else
                {
                    IGameObject gameObject = child.As <IGameObject>();
                    if (gameObject != null && !this.Contains(gameObject))
                    {
                        DomNode referenceNode = new DomNode(Schema.gameObjectReferenceType.Type);
                        reference        = referenceNode.Cast <IReference <IGameObject> >();
                        reference.Target = gameObject;
                        GameObjectReferences.Add(reference);
                        added = true;
                    }
                }
            }
            return(added);
        }
 Entity IUndoableTopology.GetParent(Entity instance)
 {
     return(Layers.Contains(instance) ? this : null);
 }
Exemple #18
0
 /// <summary>
 /// gets the TiledLayer by name
 /// </summary>
 /// <returns>The layer.</returns>
 /// <param name="name">Name.</param>
 public ITmxLayer GetLayer(string name) => Layers.Contains(name) ? Layers[name] : null;
Exemple #19
0
 // @Search by given layer
 public FootstepSound GetByLayer(int layer)
 {
     return(footsteps.Find(footstep => Layers.Contains(footstep.layer, layer)));
 }