private void mouseLeftButtonDown_GetPolygonalIsovist(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; } this._children.Clear(); var timer = new System.Diagnostics.Stopwatch(); try { timer.Start(); HashSet <UVLine> blocks = this._host.cellularFloor.PolygonalIsovistVisualObstacles(p, this._host.IsovistDepth, this._host.IsovistBarrierType); BarrierPolygon isovistPolygon = this._host.BIM_To_OSM.IsovistPolygon(p, this._host.IsovistDepth, blocks); IsovistPolygon newIsovistPolygon = new IsovistPolygon(isovistPolygon.BoundaryPoints, p); timer.Stop(); this._host.IsovistInformation = new IsovistInformation(IsovistInformation.IsovistType.Polygonal, timer.Elapsed.TotalMilliseconds, isovistPolygon.GetArea(), isovistPolygon.GetPerimeter()); this.draw(newIsovistPolygon); } catch (Exception error0) { this._host.IsovistInformation = null; MessageBox.Show(error0.Message); } timer = null; }
private void drawInRevit() { var timer = new System.Diagnostics.Stopwatch(); this._host.Hide(); UV p = this._host.OSM_to_BIM.PickPoint("Pick a vantage point to draw polygonal Isovist"); Cell cell = this._host.cellularFloor.FindCell(p); if (cell == null) { MessageBox.Show("Pick a point on the walkable field and try again!\n"); this._host.ShowDialog(); 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; } try { timer.Start(); HashSet <UVLine> blocks = this._host.cellularFloor.PolygonalIsovistVisualObstacles(p, this._host.IsovistDepth, this._host.IsovistBarrierType); BarrierPolygon isovistPolygon = this._host.BIM_To_OSM.IsovistPolygon(p, this._host.IsovistDepth, blocks); timer.Stop(); isovistPolygon.Visualize(this._host.OSM_to_BIM, this._host.BIM_To_OSM.PlanElevation); this._host.IsovistInformation = new IsovistInformation(IsovistInformation.IsovistType.Polygonal, timer.Elapsed.TotalMilliseconds, isovistPolygon.GetArea(), isovistPolygon.GetPerimeter()); } catch (Exception error0) { this._host.IsovistInformation = null; MessageBox.Show(error0.Message); } timer = null; this._host.ShowDialog(); }