//Control public pElement(Control WPFControl, pChart PollenControlObject, string ElementType) { PollenControl = PollenControlObject; Element = WPFControl; SetGraphics("B" + WPFControl.Name); Container.Content = WPFControl; Container.Mode = ColorZoneMode.Standard; Type = ElementType; Category = "Chart"; }
//Control public pElement(Panel GenericPanel, pChart PollenControlObject, string ElementType) { PollenControl = PollenControlObject; Layout = GenericPanel; SetGraphics("B" + Layout.Name); Container.Content = Layout; Container.Mode = ColorZoneMode.Standard; Type = ElementType; Category = "Chart"; }
/// <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 Y = 0; int Z = 0; bool D = false; if (!DA.GetData(0, ref Element)) { return; } if (!DA.GetData(1, ref X)) { return; } if (!DA.GetData(2, ref Y)) { return; } if (!DA.GetData(3, ref Z)) { return; } wObject W; Element.CastTo(out W); D = !((X == 0) & (Y == 0) & (Z == 0)); p3D V = new p3D(X, Y, Z, D, (p3D.LightingMode)ModeLighting); switch (W.Type) { case "Pollen": switch (W.SubType) { case "DataSet": DataSetCollection tDataSet = (DataSetCollection)W.Element; tDataSet.SetThreeDView(D, V); W.Element = tDataSet; break; case "PointChart": pElement E = (pElement)W.Element; pChart C = (pChart)E.PollenControl; C.View = V; C.SetThreeDView(); E.PollenControl = C; W.Element = E; break; } break; } DA.SetData(0, W); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }