コード例 #1
0
 private void SetStepLineProperties(StepLineSeries Ser, DataPt Pt)
 {
     Ser.Fill              = Brushes.Transparent;
     Ser.PointForeground   = Pt.Marker.Graphics.GetBackgroundBrush();
     Ser.PointGeometrySize = Pt.Marker.Radius;
     Ser.AlternativeStroke = Pt.Graphics.GetStrokeBrush();
 }
コード例 #2
0
        private void SetLineProperties(LineSeries Ser, DataPt Pt)
        {
            Ser.Fill = Brushes.Transparent;

            Ser.PointForeground   = Pt.Marker.Graphics.GetBackgroundBrush();
            Ser.PointGeometrySize = Pt.Marker.Radius;
        }
コード例 #3
0
ファイル: pRadialChart.cs プロジェクト: pm-Architect/Aviary
        public PieSeries SetSequenceProperties(DataPt Pt, PieSeries Sequence)
        {
            wGraphic G = Pt.Graphics;
            wFont    F = G.FontObject;

            Sequence.PointGeometry = GetGeometry((int)Pt.Marker.Mode);

            Sequence.DataLabels = true;
            Sequence.LabelPoint = point => string.Format("{0:" + Pt.Label.Format + "}", point.Y);

            Sequence.Fill = G.GetBackgroundBrush();

            Sequence.Foreground = F.GetFontBrush();
            Sequence.FontSize   = F.Size;
            Sequence.FontStyle  = F.ToMediaFont().Italic;
            Sequence.FontWeight = F.ToMediaFont().Bold;

            Sequence.StrokeThickness = G.StrokeWeight[0];
            Sequence.Stroke          = G.GetStrokeBrush();
            Sequence.StrokeDashArray = new DoubleCollection(G.StrokePattern);

            Sequence.PointGeometry = GetGeometry((int)Pt.Marker.Mode);
            if (Pt.Label.Alignment == 0)
            {
                Sequence.LabelPosition = PieLabelPosition.OutsideSlice;
            }
            else
            {
                Sequence.LabelPosition = PieLabelPosition.InsideSlice;
            }

            return(Sequence);
        }
コード例 #4
0
        public StackedAreaSeries SetProperties(StackedAreaSeries NewSeries, DataPt Pt)
        {
            NewSeries.PointForeground   = Pt.Marker.Graphics.GetBackgroundBrush();
            NewSeries.PointGeometrySize = Pt.Marker.Radius;

            return(NewSeries);
        }
コード例 #5
0
        public void SetPointProperties(LineSeries Ser, DataPt Pt)
        {
            Ser.Fill = Brushes.Transparent;

            Ser.PointGeometry   = GetGeometry(1);
            Ser.PointForeground = Pt.Marker.Graphics.GetBackgroundBrush();
        }
コード例 #6
0
        public LiveCharts.Wpf.Series SetSequenceProperties(DataPt Pt, LiveCharts.Wpf.Series Sequence)
        {
            wGraphic G = Pt.Graphics;
            wFont    F = G.FontObject;

            Sequence.DataLabels = Pt.Label.Enabled;
            switch (ChartType)
            {
            default:
                Sequence.LabelPoint = point => string.Format("{0:" + Pt.Label.Format + "}", point.Y);
                break;

            case SeriesChartType.BarAdjacent:
            case SeriesChartType.BarStack:
            case SeriesChartType.BarStack100:
                Sequence.LabelPoint = point => string.Format("{0:" + Pt.Label.Format + "}", point.X);
                break;

            case SeriesChartType.Gantt:
                Sequence.LabelPoint = point => (string.Format("{0:" + Pt.Label.Format + "}", point.XStart) + " & " + string.Format("{0:" + Pt.Label.Format + "}", point.X));
                break;

            case SeriesChartType.Scatter:
                Sequence.LabelPoint = point => (string.Format("{0:" + Pt.Label.Format + "}", point.X) + " & " + string.Format("{0:" + Pt.Label.Format + "}", point.Y));
                break;

            case SeriesChartType.Bubble:
                Sequence.LabelPoint = point => string.Format("{0:" + Pt.Label.Format + "}", point.Weight);
                break;
            }

            Sequence.PointGeometry = GetGeometry((int)Pt.Marker.Mode);

            Sequence.Foreground = G.GetFontBrush();
            Sequence.FontFamily = F.ToMediaFont().Family;
            Sequence.FontSize   = F.Size;
            Sequence.FontStyle  = F.ToMediaFont().Italic;
            Sequence.FontWeight = F.ToMediaFont().Bold;

            Sequence.Fill = G.GetBackgroundBrush();

            Sequence.StrokeThickness = G.StrokeWeight[0];
            Sequence.Stroke          = G.GetStrokeBrush();
            Sequence.StrokeDashArray = new DoubleCollection(G.StrokePattern);

            return(Sequence);
        }
