Exemplo n.º 1
0
        public Path WpfCircle(wCurve Shp, wGraphic Graphics, wEffects ShapeEffects)
        {
            Path    X = new Path();
            wCircle C = (wCircle)Shp;

            EllipseGeometry E = new EllipseGeometry();

            E.Center  = new System.Windows.Point((C.Center.X) * Scale, (C.Center.Y) * Scale);
            E.RadiusX = C.Radius * Scale;
            E.RadiusY = C.Radius * Scale;

            X.Data            = E;
            X.RenderTransform = Xform;

            X = SetPathFill(X, Graphics);
            X = SetPathStroke(X, Graphics);
            X = SetPathEffects(X, ShapeEffects);

            group.Shapes.Add(new wShape(E, Graphics));
            return(X);
        }
Exemplo n.º 2
0
        public void SetGaugeValues(DataPt PollenDataPoint, int Mode, double Min, double Max, double Sum)
        {
            wGraphic G = PollenDataPoint.Graphics;

            Element.GaugeBackground = new SolidColorBrush(Color.FromArgb(100, 245, 245, 245));
            Element.GaugeActiveFill = PollenDataPoint.Graphics.GetBackgroundBrush();

            Element.Stroke          = G.GetStrokeBrush();
            Element.StrokeThickness = G.StrokeWeight[0];

            Element.Foreground = G.FontObject.GetFontBrush();

            switch (Mode)
            {
            default:
                Element.From  = 0;
                Element.To    = 100;
                Element.Value = SetSigDigits((PollenDataPoint.Number / Sum * 100), 3);
                break;

            case 1:
                Element.From  = 0;
                Element.To    = SetSigDigits(Sum, 3);
                Element.Value = SetSigDigits(PollenDataPoint.Number, 3);
                break;

            case 2:
                Element.From  = SetSigDigits(Min, 3);
                Element.To    = SetSigDigits(Max, 3);
                Element.Value = SetSigDigits((PollenDataPoint.Number), 3);
                break;

            case 3:
                Element.From  = 0;
                Element.To    = 100;
                Element.Value = SetSigDigits((PollenDataPoint.Number - Min) / (Max - Min) * 100, 3);
                break;
            }
        }
Exemplo n.º 3
0
        public Path WpfText(wCurve Shp, wGraphic Graphics, wEffects ShapeEffects)
        {
            Path        X = new Path();
            wTextObject Z = (wTextObject)Shp;
            wText       Y = Z.Text;
            wFontMedia  F = Y.Font.ToMediaFont();

            FormattedText T = new FormattedText("Test", CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, new Typeface("Arial"), 24, new SolidColorBrush(Colors.Black));

            //FormattedText T = new FormattedText(Y.Text,CultureInfo.GetCultureInfo("en-us"),FlowDirection.LeftToRight, F.GetTypeFace(),F.Size, Graphics.WpfFill);

            X.Data = T.BuildGeometry(new System.Windows.Point(Z.Plane.Origin.X, Z.Plane.Origin.Y));

            X.RenderTransform = Xform;

            //X = SetPathFill(X, Graphics);
            //X = SetPathEffects(X, ShapeEffects);
            //X = SetPathStroke(X, Graphics);

            group.Shapes.Add(new wShape(Shp, Graphics));
            return(X);
        }
Exemplo n.º 4
0
        public Path WpfSpline(wCurve Shp, wGraphic Graphics, wEffects ShapeEffects)
        {
            wBezierSpline C = (wBezierSpline)Shp;

            PathFigure            Pf = new PathFigure();
            PolyBezierSegment     S  = new PolyBezierSegment();
            PathGeometry          G  = new PathGeometry();
            PathFigureCollection  Fc = new PathFigureCollection();
            PathSegmentCollection Sc = new PathSegmentCollection();

            Path X = new Path();

            Pf.StartPoint = new System.Windows.Point(C.Points[0].X * Scale, C.Points[0].Y * Scale);

            for (int i = 1; i < C.Points.Count; i++)
            {
                wPoint P = C.Points[i];
                S.Points.Add(new System.Windows.Point(P.X * Scale, P.Y * Scale));
            }

            Sc.Add(S);
            Pf.Segments = Sc;
            Fc.Add(Pf);
            G.Figures = Fc;
            X.Data    = G;

            X.StrokeMiterLimit = 1.0;

            X.RenderTransform = Xform;

            X = SetPathFill(X, Graphics);
            X = SetPathStroke(X, Graphics);
            X = SetPathEffects(X, ShapeEffects);


            group.Shapes.Add(new wShape(G, Graphics));
            return(X);
        }
Exemplo n.º 5
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element       = null;
            int     FrameIndex    = 0;
            double  FrameDuration = 0.333;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref FrameIndex))
            {
                return;
            }
            if (!DA.GetData(2, ref FrameDuration))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }
            wGraphic G = W.Graphics;

            string LayerName = FrameIndex.ToString();

            G.Layer = LayerName;

            W.Graphics = G;

            switch (W.Type)
            {
            case "Parrot":
                pElement E = (pElement)W.Element;
                pControl C = (pControl)E.ParrotControl;
                C.Graphics = G;

                break;

            case "Pollen":
                switch (W.SubType)
                {
                }
                break;

            case "Hoopoe":
                wShapeCollection Shapes = (wShapeCollection)W.Element;

                Shapes.Group          = LayerName;
                Shapes.Graphics.Layer = LayerName;

                Shapes.Frame = new wFrames(FrameIndex, FrameDuration, CompositeMode);

                W.Element = Shapes;
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
Exemplo n.º 6
0
 public void SetGradient(wGraphic Graphics)
 {
     ChartSeries.GradientStopCollection = Graphics.Gradient.ToMediaGradient();
 }
Exemplo n.º 7
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;
            int     M       = 0;
            int     R       = 10;

            System.Drawing.Color F = System.Drawing.Color.DarkGray;
            System.Drawing.Color S = System.Drawing.Color.Transparent;
            double T = 0;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref M))
            {
                return;
            }
            if (!DA.GetData(2, ref R))
            {
                return;
            }
            if (!DA.GetData(3, ref F))
            {
                return;
            }
            if (!DA.GetData(4, ref S))
            {
                return;
            }
            if (!DA.GetData(5, ref T))
            {
                return;
            }

            wObject W;

            Element.CastTo(out W);

            wGraphic G = new wGraphic();

            G.Background  = new wColor(F);
            G.StrokeColor = new wColor(S);
            G.SetUniformStrokeWeight(T);

            wMarker CustomMarker = new wMarker((wMarker.MarkerType)M, (int)R, G);

            switch (W.Type)
            {
            case "Pollen":

                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt Pt = (DataPt)W.Element;
                    Pt.SetMarker(CustomMarker);

                    W.Element = Pt;
                    break;

                case "DataSet":
                    DataSetCollection St = (DataSetCollection)W.Element;
                    St.SetUniformMarkers(CustomMarker);

                    W.Element = St;
                    break;
                }
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, CustomMarker);
        }
