• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DomCR / ACadSharp / 16466537186

23 Jul 2025 09:13AM UTC coverage: 75.055% (-0.002%) from 75.057%
16466537186

Pull #718

github

web-flow
Merge 6ea0d57f2 into 4b0db03db
Pull Request #718: SVG tests

6014 of 8808 branches covered (68.28%)

Branch coverage included in aggregate %.

98 of 149 new or added lines in 6 files covered. (65.77%)

4 existing lines in 1 file now uncovered.

23932 of 31091 relevant lines covered (76.97%)

78785.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

65.22
/src/ACadSharp/IO/SVG/SvgConfiguration.cs
1
using ACadSharp.Objects;
2
using System;
3
using System.ComponentModel;
4

5
namespace ACadSharp.IO
6
{
7
        /// <summary>
8
        /// Configuration for writing SVG files.
9
        /// </summary>
10
        public class SvgConfiguration : CadWriterConfiguration
11
        {
12
                /// <summary>
13
                /// The <see cref="Entities.Entity.LineWeight"/> will be divided by this value to process the stroke-width in the svg.
14
                /// </summary>
15
                /// <remarks>
16
                /// The default value is 100, which matches with the line weight real value in mm.
17
                /// </remarks>
18
                public double LineWeightRatio { get; set; } = 100;
1,181✔
19

20
                /// <summary>
21
                /// Radius applied for the points.
22
                /// </summary>
23
                /// <remarks>
24
                /// In svg the points will be drawn as circles.
25
                /// </remarks>
26
                public double PointRadius { get; set; } = 0.5;
568✔
27

28
                /// <summary>
29
                /// Pixel size reference for the configuration.
30
                /// </summary>
31
                [Obsolete("this is only for mm")]
32
                public const double PixelSize = 3.7795275591;
33

34
                /// <summary>
35
                /// Get the value of the stroke-width.
36
                /// </summary>
37
                /// <param name="lineweightType"></param>
38
                /// <returns></returns>
39
                public double GetLineWeightValue(LineweightType lineweightType)
40
                {
55✔
41
                        double value = (double)lineweightType;
55✔
42
                        if (lineweightType == LineweightType.W0)
55!
43
                        {
×
NEW
44
                                value = 0.001;
×
45
                        }
×
46

47
                        return ToPixelSize(Math.Abs(value) / this.LineWeightRatio, PlotPaperUnits.Milimeters);
55✔
48
                }
55✔
49

50
                public static double ToPixelSize(double value, PlotPaperUnits units)
51
                {
361✔
52
                        switch (units)
361!
53
                        {
54
                                case PlotPaperUnits.Inches:
55
                                        return value * 96;
237✔
56
                                case PlotPaperUnits.Milimeters:
57
                                        return value * 96 / 25.4;
124✔
58
                                case PlotPaperUnits.Pixels:
NEW
59
                                        return value;
×
60
                                default:
NEW
61
                                        throw new InvalidEnumArgumentException(nameof(units), (int)units, typeof(PlotPaperUnits));
×
62
                        }
63
                }
361✔
64
        }
65
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc