]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
EDF 1337 : Sketch 3D improvement
authorrnc <rnc@opencascade.com>
Thu, 13 Sep 2012 16:42:34 +0000 (16:42 +0000)
committerrnc <rnc@opencascade.com>
Thu, 13 Sep 2012 16:42:34 +0000 (16:42 +0000)
Added an optional control of start and end point coordinates.

src/EntityGUI/EntityGUI_3DSketcherDlg.cxx
src/EntityGUI/EntityGUI_3DSketcherDlg.h
src/EntityGUI/EntityGUI_Controls_QTD.ui

index 1295b3e0d9451d1a4bd28730283e9e13d943aba0..67fd92da2d65aa9815b443e428228bc197b207d5 100755 (executable)
@@ -155,6 +155,19 @@ EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg (GeometryGUI* theGeometryGUI, Q
   GroupControls->GroupBox1->setTitle(tr("GEOM_CONTROLS"));
   GroupControls->CheckBox1->setText(tr("Show length dimensions")); //TODO translation
   GroupControls->CheckBox2->setText(tr("Show angle dimensions"));  //TODO translation
+  GroupControls->CheckBox3->setText(tr("Show start/end point coordinates"));  //TODO translation
+  GroupControls->lineEdit_1->setReadOnly(true);
+  GroupControls->lineEdit_2->setReadOnly(true);
+  GroupControls->lineEdit_3->setReadOnly(true);
+  GroupControls->lineEdit_4->setReadOnly(true);
+  GroupControls->lineEdit_5->setReadOnly(true);
+  GroupControls->lineEdit_6->setReadOnly(true);
+  GroupControls->label_1->setText(tr("X:"));
+  GroupControls->label_2->setText(tr("Y:"));
+  GroupControls->label_3->setText(tr("Z:"));
+  GroupControls->label_4->setText(tr("X:"));
+  GroupControls->label_5->setText(tr("Y:"));
+  GroupControls->label_6->setText(tr("Z:"));
 
   buttonOk()->setText(tr("GEOM_BUT_END_SKETCH"));
   buttonApply()->setText(tr("GEOM_BUT_CLOSE_SKETCH"));
@@ -198,6 +211,7 @@ void EntityGUI_3DSketcherDlg::Init()
   //TEST
   localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
 //   globalSelection(GEOM_PREVIEW);
+//   setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 
 
   /* Get setting of step value from file configuration */
   double step = SUIT_Session::session()->resourceMgr()->doubleValue("Geometry", "SettingsGeomStep", 100.0);
@@ -225,6 +239,8 @@ void EntityGUI_3DSketcherDlg::Init()
 
   GroupControls->CheckBox1->setChecked(true);
   GroupControls->CheckBox2->setChecked(true);
+  GroupControls->CheckBox3->setChecked(true);
+  
   isLengthVisible = true;
   isAngleVisible = true;
 
@@ -261,6 +277,7 @@ void EntityGUI_3DSketcherDlg::Init()
   connect(GroupAngles->checkBox,        SIGNAL(clicked (bool)), this, SLOT(BoxChecked (bool))) ;
   connect(GroupControls->CheckBox1,     SIGNAL(clicked (bool)), this, SLOT(BoxChecked (bool))) ;
   connect(GroupControls->CheckBox2,     SIGNAL(clicked (bool)), this, SLOT(BoxChecked (bool))) ;
+  connect(GroupControls->CheckBox3,     SIGNAL(clicked (bool)), this, SLOT(BoxChecked (bool))) ;
 
   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
 
@@ -268,6 +285,8 @@ void EntityGUI_3DSketcherDlg::Init()
   connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()),        this, SLOT(ClickOnCancel()));
 
   initName(tr("GEOM_3DSKETCHER"));
+  
+  GroupControls->CheckBox3->click();
 
   UpdateButtonsState();
   GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
@@ -343,7 +362,7 @@ void EntityGUI_3DSketcherDlg::TypeClicked (int mode)
 // purpose  : called when the point coordinates is Applyed
 //=================================================================================
 void EntityGUI_3DSketcherDlg::ClickOnAddPoint()
-{
+{ 
   QString msg;
   if (!isValid(msg)) {
     showError(msg);
@@ -380,7 +399,8 @@ void EntityGUI_3DSketcherDlg::ClickOnAddPoint()
   myLengthIORedoList.Clear();
   myAngleIORedoList.Clear();
 
-  if (myMode == 1) {
+  if (myMode == 1) 
+  {
     Group3Spin->SpinBox_DX->setValue(0.0);
     Group3Spin->SpinBox_DY->setValue(0.0);
     Group3Spin->SpinBox_DZ->setValue(0.0);
@@ -391,6 +411,9 @@ void EntityGUI_3DSketcherDlg::ClickOnAddPoint()
     GroupAngles->SpinBox_DL->setValue(0.0);
     GroupAngles->SpinBox_DA2->setValue(0.0);
   }
+  
+  UpdatePointCoordinates();
+    
   UpdateButtonsState();
   GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
 }
@@ -410,6 +433,44 @@ void EntityGUI_3DSketcherDlg::UpdateButtonsState()
   GroupAngles->buttonRedo->setEnabled(myRedoList.count() > 0);
 }
 
+//=================================================================================
+// function : UpdatePointCoordinates()
+// purpose  :Update point coordinates in the control groupbox
+//=================================================================================
+void EntityGUI_3DSketcherDlg::UpdatePointCoordinates()
+{
+  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+  int aPrecision = resMgr->integerValue("Geometry", "length_precision", 6);
+  
+  if (myPointsList.count() == 0)
+  {
+    GroupControls->lineEdit_1->setText("");
+    GroupControls->lineEdit_2->setText("");
+    GroupControls->lineEdit_3->setText("");
+    
+    GroupControls->lineEdit_4->setText("");
+    GroupControls->lineEdit_5->setText("");
+    GroupControls->lineEdit_6->setText("");
+  }
+  else if (myPointsList.count() == 1)
+  {
+    GroupControls->lineEdit_1->setText(DlgRef::PrintDoubleValue(getLastPoint().x, aPrecision));
+    GroupControls->lineEdit_2->setText(DlgRef::PrintDoubleValue(getLastPoint().y, aPrecision));
+    GroupControls->lineEdit_3->setText(DlgRef::PrintDoubleValue(getLastPoint().z, aPrecision));
+    
+    GroupControls->lineEdit_4->setText("");
+    GroupControls->lineEdit_5->setText("");
+    GroupControls->lineEdit_6->setText("");
+  }
+  else
+  {
+    GroupControls->lineEdit_4->setText(DlgRef::PrintDoubleValue(getLastPoint().x, aPrecision));
+    GroupControls->lineEdit_5->setText(DlgRef::PrintDoubleValue(getLastPoint().y, aPrecision));
+    GroupControls->lineEdit_6->setText(DlgRef::PrintDoubleValue(getLastPoint().z, aPrecision));
+  }
+  
+}
+
 //=================================================================================
 // function : ClickOnUndo()
 // purpose  :
@@ -452,6 +513,9 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo()
       ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myLengthPrs);
     if (isAngleVisible)
       ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs);
+    
+    // Update of point coordinates in the control groupbox
+    UpdatePointCoordinates();
 
     updateViewer();
   }
@@ -497,6 +561,9 @@ void EntityGUI_3DSketcherDlg::ClickOnRedo()
       ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myLengthPrs);
     if (isAngleVisible)
       ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs);
+    
+    // Update of point coordinates in the control groupbox
+    UpdatePointCoordinates();
 
     updateViewer();
   }
@@ -674,7 +741,31 @@ void EntityGUI_3DSketcherDlg::BoxChecked (bool checked)
     else
       isAngleVisible=false;
   }
+  else if (send == GroupControls->CheckBox3)
+  {
+    GroupControls->lineEdit_1->setVisible(checked);
+    GroupControls->lineEdit_2->setVisible(checked);
+    GroupControls->lineEdit_3->setVisible(checked);
+    GroupControls->lineEdit_4->setVisible(checked);
+    GroupControls->lineEdit_5->setVisible(checked);
+    GroupControls->lineEdit_6->setVisible(checked);
+    
+    GroupControls->label_1->setVisible(checked);
+    GroupControls->label_2->setVisible(checked);
+    GroupControls->label_3->setVisible(checked);
+    GroupControls->label_4->setVisible(checked);
+    GroupControls->label_5->setVisible(checked);
+    GroupControls->label_6->setVisible(checked);
+    GroupControls->label_7->setVisible(checked);
+    GroupControls->label_8->setVisible(checked);
+    
+    GroupControls->updateGeometry();
+    GroupControls->resize(minimumSizeHint());
+  } 
 