Exemplo n.º 8
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;
            double  width   = 0;
            double  height  = 0;
            double  scale   = 1.0;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref width))
            {
                return;
            }
            if (!DA.GetData(2, ref height))
            {
                return;
            }
            if (!DA.GetData(3, ref scale))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }
            wGraphic G = W.Graphics;

            G.Width  = width;
            G.Height = height;
            G.Scale  = scale;

            W.Graphics = G;

            switch (W.Type)
            {
            case "Parrot":
                pElement E = (pElement)W.Element;
                pControl C = (pControl)E.ParrotControl;

                C.Graphics = G;
                C.SetSize();
                break;

            case "Pollen":
                switch (W.SubType)
                {
                default:
                    pElement El = (pElement)W.Element;
                    pChart   P  = (pChart)El.PollenControl;
                    P.Graphics = G;

                    P.SetSize();
                    break;

                case "DataPoint":
                    DataPt tDataPt = (DataPt)W.Element;
                    tDataPt.Graphics = G;

                    W.Element = tDataPt;
                    break;

                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;
                    tDataSet.Graphics = G;

                    tDataSet.SetSeriesScales();

                    tDataSet.SetScales();
                    W.Element = tDataSet;
                    break;

                case "Chart":
                case "Table":

                    pElement pE = (pElement)W.Element;
                    pChart   pC = pE.PollenControl;
                    pC.Graphics = G;

                    pC.SetSize();
                    pE.PollenControl = pC;
                    W.Element        = pE;
                    break;
                }
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
Exemplo n.º 9
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;
            IGH_Goo Shps    = null;
            double  Scale   = 1.0;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref Shps))
            {
                return;
            }
            if (!DA.GetData(2, ref Scale))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }
            wGraphic G = W.Graphics;

            wShapeCollection S = new wShapeCollection();

            if (Shps != null)
            {
                Shps.CastTo(out S);
            }

            wFillSwatch Swatch = new wFillSwatch(S, Scale, TilingMode, S.X, S.Y, S.Width, S.Height);

            G.FillType     = wGraphic.FillTypes.Pattern;
            G.WpfPattern   = Swatch.DwgBrush;
            G.WpfFill      = Swatch.DwgBrush;
            G.CustomFills += 1;

            W.Graphics = G;

            switch (W.Type)
            {
            case "Parrot":
                pElement E = (pElement)W.Element;
                pControl C = (pControl)E.ParrotControl;
                C.Graphics = G;
                C.SetFill();

                break;

            case "Pollen":
                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt tDataPt = (DataPt)W.Element;
                    tDataPt.Graphics = G;

                    tDataPt.Graphics.WpfFill    = G.WpfFill;
                    tDataPt.Graphics.WpfPattern = G.WpfPattern;

                    W.Element = tDataPt;
                    break;

                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;
                    tDataSet.Graphics = G;

                    tDataSet.Graphics.WpfFill    = G.WpfFill;
                    tDataSet.Graphics.WpfPattern = G.WpfPattern;

                    W.Element = tDataSet;
                    break;

                case "Chart":
                case "Table":

                    pElement pE = (pElement)W.Element;
                    pChart   pC = pE.PollenControl;
                    pC.Graphics = G;

                    pC.Graphics.WpfFill    = G.WpfFill;
                    pC.Graphics.WpfPattern = G.WpfPattern;

                    pC.SetPatternFill();

                    pE.PollenControl = pC;
                    W.Element        = pE;
                    break;
                }
                break;

            case "Hoopoe":
                wShapeCollection Shapes = (wShapeCollection)W.Element;
                Shapes.Graphics.FillType = wGraphic.FillTypes.Pattern;

                Shapes.Graphics.WpfFill    = G.WpfFill;
                Shapes.Graphics.WpfPattern = G.WpfPattern;

                W.Element = Shapes;
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
Exemplo n.º 10
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;
            bool    P       = false;
            double  R0      = 5;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref P))
            {
                return;
            }
            if (!DA.GetData(2, ref R0))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }
            wGraphic G = W.Graphics;

            G.PadRadius = P;
            G.Radius[0] = R0;
            G.Radius[1] = R0;
            G.Radius[2] = R0;
            G.Radius[3] = R0;

            W.Graphics = G;

            if (P)
            {
                W.Graphics.SetPaddingFromCorners();
            }
            else
            {
                W.Graphics.SetUniformPadding(0);
            }

            switch (W.Type)
            {
            case "Parrot":
                pElement E = (pElement)W.Element;
                pControl C = (pControl)E.ParrotControl;
                C.Graphics = G;

                C.SetCorners();

                break;

            case "Pollen":
                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt tDataPt = (DataPt)W.Element;

                    tDataPt.Graphics.Radius = G.Radius;
                    W.Element = tDataPt;
                    break;

                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;

                    tDataSet.Graphics.Radius = G.Radius;
                    W.Element = tDataSet;
                    break;
                }
                break;

            case "Hoopoe":
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
Exemplo n.º 11
0
 public void SetCorners(wGraphic Graphic)
 {
 }
Exemplo n.º 12
0
        public Path SetPathFill(Path ShapePath, wGraphic ShapeGraphics)
        {
            ShapePath.Fill = ShapeGraphics.WpfFill;

            return(ShapePath);
        }
Exemplo n.º 13
0
 public void SetCorners(wGraphic Graphic)
 {
     //Element.CornerRadius = new CornerRadius(Graphic.Radius[0], Graphic.Radius[1], Graphic.Radius[2], Graphic.Radius[3]);
 }
