Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
 /// <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;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Is this set out relative to either the left or right edge?
 /// </summary>
 /// <param name="hSO"></param>
 /// <returns></returns>
 public static bool IsEdge(this HorizontalSetOut hSO)
 {
     if (hSO == HorizontalSetOut.Left || hSO == HorizontalSetOut.Right)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
 /// <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?
 }
Ejemplo n.º 5
0
 /// <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);
         }
     }
 }
Ejemplo n.º 6
0
 /// <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);
         }
     }
 }
Ejemplo n.º 7
0
 public override Vector GetTotalOffset(HorizontalSetOut toHorizontal = HorizontalSetOut.Centroid, VerticalSetOut toVertical = VerticalSetOut.Centroid)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 8
0
 public override Vector GetTotalOffset(HorizontalSetOut toHorizontal = HorizontalSetOut.Centroid, VerticalSetOut toVertical = VerticalSetOut.Centroid)
 {
     return(CalculateOriginOffset(_CentroidOffset, toHorizontal, toVertical) - _OriginOffset);
 }
Ejemplo n.º 9
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);
Ejemplo n.º 10
0
 /// <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;
 }
Ejemplo n.º 11
0
 /// <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;
 }