public static bool ApplyLockRoom(AdvicePackage advice, ZoneManifest zm, ProgramManifest pm) { var bounds = advice.Bounds; foreach (ZonePackage zone in zm.Zones) { foreach (RoomPackage room in zone.Rooms) { foreach (PlacementPackage item in room.PlacedItems) { PointContainment pc = bounds.Contains(item.Dims.Center); if (pc == PointContainment.Inside) { if (advice.CapturedProgram == null) { advice.CapturedProgram = new List <PlacementPackage>(); } advice.CapturedProgram.Add(item); if (pm.ProgramPackages[item.Program.Priority].Quota > 0) { pm.ProgramPackages[item.Program.Priority].Quota--; } } } } } zm.FloorPlan.ExemptionProfiles.Add(advice.Bounds); return(true); }
public static void ApplyAdvice(AdvicePackage advice, ZoneManifest zm, ProgramManifest pm) { var adviceDictionary = new Dictionary <string, Func <AdvicePackage, ZoneManifest, ProgramManifest, bool> > { { "Lock", ApplyLockRoom } }; adviceDictionary[advice.Type](advice, zm, pm); }
protected override void SolveInstance(IGH_DataAccess DA) { var type = ""; DA.GetData(0, ref type); Curve bounds = null; DA.GetData(1, ref bounds); var indices = new List <int>(); DA.GetDataList(2, indices); var adjustments = new List <double>(); DA.GetDataList(3, adjustments); var advice = new AdvicePackage(type, bounds, indices, adjustments); DA.SetData(0, advice); }