Refactoring SuspendRebuild to be RubuildLock
Marching squares has more data on how it expects to be processed (edge color)
This commit is contained in:
parent
ec28305b56
commit
3e49946e5a
44 changed files with 531 additions and 195 deletions
|
|
@ -58,7 +58,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
public override bool CanRemove => true;
|
||||
public override bool CanApply => true;
|
||||
|
||||
public BaseTypes CurrentBaseType { get; set; }
|
||||
public BaseTypes BaseType { get; set; } = BaseTypes.Circle;
|
||||
public double BaseSize { get; set; } = 3;
|
||||
public double InfillAmount { get; set; } = 3;
|
||||
public double ExtrusionHeight { get; set; } = 5;
|
||||
|
|
@ -126,7 +126,12 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|| invalidateType.InvalidateType == InvalidateType.Path
|
||||
|| invalidateType.InvalidateType == InvalidateType.Mesh)
|
||||
&& invalidateType.Source != this
|
||||
&& !RebuildSuspended)
|
||||
&& !RebuildLocked)
|
||||
{
|
||||
Rebuild(null);
|
||||
}
|
||||
else if (invalidateType.InvalidateType == InvalidateType.Properties
|
||||
&& invalidateType.Source == this)
|
||||
{
|
||||
Rebuild(null);
|
||||
}
|
||||
|
|
@ -136,7 +141,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
}
|
||||
}
|
||||
|
||||
public override void Rebuild(UndoBuffer undoBuffer)
|
||||
private void Rebuild(UndoBuffer undoBuffer)
|
||||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
|
||||
|
|
@ -262,7 +267,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
Polygons polysToOffset = new Polygons();
|
||||
|
||||
switch (CurrentBaseType)
|
||||
switch (BaseType)
|
||||
{
|
||||
case BaseTypes.Rectangle:
|
||||
polysToOffset.Add(GetBoundingPolygon(polygonShape));
|
||||
|
|
@ -285,7 +290,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
Polygons basePolygons;
|
||||
|
||||
if (CurrentBaseType == BaseTypes.Outline
|
||||
if (BaseType == BaseTypes.Outline
|
||||
&& InfillAmount > 0)
|
||||
{
|
||||
basePolygons = Offset(polysToOffset, (BaseSize + InfillAmount) * scalingForClipper);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
public double Height { get; set; } = 20;
|
||||
public int Sides { get; set; } = 40;
|
||||
|
||||
public override void Rebuild(UndoBuffer undoBuffer)
|
||||
public override void OnInvalidate(InvalidateArgs invalidateType)
|
||||
{
|
||||
if (invalidateType.InvalidateType == InvalidateType.Properties
|
||||
&& invalidateType.Source == this)
|
||||
{
|
||||
Rebuild(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void Rebuild(UndoBuffer undoBuffer)
|
||||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
using (RebuildLock())
|
||||
|
|
|
|||
|
|
@ -76,7 +76,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
return item;
|
||||
}
|
||||
|
||||
public override void Rebuild(UndoBuffer undoBuffer)
|
||||
public override void OnInvalidate(InvalidateArgs invalidateType)
|
||||
{
|
||||
if (invalidateType.InvalidateType == InvalidateType.Properties
|
||||
&& invalidateType.Source == this)
|
||||
{
|
||||
Rebuild(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void Rebuild(UndoBuffer undoBuffer)
|
||||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
using (RebuildLock())
|
||||
|
|
|
|||
|
|
@ -117,7 +117,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
public double EndingAngle { get; set; } = 360;
|
||||
public double DiameterTop { get; set; } = 20;
|
||||
|
||||
public override void Rebuild(UndoBuffer undoBuffer)
|
||||
public override void OnInvalidate(InvalidateArgs invalidateType)
|
||||
{
|
||||
if (invalidateType.InvalidateType == InvalidateType.Properties
|
||||
&& invalidateType.Source == this)
|
||||
{
|
||||
Rebuild(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void Rebuild(UndoBuffer undoBuffer)
|
||||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
using (RebuildLock())
|
||||
|
|
|
|||
|
|
@ -58,7 +58,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
public double Depth { get; set; } = 20;
|
||||
public int Sides { get; set; } = 20;
|
||||
|
||||
public override void Rebuild(UndoBuffer undoBuffer)
|
||||
public override void OnInvalidate(InvalidateArgs invalidateType)
|
||||
{
|
||||
if (invalidateType.InvalidateType == InvalidateType.Properties
|
||||
&& invalidateType.Source == this)
|
||||
{
|
||||
Rebuild(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void Rebuild(UndoBuffer undoBuffer)
|
||||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
using (RebuildLock())
|
||||
|
|
|
|||
|
|
@ -66,7 +66,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
public int LongitudeSides { get; set; } = 40;
|
||||
public int LatitudeSides { get; set; } = 10;
|
||||
|
||||
public override void Rebuild(UndoBuffer undoBuffer)
|
||||
public override void OnInvalidate(InvalidateArgs invalidateType)
|
||||
{
|
||||
if (invalidateType.InvalidateType == InvalidateType.Properties
|
||||
&& invalidateType.Source == this)
|
||||
{
|
||||
Rebuild(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void Rebuild(UndoBuffer undoBuffer)
|
||||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
using (RebuildLock())
|
||||
|
|
|
|||
|
|
@ -58,7 +58,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
public double Depth { get; set; } = 20;
|
||||
public double Height { get; set; } = 10;
|
||||
|
||||
public override void Rebuild(UndoBuffer undoBuffer)
|
||||
public override void OnInvalidate(InvalidateArgs invalidateType)
|
||||
{
|
||||
if (invalidateType.InvalidateType == InvalidateType.Properties
|
||||
&& invalidateType.Source == this)
|
||||
{
|
||||
Rebuild(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void Rebuild(UndoBuffer undoBuffer)
|
||||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
using (RebuildLock())
|
||||
|
|
|
|||
|
|
@ -192,11 +192,5 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void Rebuild(UndoBuffer undoBuffer)
|
||||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
//MeshHelper.PlaceTextureOnFace(Mesh.Faces[0], ImageAsset.Image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -58,7 +58,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
public double Depth { get; set; } = 20;
|
||||
public double Height { get; set; } = 20;
|
||||
|
||||
public override void Rebuild(UndoBuffer undoBuffer)
|
||||
public override void OnInvalidate(InvalidateArgs invalidateType)
|
||||
{
|
||||
if (invalidateType.InvalidateType == InvalidateType.Properties
|
||||
&& invalidateType.Source == this)
|
||||
{
|
||||
Rebuild(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void Rebuild(UndoBuffer undoBuffer)
|
||||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
using (RebuildLock())
|
||||
|
|
|
|||
|
|
@ -76,7 +76,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
public double StartingAngle { get; set; } = 0;
|
||||
public double EndingAngle { get; set; } = 360;
|
||||
|
||||
public override void Rebuild(UndoBuffer undoBuffer)
|
||||
public override void OnInvalidate(InvalidateArgs invalidateType)
|
||||
{
|
||||
if (invalidateType.InvalidateType == InvalidateType.Properties
|
||||
&& invalidateType.Source == this)
|
||||
{
|
||||
Rebuild(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void Rebuild(UndoBuffer undoBuffer)
|
||||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
using (RebuildLock())
|
||||
|
|
|
|||
|
|
@ -71,7 +71,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
public double EndingAngle { get; set; } = 360;
|
||||
public int LatitudeSides { get; set; } = 30;
|
||||
|
||||
public override void Rebuild(UndoBuffer undoBuffer)
|
||||
public override void OnInvalidate(InvalidateArgs invalidateType)
|
||||
{
|
||||
if (invalidateType.InvalidateType == InvalidateType.Properties
|
||||
&& invalidateType.Source == this)
|
||||
{
|
||||
Rebuild(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void Rebuild(UndoBuffer undoBuffer)
|
||||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
using (RebuildLock())
|
||||
|
|
|
|||
|
|
@ -86,7 +86,28 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
undoBuffer.AddAndDo(new ReplaceCommand(new List<IObject3D> { this }, new List<IObject3D> { newContainer }));
|
||||
}
|
||||
|
||||
public override void Rebuild(UndoBuffer undoBuffer)
|
||||
public override void OnInvalidate(InvalidateArgs invalidateType)
|
||||
{
|
||||
if ((invalidateType.InvalidateType == InvalidateType.Content
|
||||
|| invalidateType.InvalidateType == InvalidateType.Matrix
|
||||
|| invalidateType.InvalidateType == InvalidateType.Mesh)
|
||||
&& invalidateType.Source != this
|
||||
&& !RebuildLocked)
|
||||
{
|
||||
Rebuild(null);
|
||||
}
|
||||
else if (invalidateType.InvalidateType == InvalidateType.Properties
|
||||
&& invalidateType.Source == this)
|
||||
{
|
||||
Rebuild(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnInvalidate(invalidateType);
|
||||
}
|
||||
}
|
||||
|
||||
private void Rebuild(UndoBuffer undoBuffer)
|
||||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
using (RebuildLock())
|
||||
|
|
|
|||
|
|
@ -61,7 +61,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
public int RingSides { get; set; } = 15;
|
||||
public int RingPhaseAngle { get; set; } = 0;
|
||||
|
||||
public override void Rebuild(UndoBuffer undoBuffer)
|
||||
public override void OnInvalidate(InvalidateArgs invalidateType)
|
||||
{
|
||||
if (invalidateType.InvalidateType == InvalidateType.Properties
|
||||
&& invalidateType.Source == this)
|
||||
{
|
||||
Rebuild(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void Rebuild(UndoBuffer undoBuffer)
|
||||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
using (RebuildLock())
|
||||
|
|
|
|||
|
|
@ -59,7 +59,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
public double Depth { get; set; } = 20;
|
||||
public double Height { get; set; } = 20;
|
||||
|
||||
public override void Rebuild(UndoBuffer undoBuffer)
|
||||
public override void OnInvalidate(InvalidateArgs invalidateType)
|
||||
{
|
||||
if (invalidateType.InvalidateType == InvalidateType.Properties
|
||||
&& invalidateType.Source == this)
|
||||
{
|
||||
Rebuild(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void Rebuild(UndoBuffer undoBuffer)
|
||||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
using (RebuildLock())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue