Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static StyleLibrary TemplateStyleLibrary()
        {
            var sgt = StyleLibrary.Create("Template");
            var gs  = ShapeStyle.Create("Grid", 255, 222, 222, 222, 255, 222, 222, 222, 1.0);

            var builder = sgt.Styles.ToBuilder();

            builder.Add(gs);
            sgt.Styles = builder.ToImmutable();

            sgt.CurrentStyle = sgt.Styles.FirstOrDefault();

            return(sgt);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static StyleLibrary DefaultStyleLibrary()
        {
            var sgd = StyleLibrary.Create("Default");

            var builder = sgd.Styles.ToBuilder();

            builder.Add(ShapeStyle.Create("Black", 255, 0, 0, 0, 80, 0, 0, 0, 2.0));
            builder.Add(ShapeStyle.Create("Yellow", 255, 255, 255, 0, 80, 255, 255, 0, 2.0));
            builder.Add(ShapeStyle.Create("Red", 255, 255, 0, 0, 80, 255, 0, 0, 2.0));
            builder.Add(ShapeStyle.Create("Green", 255, 0, 255, 0, 80, 0, 255, 0, 2.0));
            builder.Add(ShapeStyle.Create("Blue", 255, 0, 0, 255, 80, 0, 0, 255, 2.0));
            sgd.Styles = builder.ToImmutable();

            sgd.CurrentStyle = sgd.Styles.FirstOrDefault();

            return(sgd);
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static StyleLibrary LinesStyleLibrary()
        {
            var sgdl = StyleLibrary.Create("Lines");

            var solid = ShapeStyle.Create("Solid", 255, 0, 0, 0, 80, 0, 0, 0, 2.0);

            solid.Dashes     = default(double[]);
            solid.DashOffset = 0.0;

            var dash = ShapeStyle.Create("Dash", 255, 0, 0, 0, 80, 0, 0, 0, 2.0);

            dash.Dashes     = new double[] { 2, 2 };
            dash.DashOffset = 1.0;

            var dot = ShapeStyle.Create("Dot", 255, 0, 0, 0, 80, 0, 0, 0, 2.0);

            dot.Dashes     = new double[] { 0, 2 };
            dot.DashOffset = 0.0;

            var dashDot = ShapeStyle.Create("DashDot", 255, 0, 0, 0, 80, 0, 0, 0, 2.0);

            dashDot.Dashes     = new double[] { 2, 2, 0, 2 };
            dashDot.DashOffset = 1.0;

            var dashDotDot = ShapeStyle.Create("DashDotDot", 255, 0, 0, 0, 80, 0, 0, 0, 2.0);

            dashDotDot.Dashes     = new double[] { 2, 2, 0, 2, 0, 2 };
            dashDotDot.DashOffset = 1.0;

            var builder = sgdl.Styles.ToBuilder();

            builder.Add(solid);
            builder.Add(dash);
            builder.Add(dot);
            builder.Add(dashDot);
            builder.Add(dashDotDot);
            sgdl.Styles = builder.ToImmutable();

            sgdl.CurrentStyle = sgdl.Styles.FirstOrDefault();

            return(sgdl);
        }
Example #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sg"></param>
        public void Add(StyleLibrary sg)
        {
            if (sg == null)
                return;

            if (sg.Styles != null)
            {
                Add(sg.Styles);
            }

            sg.PropertyChanged += StyleLibraryObserver;
            Verbose("Add Style Library: " + sg.Name);
        }
Example #5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sg"></param>
        public void Remove(StyleLibrary sg)
        {
            if (sg == null)
                return;

            if (sg.Styles != null)
            {
                Remove(sg.Styles);
            }

            sg.PropertyChanged -= StyleLibraryObserver;
            Verbose("Remove Style Library: " + sg.Name);
        }