geom/src/EntityGUI/EntityGUI_SketcherDlg.h

240 lines
9.7 KiB
C
Raw Normal View History

2013-04-01 18:25:01 +06:00
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
2004-06-16 21:24:55 +06:00
//
2012-08-09 13:58:02 +06:00
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
2012-08-09 13:58:02 +06:00
// 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.
//
2012-08-09 13:58:02 +06:00
// 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.
//
2012-08-09 13:58:02 +06:00
// 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
//
2012-08-09 13:58:02 +06:00
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
2004-06-16 21:24:55 +06:00
//
2012-08-09 13:58:02 +06:00
2009-02-13 17:16:39 +05:00
// GEOM GEOMGUI : GUI for Geometry component
// File : EntityGUI_SketcherDlg.h
// Author : Damien COQUERET, Open CASCADE S.A.S.
2004-06-16 21:24:55 +06:00
//
#ifndef ENTITYGUI_SKETCHERDLG_H
#define ENTITYGUI_SKETCHERDLG_H
2009-02-13 17:16:39 +05:00
#include <GEOMBase_Helper.h>
2012-08-09 13:58:02 +06:00
#include <QGroupBox>
#include <QComboBox>
2009-02-13 17:16:39 +05:00
#include <QDialog>
2012-08-09 13:58:02 +06:00
#include <QLabel>
#include <gp_Ax3.hxx>
2009-02-13 17:16:39 +05:00
class QLineEdit;
class SalomeApp_DoubleSpinBox;
class EntityGUI_1Sel;
2012-08-09 13:58:02 +06:00
class EntityGUI_2Sel1Check;
class EntityGUI_1Sel1Spin1Check;
2009-02-13 17:16:39 +05:00
class EntityGUI_1Spin;
class EntityGUI_2Spin;
2012-08-09 13:58:02 +06:00
class EntityGUI_3Spin1Check;
class EntityGUI_4Spin1Check;
2009-02-13 17:16:39 +05:00
class EntityGUI_Point;
class EntityGUI_Dir1;
class EntityGUI_Dir2;
class EntityGUI_Skeleton;
2012-08-09 13:58:02 +06:00
class DlgRef_4Spin;
2009-02-13 17:16:39 +05:00
class GeometryGUI;
#ifndef COORD_MIN
# define COORD_MIN -1e+15
# define COORD_MAX +1e+15
# define MAX_NUMBER 100000
# define DBL_DIGITS_DISPLAY 16
#endif // COORD_MIN
2004-06-16 21:24:55 +06:00
//=================================================================================
// class : EntityGUI_Dlg
// purpose :
//=================================================================================
2009-02-13 17:16:39 +05:00
class EntityGUI_SketcherDlg : public QDialog, GEOMBase_Helper
2004-06-16 21:24:55 +06:00
{
2009-02-13 17:16:39 +05:00
Q_OBJECT
2004-06-16 21:24:55 +06:00
public:
2009-02-13 17:16:39 +05:00
EntityGUI_SketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0,
2012-08-09 13:58:02 +06:00
const double = -1 );
2009-02-13 17:16:39 +05:00
~EntityGUI_SketcherDlg();
2004-06-16 21:24:55 +06:00
2009-02-13 17:16:39 +05:00
bool eventFilter (QObject* object, QEvent* event);
2012-08-09 13:58:02 +06:00
bool acceptMouseEvent() const; // called by EntityGUI::OnMousePress()
void OnPointSelected( Qt::KeyboardModifiers, const gp_Pnt&, bool isStart = true );
2004-12-01 15:39:14 +05:00
protected:
2009-02-13 17:16:39 +05:00
void initSpinBox( SalomeApp_DoubleSpinBox*,
2012-08-09 13:58:02 +06:00
double, double, double = 0.1,
const char* quantity = "length_precision" );
2009-02-13 17:16:39 +05:00
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
2012-08-09 13:58:02 +06:00
virtual void addSubshapesToStudy();
2009-02-13 17:16:39 +05:00
void closeEvent( QCloseEvent* );
void keyPressEvent( QKeyEvent* );
private:
void Init();
void enterEvent( QEvent* );
void InitClick();
void setEnabledUndo( bool );
void setEnabledRedo( bool );
QString GetNewCommand( QString& );
virtual void displayPreview( GEOM::GEOM_Object_ptr,
2012-08-09 13:58:02 +06:00
const bool = false,
const bool = false,
const bool = true,
const double = -1,
const int = -1,
const int = -1);
void displayPntPreview( const double = 0.0,
const double = 0.0,
bool /*append*/ = true,
bool /*update*/ = true
);
2009-02-13 17:16:39 +05:00
bool createShapes( GEOM::GEOM_Object_ptr,
2012-08-09 13:58:02 +06:00
TopoDS_Shape&,
TopoDS_Shape& );
int getPnt1ConstructorId() const;
int getPnt2ConstructorId() const;
void OnFirstPoint();
void OnNextPoint();
2009-02-13 17:16:39 +05:00
private:
int myConstructorId;
int myConstructorDirId;
2012-08-09 13:58:02 +06:00
int myConstructorPntId;
2009-02-13 17:16:39 +05:00
int mySketchType;
int mySketchState;
bool myIsAllAdded;
bool myIsApply;
2012-08-09 13:58:02 +06:00
bool autoApply;
2009-02-13 17:16:39 +05:00
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
QStringList myCommand;
QStringList myUndoCommand;
QStringList myParameters;
QStringList myUndoParameters;
Standard_Real myX, myY, myDX, myDY;
2012-08-09 13:58:02 +06:00
Standard_Real myX1, myY1, myX2, myY2;
Standard_Real myXc, myYc, myDXc, myDYc;
2009-02-13 17:16:39 +05:00
Standard_Real myLength, myAngle, myRadius;
Standard_Real myLastX1, myLastY1;
Standard_Real myLastX2, myLastY2;
QString myXStr, myYStr, myDXStr, myDYStr;
2012-08-09 13:58:02 +06:00
QString myX1Str, myY1Str, myX2Str, myY2Str;
QString myXcStr, myYcStr, myDXcStr, myDYcStr;
2009-02-13 17:16:39 +05:00
QString myLengthStr, myAngleStr, myRadiusStr;
QString myLastX1Str, myLastY1Str;
QString myLastX2Str, myLastY2Str;
EntityGUI_Skeleton* MainWidget;
EntityGUI_Point* GroupPt;
2012-08-09 13:58:02 +06:00
EntityGUI_Point* GroupPt2;
2009-02-13 17:16:39 +05:00
EntityGUI_Dir1* GroupD1;
EntityGUI_Dir2* GroupD2;
EntityGUI_1Sel* Group1Sel;
2012-08-09 13:58:02 +06:00
EntityGUI_2Sel1Check* Group2Sel;
EntityGUI_1Sel1Spin1Check* Group1Sel1Spin;
2009-02-13 17:16:39 +05:00
EntityGUI_1Spin* Group1Spin;
EntityGUI_2Spin* Group2Spin;
2012-08-09 13:58:02 +06:00
EntityGUI_3Spin1Check* Group3Spin;
EntityGUI_4Spin1Check* Group4Spin;
DlgRef_4Spin* GroupRect;
QLabel* myErrLabel;
QGroupBox* GroupBox1;
QComboBox* ComboBox1;
QPushButton* planeButton;
QPushButton* selButton;
QLineEdit* WPlaneLineEdit;
2009-02-13 17:16:39 +05:00
GeometryGUI* myGeometryGUI;
QString myHelpFileName;
double myLineWidth;
2012-08-09 13:58:02 +06:00
QList<gp_Ax3> myLCSList;
GEOM::GEOM_Object_var myGlobalCS;
GEOM::GEOM_Object_var myWPlane;
QList< GEOM::GEOM_Object_var > myWPlaneList;
int myCheckFlag;
TopAbs_ShapeEnum myNeedType;
2009-02-13 17:16:39 +05:00
private:
enum SketchState { FIRST_POINT, NEXT_POINT };
enum SketchType { PT_ABS, PT_RELATIVE, PT_SEL,
2012-08-09 13:58:02 +06:00
PT_ABS_RADIUS,PT_REL_RADIUS,PT_SEL_RADIUS,
PT_ABS_CENTER,PT_REL_CENTER,PT_SEL_CENTER,
DIR_ANGLE_LENGTH, DIR_ANGLE_X, DIR_ANGLE_Y,
DIR_PER_LENGTH, DIR_PER_X, DIR_PER_Y,
DIR_TAN_LENGTH, DIR_TAN_X, DIR_TAN_Y,
DIR_DXDY_LENGTH, DIR_DXDY_X, DIR_DXDY_Y };
2009-02-13 17:16:39 +05:00
2004-06-16 21:24:55 +06:00
private slots:
2009-02-13 17:16:39 +05:00
void ClickOnEnd();
void ClickOnCancel();
bool ClickOnApply();
void ClickOnUndo();
void ClickOnRedo();
void ClickOnHelp();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void DeactivateActiveDialog();
void ActivateThisDialog();
void TypeClicked( int );
2012-08-09 13:58:02 +06:00
void RectClicked();
2009-02-13 17:16:39 +05:00
void DestClicked( int );
void PointClicked( int );
2012-08-09 13:58:02 +06:00
void Point2Clicked( int );
2009-02-13 17:16:39 +05:00
void Dir1Clicked( int );
void Dir2Clicked( int );
2012-08-09 13:58:02 +06:00
void CheckBoxClicked( int );
2009-02-13 17:16:39 +05:00
void ValueChangedInSpinBox( double );
void SetDoubleSpinBoxStep( double );
2012-08-09 13:58:02 +06:00
void AddLocalCS( GEOM::GEOM_Object_var );
void FindLocalCS();
gp_Ax3 GetActiveLocalCS();
gp_Ax3 WPlaneToLCS( GEOM::GEOM_Object_var );
void ActivateLocalCS();
2004-06-16 21:24:55 +06:00
};
#endif // ENTITYGUI_SKETCHERDLG_H