Exemplo n.º 1
0
        protected string GeodesicLengthToString(double length, LinearUnitType linearUnitType)
        {
            length = Math.Abs(length);
            switch (linearUnitType)
            {
            case LinearUnitType.Metric:
            {
                if (length < 10000)
                {
                    return(string.Format("{0:0} m", length));
                }
                return(string.Format("{0:0.###} km", length / 1000));
            }

            case LinearUnitType.ImperialUS:
            {
                double miles = length * 0.000621371;
                if (miles > .25)
                {
                    return(string.Format("{0:0.###} mi", miles));
                }
                return(string.Format("{0:0} ft", length * 3.28084));
            }
            }
            return(null);
        }
Exemplo n.º 2
0
        protected string GeodesicAreaToString(double area, LinearUnitType linearUnitType)
        {
            area = Math.Abs(area);
            switch (linearUnitType)
            {
            case LinearUnitType.Metric:
            {
                if (area < 1000000)
                {
                    return(string.Format("{0:0} m²", area));
                }
                return(string.Format("{0:0.##} km²", area / 1000000));
            }

            case LinearUnitType.ImperialUS:
            {
                double squareMiles = area * 3.86102e-7;
                if (squareMiles >= 1)
                {
                    return(string.Format("{0:0.###} mi²", squareMiles));
                }
                double squareFeet = area * 10.7639;
                return(string.Format("{0:0} ft²", squareFeet));
            }
            }
            return(null);
        }
 /// <summary>
 /// Initializes a new instance of the <c>DimensionStyleUnitsFormat</c> class.
 /// </summary>
 public DimensionStyleAlternateUnits()
 {
     this.dimalt       = false;
     this.dimaltd      = 2;
     this.dimPrefix    = string.Empty;
     this.dimSuffix    = string.Empty;
     this.dimaltf      = 25.4;
     this.dimaltu      = LinearUnitType.Decimal;
     this.stackedUnits = false;
     this.suppressLinearLeadingZeros  = false;
     this.suppressLinearTrailingZeros = false;
     this.suppressZeroFeet            = true;
     this.suppressZeroInches          = true;
     this.dimaltrnd = 0.0;
 }
Exemplo n.º 4
0
        internal DimensionStyle(string name, bool checkName)
            : base(name, DxfObjectCode.DimStyle, checkName)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name", "The dimension style name should be at least one character long.");
            }

            this.IsReserved = name.Equals(DefaultName, StringComparison.OrdinalIgnoreCase);

            // dimension and extension lines
            this.dimclrd  = AciColor.ByBlock;
            this.dimltype = Linetype.ByBlock;
            this.dimlwd   = Lineweight.ByBlock;
            this.dimdle   = 0.0;
            this.dimdli   = 0.38;
            this.dimsd1   = false;
            this.dimsd2   = false;

            this.dimclre  = AciColor.ByBlock;
            this.dimltex1 = Linetype.ByBlock;
            this.dimltex2 = Linetype.ByBlock;
            this.dimlwe   = Lineweight.ByBlock;
            this.dimse1   = false;
            this.dimse2   = false;
            this.dimexo   = 0.0625;
            this.dimexe   = 0.18;
            this.dimfxlon = false;
            this.dimfxl   = 1.0;

            // symbols and arrows
            this.dimldrblk = null;
            this.dimblk1   = null;
            this.dimblk2   = null;
            this.dimasz    = 0.18;
            this.dimcen    = 0.09;

            // text
            this.dimtxsty        = TextStyle.Default;
            this.dimclrt         = AciColor.ByBlock;
            this.dimtfillclr     = null;
            this.dimtxt          = 0.18;
            this.dimtad          = DimensionStyleTextVerticalPlacement.Centered;
            this.dimjust         = DimensionStyleTextHorizontalPlacement.Centered;
            this.dimgap          = 0.09;
            this.dimtih          = false;
            this.dimtoh          = false;
            this.dimtxtdirection = DimensionStyleTextDirection.LeftToRight;
            this.dimtfac         = 1.0;

            // fit
            this.dimtofl  = false;
            this.dimsoxd  = true;
            this.dimscale = 1.0;
            this.dimatfit = DimensionStyleFitOptions.BestFit;
            this.dimtix   = false;
            this.dimtmove = DimensionStyleFitTextMove.BesideDimLine;

            // primary units
            this.dimdec    = 4;
            this.dimadec   = 0;
            this.dimPrefix = string.Empty;
            this.dimSuffix = string.Empty;
            this.dimdsep   = '.';
            this.dimlfac   = 1.0;
            this.dimaunit  = AngleUnitType.DecimalDegrees;
            this.dimlunit  = LinearUnitType.Decimal;
            this.dimfrac   = FractionFormatType.Horizontal;
            this.suppressLinearLeadingZeros   = false;
            this.suppressLinearTrailingZeros  = false;
            this.suppressZeroFeet             = true;
            this.suppressZeroInches           = true;
            this.suppressAngularLeadingZeros  = false;
            this.suppressAngularTrailingZeros = false;
            this.dimrnd = 0.0;

            // alternate units
            this.alternateUnits = new DimensionStyleAlternateUnits();

            // tolerances
            this.tolerances = new DimensionStyleTolerances();
        }
