mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-13 17:18:36 +05:00
22888: EDF 10437 GEOM: Dimensions improvements
This commit is contained in:
parent
63738c1a1f
commit
c94c721135
@ -35,6 +35,7 @@ SET( _res_files
|
|||||||
GEOM.config
|
GEOM.config
|
||||||
GEOMDS_Resources
|
GEOMDS_Resources
|
||||||
ShHealing
|
ShHealing
|
||||||
|
Y14.5M-2009.ttf
|
||||||
3dsketch.png
|
3dsketch.png
|
||||||
isoline.png
|
isoline.png
|
||||||
isoline_v.png
|
isoline_v.png
|
||||||
|
@ -92,12 +92,13 @@
|
|||||||
<!-- Dimension presentation properties -->
|
<!-- Dimension presentation properties -->
|
||||||
<parameter name="dimensions_color" value="#ffffff" />
|
<parameter name="dimensions_color" value="#ffffff" />
|
||||||
<parameter name="dimensions_line_width" value="1" />
|
<parameter name="dimensions_line_width" value="1" />
|
||||||
<parameter name="dimensions_font_height" value="10" />
|
<parameter name="dimensions_font" value="Y14.5M-2009,14" />
|
||||||
<parameter name="dimensions_arrow_length" value="5" />
|
<parameter name="dimensions_arrow_length" value="5" />
|
||||||
<parameter name="dimensions_show_units" value="0" />
|
<parameter name="dimensions_show_units" value="0" />
|
||||||
<parameter name="dimensions_length_units" value="m" />
|
<parameter name="dimensions_length_units" value="m" />
|
||||||
<parameter name="dimensions_angle_units" value="deg" />
|
<parameter name="dimensions_angle_units" value="deg" />
|
||||||
<parameter name="dimensions_default_flyout" value="20" />
|
<parameter name="dimensions_default_flyout" value="20" />
|
||||||
|
<parameter name="dimensions_use_text3d" value="0" />
|
||||||
|
|
||||||
<!-- Scalar bar for field step presentation -->
|
<!-- Scalar bar for field step presentation -->
|
||||||
<parameter name="scalar_bar_x_position" value="0.05" />
|
<parameter name="scalar_bar_x_position" value="0.05" />
|
||||||
|
BIN
resources/Y14.5M-2009.ttf
Normal file
BIN
resources/Y14.5M-2009.ttf
Normal file
Binary file not shown.
@ -76,12 +76,14 @@ SET(GEOMGUI_HEADERS
|
|||||||
GEOMGUI_Selection.h
|
GEOMGUI_Selection.h
|
||||||
GEOM_GEOMGUI.hxx
|
GEOM_GEOMGUI.hxx
|
||||||
GEOMGUI_CreationInfoWdg.h
|
GEOMGUI_CreationInfoWdg.h
|
||||||
|
GEOMGUI_TextTreeWdg.h
|
||||||
GEOMGUI_DimensionProperty.h
|
GEOMGUI_DimensionProperty.h
|
||||||
)
|
)
|
||||||
|
|
||||||
# header files / to be processed by moc
|
# header files / to be processed by moc
|
||||||
SET(_moc_HEADERS
|
SET(_moc_HEADERS
|
||||||
GEOMGUI_CreationInfoWdg.h
|
GEOMGUI_CreationInfoWdg.h
|
||||||
|
GEOMGUI_TextTreeWdg.h
|
||||||
GeometryGUI.h
|
GeometryGUI.h
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -114,6 +116,7 @@ SET(GEOMGUI_SOURCES
|
|||||||
GEOMGUI_OCCSelector.cxx
|
GEOMGUI_OCCSelector.cxx
|
||||||
GEOMGUI_Selection.cxx
|
GEOMGUI_Selection.cxx
|
||||||
GEOMGUI_CreationInfoWdg.cxx
|
GEOMGUI_CreationInfoWdg.cxx
|
||||||
|
GEOMGUI_TextTreeWdg.cxx
|
||||||
GEOMGUI_DimensionProperty.cxx
|
GEOMGUI_DimensionProperty.cxx
|
||||||
${_moc_SOURCES}
|
${_moc_SOURCES}
|
||||||
${_rcc_SOURCES}
|
${_rcc_SOURCES}
|
||||||
|
421
src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx
Normal file
421
src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx
Normal file
@ -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 <GEOM_Constants.h>
|
||||||
|
#include <GEOMUtils.hxx>
|
||||||
|
|
||||||
|
// GUI includes
|
||||||
|
#include <LightApp_Module.h>
|
||||||
|
#include <SalomeApp_Application.h>
|
||||||
|
#include <SalomeApp_Study.h>
|
||||||
|
#include <SUIT_Desktop.h>
|
||||||
|
#include <SUIT_Session.h>
|
||||||
|
#include <SUIT_ResourceMgr.h>
|
||||||
|
#include <SUIT_DataBrowser.h>
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QAction>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QString>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QTreeWidget>
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
|
GEOMGUI_TextTreeWdg::GEOMGUI_TextTreeWdg( SalomeApp_Application* app )
|
||||||
|
: myDisplayer(NULL)
|
||||||
|
{
|
||||||
|
myStudy = dynamic_cast<SalomeApp_Study*>( 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<GeometryGUI*>( 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"<<std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : createActions
|
||||||
|
// purpose : Create context popup menu actions.
|
||||||
|
//=================================================================================
|
||||||
|
void GEOMGUI_TextTreeWdg::createActions()
|
||||||
|
{
|
||||||
|
QAction* a = new QAction( tr( "MEN_DISPLAY" ), this );
|
||||||
|
a->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<SalomeApp_Study*>( 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<QString> 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<SalomeApp_Study*>( 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 );
|
||||||
|
}
|
89
src/GEOMGUI/GEOMGUI_TextTreeWdg.h
Normal file
89
src/GEOMGUI/GEOMGUI_TextTreeWdg.h
Normal file
@ -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 <QTreeWidget>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
|
#include <SALOMEDSClient.hxx>
|
||||||
|
|
||||||
|
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<QString, QTreeWidgetItem*> myObjects;
|
||||||
|
SalomeApp_Study* myStudy;
|
||||||
|
QTreeWidgetItem* myDimensionsItem;
|
||||||
|
GEOM_Displayer myDisplayer;
|
||||||
|
|
||||||
|
QMap<int, QAction*> myActions; //!< menu actions list
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
@ -1234,11 +1234,12 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t
|
|||||||
|
|
||||||
QColor aQColor = aResMgr->colorValue ( "Geometry", "dimensions_color", QColor( 0, 255, 0 ) );
|
QColor aQColor = aResMgr->colorValue ( "Geometry", "dimensions_color", QColor( 0, 255, 0 ) );
|
||||||
int aLineWidth = aResMgr->integerValue( "Geometry", "dimensions_line_width", 1 );
|
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 anArrowLength = aResMgr->doubleValue ( "Geometry", "dimensions_arrow_length", 5 );
|
||||||
bool isUnitsShown = aResMgr->booleanValue( "Geometry", "dimensions_show_units", false );
|
bool isUnitsShown = aResMgr->booleanValue( "Geometry", "dimensions_show_units", false );
|
||||||
QString aUnitsLength = aResMgr->stringValue ( "Geometry", "dimensions_length_units", "m" );
|
QString aUnitsLength = aResMgr->stringValue ( "Geometry", "dimensions_length_units", "m" );
|
||||||
QString aUnitsAngle = aResMgr->stringValue ( "Geometry", "dimensions_angle_units", "deg" );
|
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
|
// restore dimension presentation from saved attribute or property data
|
||||||
AIS_ListOfInteractive aRestoredDimensions;
|
AIS_ListOfInteractive aRestoredDimensions;
|
||||||
@ -1304,10 +1305,12 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t
|
|||||||
|
|
||||||
aStyle->SetCommonColor( aColor );
|
aStyle->SetCommonColor( aColor );
|
||||||
aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown );
|
aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown );
|
||||||
aStyle->MakeText3d( Standard_True );
|
aStyle->MakeText3d( aUseText3d );
|
||||||
aStyle->MakeTextShaded( Standard_True );
|
aStyle->MakeTextShaded( Standard_True );
|
||||||
aStyle->SetExtensionSize( aFontHeight * 0.5 );
|
int fsize = aFont.pixelSize() != -1 ? aFont.pixelSize() : aFont.pointSize();
|
||||||
aStyle->TextAspect()->SetHeight( aFontHeight );
|
aStyle->SetExtensionSize( fsize * 0.5 );
|
||||||
|
aStyle->TextAspect()->SetFont( aFont.family().toLatin1().data() );
|
||||||
|
aStyle->TextAspect()->SetHeight( fsize );
|
||||||
aStyle->ArrowAspect()->SetLength( anArrowLength );
|
aStyle->ArrowAspect()->SetLength( anArrowLength );
|
||||||
aStyle->LineAspect()->SetWidth( aLineWidth );
|
aStyle->LineAspect()->SetWidth( aLineWidth );
|
||||||
aStyle->SetTextHorizontalPosition( aPrs->DimensionAspect()->TextHorizontalPosition() );
|
aStyle->SetTextHorizontalPosition( aPrs->DimensionAspect()->TextHorizontalPosition() );
|
||||||
|
@ -3453,8 +3453,8 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<translation>Line width</translation>
|
<translation>Line width</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>PREF_DIMENSIONS_FONT_HEIGHT</source>
|
<source>PREF_DIMENSIONS_FONT</source>
|
||||||
<translation>Font height</translation>
|
<translation>Font</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>PREF_DIMENSIONS_ARROW_LENGTH</source>
|
<source>PREF_DIMENSIONS_ARROW_LENGTH</source>
|
||||||
@ -3476,6 +3476,10 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>PREF_DIMENSIONS_SHOW_UNITS</source>
|
<source>PREF_DIMENSIONS_SHOW_UNITS</source>
|
||||||
<translation>Show units of measurement</translation>
|
<translation>Show units of measurement</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>PREF_DIMENSIONS_USE_TEXT3D</source>
|
||||||
|
<translation>Use 3D text</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>PREF_HIDE_INPUT_OBJECT</source>
|
<source>PREF_HIDE_INPUT_OBJECT</source>
|
||||||
<translation>Hide input objects from the viewer</translation>
|
<translation>Hide input objects from the viewer</translation>
|
||||||
@ -7238,6 +7242,17 @@ Do you want to create new material?</translation>
|
|||||||
<translation>(No info available)</translation>
|
<translation>(No info available)</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>GEOMGUI_TextTreeWdg</name>
|
||||||
|
<message>
|
||||||
|
<source>TEXT_TREE_VIEW_TITLE</source>
|
||||||
|
<translation>Text</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>TEXT_TREE_VIEW_NAME</source>
|
||||||
|
<translation>Name</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>EntityGUI_IsolineDlg</name>
|
<name>EntityGUI_IsolineDlg</name>
|
||||||
<message>
|
<message>
|
||||||
|
@ -3401,8 +3401,8 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
|||||||
<translation>Epaisseur de la ligne</translation>
|
<translation>Epaisseur de la ligne</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>PREF_DIMENSIONS_FONT_HEIGHT</source>
|
<source>PREF_DIMENSIONS_FONT</source>
|
||||||
<translation>Taille de police</translation>
|
<translation type="unfinished">Font</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>PREF_DIMENSIONS_ARROW_LENGTH</source>
|
<source>PREF_DIMENSIONS_ARROW_LENGTH</source>
|
||||||
@ -3424,6 +3424,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
|||||||
<source>PREF_DIMENSIONS_SHOW_UNITS</source>
|
<source>PREF_DIMENSIONS_SHOW_UNITS</source>
|
||||||
<translation>Afficher les unités</translation>
|
<translation>Afficher les unités</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>PREF_DIMENSIONS_USE_TEXT3D</source>
|
||||||
|
<translation type="unfinished">Use 3D text</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>PREF_HIDE_INPUT_OBJECT</source>
|
<source>PREF_HIDE_INPUT_OBJECT</source>
|
||||||
<translation type="unfinished">Hide input objects from the viewer</translation>
|
<translation type="unfinished">Hide input objects from the viewer</translation>
|
||||||
@ -7171,6 +7175,17 @@ Voulez-vous en créer un nouveau ?</translation>
|
|||||||
<translation>(aucune information disponible)</translation>
|
<translation>(aucune information disponible)</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>GEOMGUI_TextTreeWdg</name>
|
||||||
|
<message>
|
||||||
|
<source>TEXT_TREE_VIEW_TITLE</source>
|
||||||
|
<translation type="unfinished">Text</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>TEXT_TREE_VIEW_NAME</source>
|
||||||
|
<translation type="unfinished">Name</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>EntityGUI_IsolineDlg</name>
|
<name>EntityGUI_IsolineDlg</name>
|
||||||
<message>
|
<message>
|
||||||
|
@ -3344,8 +3344,8 @@
|
|||||||
<translation>線幅</translation>
|
<translation>線幅</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>PREF_DIMENSIONS_FONT_HEIGHT</source>
|
<source>PREF_DIMENSIONS_FONT</source>
|
||||||
<translation>フォント高さ</translation>
|
<translation type="unfinished">Font</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>PREF_DIMENSIONS_ARROW_LENGTH</source>
|
<source>PREF_DIMENSIONS_ARROW_LENGTH</source>
|
||||||
@ -3368,8 +3368,12 @@
|
|||||||
<translation>測定単位の表示</translation>
|
<translation>測定単位の表示</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>PREF_HIDE_INPUT_OBJECT</source>
|
<source>PREF_DIMENSIONS_USE_TEXT3D</source>
|
||||||
<translation type="unfinished">Hide input objects from the viewer</translation>
|
<translation type="unfinished">Use 3D text</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>PREF_HIDE_INPUT_OBJECT</source>
|
||||||
|
<translation type="unfinished">Hide input objects from the viewer</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>PREF_ISOS</source>
|
<source>PREF_ISOS</source>
|
||||||
@ -7056,6 +7060,17 @@
|
|||||||
<translation>(有効情報なし)</translation>
|
<translation>(有効情報なし)</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>GEOMGUI_TextTreeWdg</name>
|
||||||
|
<message>
|
||||||
|
<source>TEXT_TREE_VIEW_TITLE</source>
|
||||||
|
<translation type="unfinished">Text</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>TEXT_TREE_VIEW_NAME</source>
|
||||||
|
<translation type="unfinished">Name</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>EntityGUI_IsolineDlg</name>
|
<name>EntityGUI_IsolineDlg</name>
|
||||||
<message>
|
<message>
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "GEOMGUI_OCCSelector.h"
|
#include "GEOMGUI_OCCSelector.h"
|
||||||
#include "GEOMGUI_Selection.h"
|
#include "GEOMGUI_Selection.h"
|
||||||
#include "GEOMGUI_CreationInfoWdg.h"
|
#include "GEOMGUI_CreationInfoWdg.h"
|
||||||
|
#include "GEOMGUI_TextTreeWdg.h"
|
||||||
#include "GEOMGUI_DimensionProperty.h"
|
#include "GEOMGUI_DimensionProperty.h"
|
||||||
#include "GEOM_Constants.h"
|
#include "GEOM_Constants.h"
|
||||||
#include "GEOM_Displayer.h"
|
#include "GEOM_Displayer.h"
|
||||||
@ -86,6 +87,7 @@
|
|||||||
#include <SALOMEDS_SObject.hxx>
|
#include <SALOMEDS_SObject.hxx>
|
||||||
|
|
||||||
#include <Basics_OCCTVersion.hxx>
|
#include <Basics_OCCTVersion.hxx>
|
||||||
|
#include <QtxFontEdit.h>
|
||||||
|
|
||||||
// External includes
|
// External includes
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@ -97,6 +99,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QSignalMapper>
|
#include <QSignalMapper>
|
||||||
|
#include <QFontDatabase>
|
||||||
|
|
||||||
#include <AIS_ListOfInteractive.hxx>
|
#include <AIS_ListOfInteractive.hxx>
|
||||||
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
||||||
@ -107,6 +110,7 @@
|
|||||||
#include <NCollection_DataMap.hxx>
|
#include <NCollection_DataMap.hxx>
|
||||||
|
|
||||||
#include <TColStd_HArray1OfByte.hxx>
|
#include <TColStd_HArray1OfByte.hxx>
|
||||||
|
#include <TColStd_SequenceOfHAsciiString.hxx>
|
||||||
|
|
||||||
#include <utilities.h>
|
#include <utilities.h>
|
||||||
|
|
||||||
@ -116,6 +120,10 @@
|
|||||||
#include <Standard_Failure.hxx>
|
#include <Standard_Failure.hxx>
|
||||||
#include <Standard_ErrorHandler.hxx>
|
#include <Standard_ErrorHandler.hxx>
|
||||||
|
|
||||||
|
#include <Font_SystemFont.hxx>
|
||||||
|
#include <Font_FontMgr.hxx>
|
||||||
|
#include <TCollection_HAsciiString.hxx>
|
||||||
|
|
||||||
#include "GEOM_version.h"
|
#include "GEOM_version.h"
|
||||||
#include "GEOMImpl_Types.hxx" // dangerous hxx (defines short-name macros) - include after all
|
#include "GEOMImpl_Types.hxx" // dangerous hxx (defines short-name macros) - include after all
|
||||||
|
|
||||||
@ -218,6 +226,7 @@ GeometryGUI::GeometryGUI() :
|
|||||||
myLocalSelectionMode = GEOM_ALLOBJECTS;
|
myLocalSelectionMode = GEOM_ALLOBJECTS;
|
||||||
|
|
||||||
myCreationInfoWdg = 0;
|
myCreationInfoWdg = 0;
|
||||||
|
myTextTreeWdg = 0;
|
||||||
|
|
||||||
connect( Material_ResourceMgr::resourceMgr(), SIGNAL( changed() ), this, SLOT( updateMaterials() ) );
|
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()->insertDockWindow( myCreationInfoWdg->getWinID(), myCreationInfoWdg );
|
||||||
getApp()->placeDockWindow( myCreationInfoWdg->getWinID(), Qt::LeftDockWidgetArea );
|
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
|
//NPAL 19674
|
||||||
SALOME_ListIO selected;
|
SALOME_ListIO selected;
|
||||||
sm->selectedObjects( 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( updateCreationInfo() ));
|
||||||
disconnect( selMrg, SIGNAL( currentSelectionChanged() ), this, SLOT( updateFieldColorScale() ));
|
disconnect( selMrg, SIGNAL( currentSelectionChanged() ), this, SLOT( updateFieldColorScale() ));
|
||||||
getApp()->removeDockWindow( myCreationInfoWdg->getWinID() );
|
if ( myCreationInfoWdg ) {
|
||||||
myCreationInfoWdg = 0;
|
getApp()->removeDockWindow( myCreationInfoWdg->getWinID() );
|
||||||
|
myCreationInfoWdg = 0;
|
||||||
|
}
|
||||||
|
if ( myTextTreeWdg ) {
|
||||||
|
getApp()->removeDockWindow( myTextTreeWdg->getWinID() );
|
||||||
|
disconnect( application(), 0, myTextTreeWdg, 0 );
|
||||||
|
myTextTreeWdg = 0;
|
||||||
|
}
|
||||||
|
|
||||||
EmitSignalCloseAllDialogs();
|
EmitSignalCloseAllDialogs();
|
||||||
|
|
||||||
@ -1903,6 +1924,8 @@ void GeometryGUI::windows( QMap<int, int>& mappa ) const
|
|||||||
mappa.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
|
mappa.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
|
||||||
if ( myCreationInfoWdg )
|
if ( myCreationInfoWdg )
|
||||||
mappa.insert( myCreationInfoWdg->getWinID(), Qt::LeftDockWidgetArea );
|
mappa.insert( myCreationInfoWdg->getWinID(), Qt::LeftDockWidgetArea );
|
||||||
|
if ( myTextTreeWdg )
|
||||||
|
mappa.insert( myTextTreeWdg->getWinID(), Qt::LeftDockWidgetArea );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometryGUI::viewManagers( QStringList& lst ) const
|
void GeometryGUI::viewManagers( QStringList& lst ) const
|
||||||
@ -2237,6 +2260,8 @@ void GeometryGUI::OnSetMaterial(const QString& theName)
|
|||||||
|
|
||||||
void GeometryGUI::createPreferences()
|
void GeometryGUI::createPreferences()
|
||||||
{
|
{
|
||||||
|
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||||
|
|
||||||
int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
|
int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
|
||||||
|
|
||||||
int genGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), tabId );
|
int genGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), tabId );
|
||||||
@ -2333,12 +2358,36 @@ void GeometryGUI::createPreferences()
|
|||||||
setPreferenceProperty( aDimLineWidthId, "min", 1 );
|
setPreferenceProperty( aDimLineWidthId, "min", 1 );
|
||||||
setPreferenceProperty( aDimLineWidthId, "max", 5 );
|
setPreferenceProperty( aDimLineWidthId, "max", 5 );
|
||||||
|
|
||||||
int aDimFontHeightId = addPreference( tr( "PREF_DIMENSIONS_FONT_HEIGHT" ), aDimGroupId,
|
int aDimFontId = addPreference( tr( "PREF_DIMENSIONS_FONT" ), aDimGroupId, LightApp_Preferences::Font, "Geometry", "dimensions_font" );
|
||||||
LightApp_Preferences::DblSpin, "Geometry", "dimensions_font_height" );
|
|
||||||
|
|
||||||
setPreferenceProperty( aDimFontHeightId, "min", 1e-9 );
|
int f = QtxFontEdit::Family | QtxFontEdit::Size;
|
||||||
setPreferenceProperty( aDimFontHeightId, "max", 1e+9 );
|
setPreferenceProperty( aDimFontId, "features", f );
|
||||||
setPreferenceProperty( aDimFontHeightId, "precision", 9 );
|
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,
|
int aDimArrLengthId = addPreference( tr( "PREF_DIMENSIONS_ARROW_LENGTH" ), aDimGroupId,
|
||||||
LightApp_Preferences::DblSpin, "Geometry", "dimensions_arrow_length" );
|
LightApp_Preferences::DblSpin, "Geometry", "dimensions_arrow_length" );
|
||||||
@ -2353,9 +2402,6 @@ void GeometryGUI::createPreferences()
|
|||||||
int anAngUnitsId = addPreference( tr( "PREF_DIMENSIONS_ANGLE_UNITS" ), aDimGroupId,
|
int anAngUnitsId = addPreference( tr( "PREF_DIMENSIONS_ANGLE_UNITS" ), aDimGroupId,
|
||||||
LightApp_Preferences::Selector, "Geometry", "dimensions_angle_units" );
|
LightApp_Preferences::Selector, "Geometry", "dimensions_angle_units" );
|
||||||
|
|
||||||
addPreference( tr( "PREF_DIMENSIONS_SHOW_UNITS" ), aDimGroupId,
|
|
||||||
LightApp_Preferences::Bool, "Geometry", "dimensions_show_units" );
|
|
||||||
|
|
||||||
QStringList aListOfLengthUnits;
|
QStringList aListOfLengthUnits;
|
||||||
aListOfLengthUnits << "m";
|
aListOfLengthUnits << "m";
|
||||||
aListOfLengthUnits << "cm";
|
aListOfLengthUnits << "cm";
|
||||||
@ -2370,6 +2416,9 @@ void GeometryGUI::createPreferences()
|
|||||||
setPreferenceProperty( aLengthUnitsId, "strings", aListOfLengthUnits );
|
setPreferenceProperty( aLengthUnitsId, "strings", aListOfLengthUnits );
|
||||||
setPreferenceProperty( anAngUnitsId, "strings", aListOfAngUnits );
|
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,
|
int aDimDefFlyout = addPreference( tr( "PREF_DIMENSIONS_DEFAULT_FLYOUT" ), aDimGroupId,
|
||||||
LightApp_Preferences::DblSpin, "Geometry", "dimensions_default_flyout" );
|
LightApp_Preferences::DblSpin, "Geometry", "dimensions_default_flyout" );
|
||||||
|
|
||||||
@ -2377,6 +2426,9 @@ void GeometryGUI::createPreferences()
|
|||||||
setPreferenceProperty( aDimDefFlyout, "max", 1e+9 );
|
setPreferenceProperty( aDimDefFlyout, "max", 1e+9 );
|
||||||
setPreferenceProperty( aDimDefFlyout, "precision", 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 );
|
int isoGroup = addPreference( tr( "PREF_ISOS" ), tabId );
|
||||||
setPreferenceProperty( isoGroup, "columns", 2 );
|
setPreferenceProperty( isoGroup, "columns", 2 );
|
||||||
int isoU = addPreference( tr( "PREF_ISOS_U" ), isoGroup,
|
int isoU = addPreference( tr( "PREF_ISOS_U" ), isoGroup,
|
||||||
@ -2483,7 +2535,6 @@ void GeometryGUI::createPreferences()
|
|||||||
QList<QVariant> aMarkerTypeIndicesList;
|
QList<QVariant> aMarkerTypeIndicesList;
|
||||||
QList<QVariant> aMarkerTypeIconsList;
|
QList<QVariant> aMarkerTypeIconsList;
|
||||||
|
|
||||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
|
||||||
for ( int i = GEOM::MT_POINT; i < GEOM::MT_USER; i++ ) {
|
for ( int i = GEOM::MT_POINT; i < GEOM::MT_USER; i++ ) {
|
||||||
QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
|
QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
|
||||||
QPixmap pixmap = resMgr->loadPixmap( "GEOM", tr( qPrintable( icoFile ) ) );
|
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") ||
|
else if ( param == QString("dimensions_color") ||
|
||||||
param == QString("dimensions_line_width") ||
|
param == QString("dimensions_line_width") ||
|
||||||
param == QString("dimensions_font_height") ||
|
param == QString("dimensions_font") ||
|
||||||
param == QString("dimensions_arrow_length") ||
|
param == QString("dimensions_arrow_length") ||
|
||||||
param == QString("dimensions_show_units") ||
|
param == QString("dimensions_show_units") ||
|
||||||
param == QString("dimensions_length_units") ||
|
param == QString("dimensions_length_units") ||
|
||||||
param == QString("dimensions_angle_units") ||
|
param == QString("dimensions_angle_units") ||
|
||||||
|
param == QString("dimensions_use_text3d") ||
|
||||||
param == QString("label_color") )
|
param == QString("label_color") )
|
||||||
{
|
{
|
||||||
SalomeApp_Application* anApp = getApp();
|
SalomeApp_Application* anApp = getApp();
|
||||||
@ -3468,3 +3520,8 @@ void GeometryGUI::dropObjects( const DataObjectList& what, SUIT_DataObject* wher
|
|||||||
// update Object browser
|
// update Object browser
|
||||||
getApp()->updateObjectBrowser( false );
|
getApp()->updateObjectBrowser( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GeometryGUI::emitDimensionsUpdated( QString entry )
|
||||||
|
{
|
||||||
|
emit DimensionsUpdated( entry );
|
||||||
|
}
|
||||||
|
@ -64,6 +64,7 @@ class LightApp_Selection;
|
|||||||
class SUIT_ViewManager;
|
class SUIT_ViewManager;
|
||||||
class SalomeApp_Study;
|
class SalomeApp_Study;
|
||||||
class GEOMGUI_CreationInfoWdg;
|
class GEOMGUI_CreationInfoWdg;
|
||||||
|
class GEOMGUI_TextTreeWdg;
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : GeometryGUI
|
// class : GeometryGUI
|
||||||
@ -148,6 +149,8 @@ public:
|
|||||||
SUIT_DataObject* where,
|
SUIT_DataObject* where,
|
||||||
const int row, Qt::DropAction action );
|
const int row, Qt::DropAction action );
|
||||||
|
|
||||||
|
void emitDimensionsUpdated( QString entry );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual bool deactivateModule( SUIT_Study* );
|
virtual bool deactivateModule( SUIT_Study* );
|
||||||
virtual bool activateModule( SUIT_Study* );
|
virtual bool activateModule( SUIT_Study* );
|
||||||
@ -176,6 +179,7 @@ signals :
|
|||||||
void SignalDefaultStepValueChanged( double newVal );
|
void SignalDefaultStepValueChanged( double newVal );
|
||||||
void SignalDependencyTreeParamChanged( const QString&, const QString& );
|
void SignalDependencyTreeParamChanged( const QString&, const QString& );
|
||||||
void SignalDependencyTreeRenameObject( const QString& );
|
void SignalDependencyTreeRenameObject( const QString& );
|
||||||
|
void DimensionsUpdated( const QString& );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual LightApp_Selection* createSelection() const;
|
virtual LightApp_Selection* createSelection() const;
|
||||||
@ -224,6 +228,8 @@ private:
|
|||||||
|
|
||||||
GEOMGUI_CreationInfoWdg* myCreationInfoWdg;
|
GEOMGUI_CreationInfoWdg* myCreationInfoWdg;
|
||||||
|
|
||||||
|
GEOMGUI_TextTreeWdg* myTextTreeWdg;
|
||||||
|
|
||||||
SALOME_ListIO myTopLevelIOList;
|
SALOME_ListIO myTopLevelIOList;
|
||||||
|
|
||||||
friend class DisplayGUI;
|
friend class DisplayGUI;
|
||||||
|
@ -495,12 +495,13 @@ Handle(AIS_Dimension) MeasureGUI_CreateDimensionDlg::CreateDimension()
|
|||||||
|
|
||||||
QColor aQColor = aResMgr->colorValue ( "Geometry", "dimensions_color", QColor( 0, 255, 0 ) );
|
QColor aQColor = aResMgr->colorValue ( "Geometry", "dimensions_color", QColor( 0, 255, 0 ) );
|
||||||
int aLineWidth = aResMgr->integerValue( "Geometry", "dimensions_line_width", 1 );
|
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 anArrowLength = aResMgr->doubleValue ( "Geometry", "dimensions_arrow_length", 5 );
|
||||||
double aDefFlyout = aResMgr->doubleValue ( "Geometry", "dimensions_default_flyout", 20 );
|
double aDefFlyout = aResMgr->doubleValue ( "Geometry", "dimensions_default_flyout", 20 );
|
||||||
bool isUnitsShown = aResMgr->booleanValue( "Geometry", "dimensions_show_units", false );
|
bool isUnitsShown = aResMgr->booleanValue( "Geometry", "dimensions_show_units", false );
|
||||||
QString aUnitsLength = aResMgr->stringValue ( "Geometry", "dimensions_length_units", "m" );
|
QString aUnitsLength = aResMgr->stringValue ( "Geometry", "dimensions_length_units", "m" );
|
||||||
QString aUnitsAngle = aResMgr->stringValue ( "Geometry", "dimensions_angle_units", "deg" );
|
QString aUnitsAngle = aResMgr->stringValue ( "Geometry", "dimensions_angle_units", "deg" );
|
||||||
|
bool aUseText3d = aResMgr->booleanValue( "Geometry", "dimensions_use_text3d", false );
|
||||||
|
|
||||||
OCCViewer_ViewWindow* anActiveView = NULL;
|
OCCViewer_ViewWindow* anActiveView = NULL;
|
||||||
|
|
||||||
@ -610,10 +611,12 @@ Handle(AIS_Dimension) MeasureGUI_CreateDimensionDlg::CreateDimension()
|
|||||||
|
|
||||||
aStyle->SetCommonColor( aColor );
|
aStyle->SetCommonColor( aColor );
|
||||||
aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown );
|
aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown );
|
||||||
aStyle->MakeText3d( Standard_True );
|
aStyle->MakeText3d( aUseText3d );
|
||||||
aStyle->MakeTextShaded( Standard_True );
|
aStyle->MakeTextShaded( Standard_True );
|
||||||
aStyle->SetExtensionSize( aFontHeight * 0.5 );
|
int fsize = aFont.pixelSize() != -1 ? aFont.pixelSize() : aFont.pointSize();
|
||||||
aStyle->TextAspect()->SetHeight( aFontHeight );
|
aStyle->SetExtensionSize( fsize * 0.5 );
|
||||||
|
aStyle->TextAspect()->SetFont( aFont.family().toLatin1().data() );
|
||||||
|
aStyle->TextAspect()->SetHeight( fsize );
|
||||||
aStyle->ArrowAspect()->SetLength( anArrowLength );
|
aStyle->ArrowAspect()->SetLength( anArrowLength );
|
||||||
aStyle->LineAspect()->SetWidth( aLineWidth );
|
aStyle->LineAspect()->SetWidth( aLineWidth );
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "MeasureGUI_DimensionFilter.h"
|
#include "MeasureGUI_DimensionFilter.h"
|
||||||
|
|
||||||
#include <GEOMGUI_DimensionProperty.h>
|
#include <GEOMGUI_DimensionProperty.h>
|
||||||
|
#include <GEOMGUI_TextTreeWdg.h>
|
||||||
#include <GEOMUtils.hxx>
|
#include <GEOMUtils.hxx>
|
||||||
#include <GEOMGUI_OCCSelector.h>
|
#include <GEOMGUI_OCCSelector.h>
|
||||||
#include <GEOM_AISDimension.hxx>
|
#include <GEOM_AISDimension.hxx>
|
||||||
@ -771,6 +772,8 @@ bool MeasureGUI_ManageDimensionsDlg::ClickOnApply()
|
|||||||
|
|
||||||
mySavedPropertyState.SaveToAttribute( aStudy, myEditObject->GetStudyEntry() );
|
mySavedPropertyState.SaveToAttribute( aStudy, myEditObject->GetStudyEntry() );
|
||||||
|
|
||||||
|
myGeomGUI->emitDimensionsUpdated( QString( myEditObject->GetStudyEntry() ) );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -807,6 +810,8 @@ void MeasureGUI_ManageDimensionsDlg::OnFinish()
|
|||||||
QVariant() );
|
QVariant() );
|
||||||
|
|
||||||
redisplay( myEditObject.get() );
|
redisplay( myEditObject.get() );
|
||||||
|
|
||||||
|
myGeomGUI->emitDimensionsUpdated( QString( myEditObject->GetStudyEntry() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user