]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0020154: Implement major axis support for ellipse creation (merge development from...
authorvsr <vsr@opencascade.com>
Mon, 13 Apr 2009 12:51:18 +0000 (12:51 +0000)
committervsr <vsr@opencascade.com>
Mon, 13 Apr 2009 12:51:18 +0000 (12:51 +0000)
24 files changed:
doc/salome/gui/GEOM/images/ellipse.png
doc/salome/gui/GEOM/input/creating_ellipse.doc
doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc
idl/GEOM_Gen.idl
idl/GEOM_Superv.idl
src/BasicGUI/BasicGUI_EllipseDlg.cxx
src/BasicGUI/BasicGUI_EllipseDlg.h
src/DlgRef/DlgRef_3Sel2Spin.cxx [new file with mode: 0644]
src/DlgRef/DlgRef_3Sel2Spin.h [new file with mode: 0644]
src/DlgRef/DlgRef_3Sel2Spin_QTD.cxx [new file with mode: 0644]
src/DlgRef/DlgRef_3Sel2Spin_QTD.h [new file with mode: 0644]
src/DlgRef/Makefile.am
src/DlgRef/UIFiles/DlgRef_3Sel2Spin_QTD.ui [new file with mode: 0644]
src/DlgRef/UIFiles/ui_to_cxx
src/GEOMGUI/GEOM_msg_en.po
src/GEOMImpl/GEOMImpl_EllipseDriver.cxx
src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx
src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx
src/GEOMImpl/GEOMImpl_IEllipse.hxx
src/GEOM_I/GEOM_ICurvesOperations_i.cc
src/GEOM_I/GEOM_ICurvesOperations_i.hh
src/GEOM_I_Superv/GEOM_Superv_i.cc
src/GEOM_I_Superv/GEOM_Superv_i.hh
src/GEOM_SWIG/geompyDC.py

index 6bce2c24723e0534b0141ddda998378812e25a9f..bc35ecf47eed8ce9e07f696b9f8ffdc7456e24f0 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/ellipse.png and b/doc/salome/gui/GEOM/images/ellipse.png differ
index 78972181b06d32207d258976a21f0e95f7119710..af91be2c5470a509f8438bb6d63485208952b991 100644 (file)
@@ -4,14 +4,28 @@
 
 To create an \b Ellipse in the <b>Main Menu</b> select <b>New Entity - > Basic - > Ellipse</b>
 
-\n You can define an \b Ellipse by its <b>Center Point</b>, a \b
-Vector giving its normal, and its <b>Major & Minor Radiuses</b>.
+\n You can define an \b Ellipse by its <b>Center</b> point, a \b
+Vector giving its normal, another vector specifying the direction of
+ellipse's <b>Major Axis</b> (optionally) and its <b>Major</b> & <b>Minor Radiuses</b>.
 \n The \b Result of the operation will be a GEOM_Object (edge).
 
-\n <b>TUI Command:</b> <em>geompy.MakeEllipse(Point, Vector, RadiusMajor, RadiusMinor)</em>
+\note The parameter <b>Major Axis</b> is optional. It is calculated
+automatically basing on the direction of the normal vector (by default
+it corresponds to the OX axis of the global coordinate system).
+
+\note Actual direction of the major axis vector is defined as
+<EM> Vmaj' = (Vn * Vmaj) * Vn</em> where \em Vn is a normal vector and
+\em Vmaj is an original vector of the major axis.
+
+\n <b>TUI Command (no major axis):</b> <em>geompy.MakeEllipse(Point, Vector, RadiusMajor, RadiusMinor)</em>
 \n <b>Arguments:</b> Name + 1 vertex (for the center) + 1 edge (for
 the direction) + 1 X Radius + 1 Y Radius.
 
+\n <b>TUI Command (use major axis):</b> <em>geompy.MakeEllipseVec(Point, Vector, RadiusMajor, RadiusMinor, VectorMajor)</em>
+\n <b>Arguments:</b> Name + 1 vertex (for the center) + 1 edge (for
+the normal direction) + 1 X Radius + 1 Y Radius + 1 edge (for the
+major axis direction)
+
 \image html ellipse.png
 
 <b>Example:</b>
@@ -21,4 +35,4 @@ the direction) + 1 X Radius + 1 Y Radius.
 Our <b>TUI Scripts</b> provide you with useful examples of creation of
 \ref tui_creation_ellipse "Basic Geometric Objects".
 
-*/
\ No newline at end of file
+*/
index d9c30a23b4bbdf7bc79237a996866c6cf340823a..55e8430109994b4c744bfd98f59bf5f1348f07b9 100644 (file)
@@ -116,21 +116,32 @@ gg = salome.ImportComponentGUI("GEOM")
 
 # create vertices
 p0 = geompy.MakeVertex(0., 0., 0.)
-p50 = geompy.MakeVertex(50., 50., 50.)
+p1 = geompy.MakeVertex(50., 50., 50.)
+p2 = geompy.MakeVertex(0., 50., 0.)
 
-# create a vector from two points
-vector  = geompy.MakeVector(p0, p50)
+# create a normal vector from two points
+normal  = geompy.MakeVector(p0, p1)
+
+# create a major axis vector from two points
+major   = geompy.MakeVector(p0, p2)
 
 # create an ellipse from a point, a vector and radiuses
-ellipse = geompy.MakeEllipse(p50, vector, 50, 25)
+ellipse1 = geompy.MakeEllipse(p1, normal, 50, 25)
+
+# create an ellipse from a point, a normal vector, radiuses and a major axis vector
+ellipse2 = geompy.MakeEllipse(p1, normal, 50, 25, major)
 
 # add objects in the study
-id_vector  = geompy.addToStudy(vector, "Vector")
-id_ellipse = geompy.addToStudy(ellipse,"Ellipse")
+id_normal   = geompy.addToStudy(normal,   "Normal")
+id_major    = geompy.addToStudy(major,    "Major Axis")
+id_ellipse1 = geompy.addToStudy(ellipse1, "Ellipse 1")
+id_ellipse2 = geompy.addToStudy(ellipse2, "Ellipse 2")
 
 # display the ellipse and its normal vector
-gg.createAndDisplayGO(id_vector)
-gg.createAndDisplayGO(id_ellipse)
+gg.createAndDisplayGO(id_normal)
+gg.createAndDisplayGO(id_major)
+gg.createAndDisplayGO(id_ellipse1)
+gg.createAndDisplayGO(id_ellipse2)
 \endcode
  
 \anchor tui_creation_curve
@@ -269,4 +280,4 @@ gg.setDisplayMode(id_plane3,1)
 gg.setTransparency(id_plane3,0.5) 
 \endcode
 