Exemplo n.º 14
0
        public override void SetAxisAppearance()
        {
            SetAxisScale();

            wColor HalfTone = new wColor(DataSet.Graphics.StrokeColor);

            HalfTone.Lighten(0.5);

            ChartArea A = ChartObject.ChartAreas[0];
            wAxes     X = DataSet.Axes;
            wGraphic  G = DataSet.Graphics;
            wFont     F = G.FontObject;

            A.AxisX.Interval = X.AxisX.MajorSpacing;
            A.AxisY.Interval = X.AxisY.MajorSpacing;


            // ==================== X Axis Formatting ====================
            if (X.AxisX.Enabled)
            {
                A.AxisX.Enabled = AxisEnabled.True;
            }
            else
            {
                A.AxisX.Enabled = AxisEnabled.False;
            }
            A.AxisX.LineColor               = G.StrokeColor.ToDrawingColor();
            A.AxisX.MajorTickMark.Enabled   = X.AxisX.HasLabel;
            A.AxisX.MajorTickMark.Interval  = X.AxisX.MajorSpacing;
            A.AxisX.MajorTickMark.LineWidth = (int)G.StrokeWeight[0];
            A.AxisX.MajorTickMark.LineColor = G.StrokeColor.ToDrawingColor();
            A.AxisX.MinorTickMark.Enabled   = false;


            //X Major Grid Formatting
            A.AxisX.MajorGrid.Enabled   = X.AxisX.Enabled;
            A.AxisX.MajorGrid.Interval  = X.AxisX.MajorSpacing;
            A.AxisX.MajorGrid.LineWidth = (int)G.StrokeWeight[0];
            A.AxisX.MajorGrid.LineColor = G.StrokeColor.ToDrawingColor();

            //X Minor Grid Formatting
            A.AxisX.MinorGrid.Enabled   = (X.AxisX.MinorSpacing != 0);
            A.AxisX.MinorGrid.Interval  = A.AxisX.MajorGrid.Interval / X.AxisX.MinorSpacing;
            A.AxisX.MinorGrid.LineWidth = (int)G.StrokeWeight[0];
            A.AxisX.MinorGrid.LineColor = HalfTone.ToDrawingColor();

            //X Label Formatting
            A.AxisX.IsMarginVisible         = X.AxisX.HasLabel;
            A.AxisX.Interval                = 0;
            A.AxisX.LabelStyle.Enabled      = X.AxisX.HasLabel;
            A.AxisX.LabelStyle.IntervalType = DateTimeIntervalType.Auto;
            A.AxisX.LabelStyle.Interval     = 1;
            A.AxisX.LabelAutoFitStyle       = LabelAutoFitStyles.DecreaseFont;
            A.AxisX.LabelStyle.Interval     = X.AxisX.MajorSpacing;
            A.AxisX.LabelStyle.Font         = F.ToDrawingFont().FontObject;
            A.AxisX.LabelStyle.ForeColor    = F.FontColor.ToDrawingColor();
            A.AxisX.LabelStyle.Angle        = (int)X.AxisX.Angle;



            // ==================== Y Axis Formatting ====================
            if (X.AxisY.Enabled)
            {
                A.AxisY.Enabled = AxisEnabled.True;
            }
            else
            {
                A.AxisY.Enabled = AxisEnabled.False;
            }
            A.AxisY.LineColor               = G.StrokeColor.ToDrawingColor();
            A.AxisY.MajorTickMark.Enabled   = X.AxisY.HasLabel;
            A.AxisY.MajorTickMark.Interval  = X.AxisY.MajorSpacing;
            A.AxisY.MajorTickMark.LineWidth = (int)G.StrokeWeight[0];
            A.AxisY.MajorTickMark.LineColor = G.StrokeColor.ToDrawingColor();
            A.AxisY.MinorTickMark.Enabled   = false;

            //Y Major Grid Formatting
            A.AxisY.MajorGrid.Enabled   = X.AxisY.Enabled;
            A.AxisY.MajorGrid.Interval  = X.AxisY.MajorSpacing;
            A.AxisY.MajorGrid.LineWidth = (int)G.StrokeWeight[0];
            A.AxisY.MajorGrid.LineColor = G.StrokeColor.ToDrawingColor();

            //Y Minor Grid Formatting
            A.AxisY.MinorGrid.Enabled   = (X.AxisY.MinorSpacing != 0);
            A.AxisY.MinorGrid.LineWidth = (int)G.StrokeWeight[0];
            A.AxisY.MinorGrid.LineColor = HalfTone.ToDrawingColor();
            A.AxisY.MinorGrid.Interval  = A.AxisY.MajorGrid.Interval / X.AxisY.MinorSpacing;

            //Y Label Formatting
            A.AxisY.IsMarginVisible         = X.AxisY.HasLabel;
            A.AxisY.Interval                = 1;
            A.AxisY.LabelStyle.Enabled      = X.AxisY.HasLabel;
            A.AxisY.LabelStyle.IntervalType = DateTimeIntervalType.Auto;
            A.AxisY.LabelAutoFitStyle       = LabelAutoFitStyles.DecreaseFont;
            A.AxisY.LabelStyle.Interval     = X.AxisY.MajorSpacing;
            A.AxisY.LabelStyle.Font         = F.ToDrawingFont().FontObject;
            A.AxisY.LabelStyle.ForeColor    = F.FontColor.ToDrawingColor();
            A.AxisY.LabelStyle.Angle        = (int)X.AxisY.Angle;


            ChartObject.ChartAreas[0] = A;
        }
