void AddBT_Click(object sender, EventArgs e) { List <string> sel = editor.GetSelection(); List <Area> areas = new List <Area>(); float minX = float.MaxValue; float maxX = float.MinValue; float minY = float.MaxValue; float maxY = float.MinValue; foreach (string selItem in sel) { RigElement elem = editor.GenData.RealNamesControls[selItem]; Area oscarControlArea = AreaMapComponent.AddOscarControl(selItem, elem, editor.GenData.CtrlsInfos[elem.FullName], editor.Projection); Vector2 corner = oscarControlArea.Corner; Vector2 otherCorner = oscarControlArea.Shape.LowerRightCorner; if (maxX < otherCorner.X) { maxX = otherCorner.X; } if (minX > corner.X) { minX = corner.X; } if (maxY < otherCorner.Y) { maxY = otherCorner.Y; } if (minY > corner.Y) { minY = corner.Y; } areas.Add(oscarControlArea); } float Yextension = maxY - minY; float Xextension = maxX - minX; float scale = Math.Min(AreaMapComponent.Width / Xextension, AreaMapComponent.Height / Yextension); foreach (Area area in areas) { area.Center *= new Vector2(1.0f, -1.0f); area.Center += new Vector2(-minX, maxY); area.Scale(new Vector2(scale, scale), new Vector2(0f, 0f)); } AreaMapComponent.Invalidate(); RefreshListBox(); }
private bool MatchFilters(RigElement elem) { if (existingAreas == null) { existingAreas = new List <string>(); foreach (Area area in areaMapComponent.CurrentAreaMap.Areas) { existingAreas.Add(area.Name); } } return((nameFilter == string.Empty || genData.CtrlsInfos[elem.FullName].RealName.Contains(nameFilter)) && (lodFilter == -1 || lodFilter == (elem.OwnerRig.LOD + elem.LOD)) && (!onlyNewFilter || !existingAreas.Contains(genData.CtrlsInfos[elem.FullName].RealName))); }