// 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 // Human Activity (Menselijke Activiteit) // Started from MenuObservationReport. // ------------------------------------------------------------ // Created by Maarten van Zomeren // Template by Maarten Wesselius // © 2006, GeoDelft //============================================================================= class MenuHumanActivity extends MenuSignalQuestions dependsOn(Signal); 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); InitializeCheckedness(); verticalOffset = CheckBoxHeight + ButtonVGapSmall; moCheckBox(Controls[HashTable.getValue("Q1A2")]).WinLeft = moCheckBox(Controls[HashTable.getValue("Q1A2")]).WinLeft +ButtonHGap; moCheckBox(Controls[HashTable.getValue("Q1A2")]).WinWidth = moCheckBox(Controls[HashTable.getValue("Q1A2")]).WinWidth+0.02; moCheckBox(Controls[HashTable.getValue("Q1A3")]).WinLeft = moCheckBox(Controls[HashTable.getValue("Q1A3")]).WinLeft +2*ButtonHGap; moCheckBox(Controls[HashTable.getValue("Q1A4")]).WinTop += verticalOffset; moCheckBox(Controls[HashTable.getValue("Q1A5")]).WinTop += verticalOffset; moCheckBox(Controls[HashTable.getValue("Q1A4")]).WinLeft = moCheckBox(Controls[HashTable.getValue("Q1A1")]).WinLeft; moCheckBox(Controls[HashTable.getValue("Q1A5")]).WinLeft = moCheckBox(Controls[HashTable.getValue("Q1A2")]).WinLeft; } 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); } function InitializeStringData() { local Signal.GeoSignalTypes TypeThis; TypeThis = SIG_HumanActivity; 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 SignalHumanActivity theSignal; local moCheckBox Q1A1, Q1A2, Q1A3, Q1A4, Q1A5; 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")]); theSignal = SignalHumanActivity(GeoPC.NewSignal); // get signal properties that are independent of the state of the failure // QUESTION 1 if(theSignal.RiskCause == RISK_CabelsPipes) Q1A1.Checked(true); else if(theSignal.RiskCause == RISK_ConstructionWork) Q1A2.Checked(true); else if(theSignal.RiskCause == RISK_Traffic) Q1A3.Checked(true); else if(theSignal.RiskCause == RISK_ChangesDike) Q1A4.Checked(true); else if(theSignal.RiskCause == RISK_NonWaterObjects) Q1A5.Checked(true); } function storeAnswerValues() { // FUNCTIONALITY: look at current values in answers and save it in GeoPC.NewSignal local SignalHumanActivity theSignal; // set to GeoPC.NewSignal, working variable for the Signal answers local SignalHumanActivity OriginalSignal; // the original report made, to check for changes in observations local SignalReportHumanActivity tempSignalReport; local moCheckBox Q1A1, Q1A2, Q1A3, Q1A4, Q1A5; local bool bObservationsChanged; // if answers are different from original answers for this report // (only used when in editing mode) 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")]); theSignal = SignalHumanActivity(GeoPC.NewSignal.Duplicate()); tempSignalReport = new class'SignalReportHumanActivity'; // set Signal properties (that are independent of the state of the failure) // QUESTION 1 if(Q1A1.isChecked()) theSignal.RiskCause = RISK_CabelsPipes; else if(Q1A2.isChecked()) theSignal.RiskCause = RISK_ConstructionWork; else if(Q1A3.isChecked()) theSignal.RiskCause = RISK_Traffic; else if(Q1A4.isChecked()) theSignal.RiskCause = RISK_ChangesDike; else if(Q1A5.isChecked()) theSignal.RiskCause = RISK_NonWaterObjects; // 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 = SignalHumanActivity(GeoPC.NearbyMarker.SignalOriginals[GeoPC.EditIndex]); if(OriginalSignal.RiskCause != theSignal.RiskCause) bObservationsChanged = true; // bChanged reflects if any changes were made regarding the original report tempSignalReport.bChanged = bObservationsChanged; } if(!(theSignal.RiskCause>7||theSignal.RiskCause<2)) { theSignal.NL_DamageName = NL_AnswerStrings[0].Answers[theSignal.RiskCause-3]; theSignal.EN_DamageName = EN_AnswerStrings[0].Answers[theSignal.RiskCause-3]; } 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' MenuWidth=0.8 MenuHeight=0.55 ButtonHGap=0.02 // override standard values of superclass here! EN_Title = "Observation report for human activity" NL_Title = "Observatie rapport voor menselijke activiteit" HelpMenuOption=11 }