Exemplo n.º 15
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // Declare variables
            IGH_Goo Element = null;
            IGH_Goo Z       = null;
            int     A       = 6;
            int     T       = 4;
            int     F       = 1;
            double  R       = 0;

            // Access the input parameters
            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref Z))
            {
                return;
            }
            if (!DA.GetData(2, ref A))
            {
                return;
            }
            if (!DA.GetData(3, ref F))
            {
                return;
            }
            if (!DA.GetData(4, ref T))
            {
                return;
            }
            if (!DA.GetData(5, ref R))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }
            wGraphic G = W.Graphics;

            Bitmap B = null;

            if (Z != null)
            {
                Z.CastTo(out B);
            }

            G.FillType   = wGraphic.FillTypes.Bitmap;
            G.FillBitmap = new wImage(B, (wImage.FillSpace)FillSpace, IsEmbedded, (wImage.AlignMode)A, (wImage.FitMode)F, R);

            G.WpfFill      = new wFillBitmap(B, A, F, T, R, ScaleFactor).FillBrush;
            G.CustomFills += 1;

            W.Graphics = G;

            if (Element != null)
            {
                switch (W.Type)
                {
                case "Parrot":
                    pElement E = (pElement)W.Element;
                    pControl C = (pControl)E.ParrotControl;
                    C.SetFill();

                    C.Graphics = G;
                    break;

                case "Pollen":
                    switch (W.SubType)
                    {
                    case "DataPoint":
                        DataPt tDataPt = (DataPt)W.Element;
                        tDataPt.Graphics = G;

                        tDataPt.Graphics.WpfFill    = G.WpfFill;
                        tDataPt.Graphics.WpfPattern = G.WpfPattern;

                        W.Element = tDataPt;
                        break;

                    case "DataSet":
                        DataSetCollection tDataSet = (DataSetCollection)W.Element;
                        tDataSet.Graphics = G;

                        tDataSet.Graphics.WpfFill    = G.WpfFill;
                        tDataSet.Graphics.WpfPattern = G.WpfPattern;

                        W.Element = tDataSet;
                        break;
                    }
                    break;

                case "Hoopoe":
                    wShapeCollection Shapes = (wShapeCollection)W.Element;
                    Shapes.Graphics.FillType = wGraphic.FillTypes.Bitmap;
                    Shapes.Graphics.WpfFill  = G.WpfFill;

                    Shapes.Graphics.FillBitmap = new wImage(B, (wImage.FillSpace)FillSpace, IsEmbedded, (wImage.AlignMode)A, (wImage.FitMode)F, R);

                    W.Element = Shapes;
                    break;
                }
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
Exemplo n.º 16
0
 public wShape(GeometryGroup GeoGroup, wGraphic WindGraphic)
 {
     GeometrySet = GeoGroup;
     Graphic     = WindGraphic;
 }
Exemplo n.º 17
0
 public wShape(System.Windows.Media.Geometry GeoObject, wGraphic WindGraphic)
 {
     GeometrySet.Children.Clear();
     GeometrySet.Children.Add(GeoObject);
     Graphic = WindGraphic;
 }
Exemplo n.º 18
0
 public wShape(wCurve WindCurve, wGraphic WindGraphic)
 {
     Curve   = WindCurve;
     Graphic = WindGraphic;
 }
Exemplo n.º 19
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;
            IGH_Goo Gx      = null;
            IGH_Goo Fx      = null;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref Gx))
            {
                return;
            }
            if (!DA.GetData(2, ref Fx))
            {
                return;
            }

            wObject W;

            Element.CastTo(out W);

            wLabel CustomToolTip = new wLabel();

            wGraphic G = CustomToolTip.Graphics;
            wFont    F = CustomToolTip.Font;

            Gx.CastTo(out G);
            Fx.CastTo(out F);

            CustomToolTip.Graphics = G;
            CustomToolTip.Font     = F;

            switch (W.Type)
            {
            case "Pollen":

                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt Pt = (DataPt)W.Element;

                    Pt.ToolTip.Enabled             = true;
                    Pt.ToolTip.Graphics            = G;
                    Pt.ToolTip.Font                = F;
                    Pt.ToolTip.Graphics.FontObject = F;

                    W.Element = Pt;
                    break;

                case "DataSet":
                    DataSetCollection St = (DataSetCollection)W.Element;
                    St.SetUniformTooltips(CustomToolTip);

                    St.ToolTip.Enabled             = true;
                    St.ToolTip.Graphics            = G;
                    St.ToolTip.Font                = F;
                    St.ToolTip.Graphics.FontObject = F;

                    W.Element = St;
                    break;
                }
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, CustomToolTip);
        }
