-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 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.
+// 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
#include "HYDROGUI_ImmersibleZoneDlg.h"
-#include "HYDROGUI_ColorWidget.h"
#include "HYDROGUI_Tool.h"
#include <QComboBox>
#include <QLabel>
#include <QLayout>
#include <QLineEdit>
-#include <QListWidget>
-#include <QRadioButton>
HYDROGUI_ImmersibleZoneDlg::HYDROGUI_ImmersibleZoneDlg( HYDROGUI_Module* theModule, const QString& theTitle )
: HYDROGUI_InputPanel( theModule, theTitle )
aPolyLayout->setSpacing( 5 );
aPolyLayout->addWidget( new QLabel( tr( "ZONE_POLYLINE" ), aPolylineFrame ) );
aPolyLayout->addWidget( myPolylines );
-
-
- QFrame* aFillingFrame = new QFrame( aParamGroup );
- QLabel* aFillingLabel = new QLabel( tr( "FILLING_COLOR" ), aFillingFrame );
- myFillingTransparent = new QRadioButton( tr( "TRANSPARENT" ), aFillingFrame );
- myFillingTransparent->setChecked( true );
- myFillingColor = new QRadioButton( tr( "COLOR" ), aFillingFrame );
- myFillingColorBox = new HYDROGUI_ColorWidget( aFillingFrame );
-
- QGridLayout* aFillingLayout = new QGridLayout( aFillingFrame );
- aFillingLayout->setMargin( 0 );
- aFillingLayout->setSpacing( 5 );
- aFillingLayout->addWidget( aFillingLabel, 0, 0, 2, 1 );
- aFillingLayout->addWidget( myFillingTransparent, 0, 1 );
- aFillingLayout->addWidget( myFillingColor, 1, 1 );
- aFillingLayout->addWidget( myFillingColorBox, 1, 2 );
-
-
- myBorderColorGroup = new QGroupBox( tr( "BORDER_COLOR" ), mainFrame() );
- myBorderColorGroup->setCheckable( true );
-
- myBorderColorBox = new HYDROGUI_ColorWidget( myBorderColorGroup );
-
- QBoxLayout* aBorderColorLayout = new QHBoxLayout( myBorderColorGroup );
- aBorderColorLayout->setMargin( 5 );
- aBorderColorLayout->setSpacing( 5 );
- aBorderColorLayout->addWidget( new QLabel( tr( "COLOR" ), myBorderColorGroup ) );
- aBorderColorLayout->addWidget( myBorderColorBox );
-
-
+
QBoxLayout* aParamLayout = new QVBoxLayout( aParamGroup );
aParamLayout->setMargin( 5 );
aParamLayout->setSpacing( 5 );
aParamLayout->addWidget( aPolylineFrame );
- aParamLayout->addWidget( aFillingFrame );
- aParamLayout->addWidget( myBorderColorGroup );
-
QGroupBox* aBathGroup = new QGroupBox( tr( "ZONE_BATHYMETRY" ), mainFrame() );
// Connect signals and slots
connect( myPolylines, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onZoneDefChanged() ) );
- connect( myFillingTransparent, SIGNAL( toggled( bool ) ), this, SLOT( onFillingColorChanged( const bool ) ) );
- connect( myFillingColor, SIGNAL( toggled( bool ) ), this, SLOT( onFillingColorChanged( const bool ) ) );
- connect( myFillingColorBox, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( onFillingColorChanged() ) );
- connect( myBorderColorGroup, SIGNAL( toggled( bool ) ), this, SLOT( onZoneDefChanged() ) );
- connect( myBorderColorBox, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( onZoneDefChanged() ) );
}
HYDROGUI_ImmersibleZoneDlg::~HYDROGUI_ImmersibleZoneDlg()
myPolylines->clear();
myBathymetries->clear();
- myFillingTransparent->setChecked( true );
- myFillingColorBox->resetColor();
-
- myBorderColorGroup->setChecked( false );
- myBorderColorBox->resetColor();
-
blockSignals( isBlocked );
onZoneDefChanged();
return myBathymetries->currentText();
}
-void HYDROGUI_ImmersibleZoneDlg::setFillingColor( const QColor& theColor )
-{
- bool isBlocked = blockSignals( true );
-
- if( theColor.alpha() == 0 ) // transparent
- myFillingTransparent->setChecked( true );
- else
- myFillingColor->setChecked( true );
-
- myFillingColorBox->setColor( theColor );
-
- blockSignals( isBlocked );
-
- onZoneDefChanged();
-}
-
-QColor HYDROGUI_ImmersibleZoneDlg::getFillingColor() const
-{
- QColor aColor( 255, 255, 255, 0 ); // transparent
- if( myFillingColor->isChecked() )
- aColor = myFillingColorBox->color();
- return aColor;
-}
-
-void HYDROGUI_ImmersibleZoneDlg::setBorderColor( const QColor& theColor )
-{
- bool isBlocked = blockSignals( true );
-
- bool isTransparent = theColor.alpha() == 0;
- myBorderColorGroup->setChecked( !isTransparent );
- myBorderColorBox->setColor( !isTransparent ? theColor : QColor( Qt::black ) );
-
- blockSignals( isBlocked );
-
- onZoneDefChanged();
-}
-
-QColor HYDROGUI_ImmersibleZoneDlg::getBorderColor() const
-{
- QColor aColor( Qt::transparent ); // transparent
- if( myBorderColorGroup->isChecked() )
- aColor = myBorderColorBox->color();
- return aColor;
-}
-
-void HYDROGUI_ImmersibleZoneDlg::onFillingColorChanged()
-{
- if ( !myFillingColor->isChecked() )
- return;
-
- onZoneDefChanged();
-}
-
-void HYDROGUI_ImmersibleZoneDlg::onFillingColorChanged( const bool theIsChecked )
-{
- if ( !theIsChecked )
- return;
-
- onZoneDefChanged();
-}
-
void HYDROGUI_ImmersibleZoneDlg::onZoneDefChanged()
{
if ( signalsBlocked() )
QString aPolylineName = getPolylineName();
emit CreatePreview( aPolylineName );
}
-
-