geom/src/EntityGUI/EntityGUI_3DSketcherDlg.h

203 lines
7.7 KiB
C
Raw Normal View History

2012-08-09 13:58:02 +06:00
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
2009-02-13 17:16:39 +05: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.
//
// 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
2012-08-09 13:58:02 +06:00
// GEOM GEOMGUI : GUI for Geometry component
2009-02-13 17:16:39 +05:00
// File : EntityGUI_3DSketcherDlg.h
// Author : DMV, OCN
2012-10-08 17:16:36 +06:00
2009-02-13 17:16:39 +05:00
#ifndef ENTITYGUI_3DSKETCHERDLG_H
#define ENTITYGUI_3DSKETCHERDLG_H
#include <GEOMBase_Skeleton.h>
2012-08-09 13:58:02 +06:00
class QButtonGroup;
2009-02-13 17:16:39 +05:00
class QDoubleSpinBox;
class EntityGUI_3Spin;
2012-12-13 14:40:36 +06:00
class EntityGUI_Type;
2012-08-09 13:58:02 +06:00
class EntityGUI_Angles;
class EntityGUI_Controls;
class SOCC_Prs;
2012-12-13 14:40:36 +06:00
class gp_Dir;
2012-08-09 13:58:02 +06:00
#include <AIS_ListOfInteractive.hxx>
2012-12-13 14:40:36 +06:00
#include <AIS_AngleDimension.hxx>
#include <AIS_LengthDimension.hxx>
2009-02-13 17:16:39 +05:00
#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
2012-12-13 14:40:36 +06:00
// For convenience
bool isSame (double d1, double d2);
2009-02-13 17:16:39 +05:00
//=================================================================================
// class : EntityGUI_Dlg
// purpose :
//=================================================================================
class EntityGUI_3DSketcherDlg : public GEOMBase_Skeleton
{
Q_OBJECT
2012-08-09 13:58:02 +06:00
struct XYZ
{
2012-12-13 14:40:36 +06:00
XYZ() { x = y = z = 0.0; command = params = ""; L=A=T=0; }
2012-10-08 17:16:36 +06:00
double x, y, z; // for preview only
2012-12-13 14:40:36 +06:00
int L, A, T; // for preview only
2012-10-08 17:16:36 +06:00
QString command;
QString params;
2012-08-09 13:58:02 +06:00
};
2012-12-13 14:40:36 +06:00
struct prsType
{
prsType(){L=A=T=0;}
int L;
int A;
int T;
};
2012-08-09 13:58:02 +06:00
typedef QList<XYZ> XYZList;
2009-02-13 17:16:39 +05:00
public:
2012-10-08 17:16:36 +06:00
EntityGUI_3DSketcherDlg (GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2.);
2009-02-13 17:16:39 +05:00
~EntityGUI_3DSketcherDlg();
protected:
2012-08-09 13:58:02 +06:00
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& );
private:
void Init();
void enterEvent( QEvent* );
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);
2012-12-13 14:40:36 +06:00
Handle(AIS_LengthDimension) createAISLengthDimension(double theLength,
gp_Pnt P1,
gp_Pnt P2,
gp_Dir theNormal);
Handle(AIS_AngleDimension) createAISAngleDimension(double theAngle,
gp_Pnt P0,
gp_Pnt P1,
gp_Pnt P2);
void displayAngle(double theAngle,
gp_Pnt P0,
gp_Pnt P1,
gp_Pnt P2,
bool store = false);
void displayLength(gp_Pnt P1,
gp_Pnt P2,
gp_Dir theNormal,
bool store = false);
void displayText(std::string theText,
gp_Pnt P,
bool store = false);
2012-08-09 13:58:02 +06:00
void displayTrihedron( int );
2012-12-13 14:40:36 +06:00
void displayDimensions(bool store = false);
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& );
XYZ getLastPoint() const;
XYZ getPenultimatePoint() const;
XYZ getCurrentPoint() const;
2012-12-13 14:40:36 +06:00
gp_Dir getPresentationPlane() const;
2012-08-09 13:58:02 +06:00
std::string doubleToString( double );
2012-12-13 14:40:36 +06:00
gp_Trsf toReferenceSystem(gp_Pnt origin) const;
gp_Trsf toCurrentSystem(gp_Pnt origin) const;
void removeLastIOFromPrs();
void restoreLastIOToPrs();
double radius(gp_Pnt) const;
double height(gp_Pnt) const;
double longitude(gp_Pnt) const;
double latitude(gp_Pnt) const;
2009-02-13 17:16:39 +05:00
private:
2012-08-09 13:58:02 +06:00
XYZList myPointsList;
XYZList myRedoList;
AIS_ListOfInteractive myLengthIORedoList;
AIS_ListOfInteractive myAngleIORedoList;
2012-12-13 14:40:36 +06:00
AIS_ListOfInteractive myTextIORedoList;
prsType myPrsType;
2009-02-13 17:16:39 +05:00
EntityGUI_3Spin* Group3Spin;
2012-08-09 13:58:02 +06:00
EntityGUI_Angles* GroupAngles;
EntityGUI_Controls* GroupControls;
2012-12-13 14:40:36 +06:00
EntityGUI_Type* GroupType;
QButtonGroup* myTypeGroup1;
QButtonGroup* myTypeGroup2;
2009-02-13 17:16:39 +05:00
2012-08-09 13:58:02 +06:00
int myMode;
2012-12-13 14:40:36 +06:00
int myCoordType;
2012-08-09 13:58:02 +06:00
int myOrientation;
2009-02-13 17:16:39 +05:00
bool myOK;
2012-08-09 13:58:02 +06:00
bool isLengthVisible;
bool isAngleVisible;
2009-02-13 17:16:39 +05:00
double myLineWidth;
GeometryGUI* myGeometryGUI;
2012-08-09 13:58:02 +06:00
SOCC_Prs* myAnglePrs;
SOCC_Prs* myLengthPrs;
2012-12-13 14:40:36 +06:00
SOCC_Prs* myTextPrs;
2009-02-13 17:16:39 +05:00
private slots:
void ClickOnOk();
void ClickOnAddPoint();
bool ClickOnApply();
// bool isSameAsPrevious();
void UpdateButtonsState();
2012-10-08 17:16:36 +06:00
void UpdatePointCoordinates();
2009-02-13 17:16:39 +05:00
void ClickOnUndo();
void ClickOnRedo();
void SelectionIntoArgument();
void DeactivateActiveDialog();
void ActivateThisDialog();
2012-08-09 13:58:02 +06:00
void TypeClicked( int );
2009-02-13 17:16:39 +05:00
void ValueChangedInSpinBox( double );
2012-08-09 13:58:02 +06:00
void ButtonClicked( bool );
void BoxChecked ( bool );
2009-02-13 17:16:39 +05:00
void SetDoubleSpinBoxStep( double );
};
#endif // ENTITYGUI_SKETCHERDLG_H