private void getCellularIsovist_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var point = this._host.InverseRenderTransform.Transform(Mouse.GetPosition(this._host.FloorScene)); UV p = new UV(point.X, point.Y); Cell cell = this._host.cellularFloor.FindCell(p); if (cell == null) { MessageBox.Show("Pick a point on the walkable field and try again!\n"); return; } switch (this._host.IsovistBarrierType) { case BarrierType.Visual: if (cell.VisualOverlapState != OverlapState.Outside) { MessageBox.Show("Pick a point outside visual barriers.\nTry again!"); return; } break; case BarrierType.Physical: if (cell.PhysicalOverlapState != OverlapState.Outside) { MessageBox.Show("Pick a point outside physical barriers.\nTry again!"); return; } break; case BarrierType.Field: if (cell.FieldOverlapState != OverlapState.Inside) { MessageBox.Show("Pick a point inside the walkable field.\nTry again!"); return; } break; case BarrierType.BarrierBuffer: if (cell.BarrierBufferOverlapState != OverlapState.Outside) { MessageBox.Show("Pick a point outside barrier buffers.\nTry again!"); return; } break; default: break; } var timer = new System.Diagnostics.Stopwatch(); try { timer.Start(); Isovist isovist = CellularIsovistCalculator.GetIsovist(p, this._host.IsovistDepth, this._host.IsovistBarrierType, this._host.cellularFloor); //Isovist isovist = CellularIsovistCalculator.GetIsovist(p,this._host.isoDepth, BarrierType.BarrierBuffer, this._host.cellularFloor); timer.Stop(); this._host.IsovistInformation = new IsovistInformation(IsovistInformation.IsovistType.Cellular, timer.Elapsed.TotalMilliseconds, isovist.GetArea(this._host.cellularFloor.CellSize), double.NaN); this.draw(isovist); } catch (Exception error1) { this._host.IsovistInformation = null; MessageBox.Show(error1.Report()); } timer = null; }
private void drawInRevit() { this._host.Hide(); UV p = this._host.OSM_to_BIM.PickPoint("Pick a vantage point to draw cellular Isovist"); Cell cell = this._host.cellularFloor.FindCell(p); if (cell == null) { MessageBox.Show("Pick a point on the walkable field and try again!\n"); return; } switch (this._host.IsovistBarrierType) { case BarrierType.Visual: if (cell.VisualOverlapState != OverlapState.Outside) { MessageBox.Show("Pick a point outside visual barriers.\nTry again!"); this._host.ShowDialog(); return; } break; case BarrierType.Physical: if (cell.PhysicalOverlapState != OverlapState.Outside) { MessageBox.Show("Pick a point outside physical barriers.\nTry again!"); this._host.ShowDialog(); return; } break; case BarrierType.Field: if (cell.FieldOverlapState != OverlapState.Inside) { MessageBox.Show("Pick a point inside the walkable field.\nTry again!"); this._host.ShowDialog(); return; } break; case BarrierType.BarrierBuffer: if (cell.BarrierBufferOverlapState != OverlapState.Outside) { MessageBox.Show("Pick a point outside barrier buffers.\nTry again!"); this._host.ShowDialog(); return; } break; default: break; } Isovist isovist = null; var timer = new System.Diagnostics.Stopwatch(); try { timer.Start(); isovist = CellularIsovistCalculator.GetIsovist(p, this._host.IsovistDepth, this._host.IsovistBarrierType, this._host.cellularFloor); timer.Stop(); this._host.IsovistInformation = new IsovistInformation(IsovistInformation.IsovistType.Cellular, timer.Elapsed.TotalMilliseconds, isovist.GetArea(this._host.cellularFloor.CellSize), double.NaN); } catch (Exception error0) { this._host.IsovistInformation = null; MessageBox.Show(error0.Report()); } timer = null; if (isovist != null) { try { var boundaries = isovist.GetBoundary(this._host.cellularFloor); double elevation = this._host.BIM_To_OSM.PlanElevation; foreach (var item in boundaries) { this._host.OSM_to_BIM.VisualizePolygon(item.BoundaryPoints, elevation); } } catch (Exception error1) { MessageBox.Show(error1.Report()); } } this._host.ShowDialog(); }