-*/
\ No newline at end of file
+*/
index eb23ae6c71fdea5d6ba73f69f11ccaba8948689d..4cc2a6c161185259d1e7349a2062f25473551d15 100644 (file)
@@ -2014,6 +2014,21 @@ module GEOM
                             in double theRMajor,
                             in double theRMinor);
 
+    /*!
+     *  Create an ellipse with given center, normal vector, main axis vector and radiuses.
+     *  \param thePnt Ellipse center.
+     *  \param theVec Vector, normal to the plane of the ellipse.
+     *  \param theRMajor Major ellipse radius.
+     *  \param theRMinor Minor ellipse radius.
+     *  \param theVecMaj Vector, direction of the ellipse's main axis.
+     *  \return New GEOM_Object, containing the created ellipse.
+     */
+    GEOM_Object MakeEllipseVec (in GEOM_Object thePnt,
+                               in GEOM_Object theVec,
+                               in double theRMajor,
+                               in double theRMinor,
+                               in GEOM_Object theVecMaj);
+
     /*!
      *  Create an arc of circle, passing through three given points.
      *  \param thePnt1 Start point of the arc.
index 57bd686ed9e1766bc567eec0bcfb063a9a162829..76316bd5752808baab418063cc2f90c1f02d1e2a 100644 (file)
@@ -459,6 +459,11 @@ module GEOM
                             in GEOM_Object theVec,
                             in double      theRMajor,
                             in double      theRMinor) ;
+    GEOM_Object MakeEllipseVec (in GEOM_Object thePnt,
+                               in GEOM_Object theVec,
+                               in double      theRMajor,
+                               in double      theRMinor,
+                               in GEOM_Object theVecMaj) ;
     GEOM_Object MakeArc (in GEOM_Object thePnt1,
                         in GEOM_Object thePnt2,
                         in GEOM_Object thePnt3) ;
index fa364a92e5ed18dd67176fec97a02ed46e4d60f8..d2aa86f28787e24533caf7f62f57fa7179bfb33c 100644 (file)
@@ -70,17 +70,20 @@ BasicGUI_EllipseDlg::BasicGUI_EllipseDlg(GeometryGUI* theGeometryGUI, QWidget* p
   RadioButton2->close(TRUE);
   RadioButton3->close(TRUE);
 
-  GroupPoints = new DlgRef_2Sel2Spin(this, "GroupPoints");
+  GroupPoints = new DlgRef_3Sel2Spin(this, "GroupPoints");
   GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
   GroupPoints->TextLabel1->setText(tr("GEOM_CENTER"));
   GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
-  GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_MAJOR"));
-  GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_MINOR"));
+  GroupPoints->TextLabel3->setText(tr("%1 (%2)").arg(tr("GEOM_VECTOR_MAJOR")).arg(tr("GEOM_OPTIONAL")));
+  GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_MAJOR"));
+  GroupPoints->TextLabel5->setText(tr("GEOM_RADIUS_MINOR"));
   GroupPoints->PushButton1->setPixmap(image1);
   GroupPoints->PushButton2->setPixmap(image1);
+  GroupPoints->PushButton3->setPixmap(image1);
 
   GroupPoints->LineEdit1->setReadOnly( true );
   GroupPoints->LineEdit2->setReadOnly( true );
+  GroupPoints->LineEdit3->setReadOnly( true );
 
   Layout1->addWidget(GroupPoints, 2, 0);
   /***************************************************************/
@@ -111,7 +114,7 @@ void BasicGUI_EllipseDlg::Init()
   globalSelection(); // close local contexts, if any
   localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
 
