1- using CADability . Curve2D ;
1+ using CADability . Curve2D ;
22using System ;
33#if WEBASSEMBLY
44using CADability . WebDrawing ;
@@ -34,7 +34,7 @@ public class Line : IGeoObjectImpl, IColorDef, ILineWidth, ILinePattern,
3434 /// <returns>A Line or Line derived class</returns>
3535 public delegate Line ConstructionDelegate ( ) ;
3636 /// <summary>
37- /// Provide a delegate here if you want you Line derived class to be
37+ /// Provide a delegate here if you want you Line derived class to be
3838 /// created each time CADability creates a line.
3939 /// </summary>
4040 public static ConstructionDelegate Constructor ;
@@ -71,13 +71,10 @@ public static Line TwoPoints(GeoPoint sp, GeoPoint ep)
7171 /// </summary>
7272 public virtual GeoPoint StartPoint
7373 {
74- get
75- {
76- return startPoint ;
77- }
74+ get => startPoint ;
7875 set
7976 {
80- using ( new Changing ( this , "StartPoint" ) )
77+ using ( Changing . Create ( this , startPoint ) )
8178 {
8279 startPoint = value ;
8380 }
@@ -89,13 +86,10 @@ public virtual GeoPoint StartPoint
8986 /// </summary>
9087 public virtual GeoPoint EndPoint
9188 {
92- get
93- {
94- return endPoint ;
95- }
89+ get => endPoint ;
9690 set
9791 {
98- using ( new Changing ( this , "EndPoint" ) )
92+ using ( Changing . Create ( this , endPoint ) )
9993 {
10094 endPoint = value ;
10195 }
@@ -122,13 +116,10 @@ public void SetTwoPoints(GeoPoint startPoint, GeoPoint endPoint)
122116 /// </summary>
123117 public double Length
124118 {
125- get
126- {
127- return Geometry . Dist ( startPoint , endPoint ) ;
128- }
119+ get => Geometry . Dist ( startPoint , endPoint ) ;
129120 set
130121 {
131- using ( new Changing ( this , " Length" ) )
122+ using ( Changing . Create ( this , Length ) )
132123 {
133124 GeoVector v = endPoint - startPoint ;
134125 if ( ! v . IsNullVector ( ) ) v . Norm ( ) ;
@@ -154,7 +145,7 @@ public GeoPoint LengthFixPoint
154145 /// <param name="m">the operator for the modification</param>
155146 public override void Modify ( ModOp m )
156147 {
157- using ( new Changing ( this , " ModifyInverse" , m ) )
148+ using ( new Changing ( this , nameof ( ModifyInverse ) , m ) )
158149 {
159150 startPoint = m * startPoint ;
160151 endPoint = m * endPoint ;
@@ -447,13 +438,10 @@ public override IPropertyEntry GetShowProperties(IFrame Frame)
447438 private ColorDef colorDef ;
448439 public ColorDef ColorDef
449440 {
450- get
451- {
452- return colorDef ;
453- }
441+ get => colorDef ;
454442 set
455443 {
456- using ( new ChangingAttribute ( this , "ColorDef" , colorDef ) )
444+ using ( ChangingAttribute . Create ( this , colorDef ) )
457445 {
458446 colorDef = value ;
459447 }
@@ -754,13 +742,10 @@ bool ICurve.TryPointDeriv2At(double position, out GeoPoint point, out GeoVector
754742 #region ILineWidth Members
755743 public LineWidth LineWidth
756744 {
757- get
758- {
759- return lineWidth ;
760- }
745+ get => lineWidth ;
761746 set
762747 {
763- using ( new ChangingAttribute ( this , "LineWidth" , lineWidth ) )
748+ using ( ChangingAttribute . Create ( this , lineWidth ) )
764749 {
765750 lineWidth = value ;
766751 }
@@ -772,13 +757,10 @@ public LineWidth LineWidth
772757
773758 public LinePattern LinePattern
774759 {
775- get
776- {
777- return linePattern ;
778- }
760+ get => linePattern ;
779761 set
780762 {
781- using ( new ChangingAttribute ( this , "LinePattern" , linePattern ) )
763+ using ( ChangingAttribute . Create ( this , linePattern ) )
782764 {
783765 linePattern = value ;
784766 }
@@ -853,7 +835,7 @@ int IExportStep.Export(ExportStep export, bool topLevel)
853835 int sp = ( startPoint as IExportStep ) . Export ( export , false ) ;
854836 int ep = ( endPoint as IExportStep ) . Export ( export , false ) ;
855837 int tc = export . WriteDefinition ( "TRIMMED_CURVE('',#" + ln . ToString ( ) + ",(#" + sp . ToString ( ) + ",PARAMETER_VALUE(0.0)),(#" + ep . ToString ( ) + ",PARAMETER_VALUE(" + export . ToString ( Length ) + ")),.T.,.CARTESIAN.)" ) ;
856- int gcs = export . WriteDefinition ( "GEOMETRIC_CURVE_SET('',(#" + tc . ToString ( ) + "))" ) ; // is a Representation_Item
838+ int gcs = export . WriteDefinition ( "GEOMETRIC_CURVE_SET('',(#" + tc . ToString ( ) + "))" ) ; // is a Representation_Item
857839 ColorDef cd = ColorDef ;
858840 if ( cd == null ) cd = new ColorDef ( "Black" , Color . Black ) ;
859841 cd . MakeStepStyle ( gcs , export ) ;
0 commit comments