/// <summary> /// update function for the listview with the plane models found by the algorithm /// </summary> private void UpdateListView() { this.Dispatcher.Invoke(() => { SelectPlanesListView.Items.Clear(); //add new items to the listview if (planeModelList != null) { foreach (PlaneModel pl in planeModelList) { bool origin = false; if (refList.Exists(t => t.Equals(pl))) { origin = true; } bool master = false; if (pl == floorPlane) { master = true; } SelectPlanesListViewItem splv = new SelectPlanesListViewItem() { PlaneModel = pl, inlier = pl.inliers, D = pl.anxPlane.D, N = pl.anxPlane.Normal, selectPlane = origin, selectMaster = master }; SelectPlanesListView.Items.Add(splv); } } }); }
/// <summary> /// sets or unsets a the floor plane /// </summary> private void _CheckboxFloorSelect_Checked(object sender, RoutedEventArgs e) { SelectPlanesListViewItem obj = ((FrameworkElement)sender).DataContext as SelectPlanesListViewItem; floorPlane = planeModelList.Find(pl => pl == obj.PlaneModel); UpdateListView(); }
/// <summary> /// user switches the plane model in the listview /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SelectPlanesListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { SelectPlanesListViewItem selectedItem = ((SelectPlanesListViewItem)e.AddedItems[0]); //transform List <List <Point> > points = new List <List <Point> >(); points.Add(selectedItem.PlaneModel.getPointList()); Post_knv_Server.DataIntegration.PointCloudDrawing.PointCloudPicturePackage pcpp = PointCloudDrawing.addTriangleToPicturePackage(pointCloud.pictures, points); this._PointImagePlane_Bottom.Source = pcpp.bottomview; this._PointImagePlane_Front.Source = pcpp.frontview; this._PointImagePlane_Side.Source = pcpp.sideview; } catch (Exception) { } }