+  updateGeometry();
+  resize(minimumSizeHint());
+  
   GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
 }
 
@@ -1081,8 +1172,8 @@ void EntityGUI_3DSketcherDlg::displayAngle (double theAngle1, double theAngle2,
     {
       P1 = gp_Pnt(Last.x + theLength,Last.y,Last.z);     // X direction
       P2 = gp_Pnt(Last.x + theLength * cos(theAngle1 * M_PI / 180.) ,
-                   Last.y,
-                   Last.z + theLength * sin(theAngle1 * M_PI / 180.));
+                  Last.y,
+                  Last.z + theLength * sin(theAngle1 * M_PI / 180.));
       break;
     }
   }
index 1e790d1104101f41eb660a3a1541e2d9381d71b7..4100cab57f01654cc9a035c16579b900dbaecfed 100755 (executable)
@@ -132,6 +132,7 @@ private slots:
   bool                               ClickOnApply();
   //  bool                               isSameAsPrevious();
   void                               UpdateButtonsState();
+  void                               UpdatePointCoordinates();
 
   void                               ClickOnUndo();
   void                               ClickOnRedo();
index 0c3222beac442d721bf86fa4a3db5c5b82db38a9..b58621ea55905f475691b717cfd62cd73431378a 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>327</width>
-    <height>50</height>
+    <width>278</width>
+    <height>181</height>
    </rect>
   </property>
   <property name="windowTitle">
    </property>
    <item row="0" column="0">
     <widget class="QGroupBox" name="GroupBox1">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
      <property name="title">
       <string/>
      </property>
-     <layout class="QGridLayout" name="gridLayout">
-      <item row="0" column="0">
-       <widget class="QCheckBox" name="CheckBox2">
-        <property name="text">
-         <string/>
-        </property>
-       </widget>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <layout class="QGridLayout" name="gridLayout">
+        <item row="0" column="0">
+         <widget class="QCheckBox" name="CheckBox2">
+          <property name="text">
+           <string/>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1">
+         <widget class="QCheckBox" name="CheckBox1">
+          <property name="text">
+           <string/>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="0">
+         <widget class="QCheckBox" name="CheckBox3">
+          <property name="text">
+           <string/>
+          </property>
+         </widget>
+        </item>
+       </layout>
       </item>
-      <item row="1" column="0">
-       <widget class="QCheckBox" name="CheckBox1">
-        <property name="text">
-         <string/>
-        </property>
-       </widget>
+      <item>
+       <layout class="QGridLayout" name="gridLayout_2">
+        <item row="0" column="0" colspan="2">
+         <widget class="QLabel" name="label_8">
+          <property name="text">
+           <string>Start:</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="0">
+         <widget class="QLabel" name="label_1">
+          <property name="text">
+           <string>X</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="1">
+         <widget class="QLineEdit" name="lineEdit_1"/>
+        </item>
+        <item row="2" column="0">
+         <widget class="QLabel" name="label_2">
+          <property name="text">
+           <string>Y</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="1">
+         <widget class="QLineEdit" name="lineEdit_2"/>
+        </item>
+        <item row="3" column="0">
+         <widget class="QLabel" name="label_3">
+          <property name="text">
+           <string>Z</string>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="1">
+         <widget class="QLineEdit" name="lineEdit_3"/>
+        </item>
+        <item row="0" column="3">
+         <widget class="QLabel" name="label_7">
+          <property name="text">
+           <string>End:</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="2">
+         <widget class="QLabel" name="label_4">
+          <property name="text">
+           <string>X</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="3">
+         <widget class="QLineEdit" name="lineEdit_4"/>
+        </item>
+        <item row="2" column="2">
+         <widget class="QLabel" name="label_5">
+          <property name="text">
+           <string>Y</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="3">
+         <widget class="QLineEdit" name="lineEdit_5"/>
+        </item>
+        <item row="3" column="2">
+         <widget class="QLabel" name="label_6">
+          <property name="text">
+           <string>Z</string>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="3">
+         <widget class="QLineEdit" name="lineEdit_6"/>
+        </item>
+       </layout>
       </item>
      </layout>
     </widget>