Example #1
0
 private bool AreLayerChanged(IList <string> oldNames, IList <Color> oldColors,
                              SortedDictionary <int, bool> oldVisibility)
 {
     if (LayerNames.Count != oldNames.Count)
     {
         return(true);
     }
     for (var i = 0; i < oldNames.Count; i++)
     {
         if (LayerNames[i] != oldNames[i])
         {
             return(true);
         }
     }
     if (LayerColors.Count != oldColors.Count)
     {
         return(true);
     }
     for (var i = 0; i < oldNames.Count; i++)
     {
         if (LayerColors[i] != oldColors[i])
         {
             return(true);
         }
     }
     foreach (var visibleItem in oldVisibility.Keys)
     {
         if (!VisibleIndices.ContainsKey(visibleItem))
         {
             return(true);
         }
     }
     return(false);
 }
Example #2
0
 public void SetLayerVisibility(int layerIndex, bool isVisible)
 {
     if (isVisible)
     {
         VisibleIndices[layerIndex] = true;
     }
     else
     {
         VisibleIndices.Remove(layerIndex);
     }
     OnModified();
 }
Example #3
0
        private void DeserializeTags(AttributeData data)
        {
            var oldLayerNames     = LayerNames;
            var oldLayerColors    = LayerColors;
            var oldVisibleIndices = VisibleIndices;

            LayerNames = data.ReadAttributeListString("Tags");
            var visibilityList = data.ReadAttributeListInteger("Visible");

            LayerColors = data.ReadAttributeListColor("Colors");
            VisibleIndices.Clear();
            foreach (var visibleId in visibilityList)
            {
                VisibleIndices[visibleId] = true;
            }
            if (AreLayerChanged(oldLayerNames, oldLayerColors, oldVisibleIndices))
            {
                UpdateVisibility();
            }
            CurrentLayer = data.ReadAttributeInteger("Index");
        }
Example #4
0
 public bool IsLayerVisible(int layerTagIndex)
 {
     return(Count != 0 && VisibleIndices.ContainsKey(layerTagIndex));
 }