コード例 #1
0
        internal static Dictionary<Guid, LayerInfo> GetVisibleLayerList(Dictionary<Guid, LayerInfo> previous)
        {
            Dictionary<Guid, LayerInfo> list = new Dictionary<Guid, LayerInfo>();

            foreach (Layer layer in LayerList.Values)
            {
                if (layer.Enabled)
                {
                    LayerInfo info = new LayerInfo();
                    info.StartOpacity = info.EndOpacity = layer.Opacity;
                    info.ID = layer.ID;
                    info.StartParams = layer.GetParams();

                    if (previous.ContainsKey(info.ID))
                    {
                        info.EndOpacity = previous[info.ID].EndOpacity;
                        info.EndParams = previous[info.ID].EndParams;
                    }
                    else
                    {
                        info.EndParams = layer.GetParams();
                    }
                    list.Add(layer.ID, info);
                }
            }
            return list;
        }
コード例 #2
0
        private void LoadLayerList(XmlNode layersNode)
        {
            foreach (XmlNode layer in layersNode)
            {
                LayerInfo info = new LayerInfo();
                info.ID = new Guid(layer.InnerText);
                info.StartOpacity = Convert.ToSingle(layer.Attributes["StartOpacity"].Value);
                info.EndOpacity = Convert.ToSingle(layer.Attributes["EndOpacity"].Value);

                int len = 0;
                if (layer.Attributes["ParamCount"] != null)
                {
                    len = Convert.ToInt32(layer.Attributes["ParamCount"].Value);
                }
                info.StartParams = new double[len];
                info.EndParams = new double[len];
                info.FrameParams = new double[len];

                for (int i = 0; i < len; i++)
                {
                    info.StartParams[i] = double.Parse(layer.Attributes[string.Format("StartParam{0}", i)].Value);
                    info.EndParams[i] = double.Parse(layer.Attributes[string.Format("EndParam{0}", i)].Value);
                    info.FrameParams[i] = info.StartParams[i];
                }

                Layers.Add(info.ID,info);
            }
        }