예제 #1
0
        /// <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
                       ));
        }
예제 #2
0
 public ISubdivisionContext GetDependencyContext()
 {
     return(_parent.GetDependencyContext());
 }