Exemplo n.º 20
0
        public void SetProperties(DataSetCollection WindDataCollection, bool HasTitles)
        {
            Element.Children.Clear();
            Element.RowDefinitions.Clear();
            Element.ColumnDefinitions.Clear();

            Wc = WindDataCollection;

            for (int i = 0; i < Wc.Sets.Count; i++)
            {
                if (Wc.Sets[i].Title == "")
                {
                    Wc.Sets[i].Title = ("Title " + i.ToString());
                }

                ColumnDefinition col = new ColumnDefinition();
                Element.ColumnDefinitions.Add(col);
            }

            int k = 0;

            if (HasTitles)
            {
                k = 1;

                RowDefinition TitleRow = new RowDefinition();
                Element.RowDefinitions.Add(TitleRow);

                for (int i = 0; i < Wc.Sets.Count; i++)
                {
                    wGraphic G = Wc.Graphics;

                    Label ttxt = new Label();
                    ttxt.Content         = Wc.Sets[i].Title;
                    ttxt.Background      = G.GetBackgroundBrush();
                    ttxt.Foreground      = G.FontObject.GetFontBrush();
                    ttxt.BorderBrush     = G.GetStrokeBrush();
                    ttxt.BorderThickness = G.GetStroke();

                    ttxt.Padding = G.GetPadding();
                    ttxt.Margin  = G.GetMargin();

                    ttxt.FontFamily = G.FontObject.ToMediaFont().Family;
                    ttxt.FontSize   = G.FontObject.Size;
                    ttxt.FontStyle  = G.FontObject.ToMediaFont().Italic;
                    ttxt.FontWeight = G.FontObject.ToMediaFont().Bold;
                    ttxt.HorizontalContentAlignment = G.FontObject.ToMediaFont().HAlign;
                    ttxt.VerticalContentAlignment   = G.FontObject.ToMediaFont().VAlign;

                    Grid.SetColumn(ttxt, i);
                    Grid.SetRow(ttxt, 0);
                    Element.Children.Add(ttxt);
                }
            }

            for (int i = 0; i < Wc.Sets[0].Points.Count; i++)
            {
                RowDefinition row = new RowDefinition();
                Element.RowDefinitions.Add(row);
                for (int j = 0; j < (Wc.Count); j++)
                {
                    DataPt   Pt = Wc.Sets[j].Points[i];
                    wGraphic G  = Pt.Graphics;
                    wFont    F  = G.FontObject;

                    Border brd = new Border();
                    Label  txt = new Label();
                    txt.Content = string.Format("{0:" + Pt.Label.Format + "}", Pt.Number);

                    txt.Background      = Brushes.Transparent;
                    txt.Foreground      = G.GetFontBrush();
                    txt.BorderBrush     = Brushes.Transparent;
                    txt.BorderThickness = new Thickness(0);

                    txt.Padding = G.GetPadding();
                    txt.Margin  = G.GetMargin();

                    txt.FontFamily = F.ToMediaFont().Family;
                    txt.FontSize   = F.Size;
                    txt.FontStyle  = G.FontObject.ToMediaFont().Italic;
                    txt.FontWeight = G.FontObject.ToMediaFont().Bold;
                    txt.HorizontalContentAlignment = F.ToMediaFont().HAlign;
                    txt.VerticalContentAlignment   = F.ToMediaFont().VAlign;

                    if (G.Width > 1)
                    {
                        txt.Width = G.Width;
                    }
                    else
                    {
                        txt.Width = double.NaN;
                    }
                    if (G.Height > 1)
                    {
                        txt.Height = G.Height;
                    }
                    else
                    {
                        txt.Height = double.NaN;
                    }


                    brd.CornerRadius    = G.GetCorner();
                    brd.Background      = G.GetBackgroundBrush();
                    brd.BorderBrush     = G.GetStrokeBrush();
                    brd.BorderThickness = G.GetStroke();

                    brd.Child = txt;

                    Grid.SetColumn(brd, j);
                    Grid.SetRow(brd, i + k);
                    Element.Children.Add(brd);
                }
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;
            string  N       = "Arial";
            double  S       = 8;

            System.Drawing.Color X = System.Drawing.Color.Black;
            int  J = 0;
            bool B = false;
            bool I = false;
            bool U = false;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref N))
            {
                return;
            }
            if (!DA.GetData(2, ref S))
            {
                return;
            }
            if (!DA.GetData(3, ref X))
            {
                return;
            }
            if (!DA.GetData(4, ref J))
            {
                return;
            }
            if (!DA.GetData(5, ref B))
            {
                return;
            }
            if (!DA.GetData(6, ref I))
            {
                return;
            }
            if (!DA.GetData(7, ref U))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }
            wGraphic G = W.Graphics;

            wFont F = new wFont(N, S, new wColor(X), (wFontBase.Justification)J, B, I, U, false);

            G.FontObject = F;

            W.Graphics = G;

            switch (W.Type)
            {
            case "Parrot":
                pElement E = (pElement)W.Element;
                pControl C = (pControl)E.ParrotControl;

                C.Graphics = G;
                C.SetFont();
                break;

            case "Pollen":
                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt tDataPt = (DataPt)W.Element;
                    tDataPt.Graphics = G;

                    W.Element = tDataPt;
                    break;

                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;
                    tDataSet.Graphics = G;

                    tDataSet.TotalCustomTitles += 1;

                    W.Element = tDataSet;
                    break;

                case "Chart":
                case "Table":
                    pElement pE = (pElement)W.Element;
                    pChart   pC = pE.PollenControl;
                    pC.Graphics = G;

                    pC.SetFont();

                    pE.PollenControl = pC;
                    W.Element        = pE;
                    break;
                }
                break;

            case "Hoopoe":
                wShapeCollection Shapes = (wShapeCollection)W.Element;

                Shapes.Fonts = F;

                W.Element = Shapes;
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, G.FontObject);
            DA.SetData(2, G);
        }
