// 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 // Soak (Verweking) // 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 MenuLiquefaction extends MenuSignalQuestions 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(); ResetQuestionVisibilities(); } 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("Q1A3", 10); HashTable.add("Q1A4", 11); HashTable.add("Q1A5", 12); HashTable.add("Q1A6", 13); HashTable.add("Q2", 14); HashTable.add("Q2A1", 15); HashTable.add("Q2A2", 16); HashTable.add("Q2A3", 17); HashTable.add("Q2A4", 18); HashTable.add("Q2A5", 19); HashTable.add("Q2A6", 20); HashTable.add("Q3", 21); HashTable.add("Q3A1", 22); HashTable.add("Q3A2", 23); HashTable.add("Q4", 24); HashTable.add("Q4A1", 25); HashTable.add("Q4A2", 26); } function InitializeStringData() { local Signal.GeoSignalTypes TypeThis; TypeThis = SIG_Liquefaction; 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("Q3A1")]).isChecked()) setQuestionVisibility(4, true); else setQuestionVisibility(4, false); } function InitializeCheckedness() { // FUNCTIONALITY: load values from GeoPC.NewSignal and set answerButtons checkedness accordingly local SignalLiquefaction theSignal; local SignalReportLiquefaction theSignalReport; local moCheckBox Q1A1, Q1A2, Q1A3, Q1A4, Q1A5, Q1A6, Q2A1, Q2A2, Q2A3, Q2A4, Q2A5, Q2A6, Q3A1, Q3A2, Q4A1, Q4A2; Q1A1 = moCheckBox(Controls[HashTable.getValue("Q1A1")]); Q1A2 = moCheckBox(Controls[HashTable.getValue("Q1A2")]); Q1A3 = moCheckBox(Controls[HashTable.getValue("Q1A3")]); Q1A4 = moCheckBox(Controls[HashTable.getValue("Q1A4")]); Q1A5 = moCheckBox(Controls[HashTable.getValue("Q1A5")]); Q1A6 = moCheckBox(Controls[HashTable.getValue("Q1A6")]); Q2A1 = moCheckBox(Controls[HashTable.getValue("Q2A1")]); Q2A2 = moCheckBox(Controls[HashTable.getValue("Q2A2")]); Q2A3 = moCheckBox(Controls[HashTable.getValue("Q2A3")]); Q2A4 = moCheckBox(Controls[HashTable.getValue("Q2A4")]); Q2A5 = moCheckBox(Controls[HashTable.getValue("Q2A5")]); Q2A6 = moCheckBox(Controls[HashTable.getValue("Q2A6")]); Q3A1 = moCheckBox(Controls[HashTable.getValue("Q3A1")]); Q3A2 = moCheckBox(Controls[HashTable.getValue("Q3A2")]); Q4A1 = moCheckBox(Controls[HashTable.getValue("Q4A1")]); Q4A2 = moCheckBox(Controls[HashTable.getValue("Q4A2")]); theSignal = SignalLiquefaction(GeoPC.NewSignal); if(theSignal.SignalReports.length > 0) { // get signal properties that are dependent of the state of the failure theSignalReport = SignalReportLiquefaction(theSignal.SignalReports[theSignal.SignalReports.length-1]); // QUESTION 1 if(theSignalReport.LengthOfDamage == SIZE_VerySmall) Q1A1.Checked(true); else if(theSignalReport.LengthOfDamage == SIZE_Small) Q1A2.Checked(true); else if(theSignalReport.LengthOfDamage == SIZE_Medium) Q1A3.Checked(true); else if(theSignalReport.LengthOfDamage == SIZE_MediumLarge) Q1A4.Checked(true); else if(theSignalReport.LengthOfDamage == SIZE_Large) Q1A5.Checked(true); else if(theSignalReport.LengthOfDamage == SIZE_VeryLarge) Q1A6.Checked(true); // QUESTION 2 if(theSignalReport.WidthOfDamage == SIZE_VerySmall) Q2A1.Checked(true); else if(theSignalReport.WidthOfDamage == SIZE_Small) Q2A2.Checked(true); else if(theSignalReport.WidthOfDamage == SIZE_Medium) Q2A3.Checked(true); else if(theSignalReport.WidthOfDamage == SIZE_MediumLarge) Q2A4.Checked(true); else if(theSignalReport.WidthOfDamage == SIZE_Large) Q2A5.Checked(true); else if(theSignalReport.WidthOfDamage == SIZE_VeryLarge) Q2A6.Checked(true); // QUESTION 3 if(theSignalReport.FlushingSoil == GEO_Yes) Q3A1.Checked(true); else if(theSignalReport.FlushingSoil == GEO_No) Q3A2.Checked(true); // QUESTION 4 if(theSignalReport.FlushingSoilQuantity == QUA_Little) Q4A1.Checked(true); else if(theSignalReport.FlushingSoilQuantity == QUA_Much) Q4A2.Checked(true); } } function storeAnswerValues() { // FUNCTIONALITY: look at current values in answers and save it in GeoPC.NewSignal local SignalLiquefaction theSignal; // set to GeoPC.NewSignal, working variable for the Signal answers local SignalLiquefaction OriginalSignal; // the original report made, to check for changes in observations local SignalReportLiquefaction tempSignalReport; // temporary working SignalReport for the SignalReport answers local moCheckBox Q1A1, Q1A2, Q1A3, Q1A4, Q1A5, Q1A6, Q2A1, Q2A2, Q2A3, Q2A4, Q2A5, Q2A6, Q3A1, Q3A2, Q4A1, Q4A2; local bool bObservationsChanged; // if answers are different from original answers for this report // (only used when in editing mode) local int tmp; bObservationsChanged = false; Q1A1 = moCheckBox(Controls[HashTable.getValue("Q1A1")]); Q1A2 = moCheckBox(Controls[HashTable.getValue("Q1A2")]); Q1A3 = moCheckBox(Controls[HashTable.getValue("Q1A3")]); Q1A4 = moCheckBox(Controls[HashTable.getValue("Q1A4")]); Q1A5 = moCheckBox(Controls[HashTable.getValue("Q1A5")]); Q1A6 = moCheckBox(Controls[HashTable.getValue("Q1A6")]); Q2A1 = moCheckBox(Controls[HashTable.getValue("Q2A1")]); Q2A2 = moCheckBox(Controls[HashTable.getValue("Q2A2")]); Q2A3 = moCheckBox(Controls[HashTable.getValue("Q2A3")]); Q2A4 = moCheckBox(Controls[HashTable.getValue("Q2A4")]); Q2A5 = moCheckBox(Controls[HashTable.getValue("Q2A5")]); Q2A6 = moCheckBox(Controls[HashTable.getValue("Q2A6")]); Q3A1 = moCheckBox(Controls[HashTable.getValue("Q3A1")]); Q3A2 = moCheckBox(Controls[HashTable.getValue("Q3A2")]); Q4A1 = moCheckBox(Controls[HashTable.getValue("Q4A1")]); Q4A2 = moCheckBox(Controls[HashTable.getValue("Q4A2")]); theSignal = SignalLiquefaction(GeoPC.NewSignal.Duplicate()); // create a SignalReport for this Signal tempSignalReport = new class'SignalReportLiquefaction'; // set SignalReport properties (that are dependent of the failure state) // QUESTION 1 if(Q1A1.isChecked()) tempSignalReport.LengthOfDamage = SIZE_VerySmall; else if(Q1A2.isChecked()) tempSignalReport.LengthOfDamage = SIZE_Small; else if(Q1A3.isChecked()) tempSignalReport.LengthOfDamage = SIZE_Medium; else if(Q1A4.isChecked()) tempSignalReport.LengthOfDamage = SIZE_MediumLarge; else if(Q1A5.isChecked()) tempSignalReport.LengthOfDamage = SIZE_Large; else if(Q1A6.isChecked()) tempSignalReport.LengthOfDamage = SIZE_VeryLarge; // QUESTION 2 if(Q2A1.isChecked()) tempSignalReport.WidthOfDamage = SIZE_VerySmall; else if(Q2A2.isChecked()) tempSignalReport.WidthOfDamage = SIZE_Small; else if(Q2A3.isChecked()) tempSignalReport.WidthOfDamage = SIZE_Medium; else if(Q2A4.isChecked()) tempSignalReport.WidthOfDamage = SIZE_MediumLarge; else if(Q2A5.isChecked()) tempSignalReport.WidthOfDamage = SIZE_Large; else if(Q2A6.isChecked()) tempSignalReport.WidthOfDamage = SIZE_VeryLarge; // QUESTION 3 if(Q3A1.isChecked()) tempSignalReport.FlushingSoil = GEO_Yes; else if(Q3A2.isChecked()) tempSignalReport.FlushingSoil = GEO_No; // QUESTION 4 if(tempSignalReport.FlushingSoil == GEO_No) tempSignalReport.FlushingSoilQuantity = QUA_NONE; else if(Q4A1.isChecked()) tempSignalReport.FlushingSoilQuantity = QUA_Little; else if(Q4A2.isChecked()) tempSignalReport.FlushingSoilQuantity = QUA_Much; // 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 = SignalLiquefaction(GeoPC.NearbyMarker.SignalOriginals[GeoPC.EditIndex]); // 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; } 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' Controls(10)=moCheckBox'AnswerButton' Controls(11)=moCheckBox'AnswerButton' Controls(12)=moCheckBox'AnswerButton' Controls(13)=moCheckBox'AnswerButton' // QUESTION 2 Controls(14)=GUILabel'QuestionLabel' Controls(15)=moCheckBox'AnswerButton' Controls(16)=moCheckBox'AnswerButton' Controls(17)=moCheckBox'AnswerButton' Controls(18)=moCheckBox'AnswerButton' Controls(19)=moCheckBox'AnswerButton' Controls(20)=moCheckBox'AnswerButton' // QUESTION 3 Controls(21)=GUILabel'QuestionLabel' Controls(22)=moCheckBox'AnswerButton' Controls(23)=moCheckBox'AnswerButton' // QUESTION 4 Controls(24)=GUILabel'QuestionLabel' Controls(25)=moCheckBox'AnswerButton' Controls(26)=moCheckBox'AnswerButton' MenuWidth=0.85 MenuHeight=0.60 // override standard values of superclass here! EN_Title = "Observation report for liquefaction" NL_Title = "Observatierapport voor verweking" HelpMenuOption=10 }