Commit dc7c63ee by 鲁志-悦动

画唯一的裁切框

parent 2413be01
...@@ -2,5 +2,6 @@ ...@@ -2,5 +2,6 @@
{ {
public class SelectedModel public class SelectedModel
{ {
public bool IsSelected { get; set; }
} }
} }
...@@ -1153,7 +1153,7 @@ namespace VIZ.FGOUT.Module ...@@ -1153,7 +1153,7 @@ namespace VIZ.FGOUT.Module
if (e.OriginalSource is System.Windows.Controls.TextBox tb) if (e.OriginalSource is System.Windows.Controls.TextBox tb)
{ {
var text = tb.Text; var text = tb.Text;
if (int.TryParse(text, out var value) && value > 0) if (int.TryParse(text, out var value) && value >= 0)
{ {
AlgorithmSendCommon(); AlgorithmSendCommon();
} }
...@@ -1620,8 +1620,13 @@ namespace VIZ.FGOUT.Module ...@@ -1620,8 +1620,13 @@ namespace VIZ.FGOUT.Module
{ {
if (SelectedIsChecked) if (SelectedIsChecked)
{ {
ApplicationDomain.MessageManager.Send(_selectedModel); _selectedModel.IsSelected = true;
} }
else
{
_selectedModel.IsSelected = false;
}
ApplicationDomain.MessageManager.Send(_selectedModel);
} }
#endregion #endregion
......
...@@ -25,7 +25,8 @@ namespace VIZ.FGOUT.Module ...@@ -25,7 +25,8 @@ namespace VIZ.FGOUT.Module
private static ILog log = LogManager.GetLogger(typeof(NDIView)); private static ILog log = LogManager.GetLogger(typeof(NDIView));
public NDIViewModel vm = new NDIViewModel(); public NDIViewModel vm = new NDIViewModel();
// Rectangle rectStart = new Rectangle();
// Rectangle rectEnd = new Rectangle();
public PathGeometry aa = new PathGeometry(); public PathGeometry aa = new PathGeometry();
...@@ -48,6 +49,9 @@ namespace VIZ.FGOUT.Module ...@@ -48,6 +49,9 @@ namespace VIZ.FGOUT.Module
//裁切 //裁切
public Rect rectSelected; public Rect rectSelected;
public List<Rect> rectsSelected = new List<Rect>(); public List<Rect> rectsSelected = new List<Rect>();
//Rectangle rectSelected = new Rectangle();
//public Path myPath = new Path();
public NDIView() public NDIView()
{ {
...@@ -93,6 +97,11 @@ namespace VIZ.FGOUT.Module ...@@ -93,6 +97,11 @@ namespace VIZ.FGOUT.Module
#endregion #endregion
//myPath.Fill = Brushes.Transparent;
//myPath.Stroke = Brushes.Yellow;
//myPath.StrokeThickness = 1;
//this.canvas1.Children.Add(myPath);
} }
bool isMouseDown = false; bool isMouseDown = false;
...@@ -338,8 +347,18 @@ namespace VIZ.FGOUT.Module ...@@ -338,8 +347,18 @@ namespace VIZ.FGOUT.Module
//裁切 //裁切
if (vm.IsSelected) if (vm.IsSelected)
{ {
aa = new PathGeometry(); Path tempPath = new Path();
foreach (UIElement uec in canvas1.Children)
{
var path = uec as Path;
if (path?.Stroke == Brushes.Yellow)
{
tempPath = path;
}
}
canvas1.Children.Remove(tempPath);
aa = new PathGeometry();
aa.AddGeometry(new RectangleGeometry(rectSelected)); aa.AddGeometry(new RectangleGeometry(rectSelected));
var myPath = new Path() var myPath = new Path()
{ {
...@@ -348,12 +367,13 @@ namespace VIZ.FGOUT.Module ...@@ -348,12 +367,13 @@ namespace VIZ.FGOUT.Module
StrokeThickness = 1, StrokeThickness = 1,
Data = aa Data = aa
}; };
this.canvas1.Children.Add(myPath);
//aa = new PathGeometry();
//aa.AddGeometry(new RectangleGeometry(rectSelected));
if (!this.canvas1.Children.Contains(myPath))
{
this.canvas1.Children.Add(myPath);
}
} }
//myPath.Data = aa;
if (vm.IsReplay) if (vm.IsReplay)
{ {
......
...@@ -220,8 +220,9 @@ namespace VIZ.FGOUT.Module ...@@ -220,8 +220,9 @@ namespace VIZ.FGOUT.Module
public bool IsSelected; public bool IsSelected;
private void Selected(SelectedModel selectedModel) private void Selected(SelectedModel selectedModel)
{ {
if (this.ViewKey == NDIViewKeys.CAM_2 || this.ViewKey == NDIViewKeys.CAM_4) return; //if (this.ViewKey == NDIViewKeys.CAM_2 || this.ViewKey == NDIViewKeys.CAM_4) return;
IsSelected = true; if (this.ViewKey != NDIViewKeys.CAM_1) return;
IsSelected = selectedModel.IsSelected;
} }
private void ReplayOutPort(ReplayOutPointModel replayOutPointModel) private void ReplayOutPort(ReplayOutPointModel replayOutPointModel)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment