-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014 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 "SMESHGUI_DuplicateNodesDlg.h"
#include "SMESHGUI_ExtrusionAlongPathDlg.h"
#include "SMESHGUI_ExtrusionDlg.h"
+#include "SMESHGUI_FieldSelectorWdg.h"
#include "SMESHGUI_FileInfoDlg.h"
#include "SMESHGUI_FileValidator.h"
#include "SMESHGUI_FilterDlg.h"
void Control( int theCommandID );
// Definitions
- //=============================================================
+ //================================================================================
+ /*!
+ * \brief Reads meshes from file
+ */
+ //================================================================================
+
void ImportMeshesFromFile( SMESH::SMESH_Gen_ptr theComponentMesh,
int theCommandID )
{
if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
anInitialPath = QDir::currentPath();
+ QList< QPair< GEOM::ListOfFields_var, QString > > aFieldList;
+
// Get a file name to write in and additional otions
if ( isUNV || isDAT || isGMF ) // Export w/o options
{
QStringList checkBoxes;
checkBoxes << QObject::tr("SMESH_AUTO_GROUPS") << QObject::tr("SMESH_AUTO_DIM");
+ SMESHGUI_FieldSelectorWdg* fieldSelWdg = new SMESHGUI_FieldSelectorWdg();
+ QList< QWidget* > wdgList;
+ if ( fieldSelWdg->GetAllFeilds( aMeshList, aFieldList ))
+ wdgList.append( fieldSelWdg );
+
SalomeApp_CheckFileDlg* fd =
- new SalomeApp_CheckFileDlg ( SMESHGUI::desktop(), false, checkBoxes, true, true );
+ new SalomeApp_CheckFileDlg ( SMESHGUI::desktop(), false, checkBoxes, true, true, wdgList );
fd->setWindowTitle( aTitle );
fd->setNameFilters( filters );
fd->selectNameFilter( aDefaultFilter );
}
toCreateGroups = fd->IsChecked(0);
toFindOutDim = fd->IsChecked(1);
+ fieldSelWdg->GetSelectedFeilds();
+ if ( !fieldSelWdg->parent() )
+ delete fieldSelWdg;
delete fd;
}
else
{
SMESH::SMESH_IDSource_var aMeshOrGroup = (*aMeshIter).first;
SMESH::SMESH_Mesh_var aMeshItem = aMeshOrGroup->GetMesh();
- if ( aMeshOrGroup->_is_equivalent( aMeshItem ))
+ const GEOM::ListOfFields& fields = aFieldList[ aMeshIndex ].first.in();
+ const QString& geoAssFields = aFieldList[ aMeshIndex ].second;
+ const bool hasFields = ( fields.length() || !geoAssFields.isEmpty() );
+ if ( !hasFields && aMeshOrGroup->_is_equivalent( aMeshItem ))
aMeshItem->ExportToMEDX( aFilename.toUtf8().data(), toCreateGroups,
aFormat, toOverwrite && aMeshIndex == 0, toFindOutDim );
else
aMeshItem->ExportPartToMED( aMeshOrGroup, aFilename.toUtf8().data(), toCreateGroups,
- aFormat, toOverwrite && aMeshIndex == 0, toFindOutDim );
+ aFormat, toOverwrite && aMeshIndex == 0, toFindOutDim,
+ fields, geoAssFields.toLatin1().data() );
}
}
else if ( isSAUV )
int deltaF = 0, deltaV = 0;
int elem0dSize = 1;
int ballSize = 1;
+ int ballScale = 1;
int edgeWidth = 1;
int outlineWidth = 1;
double shrinkCoef = 0.0;
anActor->GetBallColor( color[0], color[1], color[2] );
ballColor.setRgbF( color[0], color[1], color[2] );
ballSize = qMax( (int)anActor->GetBallSize(), 1 ); // minimum allowed size is 1
+ ballScale = qMax( (int)anActor->GetBallScale(), 1 ); // minimum allowed size is 1
// outlines: color
anActor->GetOutlineColor( color[0], color[1], color[2] );
outlineColor.setRgbF( color[0], color[1], color[2] );
// balls: color, size
dlg.setBallColor( ballColor );
dlg.setBallSize( ballSize );
+ dlg.setBallScale( ballScale );
// orientation: color, scale, 3d flag
dlg.setOrientationColor( orientationColor );
dlg.setOrientationSize( int( orientationScale * 100. ) );
elem0dSize = dlg.elem0dSize();
ballColor = dlg.ballColor();
ballSize = dlg.ballSize();
+ ballScale = dlg.ballScale();
orientationColor = dlg.orientationColor();
orientationScale = dlg.orientationSize() / 100.;
orientation3d = dlg.orientation3d();
// balls: color, size
anActor->SetBallColor( ballColor.redF(), ballColor.greenF(), ballColor.blueF() );
anActor->SetBallSize( ballSize );
+ anActor->SetBallScale( ballScale );
// orientation: color, scale, 3d flag
anActor->SetFacesOrientationColor( orientationColor.redF(), orientationColor.greenF(), orientationColor.blueF() );
anActor->SetFacesOrientationScale( orientationScale );
LightApp_Preferences::IntSpin, "SMESH", "elem0d_size");
int ballSize = addPreference(tr("PREF_BALL_SIZE"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "ball_elem_size");
+ int ballScale = addPreference(tr("PREF_BALL_SCALE"), elemGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "ball_elem_scale");
int elemW = addPreference(tr("PREF_WIDTH"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "element_width");
int outW = addPreference(tr("PREF_OUTLINE_WIDTH"), elemGroup,
setPreferenceProperty( ballSize, "min", 1 );
setPreferenceProperty( ballSize, "max", 10 );
+ setPreferenceProperty( ballScale, "min", 1 );
+ setPreferenceProperty( ballScale, "max", 10 );
+
setPreferenceProperty( elemW, "min", 1 );
setPreferenceProperty( elemW, "max", 5 );
sizeStr << QString::number((int)aSmeshActor->Get0DSize());
sizeStr << "ball";
sizeStr << QString::number((int)aSmeshActor->GetBallSize());
+ sizeStr << QString::number((int)aSmeshActor->GetBallScale());
sizeStr << "shrink";
sizeStr << QString::number(aSmeshActor->GetShrinkFactor());
sizeStr << "orientation";
int outlineWidth = -1;
int elem0dSize = -1;
int ballSize = -1;
+ int ballScale = -1;
double shrinkSize = -1;
double orientationSize = -1;
bool orientation3d = false;
i++;
}
else if ( type == "ball" ) {
- // ball size is given as single integer value
+ // balls are specified by two values: size:scale, where
+ // - size - is a integer value specifying size
+ // - scale - is a integer value specifying scale factor
if ( i+1 >= sizes.count() ) break; // format error
- int v = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error
- ballSize = v;
- i++;
+ int v1 = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error
+ if ( i+2 >= sizes.count() ) break; // format error
+ int v2 = sizes[i+2].toInt( &bOk ); if ( !bOk ) break; // format error
+ ballSize = v1;
+ ballScale = v2;
+ i += 2;
}
else if ( type == "shrink" ) {
// shrink factor is given as single floating point value
// ball size
if ( ballSize > 0 )
aSmeshActor->SetBallSize( ballSize );
+ // ball scale
+ if ( ballScale > 0 )
+ aSmeshActor->SetBallScale( ballScale );
// shrink factor
if ( shrinkSize > 0 )
aSmeshActor->SetShrinkFactor( shrinkSize );