Exemplo n.º 1
0
        public void UpdateManualClassification(List <CrossSectionRecord> rlist, TransformPanel Tp)
        {
            int i = rlist.Count();

            foreach (CrossSectionRecord item in rlist)
            {
                SqlCommand SqlCmd = new SqlCommand(" UPDATE [AVIMachineLearning].[dbo].[SurfaceData] SET [ManualSurfaceClassification] = 1 WHERE ID =" + item.ID.ToString());
                SqlCmd.Connection = _connection;
                SqlCmd.ExecuteNonQuery();

                Tp.Dispatcher.Invoke(() =>
                {
                    Tp.NumOfSavedRecords = (--i).ToString();
                });
            }
        }
Exemplo n.º 2
0
        private void ZoomBorder_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
        {
            Point curLoc = e.GetPosition(child);



            MarkedAreaRectangle.Location = MouseRightPressed;
            MarkedAreaRectangle.Size     = (Size)Point.Subtract(curLoc, MouseRightPressed);

            rect                 = new System.Windows.Shapes.Rectangle();
            rect.Stroke          = new SolidColorBrush(Colors.Red);
            rect.StrokeThickness = 5;

            rect.Width  = MarkedAreaRectangle.Width;
            rect.Height = MarkedAreaRectangle.Height;
            rect.Margin = new Thickness(MouseRightPressed.X, MouseRightPressed.Y, 0, 0);

            TransformPanel c = child as TransformPanel;

            c.Children.Add(rect);

            MouseRightReleased = e.GetPosition(child);

            int i = 0;

            while (c.Children.Count > 2 && i < c.Children.Count)
            {
                System.Windows.Shapes.Rectangle r = c.Children[i] as System.Windows.Shapes.Rectangle;

                if (r != null)
                {
                    if (r.StrokeThickness == 2)
                    {
                        c.Children.RemoveAt(i);
                    }
                    else
                    {
                        i++;
                    }
                }

                else
                {
                    i++;
                }
            }
        }
Exemplo n.º 3
0
        private async Task SaveClassThreadProc()
        {
            btnClearClassification.IsEnabled = false;
            btnLoadImage.IsEnabled           = false;
            List <Rectangle> RectList = new List <Rectangle>();
            TransformPanel   c        = border.child as TransformPanel;

            foreach (UIElement item in c.Children)
            {
                Rectangle t = item as Rectangle;

                if (t != null)
                {
                    Rectangle r = new Rectangle();
                    r.Margin = t.Margin;
                    r.Width  = t.Width;
                    r.Height = t.Height;
                    RectList.Add(r);
                }
            }

            await Task.Run(() =>
            {
                _mlDispatcher.UpdateManualClassification(GetClassifications(rList, RectList), Tpanel);
            });



            string msg = "Records Have Been Updated.";

            if (Application.Current.Dispatcher.CheckAccess())
            {
                MessageBox.Show(Application.Current.MainWindow, msg);
            }
            else
            {
                Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => {
                    MessageBox.Show(Application.Current.MainWindow, msg);
                }));
            }

            btnClearClassification.IsEnabled = true;
            btnLoadImage.IsEnabled           = true;
        }
Exemplo n.º 4
0
        public void ClearClassifications()
        {
            int            i = 0;
            TransformPanel c = child as TransformPanel;

            while (c.Children.Count > 1 && i < c.Children.Count)
            {
                System.Windows.Shapes.Rectangle r = c.Children[i] as System.Windows.Shapes.Rectangle;

                if (r != null)
                {
                    c.Children.RemoveAt(i);
                }
                else
                {
                    i++;
                }
            }
        }
Exemplo n.º 5
0
        private void child_MouseMove(object sender, MouseEventArgs e)
        {
            if (child != null)
            {
                if (child.IsMouseCaptured)
                {
                    var    tt = GetTranslateTransform(child);
                    Vector v  = Start - e.GetPosition(this);
                    tt.X = Origin.X - v.X;
                    tt.Y = Origin.Y - v.Y;
                }

                if (e.RightButton == MouseButtonState.Pressed && MouseRightPressed.X != 0 && MouseRightPressed.Y != 0)
                {
                    Point curLoc = e.GetPosition(child);
                    MarkedAreaRectangle.Location = MouseRightPressed;
                    MarkedAreaRectangle.Size     = (Size)Point.Subtract(curLoc, MouseRightPressed);

                    rect                 = new System.Windows.Shapes.Rectangle();
                    rect.Stroke          = new SolidColorBrush(Colors.Red);
                    rect.StrokeThickness = 2;

                    rect.Width  = MarkedAreaRectangle.Width;
                    rect.Height = MarkedAreaRectangle.Height;
                    rect.Margin = new Thickness(MouseRightPressed.X, MouseRightPressed.Y, 0, 0);

                    TransformPanel c = child as TransformPanel;
                    System.Windows.Shapes.Rectangle tt = c.Children[c.Children.Count - 1] as System.Windows.Shapes.Rectangle;

                    if (tt != null)
                    {
                        if (tt.StrokeThickness == 2)
                        {
                            tt.Visibility = Visibility.Hidden;
                        }
                    }
                    c.Children.Add(rect);
                }
            }
        }