From 07a6d8952ce481b96a24662978561ef1868e3265 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Tue, 9 Feb 2021 23:17:11 +0100 Subject: [PATCH] Renamed SurfaceRectangle and fixed spelling mistake --- RGB.NET.Core/Devices/AbstractRGBDevice.cs | 6 ++--- RGB.NET.Core/Leds/Led.cs | 12 +++++----- RGB.NET.Core/Positioning/IPlaceable.cs | 4 ++-- RGB.NET.Core/Positioning/Placeable.cs | 28 +++++++++++----------- RGB.NET.Core/RGBSurface.cs | 18 +++++++------- RGB.NET.Groups/Groups/RectangleLedGroup.cs | 4 ++-- 6 files changed, 36 insertions(+), 36 deletions(-) diff --git a/RGB.NET.Core/Devices/AbstractRGBDevice.cs b/RGB.NET.Core/Devices/AbstractRGBDevice.cs index a83fa16..b88a3dc 100644 --- a/RGB.NET.Core/Devices/AbstractRGBDevice.cs +++ b/RGB.NET.Core/Devices/AbstractRGBDevice.cs @@ -55,11 +55,11 @@ namespace RGB.NET.Core Led? IRGBDevice.this[LedId ledId] => LedMapping.TryGetValue(ledId, out Led? led) ? led : null; /// - Led? IRGBDevice.this[Point location] => LedMapping.Values.FirstOrDefault(x => x.Boundry.Contains(location)); + Led? IRGBDevice.this[Point location] => LedMapping.Values.FirstOrDefault(x => x.Boundary.Contains(location)); /// IEnumerable IRGBDevice.this[Rectangle referenceRect, double minOverlayPercentage] - => LedMapping.Values.Where(x => referenceRect.CalculateIntersectPercentage(x.Boundry) >= minOverlayPercentage); + => LedMapping.Values.Where(x => referenceRect.CalculateIntersectPercentage(x.Boundary) >= minOverlayPercentage); #endregion @@ -136,7 +136,7 @@ namespace RGB.NET.Core if (Location == Point.Invalid) Location = new Point(0, 0); if (Size == Size.Invalid) { - Rectangle ledRectangle = new(this.Select(x => x.Boundry)); + Rectangle ledRectangle = new(this.Select(x => x.Boundary)); Size = ledRectangle.Size + new Size(ledRectangle.Location.X, ledRectangle.Location.Y); } } diff --git a/RGB.NET.Core/Leds/Led.cs b/RGB.NET.Core/Leds/Led.cs index 217580f..7c39c45 100644 --- a/RGB.NET.Core/Leds/Led.cs +++ b/RGB.NET.Core/Leds/Led.cs @@ -43,14 +43,14 @@ namespace RGB.NET.Core set => SetProperty(ref _shapeData, value); } - private Rectangle _absoluteBoundry; + private Rectangle _absoluteBoundary; /// /// Gets a rectangle representing the logical location of the on the . /// - public Rectangle AbsoluteBoundry + public Rectangle AbsoluteBoundary { - get => _absoluteBoundry; - private set => SetProperty(ref _absoluteBoundry, value); + get => _absoluteBoundary; + private set => SetProperty(ref _absoluteBoundary, value); } /// @@ -128,7 +128,7 @@ namespace RGB.NET.Core { base.UpdateActualPlaceableData(); - AbsoluteBoundry = Boundry.Translate(Device.Location); + AbsoluteBoundary = Boundary.Translate(Device.Location); } /// @@ -177,7 +177,7 @@ namespace RGB.NET.Core /// Converts a to a . /// /// The to convert. - public static implicit operator Rectangle(Led led) => led.Boundry; + public static implicit operator Rectangle(Led led) => led.Boundary; #endregion } diff --git a/RGB.NET.Core/Positioning/IPlaceable.cs b/RGB.NET.Core/Positioning/IPlaceable.cs index d8921c5..dd6d79c 100644 --- a/RGB.NET.Core/Positioning/IPlaceable.cs +++ b/RGB.NET.Core/Positioning/IPlaceable.cs @@ -42,7 +42,7 @@ namespace RGB.NET.Core /// Gets a rectangle containing the whole . /// This includes , , and . /// - Rectangle Boundry { get; } + Rectangle Boundary { get; } #endregion @@ -54,7 +54,7 @@ namespace RGB.NET.Core event EventHandler RotationChanged; event EventHandler ActualLocationChanged; event EventHandler ActualSizeChanged; - event EventHandler BoundryChanged; + event EventHandler BoundaryChanged; #endregion } diff --git a/RGB.NET.Core/Positioning/Placeable.cs b/RGB.NET.Core/Positioning/Placeable.cs index 9db851d..f415f48 100644 --- a/RGB.NET.Core/Positioning/Placeable.cs +++ b/RGB.NET.Core/Positioning/Placeable.cs @@ -80,15 +80,15 @@ namespace RGB.NET.Core } } - private Rectangle _boundry = new(Point.Invalid, Point.Invalid); + private Rectangle _boundary = new(Point.Invalid, Point.Invalid); /// - public Rectangle Boundry + public Rectangle Boundary { - get => _boundry; + get => _boundary; private set { - if (SetProperty(ref _boundry, value)) - OnBoundryChanged(); + if (SetProperty(ref _boundary, value)) + OnBoundaryChanged(); } } @@ -102,7 +102,7 @@ namespace RGB.NET.Core public event EventHandler? RotationChanged; public event EventHandler? ActualLocationChanged; public event EventHandler? ActualSizeChanged; - public event EventHandler? BoundryChanged; + public event EventHandler? BoundaryChanged; #endregion @@ -114,7 +114,7 @@ namespace RGB.NET.Core { this.Parent = parent; - Parent.BoundryChanged += (_, _) => UpdateActualPlaceableData(); + Parent.BoundaryChanged += (_, _) => UpdateActualPlaceableData(); } public Placeable(Point location, Size size) @@ -129,7 +129,7 @@ namespace RGB.NET.Core this.Location = location; this.Size = size; - Parent.BoundryChanged += (_, _) => UpdateActualPlaceableData(); + Parent.BoundaryChanged += (_, _) => UpdateActualPlaceableData(); } #endregion @@ -142,27 +142,27 @@ namespace RGB.NET.Core { Size actualSize = Size * Parent.Scale; Point actualLocation = (Location * Parent.Scale); - Rectangle boundry = new(actualLocation, actualSize); + Rectangle boundary = new(actualLocation, actualSize); if (Parent.Rotation.IsRotated) { Point parentCenter = new Rectangle(Parent.ActualSize).Center; - Point actualParentCenter = new Rectangle(Parent.Boundry.Size).Center; + Point actualParentCenter = new Rectangle(Parent.Boundary.Size).Center; Point centerOffset = new(actualParentCenter.X - parentCenter.X, actualParentCenter.Y - parentCenter.Y); actualLocation = actualLocation.Rotate(Parent.Rotation, new Rectangle(Parent.ActualSize).Center) + centerOffset; - boundry = new Rectangle(boundry.Rotate(Parent.Rotation, new Rectangle(Parent.ActualSize).Center)).Translate(centerOffset); + boundary = new Rectangle(boundary.Rotate(Parent.Rotation, new Rectangle(Parent.ActualSize).Center)).Translate(centerOffset); } ActualLocation = actualLocation; ActualSize = actualSize; - Boundry = boundry; + Boundary = boundary; } else { ActualLocation = Location; ActualSize = Size * Scale; - Boundry = new Rectangle(Location, new Rectangle(new Rectangle(Location, ActualSize).Rotate(Rotation)).Size); + Boundary = new Rectangle(Location, new Rectangle(new Rectangle(Location, ActualSize).Rotate(Rotation)).Size); } } @@ -192,7 +192,7 @@ namespace RGB.NET.Core protected virtual void OnActualLocationChanged() => ActualLocationChanged?.Invoke(this, new EventArgs()); protected virtual void OnActualSizeChanged() => ActualSizeChanged?.Invoke(this, new EventArgs()); - protected virtual void OnBoundryChanged() => BoundryChanged?.Invoke(this, new EventArgs()); + protected virtual void OnBoundaryChanged() => BoundaryChanged?.Invoke(this, new EventArgs()); #endregion } diff --git a/RGB.NET.Core/RGBSurface.cs b/RGB.NET.Core/RGBSurface.cs index e1dd16e..e45f0f9 100644 --- a/RGB.NET.Core/RGBSurface.cs +++ b/RGB.NET.Core/RGBSurface.cs @@ -49,7 +49,7 @@ namespace RGB.NET.Core /// /// Gets a copy of the representing this . /// - public Rectangle SurfaceRectangle { get; private set; } + public Rectangle Boundary { get; private set; } = new(new Point(0, 0), new Size(0, 0)); /// /// Gets a list of all on this . @@ -211,13 +211,13 @@ namespace RGB.NET.Core switch (brush.BrushCalculationMode) { case BrushCalculationMode.Relative: - Rectangle brushRectangle = new(leds.Select(led => led.AbsoluteBoundry)); + Rectangle brushRectangle = new(leds.Select(led => led.AbsoluteBoundary)); Point offset = new(-brushRectangle.Location.X, -brushRectangle.Location.Y); brushRectangle = brushRectangle.SetLocation(new Point(0, 0)); - brush.PerformRender(brushRectangle, leds.Select(led => new BrushRenderTarget(led, led.AbsoluteBoundry.Translate(offset)))); + brush.PerformRender(brushRectangle, leds.Select(led => new BrushRenderTarget(led, led.AbsoluteBoundary.Translate(offset)))); break; case BrushCalculationMode.Absolute: - brush.PerformRender(SurfaceRectangle, leds.Select(led => new BrushRenderTarget(led, led.AbsoluteBoundry))); + brush.PerformRender(Boundary, leds.Select(led => new BrushRenderTarget(led, led.AbsoluteBoundary))); break; default: throw new ArgumentException(); @@ -283,7 +283,7 @@ namespace RGB.NET.Core if (device.Surface != null) throw new RGBSurfaceException($"The device '{device.DeviceInfo.Manufacturer} {device.DeviceInfo.Model}' is already attached to a surface."); device.Surface = this; - device.BoundryChanged += DeviceOnBoundryChanged; + device.BoundaryChanged += DeviceOnBoundaryChanged; _devices.Add(device); OnSurfaceLayoutChanged(SurfaceLayoutChangedEventArgs.FromAddedDevice(device)); @@ -305,7 +305,7 @@ namespace RGB.NET.Core { if (!_devices.Contains(device)) throw new RGBSurfaceException($"The device '{device.DeviceInfo.Manufacturer} {device.DeviceInfo.Model}' isn't not attached to this surface."); - device.BoundryChanged -= DeviceOnBoundryChanged; + device.BoundaryChanged -= DeviceOnBoundaryChanged; device.Surface = null; _devices.Remove(device); @@ -329,7 +329,7 @@ namespace RGB.NET.Core // ReSharper restore UnusedMember.Global - private void DeviceOnBoundryChanged(object? sender, EventArgs args) + private void DeviceOnBoundaryChanged(object? sender, EventArgs args) => OnSurfaceLayoutChanged((sender is IRGBDevice device) ? SurfaceLayoutChangedEventArgs.FromChangedDevice(device) : SurfaceLayoutChangedEventArgs.Misc()); private void OnSurfaceLayoutChanged(SurfaceLayoutChangedEventArgs args) @@ -343,8 +343,8 @@ namespace RGB.NET.Core { lock (_devices) { - Rectangle devicesRectangle = new(_devices.Select(d => d.Boundry)); - SurfaceRectangle = SurfaceRectangle.SetSize(new Size(devicesRectangle.Location.X + devicesRectangle.Size.Width, devicesRectangle.Location.Y + devicesRectangle.Size.Height)); + Rectangle devicesRectangle = new(_devices.Select(d => d.Boundary)); + Boundary = Boundary.SetSize(new Size(devicesRectangle.Location.X + devicesRectangle.Size.Width, devicesRectangle.Location.Y + devicesRectangle.Size.Height)); } } diff --git a/RGB.NET.Groups/Groups/RectangleLedGroup.cs b/RGB.NET.Groups/Groups/RectangleLedGroup.cs index ef81c45..e6c2ae7 100644 --- a/RGB.NET.Groups/Groups/RectangleLedGroup.cs +++ b/RGB.NET.Groups/Groups/RectangleLedGroup.cs @@ -59,7 +59,7 @@ namespace RGB.NET.Groups /// (optional) The minimal percentage overlay a must have with the to be taken into the . (default: 0.5) /// (optional) Specifies whether this should be automatically attached or not. (default: true) public RectangleLedGroup(RGBSurface? surface, Led fromLed, Led toLed, double minOverlayPercentage = 0.5) - : this(surface, new Rectangle(fromLed.Boundry, toLed.Boundry), minOverlayPercentage) + : this(surface, new Rectangle(fromLed.Boundary, toLed.Boundary), minOverlayPercentage) { } /// @@ -117,7 +117,7 @@ namespace RGB.NET.Groups /// Gets a list containing all of this . /// /// The list containing all of this . - public override IList GetLeds() => _ledCache ??= (Surface?.Leds.Where(led => led.AbsoluteBoundry.CalculateIntersectPercentage(Rectangle) >= MinOverlayPercentage).ToList() ?? new List()); + public override IList GetLeds() => _ledCache ??= (Surface?.Leds.Where(led => led.AbsoluteBoundary.CalculateIntersectPercentage(Rectangle) >= MinOverlayPercentage).ToList() ?? new List()); private void InvalidateCache() => _ledCache = null;