Exemplo n.º 5
0
        internal DimensionStyle(string name, bool checkName)
            : base(name, DxfObjectCode.DimStyle, checkName)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name), "The dimension style name should be at least one character long.");
            }

            this.IsReserved = name.Equals(DefaultName, StringComparison.OrdinalIgnoreCase);

            // dimension lines
            this.dimclrd  = AciColor.ByBlock;
            this.dimltype = Linetype.ByBlock;
            this.dimlwd   = Lineweight.ByBlock;
            this.dimsd    = false;
            this.dimdli   = 0.38;
            this.dimdle   = 0.0;

            // extension lines
            this.dimclre  = AciColor.ByBlock;
            this.dimltex1 = Linetype.ByBlock;
            this.dimltex2 = Linetype.ByBlock;
            this.dimlwe   = Lineweight.ByBlock;
            this.dimse1   = false;
            this.dimse2   = false;
            this.dimexo   = 0.0625;
            this.dimexe   = 0.18;

            // symbols and arrows
            this.dimasz    = 0.18;
            this.dimcen    = 0.09;
            this.dimldrblk = null;
            this.dimblk1   = null;
            this.dimblk2   = null;

            // text
            this.dimtxsty = TextStyle.Default;
            this.dimclrt  = AciColor.ByBlock;
            this.dimtxt   = 0.18;
            this.dimtad   = 1;
            this.dimjust  = 0;
            this.dimgap   = 0.09;

            // fit
            this.dimscale = 1.0;

            // primary units
            this.dimdec    = 2;
            this.dimadec   = 0;
            this.dimPrefix = string.Empty;
            this.dimSuffix = string.Empty;
            this.dimtih    = 0;
            this.dimtoh    = 0;
            this.dimdsep   = '.';
            this.dimlfac   = 1.0;
            this.dimaunit  = AngleUnitType.DecimalDegrees;
            this.dimlunit  = LinearUnitType.Decimal;
            this.dimfrac   = FractionFormatType.Horizontal;
            this.suppressLinearLeadingZeros   = false;
            this.suppressLinearTrailingZeros  = false;
            this.suppressAngularLeadingZeros  = false;
            this.suppressAngularTrailingZeros = false;
            this.suppressZeroFeet             = true;
            this.suppressZeroInches           = true;
            this.dimrnd = 0.0;
        }
 protected string GeodesicLengthToString(double length, LinearUnitType linearUnitType)
 {
     length = Math.Abs(length);
     switch (linearUnitType)
     {
         case LinearUnitType.Metric:
             {
                 if (length < 10000)
                     return string.Format("{0:0} m", length);
                 return string.Format("{0:0.###} km", length / 1000);
             }
         case LinearUnitType.ImperialUS:
             {
                 double miles = length * 0.000621371;
                 if (miles > .25)
                     return string.Format("{0:0.###} mi", miles);
                 return string.Format("{0:0} ft", length * 3.28084);
             }
     }
     return null;
 }
 protected string GeodesicAreaToString(double area, LinearUnitType linearUnitType)
 {
     area = Math.Abs(area);
     switch (linearUnitType)
     {
         case LinearUnitType.Metric:
             {
                 if (area < 1000000)
                     return string.Format("{0:0} m²", area);
                 return string.Format("{0:0.##} km²", area / 1000000);
             }
         case LinearUnitType.ImperialUS:
             {
                 double squareMiles = area * 3.86102e-7;
                 if (squareMiles >= 1)
                     return string.Format("{0:0.###} mi²", squareMiles);
                 double squareFeet = area * 10.7639;
                 return string.Format("{0:0} ft²", squareFeet);
             }
     }
     return null;
 }
        internal DimensionStyle(string name, bool checkName)
            : base(name, DxfObjectCode.DimStyle, checkName)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentNullException(nameof(name), "The dimension style name should be at least one character long.");

            this.reserved = name.Equals(DefaultName, StringComparison.OrdinalIgnoreCase);

            // dimension lines
            this.dimclrd = AciColor.ByBlock;
            this.dimltype = LineType.ByBlock;
            this.dimlwd = Lineweight.ByBlock;
            this.dimdli = 0.38;
            this.dimdle = 0.0;

            // extension lines
            this.dimclre = AciColor.ByBlock;
            this.dimltex1 = LineType.ByBlock;
            this.dimltex2 = LineType.ByBlock;
            this.dimlwe = Lineweight.ByBlock;
            this.dimse1 = false;
            this.dimse2 = false;
            this.dimexo = 0.0625;
            this.dimexe = 0.18;

            // symbols and arrows
            this.dimasz = 0.18;
            this.dimcen = 0.09;
            this.dimsah = false;
            this.dimldrblk = null;
            this.dimblk = null;
            this.dimblk1 = null;
            this.dimblk2 = null;

            // text
            this.dimtxsty = TextStyle.Default;
            this.dimclrt = AciColor.ByBlock;
            this.dimtxt = 0.18;
            this.dimtad = 1;
            this.dimjust = 0;
            this.dimgap = 0.09;

            // fit
            this.dimscale = 1.0;

            // primary units
            this.dimdec = 2;
            this.dimadec = 0;
            this.dimpost = "<>";
            this.dimtih = 0;
            this.dimtoh = 0;
            this.dimdsep = '.';
            this.dimlfac = 1.0;
            this.dimaunit = AngleUnitType.DecimalDegrees;
            this.dimlunit = LinearUnitType.Decimal;
            this.dimfrac = FractionFormatType.Horizontal;
            this.suppressLinearLeadingZeros = false;
            this.suppressLinearTrailingZeros = false;
            this.suppressAngularLeadingZeros = false;
            this.suppressAngularTrailingZeros = false;
            this.suppressZeroFeet = true;
            this.suppressZeroInches = true;
            this.dimrnd = 0.0;
        }