diff --git a/ApplicationView/ApplicationController.cs b/ApplicationView/ApplicationController.cs index f1d9d22c1..aa3c8622a 100644 --- a/ApplicationView/ApplicationController.cs +++ b/ApplicationView/ApplicationController.cs @@ -300,7 +300,7 @@ namespace MatterHackers.MatterControl { new SceneSelectionOperation() { - OperationType = typeof(Group3D), + OperationType = typeof(GroupObject3D), TitleResolver = () => "Group".Localize(), Action = (scene) => @@ -308,7 +308,7 @@ namespace MatterHackers.MatterControl var selectedItem = scene.SelectedItem; scene.SelectedItem = null; - var newGroup = new Group3D(); + var newGroup = new GroupObject3D(); // When grouping items, move them to be centered on their bounding box newGroup.Children.Modify((gChildren) => { @@ -333,7 +333,7 @@ namespace MatterHackers.MatterControl scene.SelectedItem = newGroup; }, IsEnabled = (scene) => scene.HasSelection - && scene.SelectedItem is SelectionGroup + && scene.SelectedItem is SelectionGroupObject3D && scene.SelectedItem.Children.Count > 1, Icon = AggContext.StaticData.LoadIcon("group.png", 16, 16).SetPreMultiply(), }, @@ -362,17 +362,17 @@ namespace MatterHackers.MatterControl new SceneSelectionSeparator(), new SceneSelectionOperation() { - OperationType = typeof(Align3D), + OperationType = typeof(AlignObject3D), TitleResolver = () => "Align".Localize(), Action = (scene) => { var selectedItem = scene.SelectedItem; - var align = new Align3D(); + var align = new AlignObject3D(); align.AddSelectionAsChildren(scene, selectedItem); align.Invalidate(new InvalidateArgs(align, InvalidateType.Properties, null)); }, Icon = AggContext.StaticData.LoadIcon("align_left.png", 16, 16, theme.InvertIcons).SetPreMultiply(), - IsEnabled = (scene) => scene.SelectedItem is SelectionGroup, + IsEnabled = (scene) => scene.SelectedItem is SelectionGroupObject3D, }, new SceneSelectionOperation() { @@ -408,7 +408,7 @@ namespace MatterHackers.MatterControl TitleResolver = () => "Combine".Localize(), Action = (scene) => new CombineObject3D().WrapSelectedItemAndSelect(scene), Icon = AggContext.StaticData.LoadIcon("combine.png").SetPreMultiply(), - IsEnabled = (scene) => scene.SelectedItem is SelectionGroup, + IsEnabled = (scene) => scene.SelectedItem is SelectionGroupObject3D, }, new SceneSelectionOperation() { @@ -416,7 +416,7 @@ namespace MatterHackers.MatterControl TitleResolver = () => "Subtract".Localize(), Action = (scene) => new SubtractObject3D().WrapSelectedItemAndSelect(scene), Icon = AggContext.StaticData.LoadIcon("subtract.png").SetPreMultiply(), - IsEnabled = (scene) => scene.SelectedItem is SelectionGroup, + IsEnabled = (scene) => scene.SelectedItem is SelectionGroupObject3D, }, new SceneSelectionOperation() { @@ -424,7 +424,7 @@ namespace MatterHackers.MatterControl TitleResolver = () => "Intersect".Localize(), Action = (scene) => new IntersectionObject3D().WrapSelectedItemAndSelect(scene), Icon = AggContext.StaticData.LoadIcon("intersect.png"), - IsEnabled = (scene) => scene.SelectedItem is SelectionGroup, + IsEnabled = (scene) => scene.SelectedItem is SelectionGroupObject3D, }, new SceneSelectionOperation() { @@ -432,47 +432,47 @@ namespace MatterHackers.MatterControl TitleResolver = () => "Subtract & Replace".Localize(), Action = (scene) => new SubtractAndReplaceObject3D().WrapSelectedItemAndSelect(scene), Icon = AggContext.StaticData.LoadIcon("subtract_and_replace.png").SetPreMultiply(), - IsEnabled = (scene) => scene.SelectedItem is SelectionGroup, + IsEnabled = (scene) => scene.SelectedItem is SelectionGroupObject3D, }, new SceneSelectionSeparator(), new SceneSelectionOperation() { - OperationType = typeof(ArrayLinear3D), + OperationType = typeof(ArrayLinearObject3D), TitleResolver = () => "Linear Array".Localize(), Action = (scene) => { - var array = new ArrayLinear3D(); + var array = new ArrayLinearObject3D(); array.AddSelectionAsChildren(scene, scene.SelectedItem); array.Invalidate(new InvalidateArgs(array, InvalidateType.Properties, null)); }, Icon = AggContext.StaticData.LoadIcon("array_linear.png").SetPreMultiply(), - IsEnabled = (scene) => scene.HasSelection && !(scene.SelectedItem is SelectionGroup), + IsEnabled = (scene) => scene.HasSelection && !(scene.SelectedItem is SelectionGroupObject3D), }, new SceneSelectionOperation() { - OperationType = typeof(ArrayRadial3D), + OperationType = typeof(ArrayRadialObject3D), TitleResolver = () => "Radial Array".Localize(), Action = (scene) => { - var array = new ArrayRadial3D(); + var array = new ArrayRadialObject3D(); array.AddSelectionAsChildren(scene, scene.SelectedItem); array.Invalidate(new InvalidateArgs(array, InvalidateType.Properties, null)); }, Icon = AggContext.StaticData.LoadIcon("array_radial.png").SetPreMultiply(), - IsEnabled = (scene) => scene.HasSelection && !(scene.SelectedItem is SelectionGroup), + IsEnabled = (scene) => scene.HasSelection && !(scene.SelectedItem is SelectionGroupObject3D), }, new SceneSelectionOperation() { - OperationType = typeof(ArrayAdvanced3D), + OperationType = typeof(ArrayAdvancedObject3D), TitleResolver = () => "Advanced Array".Localize(), Action = (scene) => { - var array = new ArrayAdvanced3D(); + var array = new ArrayAdvancedObject3D(); array.AddSelectionAsChildren(scene, scene.SelectedItem); array.Invalidate(new InvalidateArgs(array, InvalidateType.Properties, null)); }, Icon = AggContext.StaticData.LoadIcon("array_advanced.png").SetPreMultiply(), - IsEnabled = (scene) => scene.HasSelection && !(scene.SelectedItem is SelectionGroup), + IsEnabled = (scene) => scene.HasSelection && !(scene.SelectedItem is SelectionGroupObject3D), }, new SceneSelectionSeparator(), new SceneSelectionOperation() @@ -501,20 +501,20 @@ namespace MatterHackers.MatterControl }, new SceneSelectionOperation() { - OperationType = typeof(FitToBounds3D), + OperationType = typeof(FitToBoundsObject3D), TitleResolver = () => "Fit to Bounds".Localize(), Action = (scene) => { var selectedItem = scene.SelectedItem; scene.SelectedItem = null; - var fit = FitToBounds3D.Create(selectedItem.Clone()); + var fit = FitToBoundsObject3D.Create(selectedItem.Clone()); fit.MakeNameNonColliding(); scene.UndoBuffer.AddAndDo(new ReplaceCommand(new List { selectedItem }, new List { fit })); scene.SelectedItem = fit; }, Icon = AggContext.StaticData.LoadIcon("fit.png", 16, 16, theme.InvertIcons), - IsEnabled = (scene) => scene.HasSelection && !(scene.SelectedItem is SelectionGroup), + IsEnabled = (scene) => scene.HasSelection && !(scene.SelectedItem is SelectionGroupObject3D), }, }; @@ -531,9 +531,9 @@ namespace MatterHackers.MatterControl // TODO: Use custom selection group icon if reusing group icon seems incorrect // // Explicitly register SelectionGroup icon - if (operationIconsByType.TryGetValue(typeof(Group3D), out ImageBuffer groupIcon)) + if (operationIconsByType.TryGetValue(typeof(GroupObject3D), out ImageBuffer groupIcon)) { - operationIconsByType.Add(typeof(SelectionGroup), groupIcon); + operationIconsByType.Add(typeof(SelectionGroupObject3D), groupIcon); } this.Thumbnails.OperationIcons = operationIconsByType; @@ -696,7 +696,7 @@ namespace MatterHackers.MatterControl { if (sceneItem is IObject3D imageObject) { - var path = new ImageToPath(); + var path = new ImageToPathObject3D(); sceneItem.WrapWith(path, scene); path.Invalidate(new InvalidateArgs(path, InvalidateType.Properties, null)); } @@ -713,7 +713,7 @@ namespace MatterHackers.MatterControl { if (sceneItem is IPathObject imageObject) { - var extrude = new LinearExtrude(); + var extrude = new LinearExtrudeObject3D(); sceneItem.WrapWith(extrude, scene); extrude.Invalidate(new InvalidateArgs(extrude, InvalidateType.Properties, null)); } @@ -730,7 +730,7 @@ namespace MatterHackers.MatterControl { if (sceneItem is IPathObject imageObject) { - var smoothPath = new SmoothPath(); + var smoothPath = new SmoothPathObject3D(); sceneItem.WrapWith(smoothPath, scene); smoothPath.Invalidate(new InvalidateArgs(smoothPath, InvalidateType.Properties, null)); } diff --git a/ApplicationView/PrinterModels.cs b/ApplicationView/PrinterModels.cs index 2850acca4..a564708f9 100644 --- a/ApplicationView/PrinterModels.cs +++ b/ApplicationView/PrinterModels.cs @@ -169,16 +169,16 @@ namespace MatterHackers.MatterControl }); } - public InsertionGroup AddToPlate(IEnumerable selectedLibraryItems) + public InsertionGroupObject3D AddToPlate(IEnumerable selectedLibraryItems) { - InsertionGroup insertionGroup = null; + InsertionGroupObject3D insertionGroup = null; var context = ApplicationController.Instance.DragDropData; var scene = context.SceneContext.Scene; scene.Children.Modify(list => { list.Add( - insertionGroup = new InsertionGroup( + insertionGroup = new InsertionGroupObject3D( selectedLibraryItems, context.View3DWidget, scene, diff --git a/DesignTools/Operations/Align2D.cs b/DesignTools/Operations/Align2D.cs new file mode 100644 index 000000000..11c306a97 --- /dev/null +++ b/DesignTools/Operations/Align2D.cs @@ -0,0 +1,124 @@ +/* +Copyright (c) 2018, Lars Brubaker, John Lewin +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. +*/ + +using System; +using MatterHackers.Agg.Transform; +using MatterHackers.Agg.VertexSource; +using MatterHackers.VectorMath; + +namespace MatterHackers.MatterControl.DesignTools.Operations +{ + public class Align2D : VertexSourceApplyTransform + { + public Align2D() + { + } + + public Align2D(IVertexSource objectToAlign, Side2D boundingFacesToAlign, IVertexSource objectToAlignTo, Side2D boundingFacesToAlignTo, double offsetX = 0, double offsetY = 0, string name = "") + : this(objectToAlign, boundingFacesToAlign, GetPositionToAlignTo(objectToAlignTo, boundingFacesToAlignTo, new Vector2(offsetX, offsetY)), name) + { + if (objectToAlign == objectToAlignTo) + { + throw new Exception("You cannot align an object to itself."); + } + } + + public Align2D(IVertexSource objectToAlign, Side2D boundingFacesToAlign, double positionToAlignToX = 0, double positionToAlignToY = 0, string name = "") + : this(objectToAlign, boundingFacesToAlign, new Vector2(positionToAlignToX, positionToAlignToY), name) + { + } + + public Align2D(IVertexSource objectToAlign, Side2D boundingFacesToAlign, Vector2 positionToAlignTo, double offsetX, double offsetY, string name = "") + : this(objectToAlign, boundingFacesToAlign, positionToAlignTo + new Vector2(offsetX, offsetY), name) + { + } + + public Align2D(IVertexSource item, Side2D boundingFacesToAlign, Vector2 positionToAlignTo, string name = "") + { + var bounds = item.GetBounds(); + + if (IsSet(boundingFacesToAlign, Side2D.Left, Side2D.Right)) + { + positionToAlignTo.X = positionToAlignTo.X - bounds.Left; + } + if (IsSet(boundingFacesToAlign, Side2D.Right, Side2D.Left)) + { + positionToAlignTo.X = positionToAlignTo.X - bounds.Left - (bounds.Right - bounds.Left); + } + if (IsSet(boundingFacesToAlign, Side2D.Bottom, Side2D.Top)) + { + positionToAlignTo.Y = positionToAlignTo.Y - bounds.Bottom; + } + if (IsSet(boundingFacesToAlign, Side2D.Top, Side2D.Bottom)) + { + positionToAlignTo.Y = positionToAlignTo.Y - bounds.Bottom - (bounds.Top - bounds.Bottom); + } + + Transform = Affine.NewTranslation(positionToAlignTo); + VertexSource = item; + } + + public static Vector2 GetPositionToAlignTo(IVertexSource objectToAlignTo, Side2D boundingFacesToAlignTo, Vector2 extraOffset) + { + Vector2 positionToAlignTo = new Vector2(); + if (IsSet(boundingFacesToAlignTo, Side2D.Left, Side2D.Right)) + { + positionToAlignTo.X = objectToAlignTo.GetBounds().Left; + } + if (IsSet(boundingFacesToAlignTo, Side2D.Right, Side2D.Left)) + { + positionToAlignTo.X = objectToAlignTo.GetBounds().Right; + } + if (IsSet(boundingFacesToAlignTo, Side2D.Bottom, Side2D.Top)) + { + positionToAlignTo.Y = objectToAlignTo.GetBounds().Bottom; + } + if (IsSet(boundingFacesToAlignTo, Side2D.Top, Side2D.Bottom)) + { + positionToAlignTo.Y = objectToAlignTo.GetBounds().Top; + } + + return positionToAlignTo + extraOffset; + } + + private static bool IsSet(Side2D variableToCheck, Side2D faceToCheckFor, Side2D faceToAssertNot) + { + if ((variableToCheck & faceToCheckFor) != 0) + { + if ((variableToCheck & faceToAssertNot) != 0) + { + throw new Exception("You cannot have both " + faceToCheckFor.ToString() + " and " + faceToAssertNot.ToString() + " set when calling Align. The are mutually exclusive."); + } + return true; + } + + return false; + } + } +} \ No newline at end of file diff --git a/DesignTools/Operations/Align3D.cs b/DesignTools/Operations/AlignObject3D.cs similarity index 78% rename from DesignTools/Operations/Align3D.cs rename to DesignTools/Operations/AlignObject3D.cs index 706a07357..a3f192eb6 100644 --- a/DesignTools/Operations/Align3D.cs +++ b/DesignTools/Operations/AlignObject3D.cs @@ -31,9 +31,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; -using MatterHackers.Agg.Transform; using MatterHackers.Agg.UI; -using MatterHackers.Agg.VertexSource; using MatterHackers.DataConverters3D; using MatterHackers.VectorMath; using Newtonsoft.Json; @@ -89,105 +87,17 @@ namespace MatterHackers.MatterControl.DesignTools.Operations Top = 0x20, }; - public class Align2D : VertexSourceApplyTransform - { - public Align2D() - { - } - - public Align2D(IVertexSource objectToAlign, Side2D boundingFacesToAlign, IVertexSource objectToAlignTo, Side2D boundingFacesToAlignTo, double offsetX = 0, double offsetY = 0, string name = "") - : this(objectToAlign, boundingFacesToAlign, GetPositionToAlignTo(objectToAlignTo, boundingFacesToAlignTo, new Vector2(offsetX, offsetY)), name) - { - if (objectToAlign == objectToAlignTo) - { - throw new Exception("You cannot align an object to itself."); - } - } - - public Align2D(IVertexSource objectToAlign, Side2D boundingFacesToAlign, double positionToAlignToX = 0, double positionToAlignToY = 0, string name = "") - : this(objectToAlign, boundingFacesToAlign, new Vector2(positionToAlignToX, positionToAlignToY), name) - { - } - - public Align2D(IVertexSource objectToAlign, Side2D boundingFacesToAlign, Vector2 positionToAlignTo, double offsetX, double offsetY, string name = "") - : this(objectToAlign, boundingFacesToAlign, positionToAlignTo + new Vector2(offsetX, offsetY), name) - { - } - - public Align2D(IVertexSource item, Side2D boundingFacesToAlign, Vector2 positionToAlignTo, string name = "") - { - var bounds = item.GetBounds(); - - if (IsSet(boundingFacesToAlign, Side2D.Left, Side2D.Right)) - { - positionToAlignTo.X = positionToAlignTo.X - bounds.Left; - } - if (IsSet(boundingFacesToAlign, Side2D.Right, Side2D.Left)) - { - positionToAlignTo.X = positionToAlignTo.X - bounds.Left - (bounds.Right - bounds.Left); - } - if (IsSet(boundingFacesToAlign, Side2D.Bottom, Side2D.Top)) - { - positionToAlignTo.Y = positionToAlignTo.Y - bounds.Bottom; - } - if (IsSet(boundingFacesToAlign, Side2D.Top, Side2D.Bottom)) - { - positionToAlignTo.Y = positionToAlignTo.Y - bounds.Bottom - (bounds.Top - bounds.Bottom); - } - - Transform = Affine.NewTranslation(positionToAlignTo); - VertexSource = item; - } - - public static Vector2 GetPositionToAlignTo(IVertexSource objectToAlignTo, Side2D boundingFacesToAlignTo, Vector2 extraOffset) - { - Vector2 positionToAlignTo = new Vector2(); - if (IsSet(boundingFacesToAlignTo, Side2D.Left, Side2D.Right)) - { - positionToAlignTo.X = objectToAlignTo.GetBounds().Left; - } - if (IsSet(boundingFacesToAlignTo, Side2D.Right, Side2D.Left)) - { - positionToAlignTo.X = objectToAlignTo.GetBounds().Right; - } - if (IsSet(boundingFacesToAlignTo, Side2D.Bottom, Side2D.Top)) - { - positionToAlignTo.Y = objectToAlignTo.GetBounds().Bottom; - } - if (IsSet(boundingFacesToAlignTo, Side2D.Top, Side2D.Bottom)) - { - positionToAlignTo.Y = objectToAlignTo.GetBounds().Top; - } - - return positionToAlignTo + extraOffset; - } - - private static bool IsSet(Side2D variableToCheck, Side2D faceToCheckFor, Side2D faceToAssertNot) - { - if ((variableToCheck & faceToCheckFor) != 0) - { - if ((variableToCheck & faceToAssertNot) != 0) - { - throw new Exception("You cannot have both " + faceToCheckFor.ToString() + " and " + faceToAssertNot.ToString() + " set when calling Align. The are mutually exclusive."); - } - return true; - } - - return false; - } - } - - public class Align3D : Object3D, IPropertyGridModifier + public class AlignObject3D : Object3D, IPropertyGridModifier { // We need to serialize this so we can remove the arrange and get back to the objects before arranging public List OriginalChildrenBounds = new List(); - public Align3D() + public AlignObject3D() { Name = "Align"; } - public Align3D(IObject3D objectToAlign, FaceAlign boundingFacesToAlign, IObject3D objectToAlignTo, FaceAlign boundingFacesToAlignTo, double offsetX = 0, double offsetY = 0, double offsetZ = 0, string name = "") + public AlignObject3D(IObject3D objectToAlign, FaceAlign boundingFacesToAlign, IObject3D objectToAlignTo, FaceAlign boundingFacesToAlignTo, double offsetX = 0, double offsetY = 0, double offsetZ = 0, string name = "") : this(objectToAlign, boundingFacesToAlign, GetPositionToAlignTo(objectToAlignTo, boundingFacesToAlignTo, new Vector3(offsetX, offsetY, offsetZ)), name) { if (objectToAlign == objectToAlignTo) @@ -196,17 +106,17 @@ namespace MatterHackers.MatterControl.DesignTools.Operations } } - public Align3D(IObject3D objectToAlign, FaceAlign boundingFacesToAlign, double positionToAlignToX = 0, double positionToAlignToY = 0, double positionToAlignToZ = 0, string name = "") + public AlignObject3D(IObject3D objectToAlign, FaceAlign boundingFacesToAlign, double positionToAlignToX = 0, double positionToAlignToY = 0, double positionToAlignToZ = 0, string name = "") : this(objectToAlign, boundingFacesToAlign, new Vector3(positionToAlignToX, positionToAlignToY, positionToAlignToZ), name) { } - public Align3D(IObject3D objectToAlign, FaceAlign boundingFacesToAlign, Vector3 positionToAlignTo, double offsetX, double offsetY, double offsetZ, string name = "") + public AlignObject3D(IObject3D objectToAlign, FaceAlign boundingFacesToAlign, Vector3 positionToAlignTo, double offsetX, double offsetY, double offsetZ, string name = "") : this(objectToAlign, boundingFacesToAlign, positionToAlignTo + new Vector3(offsetX, offsetY, offsetZ), name) { } - public Align3D(IObject3D item, FaceAlign boundingFacesToAlign, Vector3 positionToAlignTo, string name = "") + public AlignObject3D(IObject3D item, FaceAlign boundingFacesToAlign, Vector3 positionToAlignTo, string name = "") { AxisAlignedBoundingBox bounds = item.GetAxisAlignedBoundingBox(); diff --git a/DesignTools/Operations/ArrayAdvanced3D.cs b/DesignTools/Operations/ArrayAdvancedObject3D.cs similarity index 95% rename from DesignTools/Operations/ArrayAdvanced3D.cs rename to DesignTools/Operations/ArrayAdvancedObject3D.cs index b01136f99..9a85084d2 100644 --- a/DesignTools/Operations/ArrayAdvanced3D.cs +++ b/DesignTools/Operations/ArrayAdvancedObject3D.cs @@ -35,9 +35,9 @@ using System.Linq; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class ArrayAdvanced3D : Object3D + public class ArrayAdvancedObject3D : Object3D { - public ArrayAdvanced3D() + public ArrayAdvancedObject3D() { Name = "Advanced Array".Localize(); } @@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations public override void Apply(UndoBuffer undoBuffer) { - OperationSource.Apply(this); + OperationSourceObject3D.Apply(this); base.Apply(undoBuffer); } @@ -120,7 +120,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations public override void Remove(UndoBuffer undoBuffer) { - OperationSource.Remove(this); + OperationSourceObject3D.Remove(this); base.Remove(undoBuffer); } diff --git a/DesignTools/Operations/ArrayLinear3D.cs b/DesignTools/Operations/ArrayLinearObject3D.cs similarity index 93% rename from DesignTools/Operations/ArrayLinear3D.cs rename to DesignTools/Operations/ArrayLinearObject3D.cs index 585e2f93e..24c510f31 100644 --- a/DesignTools/Operations/ArrayLinear3D.cs +++ b/DesignTools/Operations/ArrayLinearObject3D.cs @@ -37,9 +37,9 @@ using System.Linq; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class ArrayLinear3D : Object3D + public class ArrayLinearObject3D : Object3D { - public ArrayLinear3D() + public ArrayLinearObject3D() { Name = "Linear Array".Localize(); } @@ -52,7 +52,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations public override void Apply(UndoBuffer undoBuffer) { - OperationSource.Apply(this); + OperationSourceObject3D.Apply(this); base.Apply(undoBuffer); } @@ -84,7 +84,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations { this.DebugDepth("Rebuild"); - var sourceContainer = OperationSource.GetOrCreateSourceContainer(this); + var sourceContainer = OperationSourceObject3D.GetOrCreateSourceContainer(this); this.Children.Modify(list => { @@ -108,7 +108,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations public override void Remove(UndoBuffer undoBuffer) { - OperationSource.Remove(this); + OperationSourceObject3D.Remove(this); base.Remove(undoBuffer); } diff --git a/DesignTools/Operations/ArrayRadial3D.cs b/DesignTools/Operations/ArrayRadialObject3D.cs similarity index 94% rename from DesignTools/Operations/ArrayRadial3D.cs rename to DesignTools/Operations/ArrayRadialObject3D.cs index 723b14e96..b702e78ce 100644 --- a/DesignTools/Operations/ArrayRadial3D.cs +++ b/DesignTools/Operations/ArrayRadialObject3D.cs @@ -38,9 +38,9 @@ using System.Linq; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class ArrayRadial3D : Object3D + public class ArrayRadialObject3D : Object3D { - public ArrayRadial3D() + public ArrayRadialObject3D() { Name = "Radial Array".Localize(); } @@ -66,7 +66,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations public override void Apply(UndoBuffer undoBuffer) { - OperationSource.Apply(this); + OperationSourceObject3D.Apply(this); base.Apply(undoBuffer); } @@ -106,7 +106,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations Axis.Origin = aabb.Center - new Vector3(30, 0, 0); } - var sourceContainer = OperationSource.GetOrCreateSourceContainer(this); + var sourceContainer = OperationSourceObject3D.GetOrCreateSourceContainer(this); this.Children.Modify(list => { list.Clear(); @@ -140,7 +140,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations public override void Remove(UndoBuffer undoBuffer) { - OperationSource.Remove(this); + OperationSourceObject3D.Remove(this); base.Remove(undoBuffer); } diff --git a/DesignTools/Operations/FitToBounds3D.cs b/DesignTools/Operations/FitToBoundsObject3D.cs similarity index 97% rename from DesignTools/Operations/FitToBounds3D.cs rename to DesignTools/Operations/FitToBoundsObject3D.cs index e570d90f0..d42b174f7 100644 --- a/DesignTools/Operations/FitToBounds3D.cs +++ b/DesignTools/Operations/FitToBoundsObject3D.cs @@ -46,7 +46,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations public enum MaintainRatio { None, X_Y, X_Y_Z } - public class FitToBounds3D : Object3D, IEditorDraw, IPropertyGridModifier + public class FitToBoundsObject3D : Object3D, IEditorDraw, IPropertyGridModifier { [Description("Set the shape the part will be fit into.")] public FitType FitType { get; set; } = FitType.Box; @@ -69,7 +69,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations [JsonIgnore] public IObject3D ItemToScale => Children.First().Children.First(); - public FitToBounds3D() + public FitToBoundsObject3D() { } @@ -138,9 +138,9 @@ namespace MatterHackers.MatterControl.DesignTools.Operations } } - public static FitToBounds3D Create(IObject3D itemToFit) + public static FitToBoundsObject3D Create(IObject3D itemToFit) { - FitToBounds3D fitToBounds = new FitToBounds3D(); + FitToBoundsObject3D fitToBounds = new FitToBoundsObject3D(); var aabb = itemToFit.GetAxisAlignedBoundingBox(); fitToBounds.Width = aabb.XSize; diff --git a/DesignTools/Operations/Group3D.cs b/DesignTools/Operations/GroupObject3D.cs similarity index 96% rename from DesignTools/Operations/Group3D.cs rename to DesignTools/Operations/GroupObject3D.cs index f2928e1c8..3bf51bee7 100644 --- a/DesignTools/Operations/Group3D.cs +++ b/DesignTools/Operations/GroupObject3D.cs @@ -32,9 +32,9 @@ using MatterHackers.Localizations; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class Group3D : Object3D + public class GroupObject3D : Object3D { - public Group3D() + public GroupObject3D() { Name = "Group".Localize(); } diff --git a/DesignTools/Operations/Image/ImageToPath.cs b/DesignTools/Operations/Image/ImageToPathObject3D.cs similarity index 98% rename from DesignTools/Operations/Image/ImageToPath.cs rename to DesignTools/Operations/Image/ImageToPathObject3D.cs index 636a9edb8..1c182caa4 100644 --- a/DesignTools/Operations/Image/ImageToPath.cs +++ b/DesignTools/Operations/Image/ImageToPathObject3D.cs @@ -50,14 +50,14 @@ namespace MatterHackers.MatterControl.DesignTools using Polygon = List; using Polygons = List>; - public class ImageToPath : Object3D, IPathObject, IEditorDraw + public class ImageToPathObject3D : Object3D, IPathObject, IEditorDraw { private ThresholdFunctions _featureDetector = ThresholdFunctions.Silhouette; private ImageBuffer _histogramRawCache = null; private ImageBuffer _histogramDisplayCache = null; - public ImageToPath() + public ImageToPathObject3D() { Name = "Image to Path".Localize(); } @@ -236,7 +236,7 @@ namespace MatterHackers.MatterControl.DesignTools public void DrawEditor(object sender, DrawEventArgs e) { - ImageToPath.DrawPath(this); + ImageToPathObject3D.DrawPath(this); } public void GenerateMarchingSquaresAndLines(Action progressReporter, ImageBuffer image, IThresholdFunction thresholdFunction) diff --git a/DesignTools/Operations/Image/LinearExtrude.cs b/DesignTools/Operations/Image/LinearExtrudeObject3D.cs similarity index 97% rename from DesignTools/Operations/Image/LinearExtrude.cs rename to DesignTools/Operations/Image/LinearExtrudeObject3D.cs index 5da03163b..06128b88e 100644 --- a/DesignTools/Operations/Image/LinearExtrude.cs +++ b/DesignTools/Operations/Image/LinearExtrudeObject3D.cs @@ -42,7 +42,7 @@ namespace MatterHackers.MatterControl.DesignTools using System.Collections.Generic; using System.Threading; - public class LinearExtrude : Object3D + public class LinearExtrudeObject3D : Object3D { public double Height { get; set; } = 5; @@ -83,7 +83,7 @@ namespace MatterHackers.MatterControl.DesignTools Invalidate(new InvalidateArgs(this, InvalidateType.Content)); } - public LinearExtrude() + public LinearExtrudeObject3D() { Name = "Linear Extrude".Localize(); } diff --git a/DesignTools/Operations/Object3DExtensions.cs b/DesignTools/Operations/Object3DExtensions.cs index 2828a3225..bde9fcefc 100644 --- a/DesignTools/Operations/Object3DExtensions.cs +++ b/DesignTools/Operations/Object3DExtensions.cs @@ -225,7 +225,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations { List itemsToReplace; - if (selectedItem is SelectionGroup) + if (selectedItem is SelectionGroupObject3D) { itemsToReplace = selectedItem.Children.ToList(); foreach (var child in itemsToReplace) diff --git a/DesignTools/Operations/OperationSource.cs b/DesignTools/Operations/OperationSourceObject3D.cs similarity index 93% rename from DesignTools/Operations/OperationSource.cs rename to DesignTools/Operations/OperationSourceObject3D.cs index c4971dec9..eba7c54e2 100644 --- a/DesignTools/Operations/OperationSource.cs +++ b/DesignTools/Operations/OperationSourceObject3D.cs @@ -35,14 +35,14 @@ using System.Linq; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class OperationSource : Object3D + public class OperationSourceObject3D : Object3D { - public OperationSource() + public OperationSourceObject3D() { Name = "Source".Localize(); } - public OperationSource(IEnumerable children) + public OperationSourceObject3D(IEnumerable children) : this() { Visible = false; @@ -63,10 +63,10 @@ namespace MatterHackers.MatterControl.DesignTools.Operations IObject3D sourceContainer; using (parent.RebuildLock()) { - sourceContainer = parent.Children.FirstOrDefault(c => c is OperationSource); + sourceContainer = parent.Children.FirstOrDefault(c => c is OperationSourceObject3D); if (sourceContainer == null) { - sourceContainer = new OperationSource(); + sourceContainer = new OperationSourceObject3D(); // Move first child to sourceContainer var firstChild = parent.Children.First(); @@ -89,7 +89,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations // The idea is we leave everything but the source and that is the applied operation parent.Children.Modify(list => { - var sourceItem = list.FirstOrDefault(c => c is OperationSource); + var sourceItem = list.FirstOrDefault(c => c is OperationSourceObject3D); if (sourceItem != null) { list.Remove(sourceItem); @@ -117,7 +117,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations { parent.Children.Modify(list => { - var sourceItem = list.FirstOrDefault(c => c is OperationSource); + var sourceItem = list.FirstOrDefault(c => c is OperationSourceObject3D); if (sourceItem != null) { IObject3D firstChild = sourceItem.Children.First(); diff --git a/DesignTools/Operations/Path/SmoothPath.cs b/DesignTools/Operations/Path/SmoothPathObject3D.cs similarity index 97% rename from DesignTools/Operations/Path/SmoothPath.cs rename to DesignTools/Operations/Path/SmoothPathObject3D.cs index ea8f4edb8..c2d8ca744 100644 --- a/DesignTools/Operations/Path/SmoothPath.cs +++ b/DesignTools/Operations/Path/SmoothPathObject3D.cs @@ -44,11 +44,11 @@ namespace MatterHackers.MatterControl.DesignTools.Operations using Polygon = List; using Polygons = List>; - public class SmoothPath : Object3D, IPathObject, IEditorDraw + public class SmoothPathObject3D : Object3D, IPathObject, IEditorDraw { public IVertexSource VertexSource { get; set; } = new VertexStorage(); - public SmoothPath() + public SmoothPathObject3D() { Name = "Smooth Path".Localize(); } @@ -148,7 +148,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations public void DrawEditor(object sender, DrawEventArgs e) { - ImageToPath.DrawPath(this); + ImageToPathObject3D.DrawPath(this); } } } \ No newline at end of file diff --git a/DesignTools/Operations/PinchObject3D.cs b/DesignTools/Operations/PinchObject3D.cs index d53738660..e520a48a5 100644 --- a/DesignTools/Operations/PinchObject3D.cs +++ b/DesignTools/Operations/PinchObject3D.cs @@ -32,6 +32,7 @@ using System.Linq; using System.Threading; using MatterHackers.Agg.UI; using MatterHackers.DataConverters3D; +using MatterHackers.Localizations; using MatterHackers.MatterControl.DesignTools.Operations; using MatterHackers.MatterControl.PartPreviewWindow.View3D; using MatterHackers.PolygonMesh; @@ -46,6 +47,7 @@ namespace MatterHackers.MatterControl.DesignTools public PinchObject3D() { + Name = "Pinch".Localize(); } private void Rebuild(UndoBuffer undoBuffer) diff --git a/DesignTools/Operations/Rotate.cs b/DesignTools/Operations/RotateObject3D.cs similarity index 88% rename from DesignTools/Operations/Rotate.cs rename to DesignTools/Operations/RotateObject3D.cs index 2c0ab5c9d..5bb88d97d 100644 --- a/DesignTools/Operations/Rotate.cs +++ b/DesignTools/Operations/RotateObject3D.cs @@ -32,18 +32,18 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class Rotate : Object3D + public class RotateObject3D : Object3D { - public Rotate() + public RotateObject3D() { } - public Rotate(IObject3D item, double x = 0, double y = 0, double z = 0, string name = "") + public RotateObject3D(IObject3D item, double x = 0, double y = 0, double z = 0, string name = "") : this(item, new Vector3(x, y, z), name) { } - public Rotate(IObject3D item, Vector3 translation, string name = "") + public RotateObject3D(IObject3D item, Vector3 translation, string name = "") { Matrix *= Matrix4X4.CreateRotation(translation); Children.Add(item.Clone()); diff --git a/DesignTools/Operations/Scale.cs b/DesignTools/Operations/ScaleObject3D.cs similarity index 88% rename from DesignTools/Operations/Scale.cs rename to DesignTools/Operations/ScaleObject3D.cs index da1b50cef..445c043fb 100644 --- a/DesignTools/Operations/Scale.cs +++ b/DesignTools/Operations/ScaleObject3D.cs @@ -32,18 +32,18 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class Scale : Object3D + public class ScaleObject3D : Object3D { - public Scale() + public ScaleObject3D() { } - public Scale(IObject3D item, double x = 0, double y = 0, double z = 0, string name = "") + public ScaleObject3D(IObject3D item, double x = 0, double y = 0, double z = 0, string name = "") : this(item, new Vector3(x, y, z), name) { } - public Scale(IObject3D item, Vector3 translation, string name = "") + public ScaleObject3D(IObject3D item, Vector3 translation, string name = "") { Matrix *= Matrix4X4.CreateScale(translation); Children.Add(item.Clone()); diff --git a/DesignTools/Operations/SetCenter.cs b/DesignTools/Operations/SetCenterObject3D.cs similarity index 90% rename from DesignTools/Operations/SetCenter.cs rename to DesignTools/Operations/SetCenterObject3D.cs index 0ee111df0..0be706ee7 100644 --- a/DesignTools/Operations/SetCenter.cs +++ b/DesignTools/Operations/SetCenterObject3D.cs @@ -34,24 +34,24 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class SetCenter : Object3D + public class SetCenterObject3D : Object3D { - public SetCenter() + public SetCenterObject3D() { } - public SetCenter(IObject3D item, Vector3 position) + public SetCenterObject3D(IObject3D item, Vector3 position) { Matrix = Matrix4X4.CreateTranslation(position - item.GetCenter()); Children.Add(item.Clone()); } - public SetCenter(IObject3D item, double x, double y, double z) + public SetCenterObject3D(IObject3D item, double x, double y, double z) : this(item, new Vector3(x, y, z)) { } - public SetCenter(IObject3D item, Vector3 offset, bool onX = true, bool onY = true, bool onZ = true) + public SetCenterObject3D(IObject3D item, Vector3 offset, bool onX = true, bool onY = true, bool onZ = true) { var center = item.GetAxisAlignedBoundingBox(Matrix4X4.Identity).Center; diff --git a/DesignTools/Operations/Translate.cs b/DesignTools/Operations/TranslateObject3D.cs similarity index 89% rename from DesignTools/Operations/Translate.cs rename to DesignTools/Operations/TranslateObject3D.cs index 288477d51..c226ad4e8 100644 --- a/DesignTools/Operations/Translate.cs +++ b/DesignTools/Operations/TranslateObject3D.cs @@ -32,18 +32,18 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class Translate : Object3D + public class TranslateObject3D : Object3D { - public Translate() + public TranslateObject3D() { } - public Translate(IObject3D item, double x = 0, double y = 0, double z = 0) + public TranslateObject3D(IObject3D item, double x = 0, double y = 0, double z = 0) : this(item, new Vector3(x, y, z)) { } - public Translate(IObject3D item, Vector3 translation) + public TranslateObject3D(IObject3D item, Vector3 translation) { Matrix *= Matrix4X4.CreateTranslation(translation); Children.Add(item.Clone()); diff --git a/Library/Widgets/InsertionGroup.cs b/Library/Widgets/InsertionGroupObject3D.cs similarity index 95% rename from Library/Widgets/InsertionGroup.cs rename to Library/Widgets/InsertionGroupObject3D.cs index 0294e33cd..f15359417 100644 --- a/Library/Widgets/InsertionGroup.cs +++ b/Library/Widgets/InsertionGroupObject3D.cs @@ -39,7 +39,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.Library { - public class InsertionGroup : Object3D + public class InsertionGroupObject3D : Object3D { public event EventHandler ContentLoaded; @@ -50,7 +50,7 @@ namespace MatterHackers.MatterControl.Library public Task LoadingItemsTask { get; } - static InsertionGroup() + static InsertionGroupObject3D() { // Create the placeholder mesh and position it at z0 placeHolderMesh = PlatonicSolids.CreateCube(20, 20, 20); @@ -58,7 +58,7 @@ namespace MatterHackers.MatterControl.Library } // TODO: Figure out how best to collapse the InsertionGroup after the load task completes - public InsertionGroup(IEnumerable items, View3DWidget view3DWidget, InteractiveScene scene, Vector2 bedCenter, Func dragOperationActive, bool trackSourceFiles = false) + public InsertionGroupObject3D(IEnumerable items, View3DWidget view3DWidget, InteractiveScene scene, Vector2 bedCenter, Func dragOperationActive, bool trackSourceFiles = false) { if(items == null) { diff --git a/Library/Widgets/ListView/ListView.cs b/Library/Widgets/ListView/ListView.cs index 1dc0f1c98..0b5c993fe 100644 --- a/Library/Widgets/ListView/ListView.cs +++ b/Library/Widgets/ListView/ListView.cs @@ -401,7 +401,7 @@ namespace MatterHackers.MatterControl.CustomWidgets var sceneChildren = scene.Children.ToList(); - var injector = new InsertionGroup(new[] { itemModel }, activeContext.View3DWidget, scene, bedCenter, () => false); + var injector = new InsertionGroupObject3D(new[] { itemModel }, activeContext.View3DWidget, scene, bedCenter, () => false); injector.ContentLoaded += (s, args) => { // Get the bounds of the loaded InsertionGroup with all of its content diff --git a/MatterControl.csproj b/MatterControl.csproj index 4f8cfb9a0..e98bcc6c1 100644 --- a/MatterControl.csproj +++ b/MatterControl.csproj @@ -92,16 +92,27 @@ - + + + + + + + - + - + - + + + + + + @@ -110,6 +121,7 @@ + @@ -122,6 +134,7 @@ + @@ -150,16 +163,8 @@ - - - - - - - - @@ -172,8 +177,6 @@ - - @@ -224,7 +227,6 @@ - @@ -238,7 +240,6 @@ - diff --git a/PartPreviewWindow/Object3DTreeBuilder.cs b/PartPreviewWindow/Object3DTreeBuilder.cs index 7e5fb20f4..cdbb4514c 100644 --- a/PartPreviewWindow/Object3DTreeBuilder.cs +++ b/PartPreviewWindow/Object3DTreeBuilder.cs @@ -52,7 +52,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow private static TreeNode AddTree(ObjectView item, TreeNode parent, ThemeConfig theme) { // Suppress MeshWrapper and OperationSource nodes in tree - bool shouldCollapseToParent = item.Source is MeshWrapper || item.Source is OperationSource; + bool shouldCollapseToParent = item.Source is ModifiedMeshObject3D || item.Source is OperationSourceObject3D; var contextNode = (shouldCollapseToParent && parent != null) ? parent : AddItem(item, parent, theme); contextNode.SuspendLayout(); @@ -72,7 +72,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow private static TreeNode AddItem(ObjectView item, TreeNode parentNode, ThemeConfig theme) { - if(item.Source is InsertionGroup insertionGroup) + if(item.Source is InsertionGroupObject3D insertionGroup) { return new TreeNode() { @@ -125,7 +125,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { switch (item) { - case FitToBounds3D fitToBounds3D: + case FitToBoundsObject3D fitToBounds3D: return new ObjectView() { Children = new IObject3D[] { fitToBounds3D.ItemToScale }, @@ -133,27 +133,27 @@ namespace MatterHackers.MatterControl.PartPreviewWindow Source = item }; - case ArrayLinear3D arrayLinear3D: + case ArrayLinearObject3D arrayLinear3D: return new ObjectView() { - Children = item.Children.OfType().ToList(), + Children = item.Children.OfType().ToList(), Name = $"{arrayLinear3D.Name} ({arrayLinear3D.Count})", Source = item }; - case ArrayAdvanced3D arrayAdvanced3D: + case ArrayAdvancedObject3D arrayAdvanced3D: return new ObjectView() { - Children = item.Children.OfType().ToList(), + Children = item.Children.OfType().ToList(), Name = $"{arrayAdvanced3D.Name} ({arrayAdvanced3D.Count})", Source = item }; // TODO: array operations should only expose OperationSource - case ArrayRadial3D arrayRadial3D: + case ArrayRadialObject3D arrayRadial3D: return new ObjectView() { - Children = item.Children.OfType().ToList(), + Children = item.Children.OfType().ToList(), Name = $"{arrayRadial3D.Name} ({arrayRadial3D.Count})", Source = item }; diff --git a/PartPreviewWindow/View3D/Actions/MeshWrapperObject3D.cs b/PartPreviewWindow/View3D/Actions/MeshWrapperObject3D.cs index 87c2fee95..3cf4506f1 100644 --- a/PartPreviewWindow/View3D/Actions/MeshWrapperObject3D.cs +++ b/PartPreviewWindow/View3D/Actions/MeshWrapperObject3D.cs @@ -115,7 +115,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D using (wrapper.RebuildLock()) { var remove = wrapper.Parent; - while (remove is MeshWrapper) + while (remove is ModifiedMeshObject3D) { var hold = remove; remove.Remove(null); @@ -202,11 +202,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D if (!child.DescendantsAndSelf().Where((c) => c.OwnerID == this.ID).Any()) { // wrap the child - child.Parent.Children.Modify((list) => + child.Parent.Children.Modify((System.Action>)((List list) => { list.Remove(child); - list.Add(new MeshWrapper(child, this.ID)); - }); + list.Add((IObject3D)new ModifiedMeshObject3D(child, this.ID)); + })); } } } diff --git a/PartPreviewWindow/View3D/Actions/MeshWrapper.cs b/PartPreviewWindow/View3D/Actions/ModifiedMeshObject3D.cs similarity index 95% rename from PartPreviewWindow/View3D/Actions/MeshWrapper.cs rename to PartPreviewWindow/View3D/Actions/ModifiedMeshObject3D.cs index ac5216bf2..ac54c1989 100644 --- a/PartPreviewWindow/View3D/Actions/MeshWrapper.cs +++ b/PartPreviewWindow/View3D/Actions/ModifiedMeshObject3D.cs @@ -38,9 +38,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D /// The goal of MeshWrapper is to provide a mutated version of a source item by some operation. To do so we wrap and clone all /// properties of the source item and reset the source matrix to Identity, given that it now exists on the wrapping parent. /// - public class MeshWrapper : Object3D + public class ModifiedMeshObject3D : Object3D { - public MeshWrapper() + public ModifiedMeshObject3D() { } @@ -63,7 +63,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D base.OnInvalidate(invalidateType); } - public MeshWrapper(IObject3D child, string ownerId) + public ModifiedMeshObject3D(IObject3D child, string ownerId) { Children.Add(child); diff --git a/PartPreviewWindow/View3D/MeshViewerWidget.cs b/PartPreviewWindow/View3D/MeshViewerWidget.cs index 84b6bdf82..d46db6404 100644 --- a/PartPreviewWindow/View3D/MeshViewerWidget.cs +++ b/PartPreviewWindow/View3D/MeshViewerWidget.cs @@ -519,7 +519,7 @@ namespace MatterHackers.MeshVisualizer var selectedItem = scene.SelectedItem; bool isSelected = selectedItem != null && (selectedItem.DescendantsAndSelf().Any((i) => i == item) - || selectedItem.Parents().Any((mw) => mw == item)); + || selectedItem.Parents().Any((mw) => mw == item)); if (isSelected && scene.DrawSelection) { diff --git a/PartPreviewWindow/View3D/SceneActions.cs b/PartPreviewWindow/View3D/SceneActions.cs index 6debe8c94..1334078a5 100644 --- a/PartPreviewWindow/View3D/SceneActions.cs +++ b/PartPreviewWindow/View3D/SceneActions.cs @@ -50,7 +50,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow var selectedItems = new List(); if (selectedItem != null) { - if (selectedItem is SelectionGroup) + if (selectedItem is SelectionGroupObject3D) { selectedItems = selectedItem.Children.ToList(); } @@ -183,7 +183,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { if (sourceItem != null) { - if (sourceItem is SelectionGroup) + if (sourceItem is SelectionGroupObject3D) { // the selection is a group of objects that need to be copied var copyList = sourceItem.Children.ToList(); diff --git a/PartPreviewWindow/View3D/UndoCommands/ChangeColor.cs b/PartPreviewWindow/View3D/UndoCommands/ChangeColor.cs index 0012227d9..0d58e5396 100644 --- a/PartPreviewWindow/View3D/UndoCommands/ChangeColor.cs +++ b/PartPreviewWindow/View3D/UndoCommands/ChangeColor.cs @@ -45,7 +45,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow public ChangeColor(IObject3D selectedItem, Color color) { this.color = color; - if (selectedItem is SelectionGroup) + if (selectedItem is SelectionGroupObject3D) { SetData(selectedItem.Children.ToList()); } diff --git a/PartPreviewWindow/View3D/UndoCommands/DeleteCommand.cs b/PartPreviewWindow/View3D/UndoCommands/DeleteCommand.cs index 3ad984b13..c42cdd0a0 100644 --- a/PartPreviewWindow/View3D/UndoCommands/DeleteCommand.cs +++ b/PartPreviewWindow/View3D/UndoCommands/DeleteCommand.cs @@ -44,7 +44,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { this.scene = scene; - if (deletingItem is SelectionGroup) + if (deletingItem is SelectionGroupObject3D) { var childrenToAdd = deletingItem.Children; // push whatever happened to the selection into the objects before saving them diff --git a/PartPreviewWindow/View3D/UndoCommands/MakeSupport.cs b/PartPreviewWindow/View3D/UndoCommands/MakeSupport.cs index abe8c6103..a8011c1ac 100644 --- a/PartPreviewWindow/View3D/UndoCommands/MakeSupport.cs +++ b/PartPreviewWindow/View3D/UndoCommands/MakeSupport.cs @@ -41,7 +41,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow public MakeSupport(IObject3D selectedItem) { - if (selectedItem is SelectionGroup) + if (selectedItem is SelectionGroupObject3D) { SetData(selectedItem.Children.ToList()); } diff --git a/PartPreviewWindow/View3D/UndoCommands/TransformCommand.cs b/PartPreviewWindow/View3D/UndoCommands/TransformCommand.cs index dff6e25ce..aa3666d79 100644 --- a/PartPreviewWindow/View3D/UndoCommands/TransformCommand.cs +++ b/PartPreviewWindow/View3D/UndoCommands/TransformCommand.cs @@ -53,7 +53,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow public TransformCommand(IObject3D transformedObject, Matrix4X4 undoTransform, Matrix4X4 redoTransform) { - if (transformedObject is SelectionGroup) + if (transformedObject is SelectionGroupObject3D) { // move the group transform into the items foreach (var child in transformedObject.Children) diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index 025ed2801..e718783c6 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -383,7 +383,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow public bool DragOperationActive { get; private set; } - public InsertionGroup DragDropObject { get; private set; } + public InsertionGroupObject3D DragDropObject { get; private set; } public ILibraryAssetStream SceneReplacement { get; private set; } @@ -458,7 +458,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow // Set the hitplane to the bed plane CurrentSelectInfo.HitPlane = bedPlane; - var insertionGroup = new InsertionGroup( + var insertionGroup = new InsertionGroupObject3D( items, this, Scene, @@ -1118,7 +1118,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow if (hitObject != null) { if (Scene.SelectedItem == hitObject - && !(Scene.SelectedItem is SelectionGroup)) + && !(Scene.SelectedItem is SelectionGroupObject3D)) { Scene.SelectedItem = null; } diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index f7fd7d618..5f061f7ce 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit f7fd7d6188ea93d03dd9c42045a9da8e073a4bc9 +Subproject commit 5f061f7ce5892cfbb0982c09fc777ec8e3dbd1fe diff --git a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs index 8bd6b921b..106ed39be 100644 --- a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs +++ b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs @@ -563,10 +563,10 @@ namespace MatterHackers.MatterControl.Tests.Automation // wait for the object to be added testRunner.WaitFor(() => scene.Children.Count == preAddCount + 1); // wait for the object to be done loading - var insertionGroup = scene.Children.LastOrDefault() as InsertionGroup; + var insertionGroup = scene.Children.LastOrDefault() as InsertionGroupObject3D; if (insertionGroup != null) { - testRunner.WaitFor(() => scene.Children.LastOrDefault() as InsertionGroup != null, 10); + testRunner.WaitFor(() => scene.Children.LastOrDefault() as InsertionGroupObject3D != null, 10); } } diff --git a/TextCreator/Braille/BrailleCardObject3D.cs b/TextCreator/Braille/BrailleCardObject3D.cs index c93ceefe2..51a0abf1a 100644 --- a/TextCreator/Braille/BrailleCardObject3D.cs +++ b/TextCreator/Braille/BrailleCardObject3D.cs @@ -82,9 +82,9 @@ namespace MatterHackers.MatterControl.DesignTools Height = BaseHeight }; textObject.Invalidate(new InvalidateArgs(textObject, InvalidateType.Properties, null)); - IObject3D letterObject = new Rotate(textObject, -MathHelper.Tau / 4); - letterObject = new Align3D(letterObject, FaceAlign.Bottom | FaceAlign.Front, brailleLetter, FaceAlign.Top | FaceAlign.Front, 0, 0, 3.5); - letterObject = new SetCenter(letterObject, brailleLetter.GetCenter(), true, false, false); + IObject3D letterObject = new RotateObject3D(textObject, -MathHelper.Tau / 4); + letterObject = new AlignObject3D(letterObject, FaceAlign.Bottom | FaceAlign.Front, brailleLetter, FaceAlign.Top | FaceAlign.Front, 0, 0, 3.5); + letterObject = new SetCenterObject3D(letterObject, brailleLetter.GetCenter(), true, false, false); this.Children.Add(letterObject); var basePath = new RoundedRect(0, 0, 22, 34, 3) @@ -98,13 +98,13 @@ namespace MatterHackers.MatterControl.DesignTools Matrix = Matrix4X4.CreateRotationX(MathHelper.Tau / 4) }; - basePlate = new Align3D(basePlate, FaceAlign.Bottom | FaceAlign.Back, brailleLetter, FaceAlign.Bottom | FaceAlign.Back); - basePlate = new SetCenter(basePlate, brailleLetter.GetCenter(), true, false, false); + basePlate = new AlignObject3D(basePlate, FaceAlign.Bottom | FaceAlign.Back, brailleLetter, FaceAlign.Bottom | FaceAlign.Back); + basePlate = new SetCenterObject3D(basePlate, brailleLetter.GetCenter(), true, false, false); this.Children.Add(basePlate); IObject3D underline = new CubeObject3D(basePlate.XSize(), .2, 1); - underline = new Align3D(underline, FaceAlign.Bottom, brailleLetter, FaceAlign.Top); - underline = new Align3D(underline, FaceAlign.Back | FaceAlign.Left, basePlate, FaceAlign.Front | FaceAlign.Left, 0, .01); + underline = new AlignObject3D(underline, FaceAlign.Bottom, brailleLetter, FaceAlign.Top); + underline = new AlignObject3D(underline, FaceAlign.Back | FaceAlign.Left, basePlate, FaceAlign.Front | FaceAlign.Left, 0, .01); this.Children.Add(underline); if (aabb.ZSize > 0) diff --git a/TextCreator/Braille/BrailleObject3D.cs b/TextCreator/Braille/BrailleObject3D.cs index 89b816436..8c3e24882 100644 --- a/TextCreator/Braille/BrailleObject3D.cs +++ b/TextCreator/Braille/BrailleObject3D.cs @@ -195,8 +195,8 @@ namespace MatterHackers.MatterControl.DesignTools Mesh = VertexSourceToMesh.Extrude(basePath, BaseHeight) }; - basePlate = new Align3D(basePlate, FaceAlign.Top, textObject, FaceAlign.Bottom, 0, 0, .01); - basePlate = new Align3D(basePlate, FaceAlign.Left | FaceAlign.Front, + basePlate = new AlignObject3D(basePlate, FaceAlign.Top, textObject, FaceAlign.Bottom, 0, 0, .01); + basePlate = new AlignObject3D(basePlate, FaceAlign.Left | FaceAlign.Front, size.Left - padding/2, size.Bottom - padding/2); this.Children.Add(basePlate); @@ -235,7 +235,7 @@ namespace MatterHackers.MatterControl.DesignTools Matrix = Matrix4X4.CreateRotationX(MathHelper.Tau / 4) }; - chainHook = new Align3D(chainHook, FaceAlign.Left | FaceAlign.Bottom | FaceAlign.Back, basePlate, FaceAlign.Right | FaceAlign.Bottom | FaceAlign.Back, -.01); + chainHook = new AlignObject3D(chainHook, FaceAlign.Left | FaceAlign.Bottom | FaceAlign.Back, basePlate, FaceAlign.Right | FaceAlign.Bottom | FaceAlign.Back, -.01); this.Children.Add(chainHook); }