コード例 #7
0
        public void SetFormatting()
        {
            DataPt   Pt = DataGrid.Sets[0].Points[0];
            wGraphic G  = Pt.Graphics;

            ChartSeries.DataLabels = Pt.Label.Enabled;
            ChartSeries.LabelPoint = point => string.Format("{0:" + Pt.Label.Format + "}", point.Weight);

            ChartSeries.Foreground = G.GetFontBrush();
            ChartSeries.FontFamily = G.FontObject.ToMediaFont().Family;
            ChartSeries.FontSize   = G.FontObject.Size;
            ChartSeries.FontStyle  = G.FontObject.ToMediaFont().Italic;
            ChartSeries.FontWeight = G.FontObject.ToMediaFont().Bold;

            ChartSeries.StrokeThickness = G.StrokeWeight[0];
            ChartSeries.Stroke          = G.GetStrokeBrush();
            ChartSeries.StrokeDashArray = new DoubleCollection(G.StrokePattern);

            ChartSeries.PointGeometry = GetGeometry((int)Pt.Marker.Mode);
        }
コード例 #8
0
        public void SetHeatData()
        {
            List <HeatPoint> DataCollection = new List <HeatPoint>();



            for (int i = 0; i < DataGrid.Sets.Count; i++)
            {
                for (int j = 0; j < DataGrid.Sets[i].Points.Count; j++)
                {
                    DataPt D = DataGrid.Sets[i].Points[j];
                    DataCollection.Add(new HeatPoint(i, j, D.Number));
                }
            }
            ChartSeries.Values.Clear();
            ChartSeries.Values.AddRange(DataCollection);

            SeriesCollect.Clear();
            SeriesCollect.Add(ChartSeries);
            Element.Series = SeriesCollect;
        }
コード例 #9
0
ファイル: pGaugeChart.cs プロジェクト: pm-Architect/Aviary
        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;
            }
        }
コード例 #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;
            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);
        }
コード例 #11
0
        public StackedColumnSeries SetProperties(StackedColumnSeries NewSeries, DataPt Pt)
        {
            NewSeries.LabelsPosition = GetPosition((int)Pt.Label.Alignment);

            return(NewSeries);
        }
コード例 #12
0
ファイル: pDataGrid.cs プロジェクト: pm-Architect/Aviary
        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);
                }
            }
        }
