public void FillSpaceWithWindows(string windowType, string windowColour, string framingColour, int numberOfVents, float kneewallHeight, string kneewallType, string transomType, bool sunshade, string valance, string fabric, string openness, string chain, string screenType, double railing) { float currentLocation = 0f; //Loop through linear items using currentLocation to keep track for (int i = 0; i <= LinearItems.Count; i++)// { try { //If an item starts at this location, we aren't in a workable area if (LinearItems[i].FixedLocation == currentLocation) { //We set the location equal to the length of the linear item, which is the end of it currentLocation += LinearItems[i].Length; } //Item must start after current else if (LinearItems[i].FixedLocation > currentLocation) { //The space is equal to where the next item starts - current location float space = LinearItems[i].FixedLocation - currentLocation; float numOfWindowsInThisSpace = 1; //If the space is too large for one window mod, we need this many float eachSpace = space; //If the space is too large for one window mod, we'll have a # of mods of this size float MAX_MOD_WIDTH = 0; float MIN_MOD_WIDTH = 0; switch (windowType) { case "Fixed Vinyl": MIN_MOD_WIDTH = Constants.VINYL_TRAP_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.VINYL_TRAP_MAX_WIDTH_WARRANTY; break; case "Fixed Glass 2\"": MIN_MOD_WIDTH = Constants.VINYL_TRAP_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.VINYL_TRAP_MAX_WIDTH_WARRANTY; break; case "Fixed Glass 3\"": MIN_MOD_WIDTH = Constants.VINYL_TRAP_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.VINYL_TRAP_MAX_WIDTH_WARRANTY; break; case "Vertical 4 Track": MIN_MOD_WIDTH = Constants.V4T_4V_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.V4T_4V_MAX_WIDTH_WARRANTY; break; case "Horizontal 2 Track": case "Horizontal Roller": MIN_MOD_WIDTH = Constants.HORIZONTAL_ROLLER_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.HORIZONTAL_ROLLER_MAX_WIDTH_WARRANTY; break; case "Single Slider": MIN_MOD_WIDTH = Constants.SINGLE_SLIDER_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.SINGLE_SLIDER_MAX_WIDTH_WARRANTY; break; case "Double Slider": MIN_MOD_WIDTH = Constants.DOUBLE_SLIDER_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.DOUBLE_SLIDER_MAX_WIDTH_WARRANTY; break; case "Open Wall": MIN_MOD_WIDTH = Constants.V4T_4V_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.V4T_4V_MAX_WIDTH_WARRANTY; break; case "Solid Wall": MIN_MOD_WIDTH = Constants.V4T_4V_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.V4T_4V_MAX_WIDTH_WARRANTY; break; case "Screen": MIN_MOD_WIDTH = Constants.SCREEN_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.SCREEN_MAX_WIDTH_WARRANTY; break; } //Find optimal lengths of window mods given space float[] windowSpecifics = FindOptimalLengthOfWindowModsGivenSpace(space, MIN_MOD_WIDTH, MAX_MOD_WIDTH); float height; //Loop mod creation for each window counted in this space for (int windowCounter = 0; windowCounter < windowSpecifics[1]; windowCounter++) { //We have a space, so create a window mod to fill it Mod aMod = new Mod(); aMod.FixedLocation = currentLocation; aMod.StartHeight = GetHeightAtLocation(currentLocation); aMod.EndHeight = GetHeightAtLocation(currentLocation + windowSpecifics[0]); aMod.ItemType = "Mod"; aMod.Length = windowSpecifics[0]; if (windowCounter == 0) { aMod.Length += windowSpecifics[2]; } aMod.ModType = "Window"; aMod.Sunshade = sunshade; aMod.SunshadeValance = valance; aMod.SunshadeFabric = fabric; aMod.SunshadeOpenness = openness; aMod.SunshadeChain = chain; height = Math.Max(aMod.StartHeight, aMod.EndHeight); //Check for kneewall info if (kneewallHeight > 0) { //Have one Kneewall aKneewall = new Kneewall(); aKneewall.FEndHeight = aKneewall.FStartHeight = kneewallHeight; aKneewall.EndHeight = aKneewall.StartHeight = kneewallHeight - 2.125f; height -= kneewallHeight; //Remove this from usable height, as the kneewall takes it up aKneewall.KneewallType = kneewallType; aKneewall.ItemType = "Kneewall"; aKneewall.FLength = aMod.Length - 2; aMod.ModularItems.Add(aKneewall); } float highestPunch = 0f; //Kneewall will have been added now, or not, either way we add the window //find highest punch for (int j = 0; j < LinearItems.Count; j++) { if (LinearItems[j].ItemType == "Mod") { Mod tempMod = (Mod)LinearItems[j]; if (tempMod.ModType == "Door") { //check 0 because door will always be first item in door mod if (((Door)tempMod.ModularItems[0]).Punch > highestPunch) { highestPunch = ((Door)tempMod.ModularItems[0]).Punch; } } } } //If punch is 0 at this point there are no doors, in such a case, we will set the punch to be a set distance below the min height of the wall //That way we arbitrarily set a location for the transom to start and maintain consistency. if (highestPunch == 0) { highestPunch = GlobalFunctions.RoundDownToNearestEighthInch(Math.Min(StartHeight, EndHeight) - 4.125F - Constants.KNEEWALL_PUNCH); //changeme based on type } //Now we know where the ending height is, so we subtract kneewall to get the height of the window //Punch takes up space too, so subtract it as well float windowHeight = highestPunch - kneewallHeight - Constants.KNEEWALL_PUNCH; //Create the window Window aWindow = new Window(); aWindow.FEndHeight = aWindow.FStartHeight = windowHeight; //CHANGEME hardcoded 2.125 aWindow.RightHeight = aWindow.LeftHeight = windowHeight - 2.125f; aWindow.FLength = aMod.Length - 2; aWindow.Width = aWindow.FLength - 2.125f; //CHANGEME hardcoded aWindow.Colour = windowColour; aWindow.FrameColour = framingColour; aWindow.ItemType = "Window"; aWindow.NumVents = numberOfVents; aWindow.ScreenType = screenType; //fixt aWindow.WindowStyle = windowType; //Check for spreader bar boolean if (windowType == "Vertical 4 Track" && aWindow.FLength > Constants.V4T_SPREADER_BAR_NEEDED) { aWindow.SpreaderBar = (aWindow.FLength/2) - (Constants.SPREADER_BAR_SIZE/2); //Find center of window, then place center of spreader bar at that position (by subtracting half of it) } if (windowType == "Horizontal Roller" && aWindow.FLength > Constants.HORIZONTAL_ROLLER_SPREADER_BAR_NEEDED) { aWindow.SpreaderBar = (aWindow.FEndHeight/2) - (Constants.SPREADER_BAR_SIZE/2); aWindow.WindowStyle = "Horizontal Roller XO"; } if (windowType == "Vinyl") { if (aWindow.FLength > Constants.TRANSOM_SPREADER_BAR_REQUIRED || aWindow.FEndHeight > Constants.TRANSOM_SPREADER_BAR_REQUIRED || aWindow.FStartHeight > Constants.TRANSOM_SPREADER_BAR_REQUIRED) { //If length is longer, vertical bar, else horizontal bar if (aWindow.Width >= aWindow.FEndHeight && aWindow.Width >= aWindow.FStartHeight) { aWindow.SpreaderBar = (aWindow.FLength / 2) - (Constants.SPREADER_BAR_SIZE / 2); } else { aWindow.SpreaderBar = (aWindow.FEndHeight / 2) - (Constants.SPREADER_BAR_SIZE / 2); } //If dimensions are equal? } } aWindow.IntegratedRailing = railing; aMod.ModularItems.Add(aWindow); //Now we handle transom float modStartWallHeight = GlobalFunctions.getHeightAtPosition(StartHeight, EndHeight, currentLocation, Length); float modEndWallHeight = GlobalFunctions.getHeightAtPosition(StartHeight, EndHeight, (currentLocation + aMod.Length), Length); float spaceAbovePunch = Math.Max(modStartWallHeight, modEndWallHeight) - highestPunch - .25f; //Punch physical space float[] transomInfo = GlobalFunctions.findOptimalHeightsOfWindows(spaceAbovePunch, transomType); if (StartHeight == EndHeight) { //rectangular window for (int currentWindow = 0; currentWindow < transomInfo[0]; currentWindow++) { //Set window properties Window aTransom = new Window(); aTransom.FEndHeight = aTransom.FStartHeight = transomInfo[1]; //Window with frame aTransom.RightHeight = aTransom.LeftHeight = transomInfo[1] - 2.125f; //Window itself aTransom.Colour = windowColour; aTransom.ItemType = "Window"; aTransom.FLength = aMod.Length - 2; aTransom.Width = aTransom.FLength - 2.125f; aTransom.WindowStyle = transomType; if (currentWindow == 0) { aTransom.FEndHeight += transomInfo[2]; aTransom.FStartHeight += transomInfo[2]; aTransom.RightHeight += transomInfo[2]; aTransom.LeftHeight += transomInfo[2]; } if (aTransom.FLength > Constants.TRANSOM_SPREADER_BAR_REQUIRED || aTransom.FEndHeight > Constants.TRANSOM_SPREADER_BAR_REQUIRED || aTransom.FStartHeight > Constants.TRANSOM_SPREADER_BAR_REQUIRED) { //If length is longer, vertical bar, else horizontal bar if (aTransom.Width > aTransom.FEndHeight && aTransom.Width > aTransom.FStartHeight) { aTransom.SpreaderBar = (aTransom.FLength / 2) - (Constants.SPREADER_BAR_SIZE / 2); } else { aTransom.SpreaderBar = (aTransom.FEndHeight / 2) - (Constants.SPREADER_BAR_SIZE / 2); } //If dimensions are equal? } aMod.ModularItems.Add(aTransom); } } else { //trapezoid float nextTransomHeight; //If start wall is higher, lower end height if (modStartWallHeight == Math.Max(modStartWallHeight, modEndWallHeight)) { nextTransomHeight = transomInfo[1]; } else { nextTransomHeight = transomInfo[1] - (Math.Max(modStartWallHeight, modEndWallHeight) - Math.Min(modStartWallHeight, modEndWallHeight)); } for (int currentWindow = 0; currentWindow < transomInfo[0]; currentWindow++) { //Set window properties Window aTransom = new Window(); aTransom.Colour = windowColour; aTransom.ItemType = "Window"; aTransom.FLength = aMod.Length - 2; aTransom.Width = aMod.Length - 2 - 2.125f; aTransom.WindowStyle = transomType; aTransom.FStartHeight = nextTransomHeight; aTransom.LeftHeight = aTransom.FStartHeight - 2.125f; //If start wall is higher, lower end height if (modStartWallHeight == Math.Max(modStartWallHeight, modEndWallHeight)) { aTransom.FEndHeight = aTransom.FStartHeight - (modStartWallHeight - modEndWallHeight); } else { aTransom.FEndHeight = aTransom.FStartHeight + (modEndWallHeight - modStartWallHeight); } aTransom.RightHeight = aTransom.FEndHeight - 2.125f; nextTransomHeight = aTransom.FEndHeight; //Add remaining area to first window if (currentWindow == 0) { aTransom.FEndHeight += transomInfo[2]; aTransom.FStartHeight += transomInfo[2]; aTransom.RightHeight += transomInfo[2]; aTransom.LeftHeight += transomInfo[2]; } aTransom.FStartHeight = GlobalFunctions.RoundDownToNearestEighthInch(aTransom.FStartHeight); aTransom.FEndHeight = GlobalFunctions.RoundDownToNearestEighthInch(aTransom.FEndHeight); aTransom.LeftHeight = GlobalFunctions.RoundDownToNearestEighthInch(aTransom.LeftHeight); aTransom.RightHeight = GlobalFunctions.RoundDownToNearestEighthInch(aTransom.RightHeight); ////If last window, we need to change a height to make it sloped //if (currentWindow == transomInfo[0] - 1) //{ // //If start wall is higher, we lower end height // if (modStartWallHeight == Math.Max(modStartWallHeight, modEndWallHeight)) // { // aTransom.FEndHeight -= (modStartWallHeight - modEndWallHeight); // aTransom.RightHeight -= (modStartWallHeight - modEndWallHeight); // } // //Otherwise we lower start height // else // { // aTransom.FStartHeight -= (modEndWallHeight - modStartWallHeight); // aTransom.LeftHeight -= (modEndWallHeight - modStartWallHeight); // } //} aMod.ModularItems.Add(aTransom); } } //float[] windowInfo = GlobalFunctions.findOptimalHeightsOfWindows //Find where to place the mod, and place it for (int j = 0; j < LinearItems.Count; j++) { if (LinearItems[j].FixedLocation > aMod.FixedLocation) { //j is past, so we insert into j-1 and exit the loop LinearItems.Insert(j, aMod); break; } } //Sets currentlocation to the ending location of current linear item currentLocation = currentLocation + aMod.Length; } } } catch (Exception ex) { //If caught, it's because we tried to touch the next linear item but it was past the last //Check currentLocation to see if there is still space left } } }
public void FillSpaceWithWindows(string windowType, string windowColour, string framingColour, int numberOfVents, float kneewallHeight, string kneewallType, string transomType, bool sunshade, string valance, string fabric, string openness, string chain, string screenType, double railing) { float currentLocation = 0f; //Loop through linear items using currentLocation to keep track for (int i = 0; i <= LinearItems.Count; i++)// { try { //If an item starts at this location, we aren't in a workable area if (LinearItems[i].FixedLocation == currentLocation) { //We set the location equal to the length of the linear item, which is the end of it currentLocation += LinearItems[i].Length; } //Item must start after current else if (LinearItems[i].FixedLocation > currentLocation) { //The space is equal to where the next item starts - current location float space = LinearItems[i].FixedLocation - currentLocation; float numOfWindowsInThisSpace = 1; //If the space is too large for one window mod, we need this many float eachSpace = space; //If the space is too large for one window mod, we'll have a # of mods of this size float MAX_MOD_WIDTH = 0; float MIN_MOD_WIDTH = 0; switch (windowType) { case "Fixed Vinyl": MIN_MOD_WIDTH = Constants.VINYL_TRAP_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.VINYL_TRAP_MAX_WIDTH_WARRANTY; break; case "Fixed Glass 2\"": MIN_MOD_WIDTH = Constants.VINYL_TRAP_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.VINYL_TRAP_MAX_WIDTH_WARRANTY; break; case "Fixed Glass 3\"": MIN_MOD_WIDTH = Constants.VINYL_TRAP_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.VINYL_TRAP_MAX_WIDTH_WARRANTY; break; case "Vertical 4 Track": MIN_MOD_WIDTH = Constants.V4T_4V_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.V4T_4V_MAX_WIDTH_WARRANTY; break; case "Horizontal 2 Track": case "Horizontal Roller": MIN_MOD_WIDTH = Constants.HORIZONTAL_ROLLER_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.HORIZONTAL_ROLLER_MAX_WIDTH_WARRANTY; break; case "Single Slider": MIN_MOD_WIDTH = Constants.SINGLE_SLIDER_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.SINGLE_SLIDER_MAX_WIDTH_WARRANTY; break; case "Double Slider": MIN_MOD_WIDTH = Constants.DOUBLE_SLIDER_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.DOUBLE_SLIDER_MAX_WIDTH_WARRANTY; break; case "Open Wall": MIN_MOD_WIDTH = Constants.V4T_4V_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.V4T_4V_MAX_WIDTH_WARRANTY; break; case "Solid Wall": MIN_MOD_WIDTH = Constants.V4T_4V_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.V4T_4V_MAX_WIDTH_WARRANTY; break; case "Screen": MIN_MOD_WIDTH = Constants.SCREEN_MIN_WIDTH_WARRANTY; //We use the trap version because they can have both MAX_MOD_WIDTH = Constants.SCREEN_MAX_WIDTH_WARRANTY; break; } //Find optimal lengths of window mods given space float[] windowSpecifics = FindOptimalLengthOfWindowModsGivenSpace(space, MIN_MOD_WIDTH, MAX_MOD_WIDTH); float height; //Loop mod creation for each window counted in this space for (int windowCounter = 0; windowCounter < windowSpecifics[1]; windowCounter++) { //We have a space, so create a window mod to fill it Mod aMod = new Mod(); aMod.FixedLocation = currentLocation; aMod.StartHeight = GetHeightAtLocation(currentLocation); aMod.EndHeight = GetHeightAtLocation(currentLocation + windowSpecifics[0]); aMod.ItemType = "Mod"; aMod.Length = windowSpecifics[0]; if (windowCounter == 0) { aMod.Length += windowSpecifics[2]; } aMod.ModType = "Window"; aMod.Sunshade = sunshade; aMod.SunshadeValance = valance; aMod.SunshadeFabric = fabric; aMod.SunshadeOpenness = openness; aMod.SunshadeChain = chain; height = Math.Max(aMod.StartHeight, aMod.EndHeight); //Check for kneewall info if (kneewallHeight > 0) { //Have one Kneewall aKneewall = new Kneewall(); aKneewall.FEndHeight = aKneewall.FStartHeight = kneewallHeight; aKneewall.EndHeight = aKneewall.StartHeight = kneewallHeight - 2.125f; height -= kneewallHeight; //Remove this from usable height, as the kneewall takes it up aKneewall.KneewallType = kneewallType; aKneewall.ItemType = "Kneewall"; aKneewall.FLength = aMod.Length - 2; aMod.ModularItems.Add(aKneewall); } float highestPunch = 0f; //Kneewall will have been added now, or not, either way we add the window //find highest punch for (int j = 0; j < LinearItems.Count; j++) { if (LinearItems[j].ItemType == "Mod") { Mod tempMod = (Mod)LinearItems[j]; if (tempMod.ModType == "Door") { //check 0 because door will always be first item in door mod if (((Door)tempMod.ModularItems[0]).Punch > highestPunch) { highestPunch = ((Door)tempMod.ModularItems[0]).Punch; } } } } //If punch is 0 at this point there are no doors, in such a case, we will set the punch to be a set distance below the min height of the wall //That way we arbitrarily set a location for the transom to start and maintain consistency. if (highestPunch == 0) { highestPunch = GlobalFunctions.RoundDownToNearestEighthInch(Math.Min(StartHeight, EndHeight) - 4.125F - Constants.KNEEWALL_PUNCH); //changeme based on type } //Now we know where the ending height is, so we subtract kneewall to get the height of the window //Punch takes up space too, so subtract it as well float windowHeight = highestPunch - kneewallHeight - Constants.KNEEWALL_PUNCH; //Create the window Window aWindow = new Window(); aWindow.FEndHeight = aWindow.FStartHeight = windowHeight; //CHANGEME hardcoded 2.125 aWindow.RightHeight = aWindow.LeftHeight = windowHeight - 2.125f; aWindow.FLength = aMod.Length - 2; aWindow.Width = aWindow.FLength - 2.125f; //CHANGEME hardcoded aWindow.Colour = windowColour; aWindow.FrameColour = framingColour; aWindow.ItemType = "Window"; aWindow.NumVents = numberOfVents; aWindow.ScreenType = screenType; //fixt aWindow.WindowStyle = windowType; //Check for spreader bar boolean if (windowType == "Vertical 4 Track" && aWindow.FLength > Constants.V4T_SPREADER_BAR_NEEDED) { aWindow.SpreaderBar = (aWindow.FLength / 2) - (Constants.SPREADER_BAR_SIZE / 2); //Find center of window, then place center of spreader bar at that position (by subtracting half of it) } if (windowType == "Horizontal Roller" && aWindow.FLength > Constants.HORIZONTAL_ROLLER_SPREADER_BAR_NEEDED) { aWindow.SpreaderBar = (aWindow.FEndHeight / 2) - (Constants.SPREADER_BAR_SIZE / 2); aWindow.WindowStyle = "Horizontal Roller XO"; } if (windowType == "Vinyl") { if (aWindow.FLength > Constants.TRANSOM_SPREADER_BAR_REQUIRED || aWindow.FEndHeight > Constants.TRANSOM_SPREADER_BAR_REQUIRED || aWindow.FStartHeight > Constants.TRANSOM_SPREADER_BAR_REQUIRED) { //If length is longer, vertical bar, else horizontal bar if (aWindow.Width >= aWindow.FEndHeight && aWindow.Width >= aWindow.FStartHeight) { aWindow.SpreaderBar = (aWindow.FLength / 2) - (Constants.SPREADER_BAR_SIZE / 2); } else { aWindow.SpreaderBar = (aWindow.FEndHeight / 2) - (Constants.SPREADER_BAR_SIZE / 2); } //If dimensions are equal? } } aWindow.IntegratedRailing = railing; aMod.ModularItems.Add(aWindow); //Now we handle transom float modStartWallHeight = GlobalFunctions.getHeightAtPosition(StartHeight, EndHeight, currentLocation, Length); float modEndWallHeight = GlobalFunctions.getHeightAtPosition(StartHeight, EndHeight, (currentLocation + aMod.Length), Length); float spaceAbovePunch = Math.Max(modStartWallHeight, modEndWallHeight) - highestPunch - .25f; //Punch physical space float[] transomInfo = GlobalFunctions.findOptimalHeightsOfWindows(spaceAbovePunch, transomType); if (StartHeight == EndHeight) { //rectangular window for (int currentWindow = 0; currentWindow < transomInfo[0]; currentWindow++) { //Set window properties Window aTransom = new Window(); aTransom.FEndHeight = aTransom.FStartHeight = transomInfo[1]; //Window with frame aTransom.RightHeight = aTransom.LeftHeight = transomInfo[1] - 2.125f; //Window itself aTransom.Colour = windowColour; aTransom.ItemType = "Window"; aTransom.FLength = aMod.Length - 2; aTransom.Width = aTransom.FLength - 2.125f; aTransom.WindowStyle = transomType; if (currentWindow == 0) { aTransom.FEndHeight += transomInfo[2]; aTransom.FStartHeight += transomInfo[2]; aTransom.RightHeight += transomInfo[2]; aTransom.LeftHeight += transomInfo[2]; } if (aTransom.FLength > Constants.TRANSOM_SPREADER_BAR_REQUIRED || aTransom.FEndHeight > Constants.TRANSOM_SPREADER_BAR_REQUIRED || aTransom.FStartHeight > Constants.TRANSOM_SPREADER_BAR_REQUIRED) { //If length is longer, vertical bar, else horizontal bar if (aTransom.Width > aTransom.FEndHeight && aTransom.Width > aTransom.FStartHeight) { aTransom.SpreaderBar = (aTransom.FLength / 2) - (Constants.SPREADER_BAR_SIZE / 2); } else { aTransom.SpreaderBar = (aTransom.FEndHeight / 2) - (Constants.SPREADER_BAR_SIZE / 2); } //If dimensions are equal? } aMod.ModularItems.Add(aTransom); } } else { //trapezoid float nextTransomHeight; //If start wall is higher, lower end height if (modStartWallHeight == Math.Max(modStartWallHeight, modEndWallHeight)) { nextTransomHeight = transomInfo[1]; } else { nextTransomHeight = transomInfo[1] - (Math.Max(modStartWallHeight, modEndWallHeight) - Math.Min(modStartWallHeight, modEndWallHeight)); } for (int currentWindow = 0; currentWindow < transomInfo[0]; currentWindow++) { //Set window properties Window aTransom = new Window(); aTransom.Colour = windowColour; aTransom.ItemType = "Window"; aTransom.FLength = aMod.Length - 2; aTransom.Width = aMod.Length - 2 - 2.125f; aTransom.WindowStyle = transomType; aTransom.FStartHeight = nextTransomHeight; aTransom.LeftHeight = aTransom.FStartHeight - 2.125f; //If start wall is higher, lower end height if (modStartWallHeight == Math.Max(modStartWallHeight, modEndWallHeight)) { aTransom.FEndHeight = aTransom.FStartHeight - (modStartWallHeight - modEndWallHeight); } else { aTransom.FEndHeight = aTransom.FStartHeight + (modEndWallHeight - modStartWallHeight); } aTransom.RightHeight = aTransom.FEndHeight - 2.125f; nextTransomHeight = aTransom.FEndHeight; //Add remaining area to first window if (currentWindow == 0) { aTransom.FEndHeight += transomInfo[2]; aTransom.FStartHeight += transomInfo[2]; aTransom.RightHeight += transomInfo[2]; aTransom.LeftHeight += transomInfo[2]; } aTransom.FStartHeight = GlobalFunctions.RoundDownToNearestEighthInch(aTransom.FStartHeight); aTransom.FEndHeight = GlobalFunctions.RoundDownToNearestEighthInch(aTransom.FEndHeight); aTransom.LeftHeight = GlobalFunctions.RoundDownToNearestEighthInch(aTransom.LeftHeight); aTransom.RightHeight = GlobalFunctions.RoundDownToNearestEighthInch(aTransom.RightHeight); ////If last window, we need to change a height to make it sloped //if (currentWindow == transomInfo[0] - 1) //{ // //If start wall is higher, we lower end height // if (modStartWallHeight == Math.Max(modStartWallHeight, modEndWallHeight)) // { // aTransom.FEndHeight -= (modStartWallHeight - modEndWallHeight); // aTransom.RightHeight -= (modStartWallHeight - modEndWallHeight); // } // //Otherwise we lower start height // else // { // aTransom.FStartHeight -= (modEndWallHeight - modStartWallHeight); // aTransom.LeftHeight -= (modEndWallHeight - modStartWallHeight); // } //} aMod.ModularItems.Add(aTransom); } } //float[] windowInfo = GlobalFunctions.findOptimalHeightsOfWindows //Find where to place the mod, and place it for (int j = 0; j < LinearItems.Count; j++) { if (LinearItems[j].FixedLocation > aMod.FixedLocation) { //j is past, so we insert into j-1 and exit the loop LinearItems.Insert(j, aMod); break; } } //Sets currentlocation to the ending location of current linear item currentLocation = currentLocation + aMod.Length; } } } catch (Exception ex) { //If caught, it's because we tried to touch the next linear item but it was past the last //Check currentLocation to see if there is still space left } } }
//Find the price for a Model 300 wall /****NEEDS REVIEWING, NOT COMPLETE****/ public static float PriceModel300Wall(Wall aWall) { float wallPrice = 0.0f; float lengthOfStandard = 0.0f; float lengthOfSolidWall = 0.0f; float lengthOfOpen = 0.0f; float lengthOfFixedVinyl = 0.0f; List <LinearItem> listOfMods = (List <LinearItem>)aWall.LinearItems; if (aWall.Orientation != "N" && aWall.Orientation != "S" && aWall.Orientation != "E" && aWall.Orientation != "W") { wallPrice = PricingConstants.MODEL_300_45_DEGREE_WALLS; } //Loop through linear items foreach (LinearItem aLinearItem in listOfMods) { //Linear item is a mod if (aLinearItem.ItemType == "Mod") { //Cast linear item as a mod Mod aMod = (Mod)aLinearItem; //Mod is a door if (aMod.ModType == "Door") { Door aDoor = (Door)aMod.ModularItems[0]; //Non door add linear length to lengthOfOpen if (aDoor.DoorType == "Vertical Four Track") { lengthOfStandard += aLinearItem.Length; } else if (aDoor.DoorType == "NoDoor") { lengthOfOpen += aLinearItem.Length; } else { lengthOfStandard += aLinearItem.Length; } } //Mod is a window else if (aMod.ModType == "Window") { Kneewall aKneewall = (Kneewall)aMod.ModularItems[0]; //Kneewall Window aWindow = (Window)aMod.ModularItems[0]; if (aKneewall.FLength > 20) { //Add pricing for custom kneewall height } else { } //Add length for fixed vinyl if (aWindow.WindowStyle.Contains("Fixed")) //Possibilities: Fixed Vinyl, Fixed Glass 2", Fixed Glass 3" { lengthOfFixedVinyl += aLinearItem.Length; } } else if (aMod.ModType == "Open" && aLinearItem.Length >= 8) { lengthOfOpen += aLinearItem.Length; } else { lengthOfStandard += aLinearItem.Length; } } else //Check to see if everything else other than mods are included { if (aLinearItem.Length >= 8) { lengthOfSolidWall += aLinearItem.Length; lengthOfStandard -= aLinearItem.Length; } } } //Add various wall pricing types to wall price based on length wallPrice += PricingConstants.MODEL_300_VINYL_HORIZONTAL_ROLLER_WINDOW * lengthOfStandard; wallPrice += PricingConstants.MODEL_300_SOLID_WALL_PANEL * lengthOfSolidWall; wallPrice += PricingConstants.MODEL_300_MANUFACTURED_OPEN_WALLS * lengthOfOpen; wallPrice += PricingConstants.MODEL_300_FIXED_WINDOWS * lengthOfFixedVinyl; //Find wall height and set appropriate pricing if ((aWall.EndHeight > 96 && aWall.EndHeight < 120) || (aWall.StartHeight > 96 && aWall.StartHeight < 120)) { wallPrice += PricingConstants.MODEL_300_NON_STANDARD_PANEL_HEIGHTS * aWall.Length; } else if (aWall.EndHeight >= 120 || aWall.StartHeight >= 120) { wallPrice += PricingConstants.MODEL_300_NON_STANDARD_PANEL_HEIGHTS_HIGHER * aWall.Length; } //Add pricing for fire protection if (aWall.FireProtection == true) { wallPrice += PricingConstants.MODEL_300_FP_HORIZONTAL_ROLLER * lengthOfStandard; wallPrice += PricingConstants.MODEL_300_FP_MANUFACTURED_OPEN_WALLS * lengthOfOpen; wallPrice += PricingConstants.MODEL_300_FP_SOLID_WALL_PANEL * lengthOfSolidWall; wallPrice += PricingConstants.MODEL_300_FP_FIXED_WINDOWS * lengthOfFixedVinyl; } return(wallPrice); }
public static float PriceModel100Wall(Wall aWall) { float wallPrice = 0.0f; int numberOfDoors = 0; float lengthOfMods = 0.0f; float lengthOfSolidWall = 0.0f; float lengthOfOpen = 0.0f; List <LinearItem> listOfMods = (List <LinearItem>)aWall.LinearItems; //Loop through linear items foreach (LinearItem aLinearItem in listOfMods) { //Linear item is a mdo if (aLinearItem.ItemType == "Mod") { //Cast linear item as a mod Mod aMod = (Mod)aLinearItem; //Mod is a door if (aMod.ModType == "Door") { Door aDoor = (Door)aMod.ModularItems[0]; //Non door add linear length to lengthOfOpen if (aDoor.DoorType == "NoDoor") { lengthOfOpen += aLinearItem.Length; } else { numberOfDoors++; lengthOfMods += aLinearItem.Length; } } //Mod is a window else if (aMod.ModType == "Window") { Kneewall aKneewall = (Kneewall)aMod.ModularItems[0]; //Kneewall Window aWindow = (Window)aMod.ModularItems[1]; if (aKneewall.FLength > 20) { //Add pricing for custom kneewall height } else { } if (aWindow.ScreenType == "No See Ums 20 x 20 Mesh") { wallPrice += PricingConstants.MODEL_100_NO_SEE_UMS_FIBERGLASS_20_X_20_MESH * aLinearItem.Length; } else if (aWindow.ScreenType == "Solar Insect Screening") { wallPrice += PricingConstants.MODEL_100_SOLAR_INSECT_SCREENING * aLinearItem.Length; } else if (aWindow.ScreenType == "Tuff Screen") { wallPrice += PricingConstants.MODEL_100_TUFF_SCREEN * aLinearItem.Length; } } else if (aMod.ModType == "Open" && aLinearItem.Length >= 8) { lengthOfOpen += aLinearItem.Length; } else { lengthOfMods += aLinearItem.Length; } } else //Check to see if everything else other than mods are included { if (aLinearItem.Length >= 8) { lengthOfSolidWall += aLinearItem.Length; lengthOfMods -= aLinearItem.Length; } } } //Set price based on number of doors in the sunroom switch (numberOfDoors) { case 1: wallPrice += PricingConstants.MODEL_100_SCREEN_OPENING_1_SCREEN_DOOR * lengthOfMods; break; case 2: wallPrice += PricingConstants.MODEL_100_SCREEN_OPENING_2_SCREEN_DOORS * lengthOfMods; break; case 3: wallPrice += PricingConstants.MODEL_100_SCREEN_OPENING_3_SCREEN_DOORS * lengthOfMods; break; } //Add solid wall pricing wallPrice += PricingConstants.MODEL_100_SOLID_WALL_PANEL * lengthOfSolidWall; //Find wall height and set appropriate pricing if ((aWall.EndHeight > 96 && aWall.EndHeight < 120) || (aWall.StartHeight > 96 && aWall.StartHeight < 120)) { wallPrice += PricingConstants.MODEL_100_NON_STANDARD_PANEL_HEIGHTS * aWall.Length; } else if (aWall.EndHeight >= 120 || aWall.StartHeight >= 120) { wallPrice += PricingConstants.MODEL_100_NON_STANDARD_PANEL_HEIGHTS_HIGHER * aWall.Length; } //Add pricing for fire protection if (aWall.FireProtection == true) { wallPrice += PricingConstants.MODEL_100_FP_SCREEN_OPENINGS_INCLUDES_1_SCREEN_DOOR * lengthOfMods; wallPrice += PricingConstants.MODEL_100_FP_SOLID_WALL_PANEL * lengthOfSolidWall; } return(wallPrice); }
//Find the price for a Model 200 wall public static float PriceModel200Wall(Wall aWall) { float wallPrice = 0.0f; float lengthOfStandard = 0.0f; float lengthOfSolidWall = 0.0f; float lengthOfOpen = 0.0f; float lengthOfFixedVinyl = 0.0f; List <LinearItem> listOfMods = (List <LinearItem>)aWall.LinearItems; if (aWall.Orientation != "N" && aWall.Orientation != "S" && aWall.Orientation != "E" && aWall.Orientation != "W") { wallPrice = PricingConstants.MODEL_200_45_DEGREE_WALLS; } //Loop through linear items foreach (LinearItem aLinearItem in listOfMods) { if (aLinearItem.ItemType == "Electrical Chase") { wallPrice += PricingConstants.MODEL_200_VERTICAL_ELECTRICAL_CHASE; } //Linear item is a mod else if (aLinearItem.ItemType == "Mod") { /****************************************** * NEED SOMETHING FOR PRICING TRANSOMS * * NEED SOMETHING FOR MISCELLANEOUS ITEMS * * ****************************************/ //Cast linear item as a mod Mod aMod = (Mod)aLinearItem; //Mod is a door if (aMod.ModType == "Door") { Door aDoor = (Door)aMod.ModularItems[0]; //Non door add linear length to lengthOfOpen if (aDoor.DoorType == "Patio") { numberOfPatioDoors++; //Cast the window within the door to a window object Window aDoorWindow = aDoor.DoorWindow; //Must be a glass window if (aDoorWindow.WindowStyle.Contains("Glass") || aDoorWindow.WindowStyle == "Single Slider" || aDoorWindow.WindowStyle == "Horizontal Roller") { //Cast window item to vinyl window item VinylWindow aVinylDoorWindow = (VinylWindow)aDoorWindow; //If glass window tint is grey or bronze, additional pricing occurs if (aVinylDoorWindow.VinylTint.Contains("Grey") || aVinylDoorWindow.VinylTint.Contains("Bronze")) { wallPrice += PricingConstants.MODEL_200_TINTED_GLASS_IN_PATIO_DOOR; } } } else if (aDoor.DoorType == "NoDoor") { //Add length to open door length lengthOfOpen += aLinearItem.Length; } else { //Add length to standard pricing lengthOfStandard += aLinearItem.Length; } /************************************** * BLOCK TO HANDLE ENTRY DOOR PRICING * * ************************************/ if (aDoor.DoorStyle == "Vertical Four Track" && aDoor.DoorType != "French") { //Add length to standard pricing lengthOfStandard += aLinearItem.Length; numberOfV4TDoors++; } else if (aDoor.DoorStyle == "Vertical Four Track" && aDoor.DoorType == "French") { //Add length to standard pricing lengthOfStandard += aLinearItem.Length; numberOfV4TFrenchDoors++; } if (aDoor.DoorStyle == "Full View" && aDoor.DoorType != "French") { numberOfFullViewDoors++; } else if (aDoor.DoorStyle == "Full View" && aDoor.DoorType == "French") { numberOfFullViewFrenchDoors++; } if (aDoor.DoorStyle == "Full View Colonial" && aDoor.DoorType != "French") { numberOfFullViewColonialDoors++; } else if (aDoor.DoorStyle == "Full View Colonial" && aDoor.DoorType == "French") { numberOfFullViewColonialFrenchDoors++; } } //Mod is a window else if (aMod.ModType == "Window") { Kneewall aKneewall = (Kneewall)aMod.ModularItems[0]; //Kneewall Window aWindow = (Window)aMod.ModularItems[1]; if (aKneewall.FLength > 20) { //Add pricing for custom kneewall height } else { } //Add length for fixed vinyl if (aWindow.WindowStyle.Contains("Fixed")) //Possibilities: Fixed Vinyl, Fixed Glass 2", Fixed Glass 3" { lengthOfFixedVinyl += aLinearItem.Length; } if (aWindow.ScreenType == "No See Ums 20 x 20 Mesh") { wallPrice += PricingConstants.MODEL_200_NO_SEE_UMS * aLinearItem.Length; } else if (aWindow.ScreenType == "Solar Insect Screening") { wallPrice += PricingConstants.MODEL_200_SOLAR_INSECT_SCREENING * aLinearItem.Length; } else if (aWindow.ScreenType == "Tuff Screen") { wallPrice += PricingConstants.MODEL_200_TUFF_SCREEN * aLinearItem.Length; } } else if (aMod.ModType == "Open" && aLinearItem.Length >= 8) { lengthOfOpen += aLinearItem.Length; } else { lengthOfStandard += aLinearItem.Length; } } else //Check to see if everything else other than mods are included { if (aLinearItem.Length >= 8) { lengthOfSolidWall += aLinearItem.Length; lengthOfStandard -= aLinearItem.Length; } } } //Add various wall pricing types to wall price based on length wallPrice += PricingConstants.MODEL_200_VINYL_HORIZONTAL_ROLLER * lengthOfStandard; wallPrice += PricingConstants.MODEL_200_SOLID_WALL_PANEL * lengthOfSolidWall; wallPrice += PricingConstants.MODEL_200_MANUFACTURED_OPEN_WALLS * lengthOfOpen; wallPrice += PricingConstants.MODEL_200_FIXED_VINYL_WALL * lengthOfFixedVinyl; //Find wall height and set appropriate pricing if ((aWall.EndHeight > 96 && aWall.EndHeight < 120) || (aWall.StartHeight > 96 && aWall.StartHeight < 120)) { wallPrice += PricingConstants.MODEL_200_NON_STANDARD_PANEL_HEIGHTS * aWall.Length; } else if (aWall.EndHeight >= 120 || aWall.StartHeight >= 120) { wallPrice += PricingConstants.MODEL_200_NON_STANDARD_PANEL_HEIGHTS_HIGHER * aWall.Length; } //Add pricing for fire protection if (aWall.FireProtection == true) { wallPrice += PricingConstants.MODEL_200_FP_HORIZONTAL_ROLLER * lengthOfStandard; wallPrice += PricingConstants.MODEL_200_FP_MANUFACTURED_OPEN_WALLS * lengthOfOpen; wallPrice += PricingConstants.MODEL_200_FP_SOLID_WALL_PANEL * lengthOfSolidWall; wallPrice += PricingConstants.MODEL_200_FP_FIXED_VINYL_WALL * lengthOfFixedVinyl; } return(wallPrice); }