-  myPoint = myDir = GEOM::GEOM_Object::_nil();
+  myPoint = myDir = myMajor = GEOM::GEOM_Object::_nil();
 
   /* Get setting of step value from file configuration */
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
@@ -135,9 +138,11 @@ void BasicGUI_EllipseDlg::Init()
 
   connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
 
   connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
   connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+  connect(GroupPoints->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
 
   connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
   connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
@@ -175,9 +180,10 @@ bool BasicGUI_EllipseDlg::ClickOnApply()
   initName();
 
   // reset
-  myPoint = myDir = GEOM::GEOM_Object::_nil();
+  myPoint = myDir = myMajor = GEOM::GEOM_Object::_nil();
   GroupPoints->LineEdit1->setText( "" );
   GroupPoints->LineEdit2->setText( "" );
+  GroupPoints->LineEdit3->setText( "" );
   myEditCurrentArgument = GroupPoints->LineEdit1;
   //globalSelection(GEOM_POINT);
   globalSelection(); // close local contexts, if any
@@ -207,6 +213,7 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument()
   {
     if      ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil();
     else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir   = GEOM::GEOM_Object::_nil();
+    else if ( myEditCurrentArgument == GroupPoints->LineEdit3 ) myMajor = GEOM::GEOM_Object::_nil();
     return;
   }
 
@@ -223,7 +230,7 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument()
     if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
     {
       TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
-      if (myEditCurrentArgument == GroupPoints->LineEdit2)
+      if (myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupPoints->LineEdit3)
         aNeedType = TopAbs_EDGE;
 
       LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
@@ -260,6 +267,7 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument()
 
     if      ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = aSelectedObject;
     else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir   = aSelectedObject;
+    else if ( myEditCurrentArgument == GroupPoints->LineEdit3 ) myMajor = aSelectedObject;
   }
 
   displayPreview();
@@ -277,10 +285,11 @@ void BasicGUI_EllipseDlg::SetEditCurrentArgument()
 
   if      ( send == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1;
   else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2;
+  else if ( send == GroupPoints->PushButton3 ) myEditCurrentArgument = GroupPoints->LineEdit3;
   
   myEditCurrentArgument->setFocus();
   globalSelection(); // close local contexts, if any
-  if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
+  if ( myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupPoints->LineEdit3 )
     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
   else
     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
@@ -295,7 +304,8 @@ void BasicGUI_EllipseDlg::LineEditReturnPressed()
 {
   QLineEdit* send = (QLineEdit*)sender();
   if ( send == GroupPoints->LineEdit1 ||
-       send == GroupPoints->LineEdit2 )
+       send == GroupPoints->LineEdit2 ||
+       send == GroupPoints->LineEdit3 )
   {
     myEditCurrentArgument = send;
     GEOMBase_Skeleton::LineEditReturnPressed();
@@ -318,6 +328,7 @@ void BasicGUI_EllipseDlg::ActivateThisDialog()
 
   GroupPoints->LineEdit1->setText( "" );
   GroupPoints->LineEdit2->setText( "" );
+  GroupPoints->LineEdit3->setText( "" );
 
   myPoint = myDir = GEOM::GEOM_Object::_nil();
   //globalSelection( GEOM_POINT );
@@ -387,7 +398,10 @@ bool BasicGUI_EllipseDlg::execute( ObjectList& objects )
 {
   double aMajorR = GroupPoints->SpinBox_DX->GetValue();
   double aMinorR = GroupPoints->SpinBox_DY->GetValue();
-  GEOM::GEOM_Object_var anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeEllipse( myPoint, myDir, aMajorR, aMinorR );
+
+  GEOM::GEOM_Object_var anObj = myMajor->_is_nil() ? 
+    GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeEllipse   ( myPoint, myDir, aMajorR, aMinorR )         :
+    GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeEllipseVec( myPoint, myDir, aMajorR, aMinorR, myMajor );
 
   if ( !anObj->_is_nil() )
     objects.push_back( anObj._retn() );
@@ -414,6 +428,8 @@ void BasicGUI_EllipseDlg::addSubshapesToStudy()
 
   objMap[GroupPoints->LineEdit1->text()] = myPoint;
   objMap[GroupPoints->LineEdit2->text()] = myDir;
+  if (!CORBA::is_nil(myMajor))
+    objMap[GroupPoints->LineEdit3->text()] = myMajor;
 
   addSubshapesToFather( objMap );
 }
index c684cec9054424ec86a6f12ea5b91a89cd420905..619450e72f0956eaa28f8f6ade4d49bbcf7a4636 100644 (file)
@@ -30,7 +30,7 @@
 #include "GEOM_BasicGUI.hxx"
 
 #include "GEOMBase_Skeleton.h"
-#include "DlgRef_2Sel2Spin.h"
+#include "DlgRef_3Sel2Spin.h"
 
 #include "BasicGUI.h"
 
@@ -59,9 +59,9 @@ private :
     void Init();
     void enterEvent(QEvent* e);
 
-    GEOM::GEOM_Object_var myPoint, myDir;
+    GEOM::GEOM_Object_var myPoint, myDir, myMajor;
 
-    DlgRef_2Sel2Spin* GroupPoints;
+    DlgRef_3Sel2Spin* GroupPoints;
 
 private slots:
     void ClickOnOk();
diff --git a/src/DlgRef/DlgRef_3Sel2Spin.cxx b/src/DlgRef/DlgRef_3Sel2Spin.cxx
new file mode 100644 (file)
index 0000000..6c256f2
--- /dev/null
@@ -0,0 +1,56 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//  GEOM GEOMGUI : GUI for Geometry component
+//  File   : DlgRef_3Sel2Spin.cxx
+//  Author : Damien COQUERET
+//  Module : GEOM
+//  $Header: 
+//
+#include "DlgRef_3Sel2Spin.h"
+
+#include <qlayout.h>
+#include <qspinbox.h>
+#include <qgroupbox.h>
+
+/* 
+ *  Constructs a DlgRef_3Sel1Spin which is a child of 'parent', with the 
+ *  name 'name' and widget flags set to 'f' 
+ */
+DlgRef_3Sel2Spin::DlgRef_3Sel2Spin(QWidget* parent,  const char* name, WFlags fl)
+  :DlgRef_3Sel2Spin_QTD(parent, name, fl)
+{
+  SpinBox1->close(TRUE);
+  SpinBox2->close(TRUE);
+  SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX");
+  Layout2->addWidget(SpinBox_DX, 0, 1);
+  SpinBox_DY = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY");
+  Layout2->addWidget(SpinBox_DY, 1, 1);
+}
+
+
+/*  
+ *  Destroys the object and frees any allocated resources
+ */
+DlgRef_3Sel2Spin::~DlgRef_3Sel2Spin()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
diff --git a/src/DlgRef/DlgRef_3Sel2Spin.h b/src/DlgRef/DlgRef_3Sel2Spin.h
new file mode 100644 (file)
index 0000000..c39ff62
--- /dev/null
@@ -0,0 +1,49 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//  GEOM GEOMGUI : GUI for Geometry component
+//  File   : DlgRef_3Sel2Spin.h
+//  Author : Damien COQUERET
+//  Module : GEOM
+//  $Header: 
+//
+#ifndef DLGREF_3SEL2SPIN_H
+#define DLGREF_3SEL2SPIN_H
+
+#include "GEOM_DlgRef.hxx"
+
+#include "DlgRef_3Sel2Spin_QTD.h"
+#include "DlgRef_SpinBox.h"
+
+class GEOM_DLGREF_EXPORT DlgRef_3Sel2Spin : public DlgRef_3Sel2Spin_QTD
+{ 
+    Q_OBJECT
+
+public:
+    DlgRef_3Sel2Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+    ~DlgRef_3Sel2Spin();
+
+    DlgRef_SpinBox* SpinBox_DX;
+    DlgRef_SpinBox* SpinBox_DY;
+
+};
+
+#endif // DLGREF_3SEL2SPIN_H
diff --git a/src/DlgRef/DlgRef_3Sel2Spin_QTD.cxx b/src/DlgRef/DlgRef_3Sel2Spin_QTD.cxx
new file mode 100644 (file)
index 0000000..2d38a17
--- /dev/null
@@ -0,0 +1,148 @@
+/****************************************************************************
+** Form implementation generated from reading ui file 'DlgRef_3Sel2Spin_QTD.ui'
+**
+** Created: Mon Apr 13 11:59:12 2009
+**      by: The User Interface Compiler ($Id$)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#include "DlgRef_3Sel2Spin_QTD.h"
+
+#include <qvariant.h>
+#include <qpushbutton.h>
+#include <qgroupbox.h>
+#include <qlineedit.h>
+#include <qlabel.h>
+#include <qspinbox.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+/*
+ *  Constructs a DlgRef_3Sel2Spin_QTD as a child of 'parent', with the
+ *  name 'name' and widget flags set to 'f'.
+ */
+DlgRef_3Sel2Spin_QTD::DlgRef_3Sel2Spin_QTD( QWidget* parent, const char* name, WFlags fl )
+    : QWidget( parent, name, fl )
+{
+    if ( !name )
+       setName( "DlgRef_3Sel2Spin_QTD" );
+    DlgRef_3Sel2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_3Sel2Spin_QTDLayout"); 
+
+    GroupBox1 = new QGroupBox( this, "GroupBox1" );
+    GroupBox1->setColumnLayout(0, Qt::Vertical );
+    GroupBox1->layout()->setSpacing( 6 );
+    GroupBox1->layout()->setMargin( 11 );
+    GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
+    GroupBox1Layout->setAlignment( Qt::AlignTop );
+
+    LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
+
+    GroupBox1Layout->addWidget( LineEdit1, 0, 2 );
+
+    TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
+    TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
+
+    GroupBox1Layout->addWidget( TextLabel1, 0, 0 );
+
+    PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
+    PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
+
+    GroupBox1Layout->addWidget( PushButton1, 0, 1 );
+
+    TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
+    TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
+
+    GroupBox1Layout->addWidget( TextLabel2, 1, 0 );
+
+    LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" );
+
+    GroupBox1Layout->addWidget( LineEdit2, 1, 2 );
+
+    PushButton2 = new QPushButton( GroupBox1, "PushButton2" );
+    PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) );
+
+    GroupBox1Layout->addWidget( PushButton2, 1, 1 );
+
+    TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
+    TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
+
+    GroupBox1Layout->addWidget( TextLabel3, 2, 0 );
+
+    PushButton3 = new QPushButton( GroupBox1, "PushButton3" );
+    PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) );
+
+    GroupBox1Layout->addWidget( PushButton3, 2, 1 );
+
+    LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" );
+
+    GroupBox1Layout->addWidget( LineEdit3, 2, 2 );
+
+    Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); 
+
+    SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" );
+    SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) );
+
+    Layout2->addWidget( SpinBox2, 1, 1 );
+
+    TextLabel5 = new QLabel( GroupBox1, "TextLabel5" );
+    TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) );
+
+    Layout2->addWidget( TextLabel5, 1, 0 );
+
+    TextLabel4 = new QLabel( GroupBox1, "TextLabel4" );
+    TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) );
+
+    Layout2->addWidget( TextLabel4, 0, 0 );
+
+    SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
+    SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
+
+    Layout2->addWidget( SpinBox1, 0, 1 );
+
+    GroupBox1Layout->addMultiCellLayout( Layout2, 3, 3, 0, 2 );
+    Spacer5 = new QSpacerItem( 16, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
+    GroupBox1Layout->addItem( Spacer5, 4, 1 );
+
+    DlgRef_3Sel2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
+    languageChange();
+    resize( QSize(124, 201).expandedTo(minimumSizeHint()) );
+    clearWState( WState_Polished );
+
+    // tab order
+    setTabOrder( PushButton1, LineEdit1 );
+    setTabOrder( LineEdit1, PushButton2 );
+    setTabOrder( PushButton2, LineEdit2 );
+    setTabOrder( LineEdit2, PushButton3 );
+    setTabOrder( PushButton3, LineEdit3 );
+    setTabOrder( LineEdit3, SpinBox1 );
+    setTabOrder( SpinBox1, SpinBox2 );
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+DlgRef_3Sel2Spin_QTD::~DlgRef_3Sel2Spin_QTD()
+{
+    // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ *  Sets the strings of the subwidgets using the current
+ *  language.
+ */
+void DlgRef_3Sel2Spin_QTD::languageChange()
+{
+    setCaption( tr( "DlgRef_2Sel2Spin_QTD" ) );
+    GroupBox1->setTitle( QString::null );
+    TextLabel1->setText( tr( "TL1" ) );
+    PushButton1->setText( QString::null );
+    TextLabel2->setText( tr( "TL2" ) );
+    PushButton2->setText( QString::null );
+    TextLabel3->setText( tr( "TL3" ) );
+    PushButton3->setText( QString::null );
+    TextLabel5->setText( tr( "TL5" ) );
+    TextLabel4->setText( tr( "TL4" ) );
+}
+
diff --git a/src/DlgRef/DlgRef_3Sel2Spin_QTD.h b/src/DlgRef/DlgRef_3Sel2Spin_QTD.h
new file mode 100644 (file)
index 0000000..6a82abc
--- /dev/null
@@ -0,0 +1,60 @@
+/****************************************************************************
+** Form interface generated from reading ui file 'DlgRef_3Sel2Spin_QTD.ui'
+**
+** Created: Mon Apr 13 11:59:11 2009
+**      by: The User Interface Compiler ($Id$)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#ifndef DLGREF_3SEL2SPIN_QTD_H
+#define DLGREF_3SEL2SPIN_QTD_H
+
+#include <qvariant.h>
+#include <qwidget.h>
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QSpacerItem;
+class QGroupBox;
+class QLineEdit;
+class QLabel;
+class QPushButton;
+class QSpinBox;
+
+class DlgRef_3Sel2Spin_QTD : public QWidget
+{
+    Q_OBJECT
+
+public:
+    DlgRef_3Sel2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+    ~DlgRef_3Sel2Spin_QTD();
+
+    QGroupBox* GroupBox1;
+    QLineEdit* LineEdit1;
+    QLabel* TextLabel1;
+    QPushButton* PushButton1;
+    QLabel* TextLabel2;
+    QLineEdit* LineEdit2;
+    QPushButton* PushButton2;
+    QLabel* TextLabel3;
+    QPushButton* PushButton3;
+    QLineEdit* LineEdit3;
+    QSpinBox* SpinBox2;
+    QLabel* TextLabel5;
+    QLabel* TextLabel4;
+    QSpinBox* SpinBox1;
+
+protected:
+    QGridLayout* DlgRef_3Sel2Spin_QTDLayout;
+    QGridLayout* GroupBox1Layout;
+    QSpacerItem* Spacer5;
+    QGridLayout* Layout2;
+
+protected slots:
+    virtual void languageChange();
+
+};
+
+#endif // DLGREF_3SEL2SPIN_QTD_H
index c4ed8ecf1fc494906fc7e0b7da9a5deb5ec7f8cc..12013a408a311fb2d377e5f47152662aa2111612 100644 (file)
@@ -49,6 +49,7 @@ dist_libDlgRef_la_SOURCES = \
        DlgRef_2Sel1Spin_QTD.cxx \
        DlgRef_2Sel2Spin_QTD.cxx \
        DlgRef_2Sel3Spin_QTD.cxx \
+       DlgRef_3Sel2Spin_QTD.cxx \
        DlgRef_1Sel1Spin1Check_QTD.cxx \
        DlgRef_2Sel1Spin2Check_QTD.cxx \
        DlgRef_2Sel2Spin1Check_QTD.cxx \
@@ -79,6 +80,7 @@ dist_libDlgRef_la_SOURCES = \
        DlgRef_2Sel1Spin.cxx \
        DlgRef_2Sel2Spin.cxx \
        DlgRef_2Sel3Spin.cxx \
+       DlgRef_3Sel2Spin.cxx \
        DlgRef_1Sel1Spin1Check.cxx \
        DlgRef_2Sel1Spin2Check.cxx \
        DlgRef_2Sel2Spin1Check.cxx \
@@ -113,6 +115,7 @@ MOC_FILES = \
        DlgRef_2Sel1Spin_QTD_moc.cxx \
        DlgRef_2Sel2Spin_QTD_moc.cxx \
        DlgRef_2Sel3Spin_QTD_moc.cxx \
+       DlgRef_3Sel2Spin_QTD_moc.cxx \
        DlgRef_2Sel3Spin2Rb_QTD_moc.cxx \
        DlgRef_2Sel3Spin2Rb_moc.cxx \
        DlgRef_1Sel1Spin1Check_QTD_moc.cxx \
@@ -143,6 +146,7 @@ MOC_FILES = \
        DlgRef_2Sel1Spin_moc.cxx \
        DlgRef_2Sel2Spin_moc.cxx \
        DlgRef_2Sel3Spin_moc.cxx \
+       DlgRef_3Sel2Spin_moc.cxx \
        DlgRef_1Sel1Spin1Check_moc.cxx \
        DlgRef_2Sel1Spin2Check_moc.cxx \
        DlgRef_2Sel2Spin1Check_moc.cxx \
@@ -179,6 +183,7 @@ salomeinclude_HEADERS = \
        DlgRef_2Sel1Spin_QTD.h \
        DlgRef_2Sel2Spin_QTD.h \
        DlgRef_2Sel3Spin_QTD.h \
+       DlgRef_3Sel2Spin_QTD.h \
        DlgRef_1Sel1Spin1Check_QTD.h \
        DlgRef_2Sel1Spin2Check_QTD.h \
        DlgRef_2Sel2Spin1Check_QTD.h \
@@ -209,6 +214,7 @@ salomeinclude_HEADERS = \
        DlgRef_2Sel1Spin.h \
        DlgRef_2Sel2Spin.h \
        DlgRef_2Sel3Spin.h \
+       DlgRef_3Sel2Spin.h \
        DlgRef_1Sel1Spin1Check.h \
        DlgRef_2Sel1Spin2Check.h \
        DlgRef_2Sel2Spin1Check.h \
diff --git a/src/DlgRef/UIFiles/DlgRef_3Sel2Spin_QTD.ui b/src/DlgRef/UIFiles/DlgRef_3Sel2Spin_QTD.ui
new file mode 100644 (file)
index 0000000..04f58e6
--- /dev/null
@@ -0,0 +1,262 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>DlgRef_3Sel2Spin_QTD</class>
+<widget class="QWidget">
+    <property name="name">
+        <cstring>DlgRef_3Sel2Spin_QTD</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>124</width>
+            <height>201</height>
+        </rect>
+    </property>
+    <property name="caption">
+        <string>DlgRef_2Sel2Spin_QTD</string>
+    </property>
+    <grid>
+        <property name="name">
+            <cstring>unnamed</cstring>
+        </property>
+        <property name="margin">
+            <number>0</number>
+        </property>
+        <property name="spacing">
+            <number>6</number>
+        </property>
+        <widget class="QGroupBox" row="0" column="0">
+            <property name="name">
+                <cstring>GroupBox1</cstring>
+            </property>
+            <property name="title">
+                <string></string>
+            </property>
+            <grid>
+                <property name="name">
+                    <cstring>unnamed</cstring>
+                </property>
+                <property name="margin">
+                    <number>11</number>
+                </property>
+                <property name="spacing">
+                    <number>6</number>
+                </property>
+                <widget class="QLineEdit" row="0" column="2">
+                    <property name="name">
+                        <cstring>LineEdit1</cstring>
+                    </property>
+                </widget>
+                <widget class="QLabel" row="0" column="0">
+                    <property name="name">
+                        <cstring>TextLabel1</cstring>
+                    </property>
+                    <property name="sizePolicy">
+                        <sizepolicy>
+                            <hsizetype>0</hsizetype>
+                            <vsizetype>0</vsizetype>
+                            <horstretch>0</horstretch>
+                            <verstretch>0</verstretch>
+                        </sizepolicy>
+                    </property>
+                    <property name="text">
+                        <string>TL1</string>
+                    </property>
+                </widget>
+                <widget class="QPushButton" row="0" column="1">
+                    <property name="name">
+                        <cstring>PushButton1</cstring>
+                    </property>
+                    <property name="sizePolicy">
+                        <sizepolicy>
+                            <hsizetype>0</hsizetype>
+                            <vsizetype>0</vsizetype>
+                            <horstretch>0</horstretch>
+                            <verstretch>0</verstretch>
+                        </sizepolicy>
+                    </property>
+                    <property name="text">
+                        <string></string>
+                    </property>
+                </widget>
+                <widget class="QLabel" row="1" column="0">
+                    <property name="name">
+                        <cstring>TextLabel2</cstring>
+                    </property>
+                    <property name="sizePolicy">
+                        <sizepolicy>
+                            <hsizetype>0</hsizetype>
+                            <vsizetype>0</vsizetype>
+                            <horstretch>0</horstretch>
+                            <verstretch>0</verstretch>
+                        </sizepolicy>
+                    </property>
+                    <property name="text">
+                        <string>TL2</string>
+                    </property>
+                </widget>
+                <widget class="QLineEdit" row="1" column="2">
+                    <property name="name">
+                        <cstring>LineEdit2</cstring>
+                    </property>
+                </widget>
+                <widget class="QPushButton" row="1" column="1">
+                    <property name="name">
+                        <cstring>PushButton2</cstring>
+                    </property>
+                    <property name="sizePolicy">
+                        <sizepolicy>
+                            <hsizetype>0</hsizetype>
+                            <vsizetype>0</vsizetype>
+                            <horstretch>0</horstretch>
+                            <verstretch>0</verstretch>
+                        </sizepolicy>
+                    </property>
+                    <property name="text">
+                        <string></string>
+                    </property>
+                </widget>
+                <widget class="QLabel" row="2" column="0">
+                    <property name="name">
+                        <cstring>TextLabel3</cstring>
+                    </property>
+                    <property name="sizePolicy">
+                        <sizepolicy>
+                            <hsizetype>0</hsizetype>
+                            <vsizetype>0</vsizetype>
+                            <horstretch>0</horstretch>
+                            <verstretch>0</verstretch>
+                        </sizepolicy>
+                    </property>
+                    <property name="text">
+                        <string>TL3</string>
+                    </property>
+                </widget>
+                <widget class="QPushButton" row="2" column="1">
+                    <property name="name">
+                        <cstring>PushButton3</cstring>
+                    </property>
+                    <property name="sizePolicy">
+                        <sizepolicy>
+                            <hsizetype>0</hsizetype>
+                            <vsizetype>0</vsizetype>
+                            <horstretch>0</horstretch>
+                            <verstretch>0</verstretch>
+                        </sizepolicy>
+                    </property>
+                    <property name="text">
+                        <string></string>
+                    </property>
+                </widget>
+                <widget class="QLineEdit" row="2" column="2">
+                    <property name="name">
+                        <cstring>LineEdit3</cstring>
+                    </property>
+                </widget>
+                <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="3">
+                    <property name="name">
+                        <cstring>Layout2</cstring>
+                    </property>
+                    <grid>
+                        <property name="name">
+                            <cstring>unnamed</cstring>
+                        </property>
+                        <property name="margin">
+                            <number>0</number>
+                        </property>
+                        <property name="spacing">
+                            <number>6</number>
+                        </property>
+                        <widget class="QSpinBox" row="1" column="1">
+                            <property name="name">
+                                <cstring>SpinBox2</cstring>
+                            </property>
+                            <property name="sizePolicy">
+                                <sizepolicy>
+                                    <hsizetype>7</hsizetype>
+                                    <vsizetype>0</vsizetype>
+                                    <horstretch>0</horstretch>
+                                    <verstretch>0</verstretch>
+                                </sizepolicy>
+                            </property>
+                        </widget>
+                        <widget class="QLabel" row="1" column="0">
+                            <property name="name">
+                                <cstring>TextLabel5</cstring>
+                            </property>
+                            <property name="sizePolicy">
+                                <sizepolicy>
+                                    <hsizetype>0</hsizetype>
+                                    <vsizetype>0</vsizetype>
+                                    <horstretch>0</horstretch>
+                                    <verstretch>0</verstretch>
+                                </sizepolicy>
+                            </property>
+                            <property name="text">
+                                <string>TL5</string>
+                            </property>
+                        </widget>
+                        <widget class="QLabel" row="0" column="0">
+                            <property name="name">
+                                <cstring>TextLabel4</cstring>
+                            </property>
+                            <property name="sizePolicy">
+                                <sizepolicy>
+                                    <hsizetype>0</hsizetype>
+                                    <vsizetype>0</vsizetype>
+                                    <horstretch>0</horstretch>
+                                    <verstretch>0</verstretch>
+                                </sizepolicy>
+                            </property>
+                            <property name="text">
+                                <string>TL4</string>
+                            </property>
+                        </widget>
+                        <widget class="QSpinBox" row="0" column="1">
+                            <property name="name">
+                                <cstring>SpinBox1</cstring>
+                            </property>
+                            <property name="sizePolicy">
+                                <sizepolicy>
+                                    <hsizetype>7</hsizetype>
+                                    <vsizetype>0</vsizetype>
+                                    <horstretch>0</horstretch>
+                                    <verstretch>0</verstretch>
+                                </sizepolicy>
+                            </property>
+                        </widget>
+                    </grid>
+                </widget>
+                <spacer row="4" column="1">
+                    <property name="name">
+                        <cstring>Spacer5</cstring>
+                    </property>
+                    <property name="orientation">
+                        <enum>Vertical</enum>
+                    </property>
+                    <property name="sizeType">
+                        <enum>Expanding</enum>
+                    </property>
+                    <property name="sizeHint">
+                        <size>
+                            <width>16</width>
+                            <height>16</height>
+                        </size>
+                    </property>
+                </spacer>
+            </grid>
+        </widget>
+    </grid>
+</widget>
+<tabstops>
+    <tabstop>PushButton1</tabstop>
+    <tabstop>LineEdit1</tabstop>
+    <tabstop>PushButton2</tabstop>
+    <tabstop>LineEdit2</tabstop>
+    <tabstop>PushButton3</tabstop>
+    <tabstop>LineEdit3</tabstop>
+    <tabstop>SpinBox1</tabstop>
+    <tabstop>SpinBox2</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
index 4f4e471f81d444314238e38975e6f84fa9d16017..1e2a8bd8e6bb6b70265cb51b8316e5932b9331df 100755 (executable)
 #uic -o DlgRef_3Sel1Check_QTD.h DlgRef_3Sel3Spin2Check_QTD.ui
 #uic -o DlgRef_3Sel1Check_QTD.cxx -impl DlgRef_3Sel1Check_QTD.h DlgRef_3Sel1Check_QTD.ui>>>>>>> 1.6.2.3
 
-uic -o DlgRef_3Sel3Spin2Check_QTD.h DlgRef_3Sel3Spin2Check_QTD.ui
-uic -o DlgRef_3Sel3Spin2Check_QTD.cxx -impl DlgRef_3Sel3Spin2Check_QTD.h DlgRef_3Sel3Spin2Check_QTD.ui
\ No newline at end of file
+#uic -o DlgRef_3Sel3Spin2Check_QTD.h DlgRef_3Sel3Spin2Check_QTD.ui
+#uic -o DlgRef_3Sel3Spin2Check_QTD.cxx -impl DlgRef_3Sel3Spin2Check_QTD.h DlgRef_3Sel3Spin2Check_QTD.ui
+
+uic -o DlgRef_3Sel2Spin_QTD.h DlgRef_3Sel2Spin_QTD.ui
+uic -o DlgRef_3Sel2Spin_QTD.cxx -impl DlgRef_3Sel2Spin_QTD.h DlgRef_3Sel2Spin_QTD.ui
index 61da72d2ed83c15d530755bbb23e1da8c2fcf633..df66b8bae19640924815a0ce0ad856089d64a7c3 100644 (file)
@@ -732,6 +732,14 @@ msgstr "Major radius :"
 msgid "GEOM_RADIUS_MINOR"
 msgstr "Minor radius :"
 
+#Major axis
+msgid "GEOM_VECTOR_MAJOR"
+msgstr "Major Axis"
+
+#Optional tag
+msgid "GEOM_OPTIONAL"
+msgstr "optional"
+
 #Compound
 msgid "GEOM_COMPOUND"
 msgstr "Compound"
index 15de08566a8938b69dc38499938d94d0b924cc1d..98c874c60678bd2c08dd687521fa644e95492056 100644 (file)
@@ -72,23 +72,68 @@ Standard_Integer GEOMImpl_EllipseDriver::Execute(TFunction_Logbook& log) const
   TopoDS_Shape aShape;
 
   if (aType == ELLIPSE_PNT_VEC_RR) {
+    // Center
     Handle(GEOM_Function) aRefPoint  = aCI.GetCenter();
-    Handle(GEOM_Function) aRefVector = aCI.GetVector();
     TopoDS_Shape aShapePnt = aRefPoint->GetValue();
+    if (aShapePnt.ShapeType() != TopAbs_VERTEX) {
+      Standard_ConstructionError::Raise
+       ("Ellipse creation aborted: invalid center argument, must be a point");
+    }
+    gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
+    // Normal
+    Handle(GEOM_Function) aRefVector = aCI.GetVector();
     TopoDS_Shape aShapeVec = aRefVector->GetValue();
-    if (aShapePnt.ShapeType() == TopAbs_VERTEX &&
-        aShapeVec.ShapeType() == TopAbs_EDGE) {
-      gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
+    if (aShapeVec.ShapeType() != TopAbs_EDGE) {
+      Standard_ConstructionError::Raise
+       ("Ellipse creation aborted: invalid normal vector argument, must be a vector or an edge");
+    }
+    TopoDS_Edge anE = TopoDS::Edge(aShapeVec);
+    TopoDS_Vertex V1, V2;
+    TopExp::Vertices(anE, V1, V2, Standard_True);
+    if (V1.IsNull() || V2.IsNull()) {
+      Standard_ConstructionError::Raise
+       ("Ellipse creation aborted: invalid normal vector argument: cannot retrieve vertices");
+    }
+    gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
+    if (aV.Magnitude() < gp::Resolution()) {
+      Standard_ConstructionError::Raise
+       ("Ellipse creation aborted: normal vector of zero length is given");
+    }
+
+    // Axes
+    gp_Ax2 anAxes (aP, aV);
+
+    // Main Axis vector (optional)
+    Handle(GEOM_Function) aRefVectorMaj = aCI.GetVectorMajor();
+    if (!aRefVectorMaj.IsNull()) {
+      TopoDS_Shape aShapeVec = aRefVectorMaj->GetValue();
+      if (aShapeVec.ShapeType() != TopAbs_EDGE) {
+        Standard_ConstructionError::Raise
+          ("Ellipse creation aborted: invalid major axis vector argument, must be a vector or an edge");
+      }
       TopoDS_Edge anE = TopoDS::Edge(aShapeVec);
       TopoDS_Vertex V1, V2;
       TopExp::Vertices(anE, V1, V2, Standard_True);
-      if (!V1.IsNull() && !V2.IsNull()) {
-        gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
-        gp_Ax2 anAxes (aP, aV);
-        gp_Elips anEll (anAxes, aCI.GetRMajor(), aCI.GetRMinor());
-        aShape = BRepBuilderAPI_MakeEdge(anEll).Edge();
+      if (V1.IsNull() || V2.IsNull()) {
+       Standard_ConstructionError::Raise
+         ("Ellipse creation aborted: invalid major axis vector argument: cannot retrieve vertices");
       }
+      gp_Vec aVM (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
+      if (aVM.Magnitude() < gp::Resolution()) {
+       Standard_ConstructionError::Raise
+         ("Ellipse creation aborted: major axis vector of zero length is given");
+      }
+      if (aV.IsParallel(aVM, Precision::Angular())) {
+       Standard_ConstructionError::Raise
+         ("Ellipse creation aborted: normal and major axis vectors are parallel");
+      }
+      // Axes defined with main axis vector
+      anAxes  = gp_Ax2 (aP, aV, aVM);
     }
+
+    // Ellipse
+    gp_Elips anEll (anAxes, aCI.GetRMajor(), aCI.GetRMinor());
+    aShape = BRepBuilderAPI_MakeEdge(anEll).Edge();
   } else {
   }
 
index 73b962508f59b301838e7709426531c0001efb58..951366f50efc30e7288f0285bedf16e804dac751 100644 (file)
@@ -325,7 +325,8 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCirclePntVecR
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse
                        (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec,
-                        double theRMajor, double theRMinor)
+                        double theRMajor, double theRMinor,
+                       Handle(GEOM_Object) theVecMaj)
 {
   SetErrorCode(KO);
 
@@ -354,6 +355,13 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse
   aCI.SetRMajor(theRMajor);
   aCI.SetRMinor(theRMinor);
 
+  // vector of major axis is optional parameter
+  if (!theVecMaj.IsNull()) {
+    Handle(GEOM_Function) aRefVecMaj = theVecMaj->GetLastFunction();
+    if (aRefVecMaj.IsNull()) return NULL;
+    aCI.SetVectorMajor(aRefVecMaj);
+  }
+
   //Compute the Ellipse value
   try {
 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
@@ -371,8 +379,16 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse
   }
 
   //Make a Python command
-  GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse("
-    << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")";
+  //Make a Python command
+  if (!theVecMaj.IsNull()) {
+    GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse("
+                                << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor
+                                << ", " << theVecMaj << ")";
+  }
+  else {
+    GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse("
+                                << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")";
+  }
 
   SetErrorCode(OK);
   return anEll;
index 2231b42ac690597970152d1fb45b1610a6e476b3..36109f8c3fd0f1aaef19d377d59afcbfde406768 100644 (file)
@@ -49,7 +49,8 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations {
 
   Standard_EXPORT Handle(GEOM_Object) MakeEllipse (Handle(GEOM_Object) thePnt,
                                                    Handle(GEOM_Object) theVec,
-                                                   double theRMajor, double theRMinor);
+                                                  double theRMajor, double theRMinor,
+                                                  Handle(GEOM_Object) theVecMaj);
 
   Standard_EXPORT Handle(GEOM_Object) MakeArc (Handle(GEOM_Object) thePnt1,
                                                Handle(GEOM_Object) thePnt2,
index 8a199e7609e9d047ebf36481ada3331c250d89db..8fe39a5f3a51ba369e556af31d170a97077c131e 100644 (file)
 //
 #include "GEOM_Function.hxx"
 
-#define ELLIPS_ARG_CC   1
-#define ELLIPS_ARG_VV   2
-#define ELLIPS_ARG_RMAJ 3
-#define ELLIPS_ARG_RMIN 4
+#define ELLIPS_ARG_CC    1
+#define ELLIPS_ARG_VV    2
+#define ELLIPS_ARG_RMAJ  3
+#define ELLIPS_ARG_RMIN  4
+#define ELLIPS_ARG_VVMAJ 5
 
 class GEOMImpl_IEllipse
 {
@@ -40,12 +41,16 @@ class GEOMImpl_IEllipse
   void SetRMajor(double theR) { _func->SetReal(ELLIPS_ARG_RMAJ, theR); }
   void SetRMinor(double theR) { _func->SetReal(ELLIPS_ARG_RMIN, theR); }
 
+  void SetVectorMajor(Handle(GEOM_Function) theV) { _func->SetReference(ELLIPS_ARG_VVMAJ, theV); }
+
   Handle(GEOM_Function) GetCenter() { return _func->GetReference(ELLIPS_ARG_CC); }
   Handle(GEOM_Function) GetVector() { return _func->GetReference(ELLIPS_ARG_VV); }
 
   double GetRMajor() { return _func->GetReal(ELLIPS_ARG_RMAJ); }
   double GetRMinor() { return _func->GetReal(ELLIPS_ARG_RMIN); }
 
+  Handle(GEOM_Function) GetVectorMajor() { return _func->GetReference(ELLIPS_ARG_VVMAJ); }
+
  private:
 
   Handle(GEOM_Function) _func;
index b0097a5afff9cf618d7eee2903550e689d4f558f..21adb1d0cfccea8e8c416618cacbbab8dc12e164 100644 (file)
@@ -173,17 +173,54 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeEllipse
 
   if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
 
-  //Get the reference points
+  //Get the arguments
   Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
     (thePnt->GetStudyID(), thePnt->GetEntry());
   Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
     (theVec->GetStudyID(), theVec->GetEntry());
+  Handle(GEOM_Object) aVecMaj;
 
   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
 
   // Make Ellipse
   Handle(GEOM_Object) anObject =
-    GetOperations()->MakeEllipse(aPnt, aVec, theRMajor, theRMinor);
+    GetOperations()->MakeEllipse(aPnt, aVec, theRMajor, theRMinor, aVecMaj);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ *  MakeEllipseVec
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeEllipseVec
+                      (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
+                      CORBA::Double theRMajor, double theRMinor,
+                      GEOM::GEOM_Object_ptr theVecMaj)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the arguments
+  Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
+    (thePnt->GetStudyID(), thePnt->GetEntry());
+  Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
+    (theVec->GetStudyID(), theVec->GetEntry());
+  Handle(GEOM_Object) aVecMaj;
+  if (!CORBA::is_nil(theVecMaj)) {
+    aVecMaj = GetOperations()->GetEngine()->GetObject
+      (theVecMaj->GetStudyID(), theVecMaj->GetEntry());
+    if (aVecMaj.IsNull()) return aGEOMObject._retn();
+  }
+
+  // Make Ellipse
+  Handle(GEOM_Object) anObject =
+    GetOperations()->MakeEllipse(aPnt, aVec, theRMajor, theRMinor, aVecMaj);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
index f26eef628442c632c5ea1f84e474864c28d533b5..950839198e4e8c4ad979dce311b8140f3a72ad88 100644 (file)
@@ -57,6 +57,11 @@ class GEOM_I_EXPORT GEOM_ICurvesOperations_i :
                                     GEOM::GEOM_Object_ptr theVector,
                                     double theRMajor, double theRMinor);
 
+  GEOM::GEOM_Object_ptr MakeEllipseVec (GEOM::GEOM_Object_ptr theCenter,
+                                       GEOM::GEOM_Object_ptr theVector,
+                                       double theRMajor, double theRMinor,
+                                       GEOM::GEOM_Object_ptr theVectorMajor);
+
   GEOM::GEOM_Object_ptr MakeArc (GEOM::GEOM_Object_ptr thePnt1,
                                 GEOM::GEOM_Object_ptr thePnt2,
                                 GEOM::GEOM_Object_ptr thePnt3);
index 7918c6cfd0f89f307f2ebb196dec2b6560e25855..c43faf91d174caf731ea9f7994321fb4f9a67f3d 100644 (file)
@@ -2412,6 +2412,23 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeEllipse (GEOM::GEOM_Object_ptr theCente
   return anObj;
 }
 
+//=============================================================================
+//  MakeEllipseVec:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeEllipseVec (GEOM::GEOM_Object_ptr theCenter,
+                                                    GEOM::GEOM_Object_ptr theVector,
+                                                    CORBA::Double theRMajor, 
+                                                    CORBA::Double theRMinor,
+                                                    GEOM::GEOM_Object_ptr theVectorMajor)
+{
+  beginService( " GEOM_Superv_i::MakeEllipseVec" );
+  MESSAGE("GEOM_Superv_i::MakeEllipseVec");
+  getCurvesOp();
+  GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakeEllipseVec(theCenter, theVector, theRMajor, theRMinor, theVectorMajor);
+  endService( " GEOM_Superv_i::MakeEllipseVec" );
+  return anObj;
+}
+
 //=============================================================================
 //  MakeArc:
 //=============================================================================
index 3e94148f55320ac14bb2fbcbae3535fb07d4a211..ae5934130ceebd3cab64809833847a9aaab98bfe 100644 (file)
@@ -530,6 +530,10 @@ public:
   GEOM::GEOM_Object_ptr MakeEllipse (GEOM::GEOM_Object_ptr theCenter,
                                     GEOM::GEOM_Object_ptr theVector,
                                     CORBA::Double theRMajor, CORBA::Double theRMinor);
+  GEOM::GEOM_Object_ptr MakeEllipseVec (GEOM::GEOM_Object_ptr theCenter,
+                                       GEOM::GEOM_Object_ptr theVector,
+                                       CORBA::Double theRMajor, CORBA::Double theRMinor,
+                                       GEOM::GEOM_Object_ptr theVectorMajor);
   GEOM::GEOM_Object_ptr MakeArc (GEOM::GEOM_Object_ptr thePnt1,
                                 GEOM::GEOM_Object_ptr thePnt2,
                                 GEOM::GEOM_Object_ptr thePnt3);
index 944ee7ccf82587203f317a012a5f487e7d5624ba..d4fc3a2d9ba179708fb445d8ee9a8cebb8d5f960 100644 (file)
@@ -534,12 +534,17 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @param theVec Vector, normal to the plane of the ellipse.
         #  @param theRMajor Major ellipse radius.
         #  @param theRMinor Minor ellipse radius.
+        #  @param theVecMaj Vector, direction of the ellipse's main axis.
         #  @return New GEOM_Object, containing the created ellipse.
         #
         #  @ref tui_creation_ellipse "Example"
-        def MakeEllipse(self,thePnt, theVec, theRMajor, theRMinor):
+        def MakeEllipse(self,thePnt, theVec, theRMajor, theRMinor, theVecMaj=None):
             # Example: see GEOM_TestAll.py
-            anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
+            if theVecMaj is not None:
+                anObj = self.CurvesOp.MakeEllipseVec(thePnt, theVec, theRMajor, theRMinor, theVecMaj)
+            else:
+                anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
+                pass
             RaiseIfFailed("MakeEllipse", self.CurvesOp)
             return anObj