From 74e4594d311d95d66c12ca61a2d852ecf59b320f Mon Sep 17 00:00:00 2001
From: Brandon Clayton <bclayton@usgs.gov>
Date: Wed, 21 Aug 2024 10:50:22 -0600
Subject: [PATCH] add weighted MFD toggle

---
 .../control-panel/control-panel.component.html       | 12 +++++++++++-
 .../control-panel/control-panel.component.ts         |  6 ++++++
 .../src/app/source/mfd/models/control-form.model.ts  |  2 ++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/projects/nshmp-apps/src/app/source/mfd/components/control-panel/control-panel.component.html b/projects/nshmp-apps/src/app/source/mfd/components/control-panel/control-panel.component.html
index b379b1f09..36c03aa08 100644
--- a/projects/nshmp-apps/src/app/source/mfd/components/control-panel/control-panel.component.html
+++ b/projects/nshmp-apps/src/app/source/mfd/components/control-panel/control-panel.component.html
@@ -51,11 +51,21 @@
       <div class="grid-row">
         <mat-slide-toggle
           color="primary"
-          [formControl]="formGroup.controls?.cumulative"
+          [formControl]="formGroup.controls.cumulative"
         >
           Cumulative
         </mat-slide-toggle>
       </div>
+
+      <!-- Weighted MFDs -->
+      <div class="grid-row">
+        <mat-slide-toggle
+          color="primary"
+          [formControl]="formGroup.controls.weightedMfds"
+        >
+          Weighted MFDs
+        </mat-slide-toggle>
+      </div>
     </div>
   </div>
 
diff --git a/projects/nshmp-apps/src/app/source/mfd/components/control-panel/control-panel.component.ts b/projects/nshmp-apps/src/app/source/mfd/components/control-panel/control-panel.component.ts
index 0464b3572..1b97ea5b1 100644
--- a/projects/nshmp-apps/src/app/source/mfd/components/control-panel/control-panel.component.ts
+++ b/projects/nshmp-apps/src/app/source/mfd/components/control-panel/control-panel.component.ts
@@ -113,6 +113,12 @@ export class ControlPanelComponent implements OnInit, OnDestroy {
         this.service.createPlots()
       )
     );
+
+    this.subs.push(
+      controls.weightedMfds.valueChanges.subscribe(() =>
+        this.service.createPlots()
+      )
+    );
   }
 
   ngOnDestroy(): void {
diff --git a/projects/nshmp-apps/src/app/source/mfd/models/control-form.model.ts b/projects/nshmp-apps/src/app/source/mfd/models/control-form.model.ts
index 1a20f3156..d770bc667 100644
--- a/projects/nshmp-apps/src/app/source/mfd/models/control-form.model.ts
+++ b/projects/nshmp-apps/src/app/source/mfd/models/control-form.model.ts
@@ -33,6 +33,8 @@ export interface ControlForm {
   sourceAsString: string;
   /** Source tree id number */
   sourceTree: number | null;
+  /** Whether to apply the weights to the MFDs */
+  weightedMfds: boolean;
 }
 
 /**
-- 
GitLab