/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Gets the xCenterCoord. /// </summary> /// <param name="varArray">the array to get the numbered variables from</param> public float GetXCenterCoord(GerberMacroVariableArray varArray) { if (xCenterCoord == null) { xCenterCoord = new GerberMacroVariable(); } float workingXCenterCoord = xCenterCoord.ProcessVariableStringToFloat(varArray); float workingDegreesRotation = GetDegreesRotation(varArray); // do we have a rotation if (workingDegreesRotation != 0) { // yes, return the converted value if (yCenterCoord == null) { yCenterCoord = new GerberMacroVariable(); } float workingYCenterCoord = yCenterCoord.ProcessVariableStringToFloat(varArray); double angleInRadians = MiscGraphicsUtils.DegreesToRadians(workingDegreesRotation); return((float)((workingXCenterCoord * Math.Cos(angleInRadians)) - workingYCenterCoord * Math.Sin(angleInRadians))); } else { // no just return the existing value return(workingXCenterCoord); } }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Gets the aperture on/off state. This may require using numbered variables /// to resolve this /// </summary> /// <param name="varArray">the array to get the numbered variables from</param> public bool GetApertureIsOn(GerberMacroVariableArray varArray) { if (apertureIsOn == null) { apertureIsOn = new GerberMacroVariable(DEFAULT_APERTURE_STATE); } return(Convert.ToBoolean(apertureIsOn.ProcessVariableStringToFloat(varArray))); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Gets the degreesRotation in degrees counter clockwise /// </summary> /// <param name="varArray">the array to get the numbered variables from</param> public float GetDegreesRotation(GerberMacroVariableArray varArray) { if (degreesRotation == null) { degreesRotation = new GerberMacroVariable(); } return(degreesRotation.ProcessVariableStringToFloat(varArray)); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Gets the width /// </summary> /// <param name="varArray">the array to get the numbered variables from</param> public float GetWidth(GerberMacroVariableArray varArray) { if (width == null) { width = new GerberMacroVariable(); } return(width.ProcessVariableStringToFloat(varArray)); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Gets the numSides /// </summary> /// <param name="varArray">the array to get the numbered variables from</param> public float GetNumSides(GerberMacroVariableArray varArray) { if (numSides == null) { numSides = new GerberMacroVariable(); } return(numSides.ProcessVariableStringToFloat(varArray)); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Gets the diameter /// </summary> /// <param name="varArray">the array to get the numbered variables from</param> public float GetDiameter(GerberMacroVariableArray varArray) { if (diameter == null) { diameter = new GerberMacroVariable(); } return(diameter.ProcessVariableStringToFloat(varArray)); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Gets the height /// </summary> /// <param name="varArray">the array to get the numbered variables from</param> public float GetHeight(GerberMacroVariableArray varArray) { if (height == null) { height = new GerberMacroVariable(); } return(height.ProcessVariableStringToFloat(varArray)); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Processes the variable pair into a numeric value. It may need the numbered /// variables to do this /// </summary> /// <param name="varArray">the array to get the numbered variables from</param> public PointF ProcessVariablePairToFloat(GerberMacroVariableArray varArray) { if (varArray == null) { return(new PointF(0, 0)); } // these objects know how to translate themselves float xVarlAsFloat = xVar.ProcessVariableStringToFloat(varArray); float yVarlAsFloat = yVar.ProcessVariableStringToFloat(varArray); return(new PointF(xVarlAsFloat, yVarlAsFloat)); }