Initial version of annotation dialog

This commit is contained in:
nds 2016-09-30 12:01:23 +03:00
parent 4697d21bcd
commit 3a7897bcc7
8 changed files with 1713 additions and 11 deletions

View File

@ -65,6 +65,29 @@ namespace
}
};
//=================================================================================
// function : ToPresentation
// purpose :
//=================================================================================
void GEOMGUI_ShapeAnnotations::ShapeAnnotation::ToPresentation(
const Handle(GEOM_Annotation)& theShapeAnnotation,
const gp_Ax3& theLCS ) const
{
gp_Trsf aToLCS;
aToLCS.SetTransformation( theLCS, gp_Ax3() );
//
TCollection_ExtendedString aText;
for (int i = 0; i < (int)Text.length(); i++ )
aText.Insert( i + 1, Text[ i ].unicode() );
//
theShapeAnnotation->SetScreenFixed( IsScreenFixed );
theShapeAnnotation->SetText( aText );
theShapeAnnotation->SetPosition( Position );
theShapeAnnotation->SetAttachPoint( Attach.Transformed( aToLCS ) );
}
//=================================================================================
// function : Constructor
// purpose :
@ -246,19 +269,20 @@ void GEOMGUI_ShapeAnnotations::ToPresentation( const int theIndex,
const Handle(GEOM_Annotation)& theShapeAnnotation,
const gp_Ax3& theLCS )
{
gp_Trsf aToLCS;
aToLCS.SetTransformation( theLCS, gp_Ax3() );
//gp_Trsf aToLCS;
//aToLCS.SetTransformation( theLCS, gp_Ax3() );
//
const ShapeAnnotation& aEntry = myAnnotations[theIndex];
//
TCollection_ExtendedString aText;
for (int i = 0; i < (int)aEntry.Text.length(); i++ )
aText.Insert( i + 1, aEntry.Text[ i ].unicode() );
//
theShapeAnnotation->SetScreenFixed( aEntry.IsScreenFixed );
theShapeAnnotation->SetText( aText );
theShapeAnnotation->SetPosition( aEntry.Position );
theShapeAnnotation->SetAttachPoint( aEntry.Attach.Transformed( aToLCS ) );
aEntry.ToPresentation(theShapeAnnotation, theLCS);
////
//TCollection_ExtendedString aText;
//for (int i = 0; i < (int)aEntry.Text.length(); i++ )
// aText.Insert( i + 1, aEntry.Text[ i ].unicode() );
////
//theShapeAnnotation->SetScreenFixed( aEntry.IsScreenFixed );
//theShapeAnnotation->SetText( aText );
//theShapeAnnotation->SetPosition( aEntry.Position );
//theShapeAnnotation->SetAttachPoint( aEntry.Attach.Transformed( aToLCS ) );
}
//=================================================================================

View File

@ -64,6 +64,13 @@ public:
int ShapeIndex; // index of the annotated subshape
int ShapeType; // type of the annotated subshape
/*!
* \brief Update presentation properties using the annotation record definition.
* \param theShapeAnnotation [in] the explicit definition of the annotation.
*/
void ToPresentation( const Handle(GEOM_Annotation)& theShapeAnnotation,
const gp_Ax3& theLCS ) const;
bool operator == (const ShapeAnnotation& theOther) const
{
return Text == theOther.Text

View File

@ -661,6 +661,7 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
case GEOMOp::OpCheckSelfInters: // MENU MEASURE - CHECK SELF INTERSECTIONS
case GEOMOp::OpFastCheckInters: // MENU MEASURE - FAST CHECK INTERSECTIONS
case GEOMOp::OpManageDimensions: // MENU MEASURE - MANAGE DIMENSIONS
case GEOMOp::OpAnnotation: // MENU MEASURE - ANNOTATION
#ifndef DISABLE_PLOT2DVIEWER
case GEOMOp::OpShapeStatistics: // MENU MEASURE - SHAPE STATISTICS
#endif
@ -1042,6 +1043,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpMinDistance, "MIN_DIST" );
createGeomAction( GEOMOp::OpAngle, "MEASURE_ANGLE" );
createGeomAction( GEOMOp::OpManageDimensions, "MANAGE_DIMENSIONS" );
createGeomAction( GEOMOp::OpAnnotation, "ANNOTATION" );
createGeomAction( GEOMOp::OpTolerance, "TOLERANCE" );
createGeomAction( GEOMOp::OpWhatIs, "WHAT_IS" );
@ -1310,6 +1312,8 @@ void GeometryGUI::initialize( CAM_Application* app )
createMenu( GEOMOp::OpAngle, dimId, -1 );
createMenu( GEOMOp::OpManageDimensions, dimId, -1 );
createMenu( GEOMOp::OpAnnotation, measurId, -1 );
createMenu( separator(), measurId, -1 );
createMenu( GEOMOp::OpTolerance, measurId, -1 );
createMenu( separator(), measurId, -1 );
@ -1466,6 +1470,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createTool( GEOMOp::OpBoundingBox, measureTbId );
createTool( GEOMOp::OpMinDistance, measureTbId );
createTool( GEOMOp::OpAngle, measureTbId );
createTool( GEOMOp::OpAnnotation, measureTbId );
createTool( GEOMOp::OpTolerance , measureTbId );
createTool( separator(), measureTbId );
createTool( GEOMOp::OpFreeBoundaries, measureTbId );