Exemplo n.º 22
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;

            System.Drawing.Color B = System.Drawing.Color.Black;
            double        T        = 1;
            List <double> P        = new List <double>();

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref B))
            {
                return;
            }
            if (!DA.GetData(2, ref T))
            {
                return;
            }
            if (!DA.GetDataList(3, P))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }
            wGraphic G = W.Graphics;

            G.StrokeColor = new wColor(B);
            G.SetUniformStrokeWeight(T);

            G.StrokeCap    = (wGraphic.StrokeCaps)CapMode;
            G.StrokeCorner = (wGraphic.StrokeCorners)CornerMode;

            switch (PatternMode)
            {
            case 0:
                if ((P.Count == 1) && (P[0] == 0))
                {
                    P = new List <double> {
                        1, 0
                    };
                }
                break;

            case 1:
                P = new List <double> {
                    2, 3
                };
                break;

            case 2:
                P = new List <double> {
                    5
                };
                break;

            case 3:
                P = new List <double> {
                    15, 10
                };
                break;

            case 4:
                P = new List <double> {
                    0.5, 2
                };
                break;

            case 5:
                P = new List <double> {
                    30, 5, 10, 5,
                };
                break;
            }


            List <double> SP = new List <double>();

            foreach (double PV in P)
            {
                SP.Add(PV / T);
            }

            G.StrokePattern  = SP.ToArray();
            G.CustomStrokes += 1;

            W.Graphics = G;



            switch (W.Type)
            {
            case "Parrot":
                pElement E = (pElement)W.Element;
                pControl C = (pControl)E.ParrotControl;

                C.Graphics = G;
                C.SetStroke();
                break;

            case "Pollen":
                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt tDataPt = (DataPt)W.Element;
                    tDataPt.Graphics = G;

                    W.Element = tDataPt;
                    break;

                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;
                    tDataSet.Graphics = G;

                    W.Element = tDataSet;
                    break;

                case "Chart":
                case "Table":
                    pElement pE = (pElement)W.Element;
                    pChart   pC = pE.PollenControl;
                    pC.Graphics = G;

                    pC.SetStroke();

                    pE.PollenControl = pC;
                    W.Element        = pE;
                    break;
                }
                break;

            case "Hoopoe":
                wShapeCollection Shapes = (wShapeCollection)W.Element;
                Shapes.Graphics.StrokeColor  = G.StrokeColor;
                Shapes.Graphics.StrokeWeight = G.StrokeWeight;


                Shapes.Graphics.StrokePattern = G.StrokePattern;

                Shapes.Graphics.StrokeCap    = G.StrokeCap;
                Shapes.Graphics.StrokeCorner = G.StrokeCorner;

                W.Element = Shapes;
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
Exemplo n.º 23
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;
            double  T0      = 1;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref T0))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }
            wGraphic G = W.Graphics;

            G.Margin[0] = T0;
            G.Margin[1] = T0;
            G.Margin[2] = T0;
            G.Margin[3] = T0;

            W.Graphics = G;

            switch (W.Type)
            {
            case "Parrot":
                pElement E = (pElement)W.Element;
                pControl C = (pControl)E.ParrotControl;
                C.Graphics = G;

                C.SetMargin();

                break;

            case "Pollen":
                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt tDataPt = (DataPt)W.Element;
                    tDataPt.Graphics = G;

                    W.Element = tDataPt;
                    break;

                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;
                    tDataSet.Graphics = G;

                    W.Element = tDataSet;
                    break;

                case "Chart":
                case "Table":

                    pElement pE = (pElement)W.Element;
                    pChart   pC = pE.PollenControl;
                    pC.Graphics = G;

                    pC.SetMargin();

                    pE.PollenControl = pC;
                    W.Element        = pE;
                    break;
                }
                break;

            case "Hoopoe":
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
Exemplo n.º 24
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;
            int     Pattern = 0;
            double  Scale   = 1;

            System.Drawing.Color Background = wColors.VeryLightGray.ToDrawingColor();
            System.Drawing.Color ForeGround = wColors.LightGray.ToDrawingColor();

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref Pattern))
            {
                return;
            }
            if (!DA.GetData(2, ref Scale))
            {
                return;
            }
            if (!DA.GetData(3, ref ForeGround))
            {
                return;
            }
            if (!DA.GetData(4, ref Background))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }
            wGraphic G = W.Graphics;

            G.FillType     = wGraphic.FillTypes.Pattern;
            G.CustomFills += 1;

            G.Background  = new wColor(Background);
            G.Foreground  = new wColor(ForeGround);
            G.StrokeColor = new wColor(ForeGround);

            G.SetUniformStrokeWeight(PatternWeight);

            wShapeCollection S = new wShapeCollection();

            S.Graphics = G;

            wPattern P = new wPattern(0, 0, 9, 9, S);

            if ((PatternModeStatus < 5) && (PatternModeStatus != 0))
            {
                P.SetStroke(Pattern);
            }
            else
            {
                P.SetStroke(0);
            }

            S = P.SetPattern(PatternModeStatus, Pattern, SpacingMode);

            G = S.Graphics;

            wFillSwatch Swatch = new wFillSwatch(S, Scale, 4, S.X, S.Y, S.Width, S.Height);


            G.WpfPattern = Swatch.DwgBrush;
            G.WpfFill    = Swatch.DwgBrush;

            W.Graphics = G;

            switch (W.Type)
            {
            case "Parrot":
                pElement E = (pElement)W.Element;
                pControl C = (pControl)E.ParrotControl;
                C.Graphics = G;

                C.SetFill();

                break;

            case "Pollen":
                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt tDataPt = (DataPt)W.Element;
                    tDataPt.Graphics = G;

                    tDataPt.Graphics.WpfFill    = G.WpfFill;
                    tDataPt.Graphics.WpfPattern = G.WpfPattern;

                    W.Element = tDataPt;
                    break;

                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;
                    tDataSet.Graphics = G;

                    tDataSet.Graphics.WpfFill    = G.WpfFill;
                    tDataSet.Graphics.WpfPattern = G.WpfPattern;

                    W.Element = tDataSet;
                    break;

                case "Chart":
                case "Table":

                    pElement pE = (pElement)W.Element;
                    pChart   pC = pE.PollenControl;
                    pC.Graphics = G;

                    pC.Graphics.WpfFill    = G.WpfFill;
                    pC.Graphics.WpfPattern = G.WpfPattern;

                    pC.SetPatternFill();

                    pE.PollenControl = pC;
                    W.Element        = pE;
                    break;
                }
                break;

            case "Hoopoe":
                wShapeCollection Shapes = (wShapeCollection)W.Element;
                Shapes.Graphics.FillType   = wGraphic.FillTypes.Pattern;
                Shapes.Graphics.WpfFill    = G.WpfFill;
                Shapes.Graphics.WpfPattern = G.WpfPattern;

                W.Element = Shapes;
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
Exemplo n.º 25
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;
            int     X       = 0;
            int     P       = 0;
            double  A       = 0;
            bool    L       = true;

            System.Drawing.Color C = System.Drawing.Color.Transparent;
            System.Drawing.Color F = System.Drawing.Color.Transparent;
            double T = 0;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref X))
            {
                return;
            }
            if (!DA.GetData(2, ref P))
            {
                return;
            }
            if (!DA.GetData(3, ref A))
            {
                return;
            }
            if (!DA.GetData(4, ref C))
            {
                return;
            }
            if (!DA.GetData(5, ref F))
            {
                return;
            }
            if (!DA.GetData(6, ref T))
            {
                return;
            }

            wObject W;

            Element.CastTo(out W);

            wLabel CustomLabel = new wLabel();

            wGraphic G = CustomLabel.Graphics;

            if (P == 0)
            {
                L = false;
            }

            CustomLabel.HasLeader = L;
            CustomLabel.Graphics  = new wGraphic(new wColor(C), G.Foreground, new wColor(F), T);
            CustomLabel.Position  = (wLabel.LabelPosition)P;
            CustomLabel.Alignment = (wLabel.LabelAlignment)X;

            CustomLabel.Graphics = G;

            switch (W.Type)
            {
            case "Pollen":

                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt Pt = (DataPt)W.Element;

                    Pt.Graphics.FontObject.Angle = A;

                    Pt.Label.HasLeader = L;
                    Pt.Label.Graphics  = new wGraphic(new wColor(C), G.Foreground, new wColor(F), T);
                    Pt.Label.Position  = (wLabel.LabelPosition)P;
                    Pt.Label.Alignment = (wLabel.LabelAlignment)X;
                    Pt.CustomLabels   += 1;

                    W.Element = Pt;
                    break;

                case "DataSet":
                    DataSetCollection St = (DataSetCollection)W.Element;
                    St.SetUniformLabel(CustomLabel, A);

                    St.Graphics.FontObject.Angle = A;

                    St.Label.HasLeader = L;
                    St.Label.Graphics  = new wGraphic(new wColor(C), G.Foreground, new wColor(F), T);
                    St.Label.Position  = (wLabel.LabelPosition)P;
                    St.Label.Alignment = (wLabel.LabelAlignment)X;

                    W.Element = St;
                    break;
                }
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, CustomLabel);
        }
