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

DomCR / ACadSharp / 17737836230

15 Sep 2025 03:12PM UTC coverage: 2.092% (-76.2%) from 78.245%
17737836230

push

github

web-flow
Merge pull request #790 from DomCR/addflag-refactor

addflag refactor

141 of 9225 branches covered (1.53%)

Branch coverage included in aggregate %.

0 of 93 new or added lines in 10 files covered. (0.0%)

24910 existing lines in 372 files now uncovered.

724 of 32119 relevant lines covered (2.25%)

5.76 hits per line

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

0.0
/src/ACadSharp/IO/SVG/SvgConfiguration.cs
1
using ACadSharp.Objects;
2
using ACadSharp.Types.Units;
3
using CSMath;
4
using System;
5
using System.ComponentModel;
6

7
namespace ACadSharp.IO
8
{
9
        /// <summary>
10
        /// Configuration for writing SVG files.
11
        /// </summary>
12
        public class SvgConfiguration : CadWriterConfiguration
13
        {
14
                /// <summary>
15
                /// The <see cref="LineWeightType"/> will be divided by this value to process the stroke-width in the svg when the units are <see cref="UnitsType.Unitless"/>.
16
                /// </summary>
17
                /// <remarks>
18
                /// The default value is 100, which matches with the line weight real value in mm.
19
                /// </remarks>
UNCOV
20
                public double LineWeightRatio { get; set; } = 100;
×
21

22
                /// <summary>
23
                /// Weight value for the <see cref="LineWeightType.Default"/>. 
24
                /// </summary>
25
                /// <value>
26
                /// Value must be in mm.
27
                /// </value>
UNCOV
28
                public double DefaultLineWeight { get; set; } = 0.01;
×
29

30
                /// <summary>
31
                /// Radius applied for the points.
32
                /// </summary>
33
                /// <remarks>
34
                /// In svg the points will be drawn as circles.
35
                /// </remarks>
UNCOV
36
                public double PointRadius { get; set; } = 0.1;
×
37

38
                /// <summary>
39
                /// Get the value of the stroke-width in mm.
40
                /// </summary>
41
                /// <param name="lineweightType"></param>
42
                /// <param name="units"></param>
43
                /// <returns></returns>
44
                public double GetLineWeightValue(LineWeightType lineweightType, UnitsType units)
UNCOV
45
                {
×
UNCOV
46
                        double value = Math.Abs((double)lineweightType);
×
47

UNCOV
48
                        if (units == UnitsType.Unitless)
×
UNCOV
49
                        {
×
UNCOV
50
                                return value / this.LineWeightRatio;
×
51
                        }
52

UNCOV
53
                        switch (lineweightType)
×
54
                        {
55
                                case LineWeightType.Default:
UNCOV
56
                                        return this.DefaultLineWeight;
×
57
                                case LineWeightType.W0:
UNCOV
58
                                        return 0.001;
×
59
                        }
60

UNCOV
61
                        return value / 100;
×
UNCOV
62
                }
×
63

64
                public static double ToPixelSize(double value, PlotPaperUnits units)
65
                {
×
66
                        switch (units)
×
67
                        {
68
                                case PlotPaperUnits.Inches:
69
                                        return value * 96;
×
70
                                case PlotPaperUnits.Millimeters:
71
                                        return value * 96 / 25.4;
×
72
                                case PlotPaperUnits.Pixels:
73
                                        return value;
×
74
                                default:
75
                                        throw new InvalidEnumArgumentException(nameof(units), (int)units, typeof(PlotPaperUnits));
×
76
                        }
77
                }
×
78

79
                public static T ToPixelSize<T>(T value, PlotPaperUnits units)
80
                        where T : IVector
81
                {
×
82
                        for (int i = 0; i < value.Dimension; i++)
×
83
                        {
×
84
                                value[i] = ToPixelSize(value[i], units);
×
85
                        }
×
86

87
                        return value;
×
88
                }
×
89
        }
90
}
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