diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt
index cef2c42f2..44d86e7bc 100755
--- a/resources/CMakeLists.txt
+++ b/resources/CMakeLists.txt
@@ -35,6 +35,7 @@ SET( _res_files
GEOM.config
GEOMDS_Resources
ShHealing
+ Y14.5M-2009.ttf
3dsketch.png
isoline.png
isoline_v.png
diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in
index 84f53783c..8e83fdbc2 100644
--- a/resources/SalomeApp.xml.in
+++ b/resources/SalomeApp.xml.in
@@ -92,12 +92,13 @@
-
+
-
+
+
diff --git a/resources/Y14.5M-2009.ttf b/resources/Y14.5M-2009.ttf
new file mode 100644
index 000000000..1f1ca199a
Binary files /dev/null and b/resources/Y14.5M-2009.ttf differ
diff --git a/src/GEOMGUI/CMakeLists.txt b/src/GEOMGUI/CMakeLists.txt
index 211156716..c5e9e928f 100755
--- a/src/GEOMGUI/CMakeLists.txt
+++ b/src/GEOMGUI/CMakeLists.txt
@@ -76,12 +76,14 @@ SET(GEOMGUI_HEADERS
GEOMGUI_Selection.h
GEOM_GEOMGUI.hxx
GEOMGUI_CreationInfoWdg.h
+ GEOMGUI_TextTreeWdg.h
GEOMGUI_DimensionProperty.h
)
# header files / to be processed by moc
SET(_moc_HEADERS
GEOMGUI_CreationInfoWdg.h
+ GEOMGUI_TextTreeWdg.h
GeometryGUI.h
)
@@ -114,6 +116,7 @@ SET(GEOMGUI_SOURCES
GEOMGUI_OCCSelector.cxx
GEOMGUI_Selection.cxx
GEOMGUI_CreationInfoWdg.cxx
+ GEOMGUI_TextTreeWdg.cxx
GEOMGUI_DimensionProperty.cxx
${_moc_SOURCES}
${_rcc_SOURCES}
diff --git a/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx b/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx
new file mode 100644
index 000000000..2c00a3bd4
--- /dev/null
+++ b/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx
@@ -0,0 +1,421 @@
+// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+// File : GEOMGUI_TextTreeWdg.cxx
+// Author : Alexander KOVALEV (akl)
+
+#include "GEOMGUI_TextTreeWdg.h"
+
+#include "GEOMGUI_DimensionProperty.h"
+#include "GeometryGUI.h"
+#include "GeometryGUI_Operations.h"
+#include
+#include
+
+// GUI includes
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+// Qt includes
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+GEOMGUI_TextTreeWdg::GEOMGUI_TextTreeWdg( SalomeApp_Application* app )
+ : myDisplayer(NULL)
+{
+ myStudy = dynamic_cast( app->activeStudy() );
+ myDisplayer = GEOM_Displayer( myStudy );
+
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ myVisibleIcon = QIcon( resMgr->loadPixmap( "SUIT", tr( "ICON_DATAOBJ_VISIBLE" ) ) );
+ myInvisibleIcon = QIcon( resMgr->loadPixmap( "SUIT", tr( "ICON_DATAOBJ_INVISIBLE" ) ) );
+
+ setWindowTitle( tr( "TEXT_TREE_VIEW_TITLE" ) );
+ setObjectName( "geomTextTreeWdg" );
+
+ setRootIsDecorated( true );
+ setSelectionMode( QAbstractItemView::ExtendedSelection );
+ setAllColumnsShowFocus( true );
+ setUniformRowHeights( true );
+
+ QStringList columnNames;
+ columnNames << tr("TEXT_TREE_VIEW_NAME") << "";
+ QTreeWidgetItem * headerItem = new QTreeWidgetItem( columnNames );
+ headerItem->setIcon( 1, myVisibleIcon );
+ setHeaderItem ( headerItem );
+ header()->moveSection( 1, 0 );
+ header()->setResizeMode( 1, QHeaderView::ResizeToContents );
+
+ QStringList rootNames;
+ rootNames << tr("GEOM_DIMENSIONS") << "";
+ myDimensionsItem = new QTreeWidgetItem( this, rootNames );
+ myDimensionsItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
+ addTopLevelItem( myDimensionsItem );
+
+ // get a free dockable window id
+ myWindowID = 11;
+ while( app->dockWindow( myWindowID ))
+ ++myWindowID;
+ ++myWindowID;
+
+ createActions();
+ setContextMenuPolicy( Qt::CustomContextMenu );
+ connect( this, SIGNAL( customContextMenuRequested(const QPoint&) ),
+ this, SLOT( showContextMenu(const QPoint&) ) );
+
+ connect( myStudy, SIGNAL( objVisibilityChanged( QString, Qtx::VisibilityState ) ),
+ this, SLOT( updateVisibilityColumn( QString, Qtx::VisibilityState ) ) );
+ connect( app->objectBrowser(), SIGNAL( updated() ), this, SLOT( updateTree() ) );
+ GeometryGUI* aGeomGUI = dynamic_cast( app->module( "Geometry" ) );
+ connect( aGeomGUI, SIGNAL( DimensionsUpdated( const QString& ) ), this, SLOT( updateBranch( const QString& ) ) );
+ connect( this, SIGNAL( itemClicked( QTreeWidgetItem*, int) ),
+ this, SLOT( onItemClicked( QTreeWidgetItem*, int ) ) );
+
+}
+
+GEOMGUI_TextTreeWdg::~GEOMGUI_TextTreeWdg()
+{
+ //std::cout<<"~GEOMGUI_TextTreeWdg"<setIcon( myVisibleIcon );
+ myActions.insert( GEOMOp::OpShow, a );
+
+ QAction* b = new QAction( tr( "MEN_ERASE" ), this );
+ b->setIcon( myInvisibleIcon );
+ myActions.insert( GEOMOp::OpHide, b );
+}
+
+//=================================================================================
+// function : updateTree
+// purpose :
+//=================================================================================
+void GEOMGUI_TextTreeWdg::updateTree()
+{
+ myStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() );
+ _PTR(Study) aDSStudy = myStudy->studyDS();
+ if ( aDSStudy ) {
+ _PTR(SComponent) SC ( aDSStudy->FindComponent( "GEOM" ) );
+ if ( SC ) {
+ _PTR(ChildIterator) anIter ( aDSStudy->NewChildIterator( SC ) );
+ anIter->InitEx( true );
+ QList objEntries = myObjects.keys();
+ while( anIter->More() ) {
+ _PTR(SObject) valSO ( anIter->Value() );
+ _PTR(SObject) refSO;
+ if ( !valSO->ReferencedObject( refSO ) ) {
+ // update tree of object's dimensions
+ QString anEntry = valSO->GetID().c_str();
+ updateBranch( anEntry );
+ objEntries.removeAll( anEntry );
+ }
+ anIter->Next();
+ }
+ foreach (QString entry, objEntries) {
+ removeBranch( entry, true );
+ }
+ }
+ }
+}
+
+//=================================================================================
+// function : updateBranch
+// purpose :
+//=================================================================================
+void GEOMGUI_TextTreeWdg::updateBranch( const QString& theEntry )
+{
+ myStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() );
+ if ( myStudy ) {
+ _PTR(Study) aStudyDS = myStudy->studyDS();
+ if ( aStudyDS ) {
+ _PTR(SObject) obj( aStudyDS->FindObjectID( theEntry.toStdString() ) );
+ QString aName = obj->GetName().c_str();
+
+ GEOMGUI_DimensionProperty aProp;
+ aProp.LoadFromAttribute( myStudy, theEntry.toStdString() );
+ int nbProps = aProp.GetNumber();
+
+ QTreeWidgetItem* objectItem = itemFromEntry( theEntry );
+ if ( objectItem ) {
+ removeBranch( theEntry, nbProps > 0 ? false : true );
+ }
+ QStringList itemName;
+ if ( nbProps > 0 ) {
+ itemName << aName << "";
+ if ( !objectItem ) {
+ objectItem = new QTreeWidgetItem( myDimensionsItem, itemName );
+ objectItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
+ objectItem->setData( 1, Qt::UserRole, theEntry );
+ myDimensionsItem->addChild( objectItem );
+ myObjects.insert( theEntry, objectItem );
+ if ( myDimensionsItem->childCount() == 1 )
+ myDimensionsItem->setExpanded( true );
+ }
+ bool isDisplayed = myDisplayer.IsDisplayed( theEntry );
+ // read dimension records from property
+ for ( int anIt = 0; anIt < aProp.GetNumber(); ++anIt )
+ {
+ QString aName = aProp.GetName( anIt );
+ bool isVisible = aProp.IsVisible( anIt );
+
+ QTreeWidgetItem* anItem = new QTreeWidgetItem;
+ anItem->setText( 0, aName );
+ // if ( isDisplayed )
+ anItem->setIcon( 1, isVisible ? myVisibleIcon : myInvisibleIcon );
+ anItem->setData( 0, Qt::UserRole, anIt );
+ anItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
+ objectItem->addChild( anItem );
+ }
+ }
+ }
+ }
+}
+
+//=================================================================================
+// function : removeBranch
+// purpose :
+//=================================================================================
+void GEOMGUI_TextTreeWdg::removeBranch( const QString& theEntry, bool force )
+{
+ QTreeWidgetItem* objectItem = itemFromEntry( theEntry );
+ if ( !objectItem )
+ return;
+ qDeleteAll( objectItem->takeChildren() );
+ if ( force ) {
+ myDimensionsItem->removeChild( objectItem );
+ myObjects.remove( theEntry );
+ }
+}
+
+//=================================================================================
+// function : onItemClicked()
+// purpose : called when tree item was clicked
+//=================================================================================
+void GEOMGUI_TextTreeWdg::onItemClicked( QTreeWidgetItem* theItem, int theColumn )
+{
+ if( theColumn != 1 || theItem->icon( 1 ).isNull() || theItem->isDisabled() )
+ return;
+
+ std::string anEntry = entryFromItem( theItem->parent() ).toStdString();
+ int aDimIndex = idFromItem( theItem );
+ GEOMGUI_DimensionProperty aProp;
+ aProp.LoadFromAttribute( myStudy, anEntry );
+ if ( aProp.IsVisible( aDimIndex ) ) {
+ aProp.SetVisible( aDimIndex, false );
+ theItem->setIcon( 1, myInvisibleIcon );
+ } else {
+ aProp.SetVisible( aDimIndex, true );
+ theItem->setIcon( 1, myVisibleIcon );
+ }
+ aProp.SaveToAttribute( myStudy, anEntry );
+ redisplay( anEntry.c_str() );
+}
+
+//=================================================================================
+// function : idFromItem
+// purpose :
+//=================================================================================
+int GEOMGUI_TextTreeWdg::idFromItem( QTreeWidgetItem* theItem )
+{
+ if ( !theItem )
+ return -1;
+
+ bool isIdOK = false;
+ const int anId = theItem->data( 0, Qt::UserRole ).toInt( &isIdOK );
+
+ return isIdOK ? anId : -1;
+}
+
+//=================================================================================
+// function : entryFromItem
+// purpose :
+//=================================================================================
+QString GEOMGUI_TextTreeWdg::entryFromItem( QTreeWidgetItem* theShapeItem )
+{
+ if ( !theShapeItem )
+ return "";
+
+ return theShapeItem->data( 1, Qt::UserRole ).toString();
+}
+
+//=================================================================================
+// function : itemFromEntry
+// purpose :
+//=================================================================================
+QTreeWidgetItem* GEOMGUI_TextTreeWdg::itemFromEntry( QString theEntry )
+{
+ if ( theEntry.isEmpty() )
+ return 0;
+
+ return myObjects.value( theEntry, 0 );
+}
+
+//=================================================================================
+// function : updateVisibilityColumn
+// purpose : Update icons of dimension items.
+//=================================================================================
+void GEOMGUI_TextTreeWdg::updateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState )
+{
+ QTreeWidgetItem* anItem = itemFromEntry( theEntry );
+ if ( !anItem )
+ return;
+ anItem->setDisabled( theState != Qtx::ShownState );
+ QTreeWidgetItem* aChildItem;
+ GEOMGUI_DimensionProperty aProp;
+ for ( int i=0; i < anItem->childCount(); i++ ) {
+ aChildItem = anItem->child( i );
+ if ( theState == Qtx::ShownState ) {
+ aProp.LoadFromAttribute( myStudy, theEntry.toStdString() );
+ if ( aProp.GetNumber() == 0 )
+ continue;
+ aChildItem->setIcon( 1, aProp.IsVisible( idFromItem( aChildItem ) ) ? myVisibleIcon : myInvisibleIcon );
+ aChildItem->setDisabled( false );
+ } else {
+ aChildItem->setIcon( 1, QIcon() );
+ aChildItem->setDisabled( true );
+ }
+ }
+}
+
+//=================================================================================
+// function : showContextMenu
+// purpose :
+//=================================================================================
+void GEOMGUI_TextTreeWdg::showContextMenu( const QPoint& pos )
+{
+ if ( selectedItems().isEmpty() )
+ return;
+ QMenu aMenu;
+ aMenu.addAction( myActions[GEOMOp::OpShow] );
+ aMenu.addAction( myActions[GEOMOp::OpHide] );
+ if ( selectedItems().count() == 1 ) {
+ QTreeWidgetItem* anItem = selectedItems().first();
+ QString anEntry = entryFromItem( anItem->parent() );
+ if ( !anEntry.isEmpty() ) {
+ GEOMGUI_DimensionProperty aProp;
+ aProp.LoadFromAttribute( myStudy, anEntry.toStdString() );
+ if ( aProp.GetNumber() == 0 )
+ return;
+ aMenu.clear();
+ if ( aProp.IsVisible( idFromItem( anItem ) ) )
+ aMenu.addAction( myActions[GEOMOp::OpHide] );
+ else
+ aMenu.addAction( myActions[GEOMOp::OpShow] );
+ }
+ }
+ QAction* selPopupItem = aMenu.exec( viewport()->mapToGlobal(pos) );
+ if ( selPopupItem == myActions[GEOMOp::OpShow] )
+ setVisibility( true );
+ else if ( selPopupItem == myActions[GEOMOp::OpHide] )
+ setVisibility( false );
+}
+
+//=================================================================================
+// function : setVisibility
+// purpose :
+//=================================================================================
+void GEOMGUI_TextTreeWdg::setVisibility( bool theVisibility )
+{
+ if ( myDimensionsItem->isSelected() ) {
+ // set visibility for all dimensions
+ QTreeWidgetItem* anItem;
+ foreach ( QString entry, myObjects.keys() ) {
+ anItem = itemFromEntry( entry );
+ if ( !anItem->isDisabled() )
+ setShapeDimensionsVisibility( entry, theVisibility );
+ }
+ return;
+ }
+ foreach ( QTreeWidgetItem* item, selectedItems() ) {
+ if ( item->isDisabled() || item->parent()->isSelected() )
+ continue;
+ QString anEntry = entryFromItem( item );
+ if ( !anEntry.isEmpty() ) {
+ // it is a shape item
+ setShapeDimensionsVisibility( anEntry, theVisibility );
+ } else {
+ // it is a dimension item
+ anEntry = entryFromItem( item->parent() );
+ setDimensionVisibility( anEntry, item, theVisibility );
+ }
+ }
+}
+
+//=================================================================================
+// function : setShapeDimensionsVisibility
+// purpose :
+//=================================================================================
+void GEOMGUI_TextTreeWdg::setShapeDimensionsVisibility( QString theEntry, bool theVisibility )
+{
+ QTreeWidgetItem* anItem = itemFromEntry( theEntry );
+ QTreeWidgetItem* aChildItem;
+ for ( int i=0; i < anItem->childCount(); i++ ) {
+ aChildItem = anItem->child( i );
+ setDimensionVisibility( theEntry, aChildItem, theVisibility );
+ }
+ redisplay( theEntry );
+}
+
+//=================================================================================
+// function : setDimensionVisibility
+// purpose :
+//=================================================================================
+void GEOMGUI_TextTreeWdg::setDimensionVisibility( QString theEntry, QTreeWidgetItem* theDimItem, bool theVisibility )
+{
+ GEOMGUI_DimensionProperty aProp;
+ aProp.LoadFromAttribute( myStudy, theEntry.toStdString() );
+ int aDimIndex = idFromItem( theDimItem );
+ if ( aProp.GetNumber() == 0 || aProp.IsVisible( aDimIndex ) == theVisibility )
+ return;;
+ aProp.SetVisible( aDimIndex, theVisibility );
+ aProp.SaveToAttribute( myStudy, theEntry.toStdString() );
+
+ theDimItem->setIcon( 1, theVisibility ? myVisibleIcon : myInvisibleIcon );
+ redisplay( theEntry );
+}
+
+//=================================================================================
+// function : redisplay
+// purpose :
+//=================================================================================
+void GEOMGUI_TextTreeWdg::redisplay( QString theEntry )
+{
+ Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( theEntry.toLatin1().constData(), "GEOM", "TEMP_IO" );
+ myDisplayer.Redisplay( io );
+}
diff --git a/src/GEOMGUI/GEOMGUI_TextTreeWdg.h b/src/GEOMGUI/GEOMGUI_TextTreeWdg.h
new file mode 100644
index 000000000..689a21a67
--- /dev/null
+++ b/src/GEOMGUI/GEOMGUI_TextTreeWdg.h
@@ -0,0 +1,89 @@
+// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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
+//
+
+#ifndef GEOMGUI_TEXTTREEWDG_H
+#define GEOMGUI_TEXTTREEWDG_H
+
+#include "GEOM_GEOMGUI.hxx"
+#include "GEOM_Displayer.h"
+
+#include
+#include
+
+#include
+
+class QLabel;
+class QLineEdit;
+class QString;
+class QTreeWidgetItem;
+class SalomeApp_Application;
+class SalomeApp_Study;
+
+/*!
+ * \brief Tree view contains Dimension and Annotation text items:
+ * - text visibility in OCC viewer
+ * - text object name
+ */
+class GEOMGUI_EXPORT GEOMGUI_TextTreeWdg : public QTreeWidget
+{
+ Q_OBJECT
+
+ public:
+ GEOMGUI_TextTreeWdg( SalomeApp_Application* app );
+ ~GEOMGUI_TextTreeWdg();
+
+ int getWinID() { return myWindowID; }
+
+ void removeBranch( const QString& theEntry,
+ bool force = true );
+ int idFromItem( QTreeWidgetItem* theItem );
+ QString entryFromItem( QTreeWidgetItem* theShapeItem );
+ QTreeWidgetItem* itemFromEntry( QString theEntry );
+ void setShapeDimensionsVisibility( QString theEntry, bool theVisibility );
+ void setDimensionVisibility( QString theEntry, QTreeWidgetItem* theDimItem, bool theVisibility );
+
+protected:
+ void createActions();
+ void redisplay( QString theEntry );
+
+ public slots:
+ void updateTree();
+ void updateBranch( const QString& theEntry );
+
+private slots:
+ void onItemClicked(QTreeWidgetItem*, int );
+ void updateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState );
+ void setVisibility( bool visibility );
+ void showContextMenu( const QPoint& pos );
+
+ private:
+
+ int myWindowID;
+
+ QIcon myVisibleIcon;
+ QIcon myInvisibleIcon;
+ QHash myObjects;
+ SalomeApp_Study* myStudy;
+ QTreeWidgetItem* myDimensionsItem;
+ GEOM_Displayer myDisplayer;
+
+ QMap myActions; //!< menu actions list
+
+};
+#endif
diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx
index 205e9db75..3166ac20a 100644
--- a/src/GEOMGUI/GEOM_Displayer.cxx
+++ b/src/GEOMGUI/GEOM_Displayer.cxx
@@ -1234,11 +1234,12 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t
QColor aQColor = aResMgr->colorValue ( "Geometry", "dimensions_color", QColor( 0, 255, 0 ) );
int aLineWidth = aResMgr->integerValue( "Geometry", "dimensions_line_width", 1 );
- double aFontHeight = aResMgr->doubleValue ( "Geometry", "dimensions_font_height", 10 );
+ QFont aFont = aResMgr->fontValue ( "Geometry", "dimensions_font", QFont("Y14.5M-2009", 14) );
double anArrowLength = aResMgr->doubleValue ( "Geometry", "dimensions_arrow_length", 5 );
bool isUnitsShown = aResMgr->booleanValue( "Geometry", "dimensions_show_units", false );
QString aUnitsLength = aResMgr->stringValue ( "Geometry", "dimensions_length_units", "m" );
QString aUnitsAngle = aResMgr->stringValue ( "Geometry", "dimensions_angle_units", "deg" );
+ bool aUseText3d = aResMgr->booleanValue( "Geometry", "dimensions_use_text3d", false );
// restore dimension presentation from saved attribute or property data
AIS_ListOfInteractive aRestoredDimensions;
@@ -1304,10 +1305,12 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t
aStyle->SetCommonColor( aColor );
aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown );
- aStyle->MakeText3d( Standard_True );
+ aStyle->MakeText3d( aUseText3d );
aStyle->MakeTextShaded( Standard_True );
- aStyle->SetExtensionSize( aFontHeight * 0.5 );
- aStyle->TextAspect()->SetHeight( aFontHeight );
+ int fsize = aFont.pixelSize() != -1 ? aFont.pixelSize() : aFont.pointSize();
+ aStyle->SetExtensionSize( fsize * 0.5 );
+ aStyle->TextAspect()->SetFont( aFont.family().toLatin1().data() );
+ aStyle->TextAspect()->SetHeight( fsize );
aStyle->ArrowAspect()->SetLength( anArrowLength );
aStyle->LineAspect()->SetWidth( aLineWidth );
aStyle->SetTextHorizontalPosition( aPrs->DimensionAspect()->TextHorizontalPosition() );
diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts
index c67b290fe..9e13e729b 100644
--- a/src/GEOMGUI/GEOM_msg_en.ts
+++ b/src/GEOMGUI/GEOM_msg_en.ts
@@ -3453,8 +3453,8 @@ Please, select face, shell or solid and try again
Line width
-
- Font height
+
+ Font
@@ -3476,6 +3476,10 @@ Please, select face, shell or solid and try again
Show units of measurement
+
+
+ Use 3D text
+
Hide input objects from the viewer
@@ -7238,6 +7242,17 @@ Do you want to create new material?
(No info available)
+
+ GEOMGUI_TextTreeWdg
+
+
+ Text
+
+
+
+ Name
+
+
EntityGUI_IsolineDlg
diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts
index 0ab7e34fc..54b86aee7 100644
--- a/src/GEOMGUI/GEOM_msg_fr.ts
+++ b/src/GEOMGUI/GEOM_msg_fr.ts
@@ -3401,8 +3401,8 @@ Choisissez une face, une coque ou un solide et essayez de nouveau
Epaisseur de la ligne
-
- Taille de police
+
+ Font
@@ -3424,6 +3424,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau
Afficher les unités
+
+
+ Use 3D text
+
Hide input objects from the viewer
@@ -7171,6 +7175,17 @@ Voulez-vous en créer un nouveau ?
(aucune information disponible)
+
+ GEOMGUI_TextTreeWdg
+
+
+ Text
+
+
+
+ Name
+
+
EntityGUI_IsolineDlg
diff --git a/src/GEOMGUI/GEOM_msg_ja.ts b/src/GEOMGUI/GEOM_msg_ja.ts
index 75807fcc7..5f181fa6e 100644
--- a/src/GEOMGUI/GEOM_msg_ja.ts
+++ b/src/GEOMGUI/GEOM_msg_ja.ts
@@ -3344,8 +3344,8 @@
線幅
-
- フォント高さ
+
+ Font
@@ -3368,8 +3368,12 @@
測定単位の表示
-
- Hide input objects from the viewer
+
+ Use 3D text
+
+
+
+ Hide input objects from the viewer
@@ -7056,6 +7060,17 @@
(有効情報なし)
+
+ GEOMGUI_TextTreeWdg
+
+
+ Text
+
+
+
+ Name
+
+
EntityGUI_IsolineDlg
diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx
index 25832ed53..ffe4ee97f 100644
--- a/src/GEOMGUI/GeometryGUI.cxx
+++ b/src/GEOMGUI/GeometryGUI.cxx
@@ -33,6 +33,7 @@
#include "GEOMGUI_OCCSelector.h"
#include "GEOMGUI_Selection.h"
#include "GEOMGUI_CreationInfoWdg.h"
+#include "GEOMGUI_TextTreeWdg.h"
#include "GEOMGUI_DimensionProperty.h"
#include "GEOM_Constants.h"
#include "GEOM_Displayer.h"
@@ -86,6 +87,7 @@
#include
#include
+#include
// External includes
#include
@@ -97,6 +99,7 @@
#include
#include
#include
+#include
#include
#include
@@ -107,6 +110,7 @@
#include
#include
+#include
#include
@@ -116,6 +120,10 @@
#include
#include
+#include
+#include
+#include
+
#include "GEOM_version.h"
#include "GEOMImpl_Types.hxx" // dangerous hxx (defines short-name macros) - include after all
@@ -218,6 +226,7 @@ GeometryGUI::GeometryGUI() :
myLocalSelectionMode = GEOM_ALLOBJECTS;
myCreationInfoWdg = 0;
+ myTextTreeWdg = 0;
connect( Material_ResourceMgr::resourceMgr(), SIGNAL( changed() ), this, SLOT( updateMaterials() ) );
@@ -1783,6 +1792,11 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
getApp()->insertDockWindow( myCreationInfoWdg->getWinID(), myCreationInfoWdg );
getApp()->placeDockWindow( myCreationInfoWdg->getWinID(), Qt::LeftDockWidgetArea );
+ if ( !myTextTreeWdg )
+ myTextTreeWdg = new GEOMGUI_TextTreeWdg( getApp() );
+ getApp()->insertDockWindow( myTextTreeWdg->getWinID(), myTextTreeWdg );
+ getApp()->placeDockWindow( myTextTreeWdg->getWinID(), Qt::LeftDockWidgetArea );
+
//NPAL 19674
SALOME_ListIO selected;
sm->selectedObjects( selected );
@@ -1844,8 +1858,15 @@ bool GeometryGUI::deactivateModule( SUIT_Study* study )
disconnect( selMrg, SIGNAL( currentSelectionChanged() ), this, SLOT( updateCreationInfo() ));
disconnect( selMrg, SIGNAL( currentSelectionChanged() ), this, SLOT( updateFieldColorScale() ));
- getApp()->removeDockWindow( myCreationInfoWdg->getWinID() );
- myCreationInfoWdg = 0;
+ if ( myCreationInfoWdg ) {
+ getApp()->removeDockWindow( myCreationInfoWdg->getWinID() );
+ myCreationInfoWdg = 0;
+ }
+ if ( myTextTreeWdg ) {
+ getApp()->removeDockWindow( myTextTreeWdg->getWinID() );
+ disconnect( application(), 0, myTextTreeWdg, 0 );
+ myTextTreeWdg = 0;
+ }
EmitSignalCloseAllDialogs();
@@ -1903,6 +1924,8 @@ void GeometryGUI::windows( QMap& mappa ) const
mappa.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
if ( myCreationInfoWdg )
mappa.insert( myCreationInfoWdg->getWinID(), Qt::LeftDockWidgetArea );
+ if ( myTextTreeWdg )
+ mappa.insert( myTextTreeWdg->getWinID(), Qt::LeftDockWidgetArea );
}
void GeometryGUI::viewManagers( QStringList& lst ) const
@@ -2237,6 +2260,8 @@ void GeometryGUI::OnSetMaterial(const QString& theName)
void GeometryGUI::createPreferences()
{
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+
int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
int genGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), tabId );
@@ -2333,12 +2358,36 @@ void GeometryGUI::createPreferences()
setPreferenceProperty( aDimLineWidthId, "min", 1 );
setPreferenceProperty( aDimLineWidthId, "max", 5 );
- int aDimFontHeightId = addPreference( tr( "PREF_DIMENSIONS_FONT_HEIGHT" ), aDimGroupId,
- LightApp_Preferences::DblSpin, "Geometry", "dimensions_font_height" );
+ int aDimFontId = addPreference( tr( "PREF_DIMENSIONS_FONT" ), aDimGroupId, LightApp_Preferences::Font, "Geometry", "dimensions_font" );
- setPreferenceProperty( aDimFontHeightId, "min", 1e-9 );
- setPreferenceProperty( aDimFontHeightId, "max", 1e+9 );
- setPreferenceProperty( aDimFontHeightId, "precision", 9 );
+ int f = QtxFontEdit::Family | QtxFontEdit::Size;
+ setPreferenceProperty( aDimFontId, "features", f );
+ setPreferenceProperty( aDimFontId, "mode", QtxFontEdit::Custom );
+
+ Handle(Font_FontMgr) fmgr = Font_FontMgr::GetInstance();
+ QString aFontFile = "";
+ resMgr->value("resources", "GEOM", aFontFile);
+ aFontFile = aFontFile + QDir::separator() + "Y14.5M-2009.ttf";
+ // add enginier font into combobox
+ int fontID = QFontDatabase::addApplicationFont( aFontFile );
+ Handle(Font_SystemFont) sf = new Font_SystemFont(
+ new TCollection_HAsciiString("Y14.5M-2009"),
+ Font_FA_Regular,
+ new TCollection_HAsciiString(aFontFile.toLatin1().data()) );
+ // register font in OCC font manager
+ fmgr->RegisterFont( sf, Standard_False );
+
+ // get list of supported fonts by OCC
+ QStringList anOCCFonts;
+ TColStd_SequenceOfHAsciiString theFontsNames;
+ fmgr->GetAvailableFontsNames( theFontsNames );
+ for(Standard_Integer i=1; i<=theFontsNames.Length(); i++) {
+ Handle(TCollection_HAsciiString) str = theFontsNames(i);
+ anOCCFonts << str->ToCString();
+ }
+ anOCCFonts.removeDuplicates();
+ // set the supported fonts into combobox to use its only
+ setPreferenceProperty( aDimFontId, "fonts", anOCCFonts );
int aDimArrLengthId = addPreference( tr( "PREF_DIMENSIONS_ARROW_LENGTH" ), aDimGroupId,
LightApp_Preferences::DblSpin, "Geometry", "dimensions_arrow_length" );
@@ -2353,9 +2402,6 @@ void GeometryGUI::createPreferences()
int anAngUnitsId = addPreference( tr( "PREF_DIMENSIONS_ANGLE_UNITS" ), aDimGroupId,
LightApp_Preferences::Selector, "Geometry", "dimensions_angle_units" );
- addPreference( tr( "PREF_DIMENSIONS_SHOW_UNITS" ), aDimGroupId,
- LightApp_Preferences::Bool, "Geometry", "dimensions_show_units" );
-
QStringList aListOfLengthUnits;
aListOfLengthUnits << "m";
aListOfLengthUnits << "cm";
@@ -2370,6 +2416,9 @@ void GeometryGUI::createPreferences()
setPreferenceProperty( aLengthUnitsId, "strings", aListOfLengthUnits );
setPreferenceProperty( anAngUnitsId, "strings", aListOfAngUnits );
+ addPreference( tr( "PREF_DIMENSIONS_SHOW_UNITS" ), aDimGroupId,
+ LightApp_Preferences::Bool, "Geometry", "dimensions_show_units" );
+
int aDimDefFlyout = addPreference( tr( "PREF_DIMENSIONS_DEFAULT_FLYOUT" ), aDimGroupId,
LightApp_Preferences::DblSpin, "Geometry", "dimensions_default_flyout" );
@@ -2377,6 +2426,9 @@ void GeometryGUI::createPreferences()
setPreferenceProperty( aDimDefFlyout, "max", 1e+9 );
setPreferenceProperty( aDimDefFlyout, "precision", 9 );
+ addPreference( tr( "PREF_DIMENSIONS_USE_TEXT3D" ), aDimGroupId,
+ LightApp_Preferences::Bool, "Geometry", "dimensions_use_text3d" );
+
int isoGroup = addPreference( tr( "PREF_ISOS" ), tabId );
setPreferenceProperty( isoGroup, "columns", 2 );
int isoU = addPreference( tr( "PREF_ISOS_U" ), isoGroup,
@@ -2483,7 +2535,6 @@ void GeometryGUI::createPreferences()
QList aMarkerTypeIndicesList;
QList aMarkerTypeIconsList;
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
for ( int i = GEOM::MT_POINT; i < GEOM::MT_USER; i++ ) {
QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
QPixmap pixmap = resMgr->loadPixmap( "GEOM", tr( qPrintable( icoFile ) ) );
@@ -2645,11 +2696,12 @@ void GeometryGUI::preferencesChanged( const QString& section, const QString& par
}
else if ( param == QString("dimensions_color") ||
param == QString("dimensions_line_width") ||
- param == QString("dimensions_font_height") ||
+ param == QString("dimensions_font") ||
param == QString("dimensions_arrow_length") ||
param == QString("dimensions_show_units") ||
param == QString("dimensions_length_units") ||
param == QString("dimensions_angle_units") ||
+ param == QString("dimensions_use_text3d") ||
param == QString("label_color") )
{
SalomeApp_Application* anApp = getApp();
@@ -3468,3 +3520,8 @@ void GeometryGUI::dropObjects( const DataObjectList& what, SUIT_DataObject* wher
// update Object browser
getApp()->updateObjectBrowser( false );
}
+
+void GeometryGUI::emitDimensionsUpdated( QString entry )
+{
+ emit DimensionsUpdated( entry );
+}
diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h
index 53d314ed1..f0abf2da2 100644
--- a/src/GEOMGUI/GeometryGUI.h
+++ b/src/GEOMGUI/GeometryGUI.h
@@ -64,6 +64,7 @@ class LightApp_Selection;
class SUIT_ViewManager;
class SalomeApp_Study;
class GEOMGUI_CreationInfoWdg;
+class GEOMGUI_TextTreeWdg;
//=================================================================================
// class : GeometryGUI
@@ -148,6 +149,8 @@ public:
SUIT_DataObject* where,
const int row, Qt::DropAction action );
+ void emitDimensionsUpdated( QString entry );
+
public slots:
virtual bool deactivateModule( SUIT_Study* );
virtual bool activateModule( SUIT_Study* );
@@ -176,6 +179,7 @@ signals :
void SignalDefaultStepValueChanged( double newVal );
void SignalDependencyTreeParamChanged( const QString&, const QString& );
void SignalDependencyTreeRenameObject( const QString& );
+ void DimensionsUpdated( const QString& );
protected:
virtual LightApp_Selection* createSelection() const;
@@ -224,6 +228,8 @@ private:
GEOMGUI_CreationInfoWdg* myCreationInfoWdg;
+ GEOMGUI_TextTreeWdg* myTextTreeWdg;
+
SALOME_ListIO myTopLevelIOList;
friend class DisplayGUI;
diff --git a/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx b/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx
index 2576676b2..45ef0135f 100644
--- a/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx
+++ b/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx
@@ -495,12 +495,13 @@ Handle(AIS_Dimension) MeasureGUI_CreateDimensionDlg::CreateDimension()
QColor aQColor = aResMgr->colorValue ( "Geometry", "dimensions_color", QColor( 0, 255, 0 ) );
int aLineWidth = aResMgr->integerValue( "Geometry", "dimensions_line_width", 1 );
- double aFontHeight = aResMgr->doubleValue ( "Geometry", "dimensions_font_height", 10 );
+ QFont aFont = aResMgr->fontValue ( "Geometry", "dimensions_font", QFont("Y14.5M-2009", 14) );
double anArrowLength = aResMgr->doubleValue ( "Geometry", "dimensions_arrow_length", 5 );
double aDefFlyout = aResMgr->doubleValue ( "Geometry", "dimensions_default_flyout", 20 );
bool isUnitsShown = aResMgr->booleanValue( "Geometry", "dimensions_show_units", false );
QString aUnitsLength = aResMgr->stringValue ( "Geometry", "dimensions_length_units", "m" );
QString aUnitsAngle = aResMgr->stringValue ( "Geometry", "dimensions_angle_units", "deg" );
+ bool aUseText3d = aResMgr->booleanValue( "Geometry", "dimensions_use_text3d", false );
OCCViewer_ViewWindow* anActiveView = NULL;
@@ -610,10 +611,12 @@ Handle(AIS_Dimension) MeasureGUI_CreateDimensionDlg::CreateDimension()
aStyle->SetCommonColor( aColor );
aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown );
- aStyle->MakeText3d( Standard_True );
+ aStyle->MakeText3d( aUseText3d );
aStyle->MakeTextShaded( Standard_True );
- aStyle->SetExtensionSize( aFontHeight * 0.5 );
- aStyle->TextAspect()->SetHeight( aFontHeight );
+ int fsize = aFont.pixelSize() != -1 ? aFont.pixelSize() : aFont.pointSize();
+ aStyle->SetExtensionSize( fsize * 0.5 );
+ aStyle->TextAspect()->SetFont( aFont.family().toLatin1().data() );
+ aStyle->TextAspect()->SetHeight( fsize );
aStyle->ArrowAspect()->SetLength( anArrowLength );
aStyle->LineAspect()->SetWidth( aLineWidth );
diff --git a/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx b/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx
index 7dfda2db9..370204f94 100644
--- a/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx
+++ b/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx
@@ -29,6 +29,7 @@
#include "MeasureGUI_DimensionFilter.h"
#include
+#include
#include
#include
#include
@@ -771,6 +772,8 @@ bool MeasureGUI_ManageDimensionsDlg::ClickOnApply()
mySavedPropertyState.SaveToAttribute( aStudy, myEditObject->GetStudyEntry() );
+ myGeomGUI->emitDimensionsUpdated( QString( myEditObject->GetStudyEntry() ) );
+
return true;
}
@@ -807,6 +810,8 @@ void MeasureGUI_ManageDimensionsDlg::OnFinish()
QVariant() );
redisplay( myEditObject.get() );
+
+ myGeomGUI->emitDimensionsUpdated( QString( myEditObject->GetStudyEntry() ) );
}
//=================================================================================