private void AddWindow([NotNull] WindowSpp window) { using (var line = GetExtentLine(window.Ext, true)) { line.TransformBy(transform); line.LayerId = settings.LayerWindow.LayerId; if (IsKitchenWindow(window)) { line.Color = Color.FromColorIndex(ColorMethod.ByAci, 1); } block.AppendEntity(line); t.AddNewlyCreatedDBObject(line, true); } }
private bool IsKitchenWindow([NotNull] WindowSpp win) { var ext = win.Ext; var center = ext.Center(); var vec = ext.GetLength() > ext.GetHeight() ? (ext.MaxPoint - ext.MinPoint).OrthoProjectTo(Vector3d.YAxis).GetNormal() : (ext.MaxPoint - ext.MinPoint).OrthoProjectTo(Vector3d.XAxis).GetNormal(); ext.AddPoint(ext.MinPoint - vec * 500); ext.AddPoint(ext.MaxPoint + vec * 500); var vecPerp = vec.GetPerpendicularVector(); ext.AddPoint(center + vecPerp * 4500); ext.AddPoint(center - vecPerp * 4500); var rec = new Rectangle(ext); var textKitchen = parser.Intersects(rec).OfType <TextSpp>().FirstOrDefault(v => v.TextType == TextSppType.Kitchen); return(textKitchen != null); }