From b0feb089ef67ac0898ef8ed80e9c246801983511 Mon Sep 17 00:00:00 2001
From: Joseph Boudreau <boudreau@pitt.edu>
Date: Thu, 31 Mar 2022 15:34:06 -0400
Subject: [PATCH] Added control over point size in the clash point system of
 gmex

---
 .../ClashPointSysController.h                 |  6 +-
 .../GXClashPointSystems/GXClashPointSystem.h  |  1 +
 .../src/ClashPointSysController.cxx           | 13 ++-
 .../src/GXClashPointSystem.cxx                | 17 ++--
 .../src/clashpointcontrollerform.ui           | 82 ++++++++++++-------
 5 files changed, 79 insertions(+), 40 deletions(-)

diff --git a/GeoModelVisualization/GXClashPointSystems/GXClashPointSystems/ClashPointSysController.h b/GeoModelVisualization/GXClashPointSystems/GXClashPointSystems/ClashPointSysController.h
index 5323a91e5..37b26159a 100644
--- a/GeoModelVisualization/GXClashPointSystems/GXClashPointSystems/ClashPointSysController.h
+++ b/GeoModelVisualization/GXClashPointSystems/GXClashPointSystems/ClashPointSysController.h
@@ -39,13 +39,15 @@ public:
   bool showClashPoints2() const;
   bool showClashPoints3() const;
   bool showClashPoints4() const;
-
+  int  setPointSize() const;
+  
 signals:
   
   void showClashPoints1Changed(bool);
   void showClashPoints2Changed(bool);
   void showClashPoints3Changed(bool);
   void showClashPoints4Changed(bool);
+  void setPointSizeChanged(int);
   void inputFileChanged();
 
 private:
@@ -58,7 +60,7 @@ private slots:
   void possibleChange_showClashPoints2();
   void possibleChange_showClashPoints3();
   void possibleChange_showClashPoints4();
-
+  void possibleChange_setPointSize();
   
 };
 
diff --git a/GeoModelVisualization/GXClashPointSystems/GXClashPointSystems/GXClashPointSystem.h b/GeoModelVisualization/GXClashPointSystems/GXClashPointSystems/GXClashPointSystem.h
index 30e751793..55ae39081 100644
--- a/GeoModelVisualization/GXClashPointSystems/GXClashPointSystems/GXClashPointSystem.h
+++ b/GeoModelVisualization/GXClashPointSystems/GXClashPointSystems/GXClashPointSystem.h
@@ -48,6 +48,7 @@ public slots:
   void showClashPoint2(bool);
   void showClashPoint3(bool);
   void showClashPoint4(bool);
+  void setPointSize(int);
   
 private:
   class Imp;
diff --git a/GeoModelVisualization/GXClashPointSystems/src/ClashPointSysController.cxx b/GeoModelVisualization/GXClashPointSystems/src/ClashPointSysController.cxx
index 5b0506226..5818113e6 100644
--- a/GeoModelVisualization/GXClashPointSystems/src/ClashPointSysController.cxx
+++ b/GeoModelVisualization/GXClashPointSystems/src/ClashPointSysController.cxx
@@ -30,7 +30,7 @@ public:
   bool last_showClashPoints2;
   bool last_showClashPoints3;
   bool last_showClashPoints4;
-  
+  int  last_setPointSize;  
 };
 #include <iostream>
 //____________________________________________________________________
@@ -59,6 +59,8 @@ ClashPointSysController::ClashPointSysController(IVP1System * sys)
   addUpdateSlot(SLOT(possibleChange_showClashPoints4()));
   connectToLastUpdateSlot(m_d->ui.checkBox_clashPoints_4);
 
+  addUpdateSlot(SLOT(possibleChange_setPointSize()));
+  connectToLastUpdateSlot(m_d->ui.pointSizeSpinBox);
   
   connect(m_d->ui.pushButton_selectInput, SIGNAL(clicked()),
 	  this, SIGNAL(inputFileChanged()));
@@ -97,11 +99,14 @@ bool ClashPointSysController::showClashPoints4() const
   return m_d->ui.checkBox_clashPoints_4->isChecked();
 }
 
+int ClashPointSysController::setPointSize() const {
+  return m_d->ui.pointSizeSpinBox->value();
+}
 
 //____________________________________________________________________
 int ClashPointSysController::currentSettingsVersion() const
 {
-  return 1;
+  return 2;
 }
 
 //____________________________________________________________________
@@ -112,6 +117,7 @@ void ClashPointSysController::actualSaveSettings(VP1Serialise&s) const
   s.save(m_d->ui.checkBox_clashPoints_2);//version 1+
   s.save(m_d->ui.checkBox_clashPoints_3);//version 1+
   s.save(m_d->ui.checkBox_clashPoints_4);//version 1+
+  s.save(m_d->ui.pointSizeSpinBox);      //version 2+
 }
 
 //____________________________________________________________________
@@ -122,6 +128,7 @@ void ClashPointSysController::actualRestoreSettings(VP1Deserialise& s)
   s.restore(m_d->ui.checkBox_clashPoints_2);
   s.restore(m_d->ui.checkBox_clashPoints_3);
   s.restore(m_d->ui.checkBox_clashPoints_4);
+  s.restore(m_d->ui.pointSizeSpinBox);
 
 }
 
@@ -135,3 +142,5 @@ POSSIBLECHANGE_IMP(showClashPoints1)
 POSSIBLECHANGE_IMP(showClashPoints2)
 POSSIBLECHANGE_IMP(showClashPoints3)
 POSSIBLECHANGE_IMP(showClashPoints4)