Exemplo n.º 26
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;
            int     J       = vJustify * 3 + hJustify;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }
            wGraphic G = W.Graphics;

            GetFont.Font  = new wFont(fName, fSize, new wColor(DrawColor), (wFontBase.Justification)J, IsBold, IsItalic, IsUnder, false).ToDrawingFont().FontObject;
            GetFont.Color = DrawColor;

            if (toggle)
            {
                GetFont.ShowDialog();

                fName = GetFont.Font.Name;
                fSize = GetFont.Font.Size;

                IsBold   = GetFont.Font.Bold;
                IsItalic = GetFont.Font.Italic;
                IsUnder  = GetFont.Font.Underline;

                DrawColor = GetFont.Color;

                toggle = false;
            }

            wFont F = new wFont(fName, fSize, new wColor(DrawColor), (wFontBase.Justification)J, IsBold, IsItalic, IsUnder, false);

            G.FontObject   = F;
            G.CustomFonts += 1;

            W.Graphics = G;

            switch (W.Type)
            {
            case "Parrot":
                pElement E = (pElement)W.Element;
                pControl C = (pControl)E.ParrotControl;

                C.Graphics = G;
                C.SetFont();
                break;

            case "Pollen":
                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt tDataPt = (DataPt)W.Element;
                    tDataPt.Graphics = G;

                    W.Element = tDataPt;
                    break;

                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;
                    tDataSet.Graphics = G;

                    tDataSet.TotalCustomTitles += 1;

                    W.Element = tDataSet;

                    break;

                case "Chart":
                case "Table":
                    pElement pE = (pElement)W.Element;
                    pChart   pC = pE.PollenControl;
                    pC.Graphics = G;

                    pC.SetFont();

                    pE.PollenControl = pC;
                    W.Element        = pE;
                    break;
                }
                break;

            case "Hoopoe":
                wShapeCollection Shapes = (wShapeCollection)W.Element;

                Shapes.Fonts = F;

                W.Element = Shapes;
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, G.FontObject);
            DA.SetData(2, G);
        }
Exemplo n.º 27
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;

            List <System.Drawing.Color> Colors = new List <System.Drawing.Color>();
            List <double> Parameters           = new List <double>();
            double        GradientAngle        = 0;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetDataList(1, Colors))
            {
                return;
            }
            if (!DA.GetDataList(2, Parameters))
            {
                return;
            }
            if (!DA.GetData(3, ref GradientAngle))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }
            wGraphic G = W.Graphics;

            G.FillType     = wGraphic.FillTypes.LinearGradient;
            G.CustomFills += 1;

            if (Parameters.Count < 1)
            {
                G.Gradient = new wGradient(Colors);
            }
            else
            {
                if (Parameters.Count < Colors.Count)
                {
                    for (int i = Parameters.Count; i < Colors.Count; i++)
                    {
                        Parameters.Add(Parameters[Parameters.Count - 1]);
                    }
                }

                G.Gradient = new wGradient(Colors, Parameters, GradientAngle, (wGradient.GradientSpace)GradientSpace);
            }

            G.WpfFill = new wFillGradient(G.Gradient, GradientType).GrdBrush;

            W.Graphics = G;

            if (Element != null)
            {
                switch (W.Type)
                {
                case "Parrot":
                    pElement E = (pElement)W.Element;
                    pControl C = (pControl)E.ParrotControl;
                    C.SetFill();

                    C.Graphics = G;
                    break;

                case "Pollen":
                    switch (W.SubType)
                    {
                    case "DataPoint":
                        DataPt tDataPt = (DataPt)W.Element;
                        tDataPt.Graphics = G;

                        tDataPt.Graphics.WpfFill    = G.WpfFill;
                        tDataPt.Graphics.WpfPattern = G.WpfPattern;

                        W.Element = tDataPt;
                        break;

                    case "DataSet":
                        DataSetCollection tDataSet = (DataSetCollection)W.Element;
                        tDataSet.Graphics = G;

                        tDataSet.Graphics.WpfFill    = G.WpfFill;
                        tDataSet.Graphics.WpfPattern = G.WpfPattern;

                        W.Element = tDataSet;
                        break;

                    case "Chart":
                    case "Table":

                        pElement pE = (pElement)W.Element;
                        pChart   pC = pE.PollenControl;
                        pC.Graphics = G;

                        pC.Graphics.WpfFill    = G.WpfFill;
                        pC.Graphics.WpfPattern = G.WpfPattern;

                        pC.SetGradientFill();

                        pE.PollenControl = pC;
                        W.Element        = pE;
                        break;
                    }
                    break;

                case "Hoopoe":
                    wShapeCollection Shapes = (wShapeCollection)W.Element;
                    Shapes.Graphics.FillType = wGraphic.FillTypes.LinearGradient;

                    wGradient GRD = new wGradient();

                    if (Parameters.Count < 1)
                    {
                        GRD = new wGradient(Colors, GradientAngle, (wGradient.GradientSpace)GradientSpace);
                    }
                    else
                    {
                        GRD = new wGradient(Colors, Parameters, GradientAngle, (wGradient.GradientSpace)GradientSpace);
                    }

                    Shapes.Graphics.Gradient = GRD;
                    Shapes.Graphics.WpfFill  = new wFillGradient(G.Gradient, GradientType).GrdBrush;



                    W.Element = Shapes;
                    break;
                }
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
Exemplo n.º 28
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;

            System.Drawing.Color Background = wColors.VeryLightGray.ToDrawingColor();

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref Background))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }
            wGraphic G = W.Graphics;

            G.FillType = wGraphic.FillTypes.Solid;

            G.Background = new wColor(Background);
            G.Foreground = new wColor(Background);

            G.WpfFill      = new wFillSolid(G.Background).FillBrush;
            G.CustomFills += 1;

            W.Graphics = G;

            switch (W.Type)
            {
            case "Parrot":
                pElement E = (pElement)W.Element;
                pControl C = (pControl)E.ParrotControl;
                C.Graphics = G;

                C.SetFill();

                break;

            case "Pollen":
                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt tDataPt = (DataPt)W.Element;
                    tDataPt.Graphics = G;

                    tDataPt.Graphics.WpfFill    = G.WpfFill;
                    tDataPt.Graphics.WpfPattern = G.WpfPattern;

                    W.Element = tDataPt;
                    break;

                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;
                    tDataSet.Graphics = G;

                    tDataSet.Graphics.WpfFill    = G.WpfFill;
                    tDataSet.Graphics.WpfPattern = G.WpfPattern;

                    W.Element = tDataSet;
                    break;

                case "Chart":
                case "Table":

                    pElement pE = (pElement)W.Element;
                    pChart   pC = pE.PollenControl;
                    pC.Graphics = G;

                    pC.SetSolidFill();

                    pE.PollenControl = pC;
                    W.Element        = pE;
                    break;
                }
                break;

            case "Hoopoe":
                wShapeCollection Shapes = (wShapeCollection)W.Element;
                Shapes.Graphics.FillType = wGraphic.FillTypes.Solid;
                Shapes.Graphics.WpfFill  = G.WpfFill;

                Shapes.Graphics.Background = new wColor(Background);
                Shapes.Graphics.Foreground = new wColor(Background);

                W.Element = Shapes;
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
Exemplo n.º 29
0
 public void SetFont(wGraphic Graphic)
 {
 }
