private void toolStripButton4_Click(object sender, EventArgs e)
        {
            if (CurrentHotFrame == null)
            {
                MessageBox.Show("Frame was not selected! Use frame selection dialog to specify hotframe!", "Frame not selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            List <VelodynePoint> points = viewer.GetSelectedPoints();

            if (points.Count() == 0)
            {
                MessageBox.Show("No point is selected! Feature won't be created!", "No point", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            VeloFeature feature = new VeloFeature(this.DataStream as VelodyneDataStream);

            feature.Points.AddRange(points);

            PropertiesWnd wnd = new PropertiesWnd(feature, false);
            DialogResult  dlg = wnd.ShowDialog();

            if (dlg == DialogResult.OK)
            {
                CurrentHotFrame.Features.Add(feature);
            }

            SetHotFrame(CurrentHotFrame);
        }
예제 #2
0
        private void frameBox_MouseClick(object sender, MouseEventArgs e)
        {
            if (this.windowState == StreamWindowState.DigitizePoints)
            {
                if (e.Button == MouseButtons.Left) // add point
                {
                    if (CurrentHotFrame == null)
                    {
                        return;
                    }

                    ImageFeature  imageFeature = (ImageFeature)CurrentHotFrame.GetImageFeatureByDataStream(dataStream);
                    Point         pt           = frameBox.PointToImage(e.X, e.Y);
                    ImagePoint    imagePoint   = new ImagePoint(++lastId, pt.X, pt.Y);
                    PropertiesWnd wnd          = new PropertiesWnd(imagePoint);
                    if (wnd.ShowDialog() == DialogResult.OK)
                    {
                        ImagePoint pti = wnd.Object as ImagePoint;
                        lastId = pti.ID;
                        imageFeature.Points.Add(pti);
                    }
                    frameBox.Refresh();
                }

                if (e.Button == MouseButtons.Right) // remove point
                {
                    ImageFeature imageFeature = (ImageFeature)CurrentHotFrame.GetImageFeatureByDataStream(dataStream);
                    Point        pt           = frameBox.PointToImage(e.X, e.Y);

                    /*double minVal = imageFeature.Points.Min(x => Math.Pow(x.X - pt.X, 2) + Math.Pow(x.Y - pt.Y, 2));
                     * int minIndex = Array.IndexOf(imageFeature.Points, minVal);*/

                    ImagePoint minPt = null;
                    double     minR  = Double.MaxValue;
                    foreach (ImagePoint pti in imageFeature.Points)
                    {
                        double r = Math.Pow(pti.X - pt.X, 2) + Math.Pow(pti.Y - pt.Y, 2);
                        if (r < minR)
                        {
                            minPt = pti;
                            minR  = r;
                        }
                    }

                    if (minPt != null)
                    {
                        PropertiesWnd wnd = new PropertiesWnd(minPt);
                        if ((wnd.ShowDialog() == DialogResult.OK) && (wnd.IsDeleteObject))
                        {
                            imageFeature.Points.Remove(minPt);
                        }
                    }
                    frameBox.Refresh();
                }
            }
        }
예제 #3
0
 private void showDataLinePropertyToolStripMenuItem_Click_1(object sender, EventArgs e)
 {
     if (currentDataLine != null)
     {
         PropertiesWnd wnd = new PropertiesWnd(currentDataLine, false);
         if (wnd.ShowDialog() == DialogResult.OK)
         {
             Refresh();
         }
     }
 }
예제 #4
0
 private void showHotFramePropertyToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (CurrentHotFrame != null)
     {
         PropertiesWnd wnd = new PropertiesWnd(CurrentHotFrame, false);
         if (wnd.ShowDialog() == DialogResult.OK)
         {
             Refresh();
         }
     }
 }
예제 #5
0
 private void showDataStreamPropertyToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (dataStream != null)
     {
         PropertiesWnd wnd = new PropertiesWnd(dataStream, false);
         if (wnd.ShowDialog() == DialogResult.OK)
         {
             Refresh();
         }
     }
 }
예제 #6
0
 private void fromCurrentTimeToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (currentDataLine != null)
     {
         SyncToManuallyParams param = new SyncToManuallyParams();
         PropertiesWnd        wnd   = new PropertiesWnd(param, false);
         wnd.Text = "Parameters for manual sync";
         if (wnd.ShowDialog() == DialogResult.OK)
         {
             double delay = param.Delay;
             dataStream.ApplyDelay(delay, TimeType.ESTIMATED);
         }
     }
 }
예제 #7
0
 private void toolStripButton4_Click(object sender, EventArgs e)
 {
     if (lstFrames.SelectedItems.Count > 0)
     {
         HotFrame hotFrame = lstFrames.SelectedItems[0].Tag as HotFrame;
         if (hotFrame != null)
         {
             PropertiesWnd wnd = new PropertiesWnd(hotFrame, false);
             if (wnd.ShowDialog() == DialogResult.OK)
             {
                 Refresh();
             }
         }
     }
 }
 private void Viewer_AnnotationClicked(object sender, EventArgs e)
 {
     if (sender is VelodyneAnnotation)
     {
         VelodyneAnnotation annot = sender as VelodyneAnnotation;
         if (annot.Object is VeloFeature)
         {
             VeloFeature   feature = annot.Object as VeloFeature;
             PropertiesWnd wnd     = new PropertiesWnd(feature);
             DialogResult  dlg     = wnd.ShowDialog();
             if ((dlg == DialogResult.OK) && (!wnd.IsDeleteObject))
             {
                 SetHotFrame(CurrentHotFrame);
             }
             else if ((dlg == DialogResult.OK) && (wnd.IsDeleteObject))
             {
                 CurrentHotFrame.Features.Remove(feature);
                 SetHotFrame(CurrentHotFrame);
             }
         }
     }
 }