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

DomCR / ACadSharp / 16517130645

25 Jul 2025 08:07AM UTC coverage: 75.158% (-0.02%) from 75.178%
16517130645

Pull #721

github

web-flow
Merge 60d3e6093 into aea407c1e
Pull Request #721: SVG paper units

6054 of 8854 branches covered (68.38%)

Branch coverage included in aggregate %.

92 of 108 new or added lines in 6 files covered. (85.19%)

14 existing lines in 2 files now uncovered.

24000 of 31134 relevant lines covered (77.09%)

78692.62 hits per line

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

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

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

22
                /// <summary>
23
                /// Weight value for the <see cref="LineweightType.Default"/>. 
24
                /// </summary>
25
                /// <value>
26
                /// Value must be in mm.
27
                /// </value>
28
                public double DefaultLineWeight { get; set; } = 0.01;
573✔
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>
36
                public double PointRadius { get; set; } = 0.1;
574✔
37

38
                /// <summary>
39
                /// Get the value of the stroke-width.
40
                /// </summary>
41
                /// <param name="lineweightType"></param>
42
                /// <returns></returns>
43
                public double GetLineWeightValue(LineweightType lineweightType)
44
                {
92✔
45
                        double value = (double)lineweightType;
92✔
46

47
                        switch (lineweightType)
92✔
48
                        {
49
                                case LineweightType.Default:
50
                                        return 0.01;
77✔
51
                                case LineweightType.W0:
52
                                        return 0.001;
1✔
53
                        }
54

55
                        return Math.Abs(value) / 100;
14✔
56
                }
92✔
57

58
                public static double ToPixelSize(double value, PlotPaperUnits units)
UNCOV
59
                {
×
UNCOV
60
                        switch (units)
×
61
                        {
62
                                case PlotPaperUnits.Inches:
UNCOV
63
                                        return value * 96;
×
64
                                case PlotPaperUnits.Millimeters:
UNCOV
65
                                        return value * 96 / 25.4;
×
66
                                case PlotPaperUnits.Pixels:
67
                                        return value;
×
68
                                default:
69
                                        throw new InvalidEnumArgumentException(nameof(units), (int)units, typeof(PlotPaperUnits));
×
70
                        }
UNCOV
71
                }
×
72

73
                public static T ToPixelSize<T>(T value, PlotPaperUnits units)
74
                        where T : IVector
NEW
75
                {
×
NEW
76
                        for (int i = 0; i < value.Dimension; i++)
×
NEW
77
                        {
×
NEW
78
                                value[i] = ToPixelSize(value[i], units);
×
NEW
79
                        }
×
80

NEW
81
                        return value;
×
NEW
82
                }
×
83
        }
84
}
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

© 2025 Coveralls, Inc