コード例 #13
0
ファイル: SetDataPoint.cs プロジェクト: pm-Architect/Aviary
        /// <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 X = null;
            int     D = 0;
            string  F = "G";
            string  T = "";

            if (!DA.GetData(0, ref X))
            {
                return;
            }
            if (!DA.GetData(1, ref D))
            {
                return;
            }
            if (!DA.GetData(2, ref F))
            {
                return;
            }
            if (!DA.GetData(3, ref T))
            {
                return;
            }

            DataPt DataObj = new DataPt();

            object obj = new object();

            X.CastTo(out obj);
            DataObj.Value = obj;

            DataObj.Type = D;
            DataObj.Tag  = T;

            DataObj.Label.Format   = F;
            DataObj.ToolTip.Format = F;

            DataObj.Graphics.Width = 1;

            string L = "";

            switch (D)
            {
            case 1:
                double num = new double();
                X.CastTo(out num);

                L = string.Format("{0:" + F + "}", num);

                DataObj.Integer = (int)num;
                DataObj.Number  = num;
                DataObj.Text    = num.ToString();
                DataObj.Domain  = new Tuple <double, double>(0, num);

                break;

            case 2:
                int intg = new int();
                X.CastTo(out intg);

                L = string.Format("{0:" + F + "}", intg);

                DataObj.Text    = intg.ToString();
                DataObj.Integer = intg;
                DataObj.Number  = (double)intg;
                DataObj.Domain  = new Tuple <double, double>(0, intg);
                break;

            case 3:
                Interval domain = new Interval();
                X.CastTo(out domain);

                L = string.Format("{0:" + F + "}" + " to " + "{1:" + F + "}", domain.T0, domain.T1);

                DataObj.Text           = domain.ToString();
                DataObj.Domain         = new Tuple <double, double>(domain.T0, domain.T1);
                DataObj.Point          = new wPoint(domain.T0, domain.T1, 0);
                DataObj.Graphics.Width = 10;
                break;

            case 4:
                Point3d point = new Point3d();
                X.CastTo(out point);

                L = string.Format("{0:" + F + "}", point.Z);

                DataObj.Text  = point.ToString();
                DataObj.Point = new wPoint(point.X, point.Y, point.Z);

                DataObj.Marker.Mode = wMarker.MarkerType.Circle;
                break;

            default:
                string text = "";
                X.CastTo(out text);
                L            = text;
                DataObj.Text = text;
                break;
            }

            switch (LabelStatus)
            {
            default:
                DataObj.Label.Content   = "";
                DataObj.ToolTip.Content = "";
                break;

            case 1:
                DataObj.Label.Enabled   = true;
                DataObj.Label.Content   = T;
                DataObj.ToolTip.Enabled = true;
                DataObj.ToolTip.Content = T;
                break;

            case 2:
                DataObj.Label.Enabled   = true;
                DataObj.Label.Content   = L;
                DataObj.ToolTip.Enabled = true;
                DataObj.ToolTip.Content = L;
                break;
            }

            DataObj.Graphics.FontObject.FontColor = wColors.Gray;
            DataObj.Graphics.Background           = wColors.VeryLightGray;
            DataObj.Graphics.StrokeColor          = wColors.OffWhite;
            DataObj.Graphics.SetUniformStrokeWeight(1);
            DataObj.Graphics.SetUniformPadding(2);

            DataObj.ToolTip.Graphics.Background           = new wColor(150, 250, 250, 250);
            DataObj.ToolTip.Graphics.FontObject.Size      = 10;
            DataObj.ToolTip.Graphics.FontObject.FontColor = wColors.Gray;

            wObject WindObject = new wObject(DataObj, "Pollen", "DataPoint");

            WindObject.Graphics = DataObj.Graphics;

            DA.SetData(0, WindObject);
        }
コード例 #14
0
ファイル: Margin.cs プロジェクト: pm-Architect/Aviary
        /// <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);
        }
コード例 #15
0
ファイル: Stroke.cs プロジェクト: pm-Architect/Aviary
        /// <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);
        }
コード例 #16
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);
        }
コード例 #17
0
 public void SetAreaProperties(LineSeries Ser, DataPt Pt)
 {
 }
コード例 #18
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);
        }
コード例 #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;
            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);
        }
コード例 #20
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);
        }
コード例 #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;
            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);
        }
コード例 #22
0
ファイル: FillPattern.cs プロジェクト: pm-Architect/Aviary
        /// <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);
        }
コード例 #23
0
 //Scatter Series
 public ScatterSeries SetProperties(ScatterSeries NewSeries, DataPt Pt)
 {
     return(NewSeries);
 }
コード例 #24
0
 public void SetStackAreaProperties(StackedAreaSeries Ser, DataPt Pt)
 {
     Ser.PointForeground   = Pt.Marker.Graphics.GetBackgroundBrush();
     Ser.PointGeometrySize = Pt.Marker.Radius;
 }
コード例 #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)
        {
            // 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);
        }
コード例 #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;
            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);
        }
コード例 #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;
            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);
        }
コード例 #28
0
ファイル: Font.cs プロジェクト: pm-Architect/Aviary
        /// <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);
        }
コード例 #29
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);
        }
コード例 #30
0
ファイル: pPointSeries.cs プロジェクト: pm-Architect/Aviary
        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;
            }
        }