public ReverseFacade(IConfigurableFacade parent, Section section) { Contract.Requires(parent != null); _parent = parent; Section = section; }
/// <summary> /// /// </summary> /// <param name="parent">The parent facade to add stamps to</param> /// <param name="min">The minimum coordinate on the parent</param> /// <param name="max">The maximum coordinate on the parent</param> /// <param name="depthMin">The minimum depth on the parent</param> /// <param name="depthMax">The maximum depth on the parent</param> /// <param name="section"></param> public SubsectionFacade(IConfigurableFacade parent, Vector2 min, Vector2 max, float depthMin, float depthMax, Section section) { Contract.Requires(parent != null); _parent = parent; _delta = (min + max) / 2; _minXY = min; _maxXY = max; _rangeDepth = depthMax - depthMin; _minDepth = depthMin; Section = section; }
/// <summary> /// Create a wall section as a subsection along the given external facade section /// </summary> /// <param name="roomPlan"></param> /// <param name="facade"></param> /// <param name="externalSection"></param> /// <returns></returns> // ReSharper disable once VirtualMemberNeverOverriden.Global (Justification: External API) protected virtual IConfigurableFacade CreateExternalWall(IRoomPlan roomPlan, Facade facade, IConfigurableFacade externalSection) { Contract.Requires(roomPlan != null); Contract.Requires(facade != null); Contract.Requires(externalSection != null); //Make sure the room subdivides before the facade (and thus has a chance to configure it externalSection.GetDependencyContext().AddPrerequisite(roomPlan.Node); //Calculate X position of subsection (map room section onto full wall section) var at = externalSection.Section.InternalLineSegment.LongLine.ClosestPointDistanceAlongLine(facade.Section.ExternalLineSegment.Start); var bt = externalSection.Section.InternalLineSegment.LongLine.ClosestPointDistanceAlongLine(facade.Section.ExternalLineSegment.End); //Transform distance along facade into facade local coordinates var minAlong = Math.Min(at, bt) * externalSection.Section.Width - externalSection.Section.Width * 0.5f; var maxAlong = Math.Max(at, bt) * externalSection.Section.Width - externalSection.Section.Width * 0.5f; return(new SubsectionFacade( externalSection, new Vector2(minAlong, -Bounds.Height / 2 + _floorThickness), new Vector2(maxAlong, -Bounds.Height / 2 + _floorThickness + _roomHeight), 0, 1, facade.Section )); }