From 44e72bb09bb6a2a1c371c8f0dc4cad9b766877c5 Mon Sep 17 00:00:00 2001 From: Michel Date: Fri, 27 Dec 2024 14:44:40 +0100 Subject: [PATCH] Fix CS3006 - Overloaded method 'method' differing only in ref or out, or in array rank, is not CLS-compliant #49 --- CADability/Arc2D.cs | 2 +- CADability/Bitmap.cs | 2 +- CADability/BoundingCube.cs | 2 +- CADability/Circle2D.cs | 2 +- CADability/ClipRect.cs | 7 ------- CADability/DebuggerContainer.cs | 2 ++ CADability/Ellipse2D.cs | 2 +- CADability/EllipseArc2D.cs | 2 +- CADability/Face.cs | 4 ++-- CADability/GeneralCurve2D.cs | 2 +- CADability/Line.cs | 8 ++++---- CADability/Line2D.cs | 4 ++-- CADability/Polyline.cs | 2 +- CADability/Polyline2D.cs | 2 +- CADability/Surface.cs | 2 +- CADability/Text.cs | 2 +- CADability/Triangulation.cs | 2 +- 17 files changed, 22 insertions(+), 27 deletions(-) diff --git a/CADability/Arc2D.cs b/CADability/Arc2D.cs index 24dcee17..8efb176f 100644 --- a/CADability/Arc2D.cs +++ b/CADability/Arc2D.cs @@ -300,7 +300,7 @@ public override bool HitTest(ref BoundingRect Rect, bool IncludeControlPoints) { // 19.8.15: bin nicht sicher, ob das mit negativem sweep auch geht, deshalb hier umdrehen return (new Arc2D(Center, Radius, start + sweep, -sweep)).HitTest(ref Rect, IncludeControlPoints); } - ClipRect clr = new ClipRect(ref Rect); + ClipRect clr = new ClipRect(Rect); int StartQuadrant = start.Quadrant; int EndQuadrant = (start + sweep).Quadrant; diff --git a/CADability/Bitmap.cs b/CADability/Bitmap.cs index 61403cf3..53a8b31b 100644 --- a/CADability/Bitmap.cs +++ b/CADability/Bitmap.cs @@ -381,7 +381,7 @@ public override bool HitTest(Projection projection, BoundingRect rect, bool only } else { - ClipRect clr = new ClipRect(ref rect); + ClipRect clr = new ClipRect(rect); return clr.ParallelogramHitTest(projection.ProjectUnscaled(location), projection.ProjectUnscaled(directionWidth), projection.ProjectUnscaled(directionHeight)); } } diff --git a/CADability/BoundingCube.cs b/CADability/BoundingCube.cs index 459c6268..4683d0d1 100644 --- a/CADability/BoundingCube.cs +++ b/CADability/BoundingCube.cs @@ -930,7 +930,7 @@ private bool Interferes(ref GeoPoint tetra1, ref GeoPoint tetra2, ref GeoPoint t /// ture if interference, false otherwise public bool Interferes(Projection projection, BoundingRect rect) { - ClipRect clr = new ClipRect(ref rect); + ClipRect clr = new ClipRect(rect); GeoPoint2D[] points2d = new GeoPoint2D[]{ projection.ProjectUnscaled(new GeoPoint(Xmin, Ymin, Zmin)), projection.ProjectUnscaled(new GeoPoint(Xmax, Ymin, Zmin)), diff --git a/CADability/Circle2D.cs b/CADability/Circle2D.cs index 3beef344..ebe4ed90 100644 --- a/CADability/Circle2D.cs +++ b/CADability/Circle2D.cs @@ -298,7 +298,7 @@ public override BoundingRect GetExtent() /// public override bool HitTest(ref BoundingRect Rect, bool IncludeControlPoints) { - ClipRect clr = new ClipRect(ref Rect); + ClipRect clr = new ClipRect(Rect); if (clr.ArcHitTest(center, radius, 0, new GeoPoint2D(center.x + radius, center.y), new GeoPoint2D(center.x, center.y + radius))) return true; if (clr.ArcHitTest(center, radius, 1, new GeoPoint2D(center.x, center.y + radius), new GeoPoint2D(center.x - radius, center.y))) return true; if (clr.ArcHitTest(center, radius, 2, new GeoPoint2D(center.x - radius, center.y), new GeoPoint2D(center.x, center.y - radius))) return true; diff --git a/CADability/ClipRect.cs b/CADability/ClipRect.cs index 93ad138c..291dd015 100644 --- a/CADability/ClipRect.cs +++ b/CADability/ClipRect.cs @@ -38,13 +38,6 @@ private int ClipCode(ref GeoPoint2D p) // ref wg. Geschwindigkeit else if (p.y > Top) res = res | ClipTop; return res; } - public ClipRect(ref BoundingRect r) - { // warum mit ref??? - Left = r.Left; - Right = r.Right; - Bottom = r.Bottom; - Top = r.Top; - } public ClipRect(BoundingRect r) { Left = r.Left; diff --git a/CADability/DebuggerContainer.cs b/CADability/DebuggerContainer.cs index e575dc55..36764a9c 100644 --- a/CADability/DebuggerContainer.cs +++ b/CADability/DebuggerContainer.cs @@ -324,6 +324,8 @@ public static DebuggerContainer Show(GeoPoint[] points) res.Add(pl); return res; } + + [CLSCompliant(false)] public static DebuggerContainer Show(GeoPoint[,] points) { DebuggerContainer res = new DebuggerContainer(); diff --git a/CADability/Ellipse2D.cs b/CADability/Ellipse2D.cs index 3f1f477e..702c0b79 100644 --- a/CADability/Ellipse2D.cs +++ b/CADability/Ellipse2D.cs @@ -384,7 +384,7 @@ public override bool HitTest(ref BoundingRect Rect, bool IncludeControlPoints) Angle majorang = majorAxis.Angle; double radiusx = majorAxis.Length; double radiusy = minorAxis.Length; - ClipRect clr = new ClipRect(ref Rect); + ClipRect clr = new ClipRect(Rect); if (clr.EllipseArcHitTest(center, radiusx, radiusy, majorang, 0, right, top)) return true; if (clr.EllipseArcHitTest(center, radiusx, radiusy, majorang, 1, top, left)) return true; if (clr.EllipseArcHitTest(center, radiusx, radiusy, majorang, 2, left, bottom)) return true; diff --git a/CADability/EllipseArc2D.cs b/CADability/EllipseArc2D.cs index 46bb530b..94398ee0 100644 --- a/CADability/EllipseArc2D.cs +++ b/CADability/EllipseArc2D.cs @@ -200,7 +200,7 @@ public override bool HitTest(ref BoundingRect Rect, bool IncludeControlPoints) Angle majorang = majorAxis.Angle; double radiusx = majorAxis.Length; double radiusy = minorAxis.Length; - ClipRect clr = new ClipRect(ref Rect); + ClipRect clr = new ClipRect(Rect); if (clr.Contains(startPoint)) return true; if (clr.Contains(EndPoint)) return true; diff --git a/CADability/Face.cs b/CADability/Face.cs index 2e08f4a1..533276aa 100644 --- a/CADability/Face.cs +++ b/CADability/Face.cs @@ -5699,7 +5699,7 @@ bool IOctTreeInsertable.HitTest(Projection projection, BoundingRect rect, bool o } else { - ClipRect clr = new ClipRect(ref rect); + ClipRect clr = new ClipRect(rect); return clr.TriangleHitTest(p1, p2, p3); } } @@ -7236,7 +7236,7 @@ internal bool HitTestWithoutEdges(ref BoundingCube cube, double precision) public override bool HitTest(Projection projection, BoundingRect rect, bool onlyInside) { if (trianglePoint == null) return false; // this is only for selecting with the mouse - ClipRect clr = new ClipRect(ref rect); + ClipRect clr = new ClipRect(rect); if (onlyInside) { lock (lockTriangulationData) diff --git a/CADability/GeneralCurve2D.cs b/CADability/GeneralCurve2D.cs index e321b6c5..e6bd2f24 100644 --- a/CADability/GeneralCurve2D.cs +++ b/CADability/GeneralCurve2D.cs @@ -3637,7 +3637,7 @@ private bool TriangleHitTest(ref ClipRect rect, GeoPoint2D sp, GeoPoint2D ep, Ge } public virtual bool HitTest(ref BoundingRect rect, bool includeControlPoints) { - ClipRect clr = new ClipRect(ref rect); + ClipRect clr = new ClipRect(rect); if (interpol == null) MakeTriangulation(); for (int i = 0; i < interpol.Length - 1; ++i) { diff --git a/CADability/Line.cs b/CADability/Line.cs index 9f4309fa..11b4beff 100644 --- a/CADability/Line.cs +++ b/CADability/Line.cs @@ -328,7 +328,7 @@ public override bool HitTest(Projection projection, BoundingRect rect, bool only } else { - ClipRect clr = new ClipRect(ref rect); + ClipRect clr = new ClipRect(rect); return clr.LineHitTest(projection.ProjectUnscaled(startPoint), projection.ProjectUnscaled(endPoint)); } } @@ -971,7 +971,7 @@ BoundingRect IQuadTreeInsertable.GetExtent() bool IQuadTreeInsertable.HitTest(ref BoundingRect rect, bool includeControlPoints) { - ClipRect clr = new ClipRect(ref rect); + ClipRect clr = new ClipRect(rect); return clr.LineHitTest(sp, ep); } @@ -1013,7 +1013,7 @@ bool IOctTreeInsertable.HitTest(Projection projection, BoundingRect rect, bool o } else { - ClipRect clr = new ClipRect(ref rect); + ClipRect clr = new ClipRect(rect); // eine Linie machen, die bestimmt über das rechteck hinaus geht GeoPoint2D sp2d = projection.ProjectUnscaled(start); GeoVector2D dir2d = projection.ProjectUnscaled(dir); @@ -1080,7 +1080,7 @@ bool IOctTreeInsertable.HitTest(Projection projection, BoundingRect rect, bool o } else { - ClipRect clr = new ClipRect(ref rect); + ClipRect clr = new ClipRect(rect); // eine Linie machen, die bestimmt über das rechteck hinaus geht GeoPoint2D sp2d = projection.ProjectUnscaled(start); GeoVector2D dir2d = projection.ProjectUnscaled(dir); diff --git a/CADability/Line2D.cs b/CADability/Line2D.cs index 49f7c5c3..ee391476 100644 --- a/CADability/Line2D.cs +++ b/CADability/Line2D.cs @@ -34,7 +34,7 @@ public Line2D(GeoPoint2D location, GeoVector2D direction, BoundingRect clippedBy double l = clippedBy.Width + clippedBy.Height; startPoint = c + l * direction; endPoint = c - l * direction; - ClipRect clr = new ClipRect(ref clippedBy); + ClipRect clr = new ClipRect(clippedBy); clr.ClipLine(ref startPoint, ref endPoint); } public override string ToString() @@ -188,7 +188,7 @@ public override BoundingRect GetExtent() /// public override bool HitTest(ref BoundingRect Rect, bool IncludeControlPoints) { - ClipRect clr = new ClipRect(ref Rect); + ClipRect clr = new ClipRect(Rect); return clr.LineHitTest(startPoint, endPoint); } /// diff --git a/CADability/Polyline.cs b/CADability/Polyline.cs index c88f7017..7162a097 100644 --- a/CADability/Polyline.cs +++ b/CADability/Polyline.cs @@ -1721,7 +1721,7 @@ bool IOctTreeInsertable.HitTest(ref BoundingCube cube, double precision) bool IOctTreeInsertable.HitTest(Projection projection, BoundingRect rect, bool onlyInside) { - ClipRect clr = new ClipRect(ref rect); + ClipRect clr = new ClipRect(rect); for (int i = 1; i < vertex.Length - 3; ++i) { if (clr.LineHitTest(projection.ProjectUnscaled(vertex[i]), projection.ProjectUnscaled(vertex[i + 1]))) return true; diff --git a/CADability/Polyline2D.cs b/CADability/Polyline2D.cs index c02d5c4c..dca3d8f4 100644 --- a/CADability/Polyline2D.cs +++ b/CADability/Polyline2D.cs @@ -263,7 +263,7 @@ public override BoundingRect GetExtent() /// public override bool HitTest(ref BoundingRect Rect, bool IncludeControlPoints) { - ClipRect clr = new ClipRect(ref Rect); + ClipRect clr = new ClipRect(Rect); for (int i = 1; i < vertex.Length; ++i) { GeoPoint2D sp = vertex[i - 1]; diff --git a/CADability/Surface.cs b/CADability/Surface.cs index 205363bd..e5d5fdcd 100644 --- a/CADability/Surface.cs +++ b/CADability/Surface.cs @@ -6515,7 +6515,7 @@ internal static bool ParallelDistance(ISurface surface1, BoundingRect domain1, I double f = (axloc.y - domain1.Top) / axdir.y; p2 = p2 - f * axdir; } - ClipRect clr = new ClipRect(ref domain1); + ClipRect clr = new ClipRect(domain1); if (clr.ClipLine(ref p1, ref p2)) { GeoPoint2D pm = new GeoPoint2D(p1, p2); diff --git a/CADability/Text.cs b/CADability/Text.cs index 27f2616a..5349138d 100644 --- a/CADability/Text.cs +++ b/CADability/Text.cs @@ -3112,7 +3112,7 @@ public override bool HitTest(Projection projection, BoundingRect rect, bool only } else { - ClipRect clr = new ClipRect(ref rect); + ClipRect clr = new ClipRect(rect); // nicht sicher, object die folgenden noch skaliert werden müssen: return clr.ParallelogramHitTest(projection.ProjectUnscaled(lowerLeft), projection.ProjectUnscaled(lowerRight - lowerLeft), projection.ProjectUnscaled(upperLeft - lowerLeft)); } diff --git a/CADability/Triangulation.cs b/CADability/Triangulation.cs index 28b66f76..79d942c0 100644 --- a/CADability/Triangulation.cs +++ b/CADability/Triangulation.cs @@ -279,7 +279,7 @@ BoundingRect IQuadTreeInsertable.GetExtent() bool IQuadTreeInsertable.HitTest(ref BoundingRect rect, bool includeControlPoints) { - ClipRect clr = new ClipRect(ref rect); + ClipRect clr = new ClipRect(rect); return clr.LineHitTest(vertex[edge.v1].p2d, vertex[edge.v2].p2d); }