// 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 // Crack (Scheur) // Started from MenuObservationReport. // // *** It is the same as MenuCrack only extends another class // for the Training Level - Gui (21-9-2006) // // ------------------------------------------------------------ // Created by Maarten van Zomeren // Template by Maarten Wesselius // © 2006, GeoDelft //============================================================================= class MenuTrainingCrack extends MenuTrainingSignalQuestions dependsOn(GeoPlayerController); function InitComponent(GUIController MyController, GUIComponent MyOwner) { GeoPC=GeoPlayerController(MyController.ViewportOwner.Actor); if(GeoPC!=None) UpdateLanguage(); else log("ERROR WITH TYPE OF GAME"); InitializeHashTable(); InitializeStringData(); Super.InitComponent(MyController, MyOwner); InitializeCheckedness(); if(GeoPC.ReportingMode == MODE_CreatingNewObservation || GeoPC.ReportingMode == MODE_EditingFirstReport) { // first report; nothing special needs to be done } else { InitLaterReport(); } ResetQuestionVisibilities(); } function InitLaterReport() { local moCheckBox Q1A1, Q1A2, Q2A1, Q2A2; Q1A1 = moCheckBox(Controls[HashTable.getValue("Q1A1")]); Q1A2 = moCheckBox(Controls[HashTable.getValue("Q1A2")]); Q2A1 = moCheckBox(Controls[HashTable.getValue("Q2A1")]); Q2A2 = moCheckBox(Controls[HashTable.getValue("Q2A2")]); if(GeoPC.Dutch) { Q1A1.MyLabel.Caption = NL_ChosenBefore $ Q1A1.MyLabel.Caption; Q1A2.MyLabel.Caption = NL_ChosenBefore $ Q1A2.MyLabel.Caption; Q2A1.MyLabel.Caption = NL_ChosenBefore $ Q2A1.MyLabel.Caption; Q2A2.MyLabel.Caption = NL_ChosenBefore $ Q2A2.MyLabel.Caption; } else { Q1A1.MyLabel.Caption = EN_ChosenBefore $ Q1A1.MyLabel.Caption; Q1A2.MyLabel.Caption = EN_ChosenBefore $ Q1A2.MyLabel.Caption; Q2A1.MyLabel.Caption = EN_ChosenBefore $ Q2A1.MyLabel.Caption; Q2A2.MyLabel.Caption = EN_ChosenBefore $ Q2A2.MyLabel.Caption; } Q1A1.WinWidth = getAnswerWidthValue(Q1A1.myLabel.Caption); Q1A2.WinWidth = getAnswerWidthValue(Q1A2.myLabel.Caption); Q2A1.WinWidth = getAnswerWidthValue(Q2A1.myLabel.Caption); Q2A2.WinWidth = getAnswerWidthValue(Q2A2.myLabel.Caption); 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 = Q1A1.WinLeft; } if(Q2A1.IsChecked()) { //the first answer of question 2 is true; show only this answer, without checkbox Q2A1.MyCheckBox.SetVisibility(false); Q2A2.SetVisibility(false); } else { //the second answer of question 2 is true; show only this answer, without checkbox Q2A2.MyCheckBox.SetVisibility(false); Q2A1.SetVisibility(false); Q2A2.WinLeft = Q2A1.WinLeft; } } function bool OnAnswerButtonClick(GUIComponent Sender) { super.OnAnswerButtonClick(Sender); ResetQuestionVisibilities(); return true; } function ResetQuestionVisibilities() { // if Question 6, answer 1 was clicked, make question 7 and it's answers visible // and if Question 6, answer 2 was clicked, make question 7 and it's answers invisible //if(Sender == moCheckBox(Controls[HashTable.getValue("Q5A1")]).myCheckBox) if(moCheckBox(Controls[HashTable.getValue("Q6A1")]).isChecked()) setQuestionVisibility(7, true); else setQuestionVisibility(7, false); } 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", 6); HashTable.add("Q1A1", 7); HashTable.add("Q1A2", 8); HashTable.add("Q2", 9); HashTable.add("Q2A1", 10); HashTable.add("Q2A2", 11); HashTable.add("Q3", 12); HashTable.add("Q3A1", 13); HashTable.add("Q3A2", 14); HashTable.add("Q3A3", 15); HashTable.add("Q3A4", 16); HashTable.add("Q3A5", 17); HashTable.add("Q3A6", 18); HashTable.add("Q4", 19); HashTable.add("Q4A1", 20); HashTable.add("Q4A2", 21); HashTable.add("Q4A3", 22); HashTable.add("Q4A4", 23); HashTable.add("Q4A5", 24); HashTable.add("Q4A6", 25); HashTable.add("Q5", 26); HashTable.add("Q5A1", 27); HashTable.add("Q5A2", 28); HashTable.add("Q6", 29); HashTable.add("Q6A1", 30); HashTable.add("Q6A2", 31); HashTable.add("Q7", 32); HashTable.add("Q7A1", 33); HashTable.add("Q7A2", 34); } function InitializeStringData() { local Signal.GeoSignalTypes TypeThis; TypeThis = SIG_Crack; 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 InitializeCheckedness() { // FUNCTIONALITY: load values from GeoPC.NewSignal and set answerButtons checkedness accordingly local SignalCrack theSignal; local SignalReportCrack theSignalReport; local moCheckBox Q1A1, Q1A2, Q2A1, Q2A2, Q3A1, Q3A2, Q3A3, Q3A4, Q3A5, Q3A6, Q4A1, Q4A2, Q4A3, Q4A4, Q4A5, Q4A6, 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")]); Q3A3 = moCheckBox(Controls[HashTable.getValue("Q3A3")]); Q3A4 = moCheckBox(Controls[HashTable.getValue("Q3A4")]); Q3A5 = moCheckBox(Controls[HashTable.getValue("Q3A5")]); Q3A6 = moCheckBox(Controls[HashTable.getValue("Q3A6")]); Q4A1 = moCheckBox(Controls[HashTable.getValue("Q4A1")]); Q4A2 = moCheckBox(Controls[HashTable.getValue("Q4A2")]); Q4A3 = moCheckBox(Controls[HashTable.getValue("Q4A3")]); Q4A4 = moCheckBox(Controls[HashTable.getValue("Q4A4")]); Q4A5 = moCheckBox(Controls[HashTable.getValue("Q4A5")]); Q4A6 = moCheckBox(Controls[HashTable.getValue("Q4A6")]); 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 = SignalCrack(GeoPC.NewSignal); // get signal properties that are independent of the state of the failure // QUESTION 1 if(theSignal.RevetmentType == REV_Grass) Q1A1.Checked(true); else if(theSignal.RevetmentType == REV_Asphalt) Q1A2.Checked(true); // QUESTION 2 if(theSignal.CrackType == CRK_Perpendicular) Q2A1.Checked(true); else if(theSignal.CrackType == CRK_Parallel) Q2A2.Checked(true); if(theSignal.SignalReports.length > 0) { // get signal properties that are dependent of the state of the failure theSignalReport = SignalReportCrack(theSignal.SignalReports[theSignal.SignalReports.length-1]); // QUESTION 3 if(theSignalReport.LengthOfDamage == SIZE_VerySmall) Q3A1.Checked(true); else if(theSignalReport.LengthOfDamage == SIZE_Small) Q3A2.Checked(true); else if(theSignalReport.LengthOfDamage == SIZE_Medium) Q3A3.Checked(true); else if(theSignalReport.LengthOfDamage == SIZE_MediumLarge) Q3A4.Checked(true); else if(theSignalReport.LengthOfDamage == SIZE_Large) Q3A5.Checked(true); else if(theSignalReport.LengthOfDamage == SIZE_VeryLarge) Q3A6.Checked(true); // QUESTION 4 if(theSignalReport.WidthOfDamage == SIZE_VerySmall) Q4A1.Checked(true); else if(theSignalReport.WidthOfDamage == SIZE_Small) Q4A2.Checked(true); else if(theSignalReport.WidthOfDamage == SIZE_Medium) Q4A3.Checked(true); else if(theSignalReport.WidthOfDamage == SIZE_MediumLarge) Q4A4.Checked(true); else if(theSignalReport.WidthOfDamage == SIZE_Large) Q4A5.Checked(true); else if(theSignalReport.WidthOfDamage == SIZE_VeryLarge) Q4A6.Checked(true); // QUESTION 5 if(theSignalReport.MultipleCracks == GEO_Yes) Q5A1.Checked(true); else if(theSignalReport.MultipleCracks == GEO_No) Q5A2.Checked(true); // QUESTION 6 if(theSignalReport.FlushingSoil == GEO_Yes) Q6A1.Checked(true); else if(theSignalReport.FlushingSoil == GEO_No) Q6A2.Checked(true); // QUESTION 7 if(theSignalReport.FlushingSoilQuantity == QUA_Little) Q7A1.Checked(true); else if(theSignalReport.FlushingSoilQuantity == QUA_Much) Q7A2.Checked(true); } } function storeAnswerValues() { // FUNCTIONALITY: look at current values in answers and save it in GeoPC.NewSignal local SignalCrack theSignal; local SignalReportCrack tempSignalReport; local int tempIndex; local moCheckBox Q1A1, Q1A2, Q2A1, Q2A2, Q3A1, Q3A2, Q3A3, Q3A4, Q3A5, Q3A6, Q4A1, Q4A2, Q4A3, Q4A4, Q4A5, Q4A6, 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")]); Q3A3 = moCheckBox(Controls[HashTable.getValue("Q3A3")]); Q3A4 = moCheckBox(Controls[HashTable.getValue("Q3A4")]); Q3A5 = moCheckBox(Controls[HashTable.getValue("Q3A5")]); Q3A6 = moCheckBox(Controls[HashTable.getValue("Q3A6")]); Q4A1 = moCheckBox(Controls[HashTable.getValue("Q4A1")]); Q4A2 = moCheckBox(Controls[HashTable.getValue("Q4A2")]); Q4A3 = moCheckBox(Controls[HashTable.getValue("Q4A3")]); Q4A4 = moCheckBox(Controls[HashTable.getValue("Q4A4")]); Q4A5 = moCheckBox(Controls[HashTable.getValue("Q4A5")]); Q4A6 = moCheckBox(Controls[HashTable.getValue("Q4A6")]); 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 = SignalCrack(GeoPC.NewSignal); // create a SignalReport for this Signal and set the failure state at this time tempSignalReport = new class'SignalReportCrack'; tempSignalReport.GeoState = GeoPC.GetCurrentFailureState(); // set Signal properties (that are independent of the state of the failure) // QUESTION 1 if(Q1A1.isChecked()) theSignal.RevetmentType = REV_Grass; else if(Q1A2.isChecked()) theSignal.RevetmentType = REV_Asphalt; // QUESTION 2 if(Q2A1.isChecked()) theSignal.CrackType = CRK_Perpendicular; else if(Q2A2.isChecked()) theSignal.CrackType = CRK_Parallel; // set SignalReport properties (that are dependent of the failure state) // QUESTION 3 if(Q3A1.isChecked()) tempSignalReport.LengthOfDamage = SIZE_VerySmall; else if(Q3A2.isChecked()) tempSignalReport.LengthOfDamage = SIZE_Small; else if(Q3A3.isChecked()) tempSignalReport.LengthOfDamage = SIZE_Medium; else if(Q3A4.isChecked()) tempSignalReport.LengthOfDamage = SIZE_MediumLarge; else if(Q3A5.isChecked()) tempSignalReport.LengthOfDamage = SIZE_Large; else if(Q3A6.isChecked()) tempSignalReport.LengthOfDamage = SIZE_VeryLarge; // QUESTION 4 if(Q4A1.isChecked()) tempSignalReport.WidthOfDamage = SIZE_VerySmall; else if(Q4A2.isChecked()) tempSignalReport.WidthOfDamage = SIZE_Small; else if(Q4A3.isChecked()) tempSignalReport.WidthOfDamage = SIZE_Medium; else if(Q4A4.isChecked()) tempSignalReport.WidthOfDamage = SIZE_MediumLarge; else if(Q4A5.isChecked()) tempSignalReport.WidthOfDamage = SIZE_Large; else if(Q4A6.isChecked()) tempSignalReport.WidthOfDamage = SIZE_VeryLarge; // QUESTION 5 if(Q5A1.isChecked()) tempSignalReport.MultipleCracks = GEO_Yes; else if(Q5A2.isChecked()) tempSignalReport.MultipleCracks = GEO_No; // QUESTION 6 if(Q6A1.isChecked()) tempSignalReport.FlushingSoil = GEO_Yes; else if(Q6A2.isChecked()) tempSignalReport.FlushingSoil = GEO_No; // QUESTION 7 if(Q7A1.isChecked()) tempSignalReport.FlushingSoilQuantity = QUA_Little; else if(Q7A2.isChecked()) tempSignalReport.FlushingSoilQuantity = QUA_Much; // add the SignalReport to the Signal if(GeoPC.ReportingMode == MODE_AddingNewReport || GeoPC.ReportingMode == MODE_CreatingNewObservation) { tempIndex = theSignal.SignalReports.length; theSignal.SignalReports.Insert(tempIndex, 1); theSignal.bApproved = false; } else { tempIndex = theSignal.SignalReports.length - 1; } theSignal.SignalReports[tempIndex] = tempSignalReport; theSignal.bReported = false; } 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(6)=GUILabel'QuestionLabel' Controls(7)=moCheckBox'AnswerButton' Controls(8)=moCheckBox'AnswerButton' // QUESTION 2 Controls(9)=GUILabel'QuestionLabel' Controls(10)=moCheckBox'AnswerButton' Controls(11)=moCheckBox'AnswerButton' // QUESTION 3 Controls(12)=GUILabel'QuestionLabel' Controls(13)=moCheckBox'AnswerButton' Controls(14)=moCheckBox'AnswerButton' Controls(15)=moCheckBox'AnswerButton' Controls(16)=moCheckBox'AnswerButton' Controls(17)=moCheckBox'AnswerButton' Controls(18)=moCheckBox'AnswerButton' // QUESTION 4 Controls(19)=GUILabel'QuestionLabel' Controls(20)=moCheckBox'AnswerButton' Controls(21)=moCheckBox'AnswerButton' Controls(22)=moCheckBox'AnswerButton' Controls(23)=moCheckBox'AnswerButton' Controls(24)=moCheckBox'AnswerButton' Controls(25)=moCheckBox'AnswerButton' // QUESTION 5 Controls(26)=GUILabel'QuestionLabel' Controls(27)=moCheckBox'AnswerButton' Controls(28)=moCheckBox'AnswerButton' // QUESTION 6 Controls(29)=GUILabel'QuestionLabel' Controls(30)=moCheckBox'AnswerButton' Controls(31)=moCheckBox'AnswerButton' // QUESTION 7 Controls(32)=GUILabel'QuestionLabel' Controls(33)=moCheckBox'AnswerButton' Controls(34)=moCheckBox'AnswerButton' MenuWidth=0.85 MenuHeight=0.9 // override standard values of superclass here! EN_Title = "Observation report for a crack" NL_Title = "Observatie rapport voor een scheur" }