// September 2015 // Levee Patroller / Dijk Patrouille // This source file is (c) by Deltares. This source file is open source but only available to select users. Do not redistribute without written permission of Stichting Deltares, Delft, The Netherlands. // This header has been automatically generated. //============================================================================= // In game menu for filling in the questions associated with // Overtopping / Overwash (Overloop / Overslag) // Started from MenuObservationReport. // ------------------------------------------------------------ // Created by Maarten van Zomeren // Template by Maarten Wesselius // © 2006, GeoDelft // // 2007-01-29 wsl Made sure that all answers to non-applicable questions are always set to NONE enum values. //============================================================================= class MenuOverToppingWash extends MenuSignalQuestions dependsOn(GeoPlayerController); function InitComponent(GUIController MyController, GUIComponent MyOwner) { local float verticalOffset; GeoPC=GeoPlayerController(MyController.ViewportOwner.Actor); if(GeoPC!=None) UpdateLanguage(); else log("ERROR WITH TYPE OF GAME"); InitializeHashTable(); InitializeStringData(); Super.InitComponent(MyController, MyOwner); // the distance verticalOffset = QuestionHeight + CheckBoxHeight + ButtonVGapSmall + ButtonVGapLarge; // Initialize the values of questions InitializeCheckedness(); if(GeoPC.ReportingMode == MODE_CreatingNewObservation || GeoPC.ReportingMode == MODE_EditingFirstReport) { InitFirstReport(verticalOffset); } else { InitLaterReport(verticalOffset); } ResetQuestionVisibilities(); } function InitLaterReport(float verticalOffset) { local moCheckBox Q1A1, Q1A2; Q1A1 = moCheckBox(Controls[HashTable.getValue("Q1A1")]); Q1A2 = moCheckBox(Controls[HashTable.getValue("Q1A2")]); // put the right caption in the answers, telling the user that this is what they filled in before if(GeoPC.Dutch) { Q1A1.MyLabel.Caption = NL_ChosenBefore $ Q1A1.MyLabel.Caption; Q1A2.MyLabel.Caption = NL_ChosenBefore $ Q1A2.MyLabel.Caption; } else { Q1A1.MyLabel.Caption = EN_ChosenBefore $ Q1A1.MyLabel.Caption; Q1A2.MyLabel.Caption = EN_ChosenBefore $ Q1A2.MyLabel.Caption; } Q1A1.WinWidth = getAnswerWidthValue(Q1A1.myLabel.Caption); Q1A2.WinWidth = getAnswerWidthValue(Q1A2.myLabel.Caption); //Check which answer of question 1 is true if(Q1A1.IsChecked()) { //the first answer of question 1 is true; show only this answer, without checkbox Q1A1.MyCheckBox.SetVisibility(false); Q1A2.SetVisibility(false); } else { //the second answer of question 1 is true; show only this answer, without checkbox Q1A2.MyCheckBox.SetVisibility(false); Q1A1.SetVisibility(false); Q1A2.WinLeft = moCheckBox(Controls[HashTable.getValue("Q1A1")]).WinLeft; // get question 7 inbetween 1 and 2, and move the following stuff down InitFirstReport(verticalOffset); } } function InitFirstReport(float verticalOffset) { // put question 7/1A in the right place GUILabel(Controls[HashTable.getValue("Q7")]).WinTop = GUILabel(Controls[HashTable.getValue("Q2")]).WinTop; moCheckBox(Controls[HashTable.getValue("Q7A1")]).WinTop = moCheckBox(Controls[HashTable.getValue("Q2A1")]).WinTop; moCheckBox(Controls[HashTable.getValue("Q7A2")]).WinTop = moCheckBox(Controls[HashTable.getValue("Q2A2")]).WinTop; // move question 2 down GUILabel(Controls[HashTable.getValue("Q2")]).WinTop += verticalOffset; moCheckBox(Controls[HashTable.getValue("Q2A1")]).WinTop += verticalOffset; moCheckBox(Controls[HashTable.getValue("Q2A2")]).WinTop += verticalOffset; // move question 3 down GUILabel(Controls[HashTable.getValue("Q3")]).WinTop += verticalOffset; moCheckBox(Controls[HashTable.getValue("Q3A1")]).WinTop += verticalOffset; moCheckBox(Controls[HashTable.getValue("Q3A2")]).WinTop += verticalOffset; // move question 4 down GUILabel(Controls[HashTable.getValue("Q4")]).WinTop += verticalOffset; moCheckBox(Controls[HashTable.getValue("Q4A1")]).WinTop += verticalOffset; moCheckBox(Controls[HashTable.getValue("Q4A2")]).WinTop += verticalOffset; // move question 5 down GUILabel(Controls[HashTable.getValue("Q5")]).WinTop += verticalOffset; moCheckBox(Controls[HashTable.getValue("Q5A1")]).WinTop += verticalOffset; moCheckBox(Controls[HashTable.getValue("Q5A2")]).WinTop += verticalOffset; // move question 6 down GUILabel(Controls[HashTable.getValue("Q6")]).WinTop += verticalOffset; moCheckBox(Controls[HashTable.getValue("Q6A1")]).WinTop += verticalOffset; moCheckBox(Controls[HashTable.getValue("Q6A2")]).WinTop += verticalOffset; } function InitializeHashTable() { // FUNCTIONALITY: initialize the hashtable with the keys (which should be "Q1", "Q1A1", // "Q2", "Q2A3", etc.) and its corresponding values (the index in the controls-array). HashTable = New class'QAHashTable'; HashTable.add("Q1", 7); HashTable.add("Q1A1", 8); HashTable.add("Q1A2", 9); HashTable.add("Q2", 10); HashTable.add("Q2A1", 11); HashTable.add("Q2A2", 12); HashTable.add("Q3", 13); HashTable.add("Q3A1", 14); HashTable.add("Q3A2", 15); HashTable.add("Q4", 16); HashTable.add("Q4A1", 17); HashTable.add("Q4A2", 18); HashTable.add("Q5", 19); HashTable.add("Q5A1", 20); HashTable.add("Q5A2", 21); HashTable.add("Q6", 22); HashTable.add("Q6A1", 23); HashTable.add("Q6A2", 24); HashTable.add("Q7", 25); HashTable.add("Q7A1", 26); HashTable.add("Q7A2", 27); } function InitializeStringData() { local Signal.GeoSignalTypes TypeThis; TypeThis = SIG_OverToppingWash; if (!GeoPC.IsDroogte()) { DataObject = new class'SignalStringData'; }else { DataObject = new class'SignalStringDataDroogte'; } NrQuestions = DataObject.GetNrQuestions(TypeThis); EN_QuestionStrings = DataObject.GetQuestionStrings(TypeThis, false); NL_QuestionStrings = DataObject.GetQuestionStrings(TypeThis, true); EN_AnswerStrings = DataObject.GetAnswerStrings(TypeThis, false); NL_AnswerStrings = DataObject.GetAnswerStrings(TypeThis, true); } function bool OnAnswerButtonClick(GUIComponent Sender) { super.OnAnswerButtonClick(Sender); ResetQuestionVisibilities(); return true; } function ResetQuestionVisibilities() { // if Question 5, answer 1 was clicked, make question 6 and it's answers visible // and if Question 5, answer 2 was clicked, make question 6 and it's answers invisible //if(Sender == moCheckBox(Controls[HashTable.getValue("Q5A1")]).myCheckBox) if(moCheckBox(Controls[HashTable.getValue("Q5A1")]).isChecked()) setQuestionVisibility(6, true); else setQuestionVisibility(6, false); // if Question 1, answer 2 was clicked, make question 7 and it's answers visible // and if Question 1, answer 1 was clicked, make question 7 and it's answers invisible if(moCheckBox(Controls[HashTable.getValue("Q1A2")]).isChecked()) setQuestionVisibility(7, true); else setQuestionVisibility(7, false); } function InitializeCheckedness() { // FUNCTIONALITY: load values from GeoPC.NewSignal and set answerButtons checkedness accordingly local SignalOverToppingWash theSignal; local SignalReportOverToppingWash theSignalReport; local moCheckBox Q1A1, Q1A2, Q2A1, Q2A2, Q3A1, Q3A2, Q4A1, Q4A2, Q5A1, Q5A2, Q6A1, Q6A2, Q7A1, Q7A2; Q1A1 = moCheckBox(Controls[HashTable.getValue("Q1A1")]); Q1A2 = moCheckBox(Controls[HashTable.getValue("Q1A2")]); Q2A1 = moCheckBox(Controls[HashTable.getValue("Q2A1")]); Q2A2 = moCheckBox(Controls[HashTable.getValue("Q2A2")]); Q3A1 = moCheckBox(Controls[HashTable.getValue("Q3A1")]); Q3A2 = moCheckBox(Controls[HashTable.getValue("Q3A2")]); Q4A1 = moCheckBox(Controls[HashTable.getValue("Q4A1")]); Q4A2 = moCheckBox(Controls[HashTable.getValue("Q4A2")]); Q5A1 = moCheckBox(Controls[HashTable.getValue("Q5A1")]); Q5A2 = moCheckBox(Controls[HashTable.getValue("Q5A2")]); Q6A1 = moCheckBox(Controls[HashTable.getValue("Q6A1")]); Q6A2 = moCheckBox(Controls[HashTable.getValue("Q6A2")]); Q7A1 = moCheckBox(Controls[HashTable.getValue("Q7A1")]); Q7A2 = moCheckBox(Controls[HashTable.getValue("Q7A2")]); //log("lengte van NewSignal.SignalReports = "$GeoPC.NewSignal.SignalReports.length); theSignal = SignalOverToppingWash(GeoPC.NewSignal); // get signal properties that are independent of the state of the failure // QUESTION 1 if(theSignal.TypeOcurring == OVER_Topping) Q1A1.Checked(true); else if(theSignal.TypeOcurring == OVER_Wash) Q1A2.Checked(true); if(theSignal.SignalReports.length > 0) { // get signal properties that are dependent of the state of the failure theSignalReport = SignalReportOverToppingWash(theSignal.SignalReports[theSignal.SignalReports.length-1]); // QUESTION 2 if(theSignalReport.IsAccessible == GEO_Yes) Q2A1.Checked(true); else if(theSignalReport.IsAccessible == GEO_No) Q2A2.Checked(true); // QUESTION 3 if(theSignalReport.InfiltrateTopInner == GEO_Yes) Q3A1.Checked(true); else if(theSignalReport.InfiltrateTopInner == GEO_No) Q3A2.Checked(true); // QUESTION 4 if(theSignalReport.WaterFlowQuantity == QUA_Little) Q4A1.Checked(true); else if(theSignalReport.WaterFlowQuantity == QUA_Much) Q4A2.Checked(true); // QUESTION 5 if(theSignalReport.FlushingSoil == GEO_Yes) Q5A1.Checked(true); else if(theSignalReport.FlushingSoil == GEO_No) Q5A2.Checked(true); // QUESTION 6 if(theSignalReport.FlushingSoilQuantity == QUA_Little) Q6A1.Checked(true); else if(theSignalReport.FlushingSoilQuantity == QUA_Much) Q6A2.Checked(true); // QUESTION 7 if(theSignalReport.WavesDescription == WAVE_Medium) Q7A1.Checked(true); else if(theSignalReport.WavesDescription == WAVE_Fierce) Q7A2.Checked(true); } } function storeAnswerValues() { // FUNCTIONALITY: look at current values in answers and save it in GeoPC.NewSignal local SignalOverToppingWash theSignal; // set to GeoPC.NewSignal, working variable for the Signal answers local SignalOverToppingWash OriginalSignal; // the original report made, to check for changes in observations local SignalReportOverToppingWash tempSignalReport; // temporary working SignalReport for the SignalReport answers local moCheckBox Q1A1, Q1A2, Q2A1, Q2A2, Q3A1, Q3A2, Q4A1, Q4A2, Q5A1, Q5A2, Q6A1, Q6A2, Q7A1, Q7A2; local bool bObservationsChanged; local int tmp; bObservationsChanged = false; Q1A1 = moCheckBox(Controls[HashTable.getValue("Q1A1")]); Q1A2 = moCheckBox(Controls[HashTable.getValue("Q1A2")]); Q2A1 = moCheckBox(Controls[HashTable.getValue("Q2A1")]); Q2A2 = moCheckBox(Controls[HashTable.getValue("Q2A2")]); Q3A1 = moCheckBox(Controls[HashTable.getValue("Q3A1")]); Q3A2 = moCheckBox(Controls[HashTable.getValue("Q3A2")]); Q4A1 = moCheckBox(Controls[HashTable.getValue("Q4A1")]); Q4A2 = moCheckBox(Controls[HashTable.getValue("Q4A2")]); Q5A1 = moCheckBox(Controls[HashTable.getValue("Q5A1")]); Q5A2 = moCheckBox(Controls[HashTable.getValue("Q5A2")]); Q6A1 = moCheckBox(Controls[HashTable.getValue("Q6A1")]); Q6A2 = moCheckBox(Controls[HashTable.getValue("Q6A2")]); Q7A1 = moCheckBox(Controls[HashTable.getValue("Q7A1")]); Q7A2 = moCheckBox(Controls[HashTable.getValue("Q7A2")]); theSignal = SignalOverToppingWash(GeoPC.NewSignal.Duplicate()); // create a SignalReport for this Signal tempSignalReport = new class'SignalReportOverToppingWash'; // set Signal properties (that are independent of the state of the failure) // QUESTION 1 if(Q1A1.isChecked()) theSignal.TypeOcurring = OVER_Topping; else if(Q1A2.isChecked()) theSignal.TypeOcurring = OVER_Wash; // set SignalReport properties (that are dependent of the failure state) // QUESTION 2 if(Q2A1.isChecked()) tempSignalReport.IsAccessible = GEO_Yes; else if(Q2A2.isChecked()) tempSignalReport.IsAccessible = GEO_No; // QUESTION 3 if(Q3A1.isChecked()) tempSignalReport.InfiltrateTopInner = GEO_Yes; else if(Q3A2.isChecked()) tempSignalReport.InfiltrateTopInner = GEO_No; // QUESTION 4 if(Q4A1.isChecked()) tempSignalReport.WaterFlowQuantity = QUA_Little; else if(Q4A2.isChecked()) tempSignalReport.WaterFlowQuantity = QUA_Much; // QUESTION 5 if(Q5A1.isChecked()) tempSignalReport.FlushingSoil = GEO_Yes; else if(Q5A2.isChecked()) tempSignalReport.FlushingSoil = GEO_No; // QUESTION 6 if(tempSignalReport.FlushingSoil == GEO_No) tempSignalReport.FlushingSoilQuantity = QUA_NONE; else if(Q6A1.isChecked()) tempSignalReport.FlushingSoilQuantity = QUA_Little; else if(Q6A2.isChecked()) tempSignalReport.FlushingSoilQuantity = QUA_Much; // QUESTION 7 if(theSignal.TypeOcurring == OVER_Topping) tempSignalReport.WavesDescription = WAVE_NONE; else if(Q7A1.isChecked()) tempSignalReport.WavesDescription = WAVE_Medium; else if(Q7A2.isChecked()) tempSignalReport.WavesDescription = WAVE_Fierce; // now check if observations have changed (only applicable in editing mode) if(GeoPC.ReportingMode == MODE_EditingFirstReport || GeoPC.ReportingMode == MODE_EditingLaterReport) { // if there is already an original, use it to get the answers // from last time, in order to see if any changes were made regarding the original. OriginalSignal = SignalOverToppingWash(GeoPC.NearbyMarker.SignalOriginals[GeoPC.EditIndex]); if(OriginalSignal.TypeOcurring != theSignal.TypeOcurring) bObservationsChanged = true; // for the SignalReport-answers, IsEqual() is used to check for changes if(!tempSignalReport.IsEqual(OriginalSignal.SignalReports[OriginalSignal.SignalReports.length - 1], 0.95,tmp,tmp)) bObservationsChanged = true; // bChanged reflects if any changes were made regarding the original report tempSignalReport.bChanged = bObservationsChanged; } if(theSignal.TypeOcurring!=2) { theSignal.NL_DamageName = NL_AnswerStrings[0].Answers[theSignal.TypeOcurring]; theSignal.EN_DamageName = EN_AnswerStrings[0].Answers[theSignal.TypeOcurring]; } SaveAnswers(theSignal, tempSignalReport); } defaultproperties { // Controls 6 to 31 are the labels for the questions, and the buttons for the possible answers // common properties of all answer buttons // QUESTION 1 Controls(7)=GUILabel'QuestionLabel' Controls(8)=moCheckBox'AnswerButton' Controls(9)=moCheckBox'AnswerButton' // QUESTION 2 Controls(10)=GUILabel'QuestionLabel' Controls(11)=moCheckBox'AnswerButton' Controls(12)=moCheckBox'AnswerButton' // QUESTION 3 Controls(13)=GUILabel'QuestionLabel' Controls(14)=moCheckBox'AnswerButton' Controls(15)=moCheckBox'AnswerButton' // QUESTION 4 Controls(16)=GUILabel'QuestionLabel' Controls(17)=moCheckBox'AnswerButton' Controls(18)=moCheckBox'AnswerButton' // QUESTION 5 Controls(19)=GUILabel'QuestionLabel' Controls(20)=moCheckBox'AnswerButton' Controls(21)=moCheckBox'AnswerButton' // QUESTION 6 Controls(22)=GUILabel'QuestionLabel' Controls(23)=moCheckBox'AnswerButton' Controls(24)=moCheckBox'AnswerButton' // QUESTION 7 Controls(25)=GUILabel'QuestionLabel' Controls(26)=moCheckBox'AnswerButton' Controls(27)=moCheckBox'AnswerButton' MenuWidth=0.75 MenuHeight=0.9 // override standard values of superclass here! EN_Title = "Observation report for overtopping / overwash" NL_Title = "Observatie rapport voor overloop / overslag" HelpMenuOption=9 }