/// <summary> /// Initialises a new label with a bound text value /// </summary> /// <param name="position"></param> /// <param name="textBinding"></param> /// <param name="textSize"></param> /// <param name="verticalSetOut"></param> /// <param name="horizontalSetOut"></param> /// <param name="attributes"></param> public Label(Vector position, PathBinding textBinding, double textSize = 1.0, VerticalSetOut verticalSetOut = VerticalSetOut.Top, HorizontalSetOut horizontalSetOut = HorizontalSetOut.Left, GeometryAttributes attributes = null) : base(position) { TextBinding = textBinding; TextSize = textSize; VerticalSetOut = verticalSetOut; HorizontalSetOut = horizontalSetOut; Attributes = attributes; }
/// <summary> /// Calculate the total combined offset of the centroid of the section to the specified set-out location /// </summary> /// <returns></returns> public Vector GetTotalOffset(HorizontalSetOut toHorizontal = HorizontalSetOut.Centroid, VerticalSetOut toVertical = VerticalSetOut.Centroid) { if (Profile != null) { return(Profile.GetTotalOffset(toHorizontal, toVertical)); } else { return(new Vector()); } //TODO: Account for multiple profiles which do not all lie within one another // Iterate through and return largest? }
/// <summary> /// Get the position of the set-out level as a proportion of the thickness /// of a panel. /// </summary> /// <param name="value"></param> /// <returns></returns> public static double FactorFromTop(this VerticalSetOut value) { if (value == VerticalSetOut.Top) { return(0); } else if (value == VerticalSetOut.Bottom) { return(1); } else { return(0.5); } }
/// <summary> /// Convert Nucleus horizontal and vertical set out values to a netDXF text alignment /// </summary> /// <param name="horizontal"></param> /// <param name="vertical"></param> /// <returns></returns> public static nDE.TextAlignment Convert(HorizontalSetOut horizontal, VerticalSetOut vertical) { if (horizontal == HorizontalSetOut.Left) { if (vertical == VerticalSetOut.Top) { return(nDE.TextAlignment.TopLeft); } else if (vertical == VerticalSetOut.Bottom) { return(nDE.TextAlignment.BottomLeft); } else { return(nDE.TextAlignment.MiddleLeft); } } else if (horizontal == HorizontalSetOut.Right) { if (vertical == VerticalSetOut.Top) { return(nDE.TextAlignment.TopRight); } else if (vertical == VerticalSetOut.Bottom) { return(nDE.TextAlignment.BottomRight); } else { return(nDE.TextAlignment.MiddleRight); } } else { if (vertical == VerticalSetOut.Top) { return(nDE.TextAlignment.TopCenter); } else if (vertical == VerticalSetOut.Bottom) { return(nDE.TextAlignment.BottomCenter); } else { return(nDE.TextAlignment.MiddleCenter); } } }
public override Vector GetTotalOffset(HorizontalSetOut toHorizontal = HorizontalSetOut.Centroid, VerticalSetOut toVertical = VerticalSetOut.Centroid) { throw new NotImplementedException(); }
/// <summary> /// Is this set out relative to either the top or bottom edge? /// </summary> /// <param name="value"></param> /// <returns></returns> public static bool IsEdge(this VerticalSetOut value) { return(value == VerticalSetOut.Top || value == VerticalSetOut.Bottom); }
public override Vector GetTotalOffset(HorizontalSetOut toHorizontal = HorizontalSetOut.Centroid, VerticalSetOut toVertical = VerticalSetOut.Centroid) { return(CalculateOriginOffset(_CentroidOffset, toHorizontal, toVertical) - _OriginOffset); }
/// <summary> /// Calculate the total offset of the mid-point of this profile /// from the set-out point of the section with the specified horizontal /// and vertical set-out /// </summary> /// <param name="centroid">The centroid of the section profile</param> /// <returns></returns> protected Vector CalculateOriginOffset(Vector centroid, HorizontalSetOut horizontalSetOut, VerticalSetOut verticalSetOut) { Vector result = Offset; if (verticalSetOut == VerticalSetOut.Centroid) { result = result.AddY(-centroid.Y); } else if (verticalSetOut == VerticalSetOut.Bottom) { result = result.AddY(OverallDepth / 2); } else if (verticalSetOut == VerticalSetOut.Top) { result = result.AddY(-OverallDepth / 2); } if (horizontalSetOut == HorizontalSetOut.Centroid) { result = result.AddX(-centroid.X); } else if (horizontalSetOut == HorizontalSetOut.Left) { result = result.AddX(OverallWidth / 2); } else if (horizontalSetOut == HorizontalSetOut.Right) { result = result.AddX(-OverallWidth / 2); } return(result); }
/// <summary> /// Convert Nucleus horizontal and vertical set-out enumerations into a Robot IRobotBarOffsetAutoPosition /// </summary> /// <param name="horizontal"></param> /// <param name="vertical"></param> /// <returns></returns> public static IRobotBarOffsetAutoPosition Convert(HorizontalSetOut horizontal, VerticalSetOut vertical) { if (horizontal == HorizontalSetOut.Left) { if (vertical == VerticalSetOut.Top) { return(IRobotBarOffsetAutoPosition.I_BOAP_VY_VPZ); } else if (vertical == VerticalSetOut.Bottom) { return(IRobotBarOffsetAutoPosition.I_BOAP_VY_VZ); } else { return(IRobotBarOffsetAutoPosition.I_BOAP_VY_0); } } else if (horizontal == HorizontalSetOut.Right) { if (vertical == VerticalSetOut.Top) { return(IRobotBarOffsetAutoPosition.I_BOAP_VPY_VPZ); } else if (vertical == VerticalSetOut.Bottom) { return(IRobotBarOffsetAutoPosition.I_BOAP_VPY_VZ); } else { return(IRobotBarOffsetAutoPosition.I_BOAP_VPY_0); } } else { if (vertical == VerticalSetOut.Top) { return(IRobotBarOffsetAutoPosition.I_BOAP_0_VPZ); } else if (vertical == VerticalSetOut.Bottom) { return(IRobotBarOffsetAutoPosition.I_BOAP_0_VZ); } else { return(IRobotBarOffsetAutoPosition.I_BOAP_0_0); } } }
/// <summary> /// Calculate the total combined offset of the centroid of the profile to the specified set-out location /// </summary> /// <returns></returns> public abstract Vector GetTotalOffset(HorizontalSetOut toHorizontal = HorizontalSetOut.Centroid, VerticalSetOut toVertical = VerticalSetOut.Centroid);
/// <summary> /// Set the set-out point of this profile defined by horizontal and vertical set-out rules. /// </summary> /// <param name="horizontal">The horizontal set-out rule</param> /// <param name="vertical">The vertical set-out rule</param> /// <param name="offset">The offset of the section relative to the the base set-out point</param> public void SetOut(HorizontalSetOut horizontal, VerticalSetOut vertical, Vector offset) { SetOut(horizontal, vertical); Offset = offset; }
/// <summary> /// Set the set-out point of this profile defined by horizontal and vertical set-out rules. /// </summary> /// <param name="horizontal">The horizontal set-out rule</param> /// <param name="vertical">The vertical set-out rule</param> public void SetOut(HorizontalSetOut horizontal, VerticalSetOut vertical) { HorizontalSetOut = horizontal; VerticalSetOut = vertical; }