View File

@ -207,6 +207,8 @@ namespace GEOMOp {
#ifndef DISABLE_PLOT2DVIEWER
OpShapeStatistics = 5019, // MENU MEASURES - SHAPE STATISTICS
#endif
OpAnnotation = 5020, // MENU MEASURES - ANNOTATION
OpEditAnnotation = 5021, // POPUP MENU - EDIT ANNOTATION
// GroupGUI --------------------//--------------------------------
OpGroupCreate = 6000, // MENU GROUP - CREATE
OpGroupEdit = 6001, // MENU GROUP - EDIT

View File

@ -88,6 +88,7 @@ SET(MeasureGUI_HEADERS
MeasureGUI_InertiaDlg.h
MeasureGUI_BndBoxDlg.h
MeasureGUI_DistanceDlg.h
MeasureGUI_AnnotationDlg.h
MeasureGUI_AngleDlg.h
MeasureGUI_MaxToleranceDlg.h
MeasureGUI_WhatisDlg.h
@ -116,6 +117,7 @@ SET(_moc_HEADERS
MeasureGUI_InertiaDlg.h
MeasureGUI_BndBoxDlg.h
MeasureGUI_DistanceDlg.h
MeasureGUI_AnnotationDlg.h
MeasureGUI_AngleDlg.h
MeasureGUI_MaxToleranceDlg.h
MeasureGUI_WhatisDlg.h
@ -154,6 +156,7 @@ SET(MeasureGUI_SOURCES
MeasureGUI_InertiaDlg.cxx
MeasureGUI_BndBoxDlg.cxx
MeasureGUI_DistanceDlg.cxx
MeasureGUI_AnnotationDlg.cxx
MeasureGUI_AngleDlg.cxx
MeasureGUI_MaxToleranceDlg.cxx
MeasureGUI_WhatisDlg.cxx

View File

@ -44,6 +44,7 @@
#include "MeasureGUI_BndBoxDlg.h" // Method BNDBOX
#include "MeasureGUI_DistanceDlg.h" // Method DISTANCE
#include "MeasureGUI_AngleDlg.h" // Method ANGLE
#include "MeasureGUI_AnnotationDlg.h" // Method ANNOTATION
#include "MeasureGUI_MaxToleranceDlg.h" // Method MAXTOLERANCE
#include "MeasureGUI_WhatisDlg.h" // Method WHATIS
#include "MeasureGUI_CheckShapeDlg.h" // Method CHECKSHAPE
@ -111,6 +112,14 @@ bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
case GEOMOp::OpAngle:
dlg = new MeasureGUI_AngleDlg( getGeometryGUI(), parent );
break; // ANGLE
case GEOMOp::OpAnnotation: {
dlg = new MeasureGUI_AnnotationDlg( getGeometryGUI(), true, parent );
} // ANNOTATION
break;
case GEOMOp::OpEditAnnotation: {
dlg = new MeasureGUI_AnnotationDlg( getGeometryGUI(), false, parent );
} // ANNOTATION
break;
case GEOMOp::OpTolerance:
dlg = new MeasureGUI_MaxToleranceDlg( getGeometryGUI(), parent );
break; // MAXTOLERANCE

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,213 @@
// Copyright (C) 2007-2016 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, or (at your option) any later version.
//
// 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 : MeasureGUI_AnnotationDlg.h
#ifndef MeasureGUI_AnnotationDlg_H
#define MeasureGUI_AnnotationDlg_H
#include <GEOMBase_Skeleton.h>
//#include <GEOM_Annotation.hxx>
#include <GEOM_Constants.h>
#include <GEOMGUI_ShapeAnnotations.h>
#include <TopAbs_ShapeEnum.hxx>
#include <TColStd_DataMapOfIntegerInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <QMap>
#include <QSet>
#include <QVector>
#include <QTableWidget>
class QGroupBox;
class QLineEdit;
class QPushButton;
class QComboBox;
class SalomeApp_IntSpinBox;
//=================================================================================
// class : MeasureGUI_AnnotationDlg
// purpose :
//=================================================================================
class MeasureGUI_AnnotationDlg : public GEOMBase_Skeleton
{
Q_OBJECT
/*class StepTable;
class IntSpinItem;
class DoubleSpinItem;
class CheckItem;
class Delegate;*/
public:
MeasureGUI_AnnotationDlg (GeometryGUI* theGeometryGUI,
const bool theIsCreate,
QWidget* parent=0,
bool modal=false, Qt::WindowFlags fl=0);
~MeasureGUI_AnnotationDlg();
protected:
// redefined from GEOMBase_Helper
//virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid (QString&);
virtual bool execute ();
//virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private slots:
void ClickOnOk();
bool ClickOnApply();
//void ActivateThisDialog();
void SelectionIntoArgument();
void SetEditCurrentArgument();
/*void onPrevStep();
void onNextStep();
void onAddStep();
void onRmStep();
void onStampChange();
void onDimChange();*/
void onTextChange();
void onTypeChange();
void onSubShapeTypeChange();
/*void onNbCompsChange();
void showCurStep();
void highlightSubShapes();
*/
private:
bool isCreateOperation() const;
void Init();
//void enterEvent (QEvent*);
//void activateSelection();
TopAbs_ShapeEnum getShapeType() const;
/* int getDim() const;
int getDataType() const;
int getCurStepID() const;
int getNbComps() const;
void updateShapeIDs();
void updateDims(int curDim=-1);
int getSelectedSubshapes (TColStd_IndexedMapOfInteger& map);
*/
private:
QList<TopAbs_ShapeEnum> mySelectionModes;
GEOMGUI_ShapeAnnotations::ShapeAnnotation myAnnotationProperties;
/// an index of edited annotation in the list shape annotations, -1 in create operation
bool myIsCreation;
GEOM::GeomObjPtr myShape;
/*QVector< int > myShapeIDs;
TopTools_IndexedMapOfShape myShapeMap;
int myCurStepID;
StepTable* myCurStepTable;
QMap< int, StepTable* > myStepTables;
QSet< int > myRemovedSteps;
int myDmMode;*/
//bool myIsHiddenMain;
// QList<int> myHiddenFieldStepIds;
QLineEdit* myTextEdit;
QPushButton* myShapeSelBtn;
QLineEdit* myShapeName;
QComboBox* myTypeCombo;
QComboBox* mySubShapeTypeCombo;
QPushButton* mySubShapeSelBtn;
QLineEdit* mySubShapeName;
/*
QComboBox* myDimCombo;
QPushButton* myPrevStepBtn;
QPushButton* myNextStepBtn;
QPushButton* myRmStepBtn;
SalomeApp_IntSpinBox* myNbCompsSpin;
QWidget* mySwitchTableWdg;
QComboBox* myStepsCombo;
QLineEdit* myStepEdit;
SalomeApp_IntSpinBox* myStampSpin;
*/
};
/*
Class : MeasureGUI_AnnotationDlg::StepTable
Description : Table widget
*/
/*class MeasureGUI_AnnotationDlg::StepTable : public QTableWidget
{
Q_OBJECT
int myDataType;
int myStepID;
int myStamp;
GEOM::GEOM_FieldStep_var myStep;
bool myIsChanged;
QTableWidgetItem * newDefaultItem();
public:
StepTable( int stepID, int dataType, int nbRows, int nbColumns,
QString shapeName, QStringList headers,
GEOM::GEOM_FieldStep_ptr stepVar, QWidget* = 0 );
virtual ~StepTable();
QSize minimumSizeHint() const;
void setEditable( bool, int, int );
bool isEditable( int, int ) const;
void setReadOnly( bool );
bool isReadOnly() const;
void insertRows( int, int = 1 );
QString text( int, int );
QList<int> selectedRows();
void selectRows(const QList<int>& rows);
void setDim( int nbRows, QString shapeName, bool setDefault=true );
void setNbComps( int nbComps );
void setDataType( int dataType );
void setStamp( int stamp ) { myStamp = stamp; }
int getStamp() { return myStamp; }
int getStepID() { return myStepID; }
QStringList getHeaders();
void setHeaders(const QStringList& headers);
GEOM::GEOM_FieldStep_var getStep() { return myStep; }
void setValues(GEOM::GEOM_FieldStep_var& step);
public slots:
void setIsChanged() { myIsChanged = true; }
void headerDblClicked( int );
};*/
#endif