blob: fad67688057781e00d8a6e56eeb12ca18eb12f6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/*
* GNU AFFERO GENERAL PUBLIC LICENSE
* Version 3, 19 November 2007
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
using System;
using Emgu.CV.CvEnum;
namespace UVtools.Core.Operations
{
public class OperationFlip : Operation
{
public override string Title => "Flip";
public override string Description =>
"Flip the layers of the model vertically and/or horizontally.";
public override string ConfirmationText =>
FlipDirection == Enumerations.FlipDirection.Both
? $"flip {(MakeCopy == true? "and blend ":"")}layers {LayerIndexStart} through {LayerIndexEnd} Horizontally and Vertically?"
: $"flip {(MakeCopy == true ? "and blend " : "")}layers {LayerIndexStart} through {LayerIndexEnd} {FlipDirection}?";
public override string ProgressTitle =>
FlipDirection == Enumerations.FlipDirection.Both
? $"Flipping {(MakeCopy == true ? "and blending " : "")}layers {LayerIndexStart} through {LayerIndexEnd} Horizontally and Vertically"
: $"Flipping {(MakeCopy == true ? "and blending " : "")}layers {LayerIndexStart} through {LayerIndexEnd} {FlipDirection}";
public override string ProgressAction => "Flipped layers";
public Enumerations.FlipDirection FlipDirection { get; set; } = Enumerations.FlipDirection.Horizontally;
public bool MakeCopy { get; set; }
public FlipType FlipTypeOpenCV
{
get
{
var flipType = FlipType.Horizontal;
switch (FlipDirection)
{
case Enumerations.FlipDirection.Horizontally:
flipType = FlipType.Horizontal;
break;
case Enumerations.FlipDirection.Vertically:
flipType = FlipType.Vertical;
break;
case Enumerations.FlipDirection.Both:
flipType = FlipType.Horizontal | FlipType.Vertical;
break;
}
return flipType;
}
}
public static Array FlipDirections => Enum.GetValues(typeof(Enumerations.FlipDirection));
}
}
|