/// <summary> /// Initializes a new instance of the <c>RasterVariables</c> class. /// </summary> public RasterVariables() : base(DxfObjectCode.RasterVariables) { this.displayFrame = true; this.quality = ImageDisplayQuality.High; this.units = ImageUnits.Unitless; }
internal RasterVariables(DxfDocument document) : base(DxfObjectCode.RasterVariables) { this.displayFrame = true; this.quality = ImageDisplayQuality.High; this.units = ImageUnits.Unitless; this.Owner = document; }
private static DrawingUnits ImageToDrawingUnits(ImageUnits units) { // more on the DXF format none sense, they don't even use the same integers for the drawing and the image units DrawingUnits rasterUnits; switch (units) { case ImageUnits.Unitless: rasterUnits = DrawingUnits.Unitless; break; case ImageUnits.Millimeters: rasterUnits = DrawingUnits.Millimeters; break; case ImageUnits.Centimeters: rasterUnits = DrawingUnits.Centimeters; break; case ImageUnits.Meters: rasterUnits = DrawingUnits.Meters; break; case ImageUnits.Kilometers: rasterUnits = DrawingUnits.Kilometers; break; case ImageUnits.Inches: rasterUnits = DrawingUnits.Inches; break; case ImageUnits.Feet: rasterUnits = DrawingUnits.Feet; break; case ImageUnits.Yards: rasterUnits = DrawingUnits.Yards; break; case ImageUnits.Miles: rasterUnits = DrawingUnits.Miles; break; default: rasterUnits = DrawingUnits.Unitless; break; } return(rasterUnits); }
/// <summary> /// Gets the conversion factor between image and drawing units. /// </summary> /// <param name="from">Original image units.</param> /// <param name="to">Destination drawing units.</param> /// <returns>The conversion factor between the units.</returns> public static double ConversionFactor(ImageUnits from, DrawingUnits to) { // more on the dxf format none sense, they don't even use the same integers for the drawing and the image units int rasterUnits = 0; switch (from) { case ImageUnits.Unitless: rasterUnits = 0; break; case ImageUnits.Millimeters: rasterUnits = 4; break; case ImageUnits.Centimeters: rasterUnits = 5; break; case ImageUnits.Meters: rasterUnits = 6; break; case ImageUnits.Kilometers: rasterUnits = 7; break; case ImageUnits.Inches: rasterUnits = 1; break; case ImageUnits.Feet: rasterUnits = 2; break; case ImageUnits.Yards: rasterUnits = 10; break; case ImageUnits.Miles: rasterUnits = 3; break; } return(UnitFactors[rasterUnits, (int)to]); }
/// <summary> /// Gets the conversion factor between units. /// </summary> /// <param name="from">Original value units.</param> /// <param name="to">Destination value units.</param> /// <returns>The conversion factor between the passed units.</returns> public static double ConversionFactor(DrawingUnits from, ImageUnits to) { return(1 / ConversionFactor(to, from)); }
/// <summary> /// Gets the conversion factor between units. /// </summary> /// <param name="from">Original value units.</param> /// <param name="to">Destination value units.</param> /// <returns>The conversion factor between the passed units.</returns> public static double ConversionFactor(DrawingUnits from, ImageUnits to) { return 1/ConversionFactor(to, from); }
/// <summary> /// Gets the conversion factor between image and drawing units. /// </summary> /// <param name="from">Original image units.</param> /// <param name="to">Destination drawing units.</param> /// <returns>The conversion factor between the units.</returns> public static double ConversionFactor(ImageUnits from, DrawingUnits to) { // more on the dxf format none sense, they don't even use the same integers for the drawing and the image units int rasterUnits = 0; switch (from) { case ImageUnits.Unitless: rasterUnits = 0; break; case ImageUnits.Millimeters: rasterUnits = 4; break; case ImageUnits.Centimeters: rasterUnits = 5; break; case ImageUnits.Meters: rasterUnits = 6; break; case ImageUnits.Kilometers: rasterUnits = 7; break; case ImageUnits.Inches: rasterUnits = 1; break; case ImageUnits.Feet: rasterUnits = 2; break; case ImageUnits.Yards: rasterUnits = 10; break; case ImageUnits.Miles: rasterUnits = 3; break; } return UnitFactors[rasterUnits, (int)to]; }
/// <summary> /// Gets the conversion factor between units. /// </summary> /// <param name="from">Original value units.</param> /// <param name="to">Destination value units.</param> /// <returns>The conversion factor between the passed units.</returns> public static double ConversionFactor(DrawingUnits from, ImageUnits to) { return(ConversionFactor(from, ImageToDrawingUnits(to))); }