+POSSIBLECHANGE_IMP(setPointSize)
+
diff --git a/GeoModelVisualization/GXClashPointSystems/src/GXClashPointSystem.cxx b/GeoModelVisualization/GXClashPointSystems/src/GXClashPointSystem.cxx
index 5eccfdbcf..8c349b2a1 100644
--- a/GeoModelVisualization/GXClashPointSystems/src/GXClashPointSystem.cxx
+++ b/GeoModelVisualization/GXClashPointSystems/src/GXClashPointSystem.cxx
@@ -57,7 +57,7 @@ public:
   SoSwitch                * switch1;
   SoSwitch                * switch2;
   SoSwitch                * switch3;
-
+  SoDrawStyle             * drawStyle;
 
     static SbColor4f color4f(const QColor& col) {
     return SbColor4f(std::max<float>(0.0f,std::min<float>(1.0f,col.redF())),
@@ -148,9 +148,10 @@ void GXClashPointSystem::buildPermanentSceneGraph(StoreGateSvc* /*detstore*/, So
   pickStyle->style=SoPickStyle::UNPICKABLE;
   root->addChild(pickStyle);
 
-  SoDrawStyle *drawStyle=new SoDrawStyle;
-  drawStyle->pointSize.setValue(3);
-  root->addChild(drawStyle);
+  m_d->drawStyle=new SoDrawStyle;
+
+  m_d->drawStyle->pointSize.setValue(3);
+  root->addChild(m_d->drawStyle);
 
   SoSeparator *s0=new SoSeparator;
   SoSeparator *s1=new SoSeparator;
@@ -198,9 +199,11 @@ void GXClashPointSystem::buildPermanentSceneGraph(StoreGateSvc* /*detstore*/, So
   connect(m_d->controller,SIGNAL(showClashPoints2Changed(bool)),this,SLOT(showClashPoint2(bool)));
   connect(m_d->controller,SIGNAL(showClashPoints3Changed(bool)),this,SLOT(showClashPoint3(bool)));
   connect(m_d->controller,SIGNAL(showClashPoints4Changed(bool)),this,SLOT(showClashPoint4(bool)));
-
+  connect(m_d->controller,SIGNAL(setPointSizeChanged(int)), this, SLOT(setPointSize(int)));
 }
 
+
+    
 //_____________________________________________________________________________________
 void GXClashPointSystem::systemuncreate()
 {
@@ -274,7 +277,11 @@ void GXClashPointSystem::selectInputFile() {
 
 }
 
+void GXClashPointSystem::setPointSize(int size) {
+  m_d->drawStyle->pointSize.setValue(size);
+}
 
+ 
 void GXClashPointSystem::showClashPoint1(bool flag) {
   m_d->switch0->whichChild=flag ? SO_SWITCH_ALL:SO_SWITCH_NONE;
 }
diff --git a/GeoModelVisualization/GXClashPointSystems/src/clashpointcontrollerform.ui b/GeoModelVisualization/GXClashPointSystems/src/clashpointcontrollerform.ui
index 4ce0d6e4b..f39c45fb8 100644
--- a/GeoModelVisualization/GXClashPointSystems/src/clashpointcontrollerform.ui
+++ b/GeoModelVisualization/GXClashPointSystems/src/clashpointcontrollerform.ui
@@ -7,14 +7,47 @@
     <x>0</x>
     <y>0</y>
     <width>268</width>
-    <height>187</height>
+    <height>243</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Form</string>
   </property>
   <layout class="QGridLayout" name="gridLayout">
-   <item row="0" column="0">
+   <item row="2" column="1">
+    <widget class="QPushButton" name="pushButton_selectInput">
+     <property name="text">
+      <string>Open Input</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QSpinBox" name="pointSizeSpinBox">
+     <property name="minimum">
+      <number>1</number>
+     </property>
+     <property name="maximum">
+      <number>10</number>
+     </property>
+     <property name="value">
+      <number>3</number>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="2">
+    <spacer>
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>1</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="0" column="1">
     <layout class="QVBoxLayout" name="verticalLayout">
      <item>
       <widget class="QCheckBox" name="checkBox_clashPoints_1">
@@ -46,51 +79,38 @@
        </property>
       </widget>
      </item>
-    <item>
-     <widget class="QCheckBox" name="checkBox_clashPoints_4">
-      <property name="text">
-       <string>InvalidSolid</string>
-      </property>
-      <property name="checked">
-       <bool>true</bool>
-      </property>
-     </widget>
-    </item>
+     <item>
+      <widget class="QCheckBox" name="checkBox_clashPoints_4">
+       <property name="text">
+        <string>InvalidSolid</string>
+       </property>
+       <property name="checked">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
     </layout>
    </item>
-   <item row="0" column="1">
+   <item row="3" column="1">
     <spacer>
      <property name="orientation">
-      <enum>Qt::Horizontal</enum>
+      <enum>Qt::Vertical</enum>
      </property>
      <property name="sizeHint" stdset="0">
       <size>
-       <width>1</width>
-       <height>20</height>
+       <width>20</width>
+       <height>1</height>
       </size>
      </property>
     </spacer>
    </item>
    <item row="1" column="0">
-    <widget class="QPushButton" name="pushButton_selectInput">
+    <widget class="QLabel" name="pointSizeLabel">
      <property name="text">
-      <string>Open Input</string>
+      <string>Point size</string>
      </property>
     </widget>
    </item>
-   <item row="2" column="0">
-    <spacer>
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>1</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
   </layout>
  </widget>
  <resources/>
-- 
GitLab