Exemplo n.º 30
0
        public void SetNumericData(int Mode)
        {
            int cnt = (DataList.Count - ChartSeries.Points.Count);

            ChartSeries.AxisLabel = DataList.Title;
            ChartSeries.ToolTip   = "";

            //Add more data points if the total number of values is higher than the current number of data points in the chart
            if (DataList.Count > ChartSeries.Points.Count)
            {
                for (int i = 0; i < cnt; i++)
                {
                    ChartSeries.Points.Add(new DataPoint());
                }
            }

            cnt = (ChartSeries.Points.Count - DataList.Count);

            //Remove data points if the total number of values is less than the current number of data points in the chart
            if (ChartSeries.Points.Count > DataList.Count)
            {
                for (int i = 0; i < cnt; i++)
                {
                    ChartSeries.Points.RemoveAt(ChartSeries.Points.Count - 1);
                }
            }

            //Assign formatting to each point
            for (int i = 0; i < DataList.Count; i++)
            {
                DataPt   D = DataList.Points[i];
                wGraphic G = D.Graphics;

                DataPoint Pt = new DataPoint();

                //Set Tooltip
                if (D.ToolTip.Enabled)
                {
                    Pt.ToolTip      = D.Label.Content;
                    Pt.LabelToolTip = D.ToolTip.Content;
                }
                else
                {
                    Pt.ToolTip      = "";
                    Pt.LabelToolTip = "";
                }

                //Set Point [Fill / Line] Color
                if (StrokeMode)
                {
                    Pt.Color = D.Graphics.StrokeColor.ToDrawingColor();
                }
                else
                {
                    Pt.Color = D.Graphics.Background.ToDrawingColor();
                }

                //Set Line & Border Properties
                Pt.BorderColor = G.StrokeColor.ToDrawingColor();
                Pt.BorderWidth = (int)G.StrokeWeight[0];

                //Set Label Properties
                Pt.IsValueShownAsLabel = true;
                Pt.LabelFormat         = "{0:" + D.Label.Format + "}";
                Pt.Font = G.FontObject.ToDrawingFont().FontObject;

                Pt.LabelAngle     = (int)G.FontObject.Angle;
                Pt.LabelForeColor = G.FontObject.FontColor.ToDrawingColor();

                //  Label Frame
                Pt["LabelStyle"]    = D.Label.GetLabelAlignment();
                Pt["BarLabelStyle"] = D.Label.GetBarAlignment();
                Pt.LabelBackColor   = D.Label.Graphics.Background.ToDrawingColor();
                Pt.LabelBorderColor = D.Label.Graphics.StrokeColor.ToDrawingColor();
                Pt.LabelBorderWidth = (int)D.Label.Graphics.StrokeWeight[0];

                //Set Marker Properties
                Pt                   = SetMarkerType(Pt, (int)D.Marker.Mode);
                Pt.MarkerSize        = D.Marker.Radius;
                Pt.MarkerColor       = D.Marker.Graphics.Background.ToDrawingColor();
                Pt.MarkerBorderWidth = (int)D.Marker.Graphics.StrokeWeight[0];
                Pt.MarkerBorderColor = D.Marker.Graphics.StrokeColor.ToDrawingColor();

                ChartSeries.Points[i] = Pt;
            }

            ChartSeries["PointWidth"] = Convert.ToString(DataList.BarScale % 1.00001);

            switch (Mode)
            {
            case 0:

                for (int i = 0; i < DataList.Count; i++)
                {
                    DataPt   D = DataList.Points[i];
                    double[] X = { D.Number };
                    ChartSeries.Points[i].YValues = X;
                }
                break;

            case 1:
                for (int i = 0; i < DataList.Count; i++)
                {
                    DataPt   D = DataList.Points[i];
                    double[] X = { D.Domain.Item1, D.Domain.Item2 };
                    ChartSeries.Points[i].YValues = X;
                    ChartSeries.Points[i].XValue  = i;
                }
                ChartSeries["PointWidth"] = Convert.ToString(DataList.Points[0].Graphics.Width);
                break;

            case 2:
                double T = 0;
                for (int i = 0; i < DataList.Count; i++)
                {
                    T += DataList.Points[i].Number;
                }
                for (int i = 0; i < DataList.Count; i++)
                {
                    DataPt   D = DataList.Points[i];
                    double[] X = { (D.Number / T) * 100 };
                    ChartSeries.Points[i].YValues = X;
                }
                break;

            case 3:
                for (int i = 0; i < DataList.Count; i++)
                {
                    DataPt   D = DataList.Points[i];
                    double[] X = { D.Point.X, D.Point.Y, D.Point.Z };
                    ChartSeries.Points[i].YValues = X;
                }
                break;

            case 4:
                for (int i = 0; i < DataList.Count; i++)
                {
                    DataPt   D = DataList.Points[i];
                    double[] X = { D.Number };
                    ChartSeries.Points[i].YValues = X;
                    ChartSeries.Points[i].XValue  = i;
                }
                break;
            }
        }