public VelodyneAnnotation GetAnnotiation() { double sx = 0; double sy = 0; double sz = 0; foreach (VelodynePoint pt in Points) { sx += pt.X; sy += pt.Y; sz += pt.Z; } int n = Points.Count(); VelodyneAnnotation annot = new VelodyneAnnotation(sx / n, sy / n, sz / n); annot.ID = ID; annot.Object = this; return(annot); }
public void NextFrame() { List <VelodynePoint> pts = veloReader.ReadNextFrame(); viewer.ClearAndAddNewPoints(pts, SimpleVelodyneViewerRenderingMode.Manual); // handle hot frame if (CurrentHotFrame != null) { foreach (Feature feature in CurrentHotFrame.Features) { if ((feature.DataStream == this.DataStream) && (feature is VeloFeature)) { VeloFeature veloFeature = feature as VeloFeature; VelodyneAnnotation annot = veloFeature.GetAnnotiation(); viewer.AddAnnotaion(annot, SimpleVelodyneViewerRenderingMode.Manual); viewer.AddNewPoints(veloFeature.Points, SimpleVelodyneViewerColorMap.Selection); } } } }
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); } } } }