-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
}
}
}
- if ( !ok )
- {
- h->SetOptionValues( myOptions ); // restore values
- h->SetPreCADOptionValues( myPreCADOptions ); // restore values
- return ok;
- }
// SizeMap and attractors
if ( ok )
try {
e = entry.toStdString();
s = that->mySMPMap[entry].toStdString();
- h->SetSizeMapEntry( e.c_str(), s.c_str() );
+ //h->SetSizeMapEntry( e.c_str(), s.c_str() );
}
catch ( const SALOME::SALOME_Exception& ex )
{
msg = tr("ZERO_VALUE_OF").arg( tr("BLSURF_CHORDAL_ERROR"));
}
+ // #16954 EDF 19466 - localsize
+ // Warn the user if local size is less than Min Size
+ if ( ok &&
+ !myStdWidget->myMinSizeRel->isChecked() &&
+ !myStdWidget->myMinSize->text().isEmpty() )
+ {
+ const double minSize = myStdWidget->myMinSize->GetValue();
+ bool isValue;
+ for ( QMapIterator<QString,QString> i( mySMPMap ); i.hasNext() && ok ; )
+ {
+ i.next();
+ double size = i.value().toDouble( &isValue );
+ ok = ( !isValue || size >= minSize );
+ }
+ for ( QMapIterator<QString, TAttractorVec > i( myATTMap ); i.hasNext() && ok ; )
+ {
+ i.next();
+ const TAttractorVec& attVec = i.value();
+ for ( size_t i = 0; i < attVec.size(); ++i )
+ ok = ( attVec[i].IsToDelete() || attVec[i].startSize >= minSize );
+ }
+ if ( !ok )
+ msg = tr( "TOO_SMALL_LOCAL_SIZE" );
+ }
+ // Warn the user if local size is more than User Size
+ if ( ok &&
+ !myStdWidget->myPhySizeRel->isChecked() &&
+ !myStdWidget->myPhySize->text().isEmpty() )
+ {
+ const double userSize = myStdWidget->myPhySize->GetValue();
+ bool isValue;
+ for ( QMapIterator<QString,QString> i( mySMPMap ); i.hasNext() && ok ; )
+ {
+ i.next();
+ double size = i.value().toDouble( &isValue );
+ ok = ( !isValue || size <= userSize );
+ }
+ for ( QMapIterator<QString, TAttractorVec > i( myATTMap ); i.hasNext() && ok ; )
+ {
+ i.next();
+ const TAttractorVec& attVec = i.value();
+ for ( size_t i = 0; i < attVec.size(); ++i )
+ ok = ( attVec[i].IsToDelete() || attVec[i].startSize <= userSize );
+ }
+ if ( !ok )
+ msg = tr( "TOO_LARGE_LOCAL_SIZE" );
+ }
+
// Enforced vertices
// TODO
+ if ( !ok )
+ {
+ h->SetOptionValues( myOptions ); // restore values
+ h->SetPreCADOptionValues( myPreCADOptions ); // restore values
+ }
+
return ok;
}
myEnforcedTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
myEnforcedTreeWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
for (int column = 0; column < ENF_VER_NB_COLUMNS; ++column) {
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
- myEnforcedTreeWidget->header()->setResizeMode(column,QHeaderView::Interactive);
-#else
myEnforcedTreeWidget->header()->setSectionResizeMode(column,QHeaderView::Interactive);
-#endif
myEnforcedTreeWidget->resizeColumnToContents(column);
}
myEnforcedTreeWidget->hideColumn(ENF_VER_FACE_ENTRY_COLUMN);
size_t periodicityVisibleColumns = 2;
for (size_t column = 0; column < periodicityVisibleColumns; ++column) {
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
- myPeriodicityTreeWidget->header()->setResizeMode(column,QHeaderView::Interactive);
-#else
myPeriodicityTreeWidget->header()->setSectionResizeMode(column,QHeaderView::Interactive);
-#endif
myPeriodicityTreeWidget->resizeColumnToContents(column);
}
myPeriodicityTreeWidget->header()->setStretchLastSection(true);
myTabWidget->setCurrentIndex( STD_TAB );
connect( myAdvWidget->addBtn, SIGNAL( clicked() ), this, SLOT( onAddOption() ) );
- connect( myStdWidget->myAllowQuadrangles, SIGNAL( stateChanged( int ) ), this, SLOT( onStateChange() ));
// Size Maps
connect( addMapButton, SIGNAL( clicked()), this, SLOT( onAddMap() ) );
myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(nbSelEnfVertex-1);
if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
- BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations();
if (CORBA::is_nil(measureOp))
return;
*/
void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices()
{
- BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
-
getGeomSelectionTool()->selectionMgr()->clearFilters();
myEnfVertexWdg->deactivateSelection();
/** BLSURFPluginGUI_HypothesisCreator::retrieveParams()
-This method updates the GUI widgets with the hypothesis data
+ This method updates the GUI widgets with the hypothesis data
*/
void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
{
myStdWidget->myVolumeGradation->setText("");
else
myStdWidget->myVolumeGradation->SetValue( data.myVolumeGradation );
- myStdWidget->myAllowQuadrangles->setChecked( data.myAllowQuadrangles );
-
+
+ foreach (QAbstractButton* button, myStdWidget->myButtonGroupElementType->buttons()) {
+ if (myStdWidget->myButtonGroupElementType->id(button) == data.myElementType) {
+ button->setChecked(true);
+ break;
+ }
+ }
+
+ myStdWidget->myUseSurfaceProximity->setChecked( data.myUseSurfaceProximity );
+ myStdWidget->myNbSurfaceProximityLayers->setValue( data.myNbSurfaceProximityLayers );
+ myStdWidget->mySurfaceProximityRatio->SetValue( data.mySurfaceProximityRatio );
+ myStdWidget->myUseVolumeProximity->setChecked( data.myUseVolumeProximity );
+ myStdWidget->myNbVolumeProximityLayers->setValue( data.myNbVolumeProximityLayers );
+ myStdWidget->myVolumeProximityRatio->SetValue( data.myVolumeProximityRatio );
+ if ( !data.myUseSurfaceProximity )
+ {
+ //myStdWidget->myNbSurfaceProximityLayers->setText("");
+ myStdWidget->mySurfaceProximityRatio->setText("");
+ }
+ if ( !data.myUseVolumeProximity )
+ {
+ //myStdWidget->myNbVolumeProximityLayers->setText("");
+ myStdWidget->myVolumeProximityRatio->setText("");
+ }
+
if (data.myAngleMesh < 0)
myStdWidget->myAngleMesh->setText("");
else
h_data.myGradation = h->GetGradation();
h_data.myUseVolumeGradation = h->GetUseVolumeGradation();
h_data.myVolumeGradation = h->GetVolumeGradation();
- h_data.myAllowQuadrangles = h->GetQuadAllowed();
+ h_data.myElementType = h->GetElementType();
double angle = h->GetAngleMesh();
h_data.myAngleMesh = angle > 0 ? angle : -1.0;
double chordalError = h->GetChordalError();
h_data.myTinyEdgeOptimisLength = myTinyEdgeOptimisLength > 0 ? myTinyEdgeOptimisLength : -1.0;
h_data.myCorrectSurfaceIntersection = h->GetCorrectSurfaceIntersection();
double corrSurfaceIntersMaxCost = h->GetCorrectSurfaceIntersectionMaxCost();
- h_data.myCorrectSurfaceIntersectionMaxCost = corrSurfaceIntersMaxCost > 0 ? corrSurfaceIntersMaxCost : -1.0;
+ h_data.myCorrectSurfaceIntersectionMaxCost = corrSurfaceIntersMaxCost > 0 ? corrSurfaceIntersMaxCost : -1.0;
h_data.myForceBadElementRemoval = h->GetBadElementRemoval();
double myBadElementAspectRatio = h->GetBadElementAspectRatio();
h_data.myBadElementAspectRatio = myBadElementAspectRatio > 0 ? myBadElementAspectRatio : -1.0;
//h_data.myPreCADMergeEdges = h->GetPreCADMergeEdges();
// h_data.myPreCADProcess3DTopology = h->GetPreCADProcess3DTopology();
// h_data.myPreCADDiscardInput = h->GetPreCADDiscardInput();
-
+ h_data.myUseSurfaceProximity = h->GetSurfaceProximity ();
+ h_data.myNbSurfaceProximityLayers = h->GetNbSurfaceProximityLayers();
+ h_data.mySurfaceProximityRatio = h->GetSurfaceProximityRatio ();
+ h_data.myUseVolumeProximity = h->GetVolumeProximity ();
+ h_data.myNbVolumeProximityLayers = h->GetNbVolumeProximityLayers ();
+ h_data.myVolumeProximityRatio = h->GetVolumeProximityRatio ();
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
that->myOptions = h->GetOptionValues();
{
periodicity_i[PERIODICITY_P1_SOURCE_COLUMN] = sourceVertices[0].in();
periodicity_i[PERIODICITY_P2_SOURCE_COLUMN] = sourceVertices[1].in();
- periodicity_i[PERIODICITY_P3_SOURCE_COLUMN] = sourceVertices[2].in();
+ if ( onFace )
+ periodicity_i[PERIODICITY_P3_SOURCE_COLUMN] = sourceVertices[2].in();
}
if (targetVertices.length()!=0)
{
periodicity_i[PERIODICITY_P1_TARGET_COLUMN] = targetVertices[0].in();
periodicity_i[PERIODICITY_P2_TARGET_COLUMN] = targetVertices[1].in();
- periodicity_i[PERIODICITY_P3_TARGET_COLUMN] = targetVertices[2].in();
+ if ( onFace )
+ periodicity_i[PERIODICITY_P3_TARGET_COLUMN] = targetVertices[2].in();
}
if (onFace)
if ( h->GetVolumeGradation() != h_data.myVolumeGradation )
h->SetVolumeGradation( h_data.myVolumeGradation <= 0 ? -1 : h_data.myVolumeGradation );
- if ( h->GetQuadAllowed() != h_data.myAllowQuadrangles )
- h->SetQuadAllowed( h_data.myAllowQuadrangles );
-
+ h->SetSurfaceProximity ( h_data.myUseSurfaceProximity );
+ h->SetNbSurfaceProximityLayers( h_data.myNbSurfaceProximityLayers );
+ h->SetSurfaceProximityRatio ( h_data.mySurfaceProximityRatio );
+ h->SetVolumeProximity ( h_data.myUseVolumeProximity );
+ h->SetNbVolumeProximityLayers ( h_data.myNbVolumeProximityLayers );
+ h->SetVolumeProximityRatio ( h_data.myVolumeProximityRatio );
+
+ if ( h->GetElementType() != h_data.myElementType )
+ h->SetElementType( h_data.myElementType );
+
if ( (int) h_data.myGeometricMesh != DefaultGeom ) {
if ( h->GetAngleMesh() != h_data.myAngleMesh )
h->SetAngleMesh( h_data.myAngleMesh <= 0 ? -1 :h_data.myAngleMesh );
if ( h->GetChordalError() != h_data.myChordalError )
h->SetChordalError( h_data.myChordalError <= 0 ? -1 :h_data.myChordalError );
}
-
+
if ( h->GetAnisotropic() != h_data.myAnisotropic )
h->SetAnisotropic( h_data.myAnisotropic );
if ( h_data.myAnisotropic && ( h->GetAnisotropicRatio() != h_data.myAnisotropicRatio ) )
h->SetAnisotropicRatio( h_data.myAnisotropicRatio <= 0 ? -1 :h_data.myAnisotropicRatio );
-
+
if ( h->GetRemoveTinyEdges() != h_data.myRemoveTinyEdges )
h->SetRemoveTinyEdges( h_data.myRemoveTinyEdges );
if ( h_data.myRemoveTinyEdges && ( h->GetTinyEdgeLength() != h_data.myTinyEdgeLength ) )
h->SetTinyEdgeLength( h_data.myTinyEdgeLength <= 0 ? -1 :h_data.myTinyEdgeLength );
-
+
if ( h->GetOptimiseTinyEdges() != h_data.myOptimiseTinyEdges )
h->SetOptimiseTinyEdges( h_data.myOptimiseTinyEdges );
if ( h_data.myOptimiseTinyEdges && ( h->GetTinyEdgeOptimisationLength() != h_data.myTinyEdgeOptimisLength ) )
h_data.myGradation = h_data.myUseGradation ? myStdWidget->myGradation->GetValue() : -1.0;
h_data.myUseVolumeGradation = myStdWidget->myUseVolumeGradation->isChecked() && !myStdWidget->myVolumeGradation->text().isEmpty();
h_data.myVolumeGradation = h_data.myUseVolumeGradation ? myStdWidget->myVolumeGradation->GetValue() : -1. ;
- h_data.myAllowQuadrangles = myStdWidget->myAllowQuadrangles->isChecked();
+ h_data.myElementType = myStdWidget->myButtonGroupElementType->checkedId();
h_data.myAngleMesh = myStdWidget->myAngleMesh->text().isEmpty() ? -1.0 : myStdWidget->myAngleMesh->GetValue();
h_data.myChordalError = myStdWidget->myChordalError->text().isEmpty() ? -1.0 : myStdWidget->myChordalError->GetValue();
h_data.myAnisotropic = myStdWidget->myAnisotropic->isChecked();
//h_data.myPreCADMergeEdges = myAdvWidget->myPreCADMergeEdges->isChecked();
//h_data.myPreCADProcess3DTopology = myAdvWidget->myPreCADProcess3DTopology->isChecked();
//h_data.myPreCADDiscardInput = myAdvWidget->myPreCADDiscardInput->isChecked();
+ h_data.myUseSurfaceProximity = myStdWidget->myUseSurfaceProximity ->isChecked();
+ h_data.myNbSurfaceProximityLayers = myStdWidget->myNbSurfaceProximityLayers->value();
+ h_data.mySurfaceProximityRatio = myStdWidget->mySurfaceProximityRatio ->value();
+ h_data.myUseVolumeProximity = myStdWidget->myUseVolumeProximity ->isChecked();
+ h_data.myNbVolumeProximityLayers = myStdWidget->myNbVolumeProximityLayers ->value();
+ h_data.myVolumeProximityRatio = myStdWidget->myVolumeProximityRatio ->value();
QString guiHyp;
guiHyp += tr("BLSURF_PHY_MESH") + " = " + QString::number( h_data.myPhysicalMesh ) + "; ";
guiHyp += tr("BLSURF_MAXSIZE") + " = "+ QString::number( h_data.myMaxSize ) + "; ";
guiHyp += tr("BLSURF_MAXSIZE") + " " + tr("BLSURF_SIZE_REL") + " = " + QString(h_data.myMaxSizeRel ? "yes" : "no") + "; ";
guiHyp += tr("BLSURF_GRADATION") + " = " + QString::number( h_data.myGradation ) + "; ";
- guiHyp += tr("BLSURF_ALLOW_QUADRANGLES") + " = " + QString(h_data.myAllowQuadrangles ? "yes" : "no") + "; ";
+ guiHyp += tr("BLSURF_ELEMENT_TYPE") + " = " + QString::number(h_data.myElementType) + "; ";
guiHyp += tr("BLSURF_ANGLE_MESH") + " = " + QString::number( h_data.myAngleMesh ) + "; ";
guiHyp += tr("BLSURF_CHORDAL_ERROR") + " = " + QString::number( h_data.myChordalError ) + "; ";
guiHyp += tr("BLSURF_ANISOTROPIC") + " = " + QString(h_data.myAnisotropic ? "yes" : "no") + "; ";
myHyPatchFaceSelBtn->toggle();
if ( myHyPatchGroupSelBtn->isChecked() )
myHyPatchGroupSelBtn->toggle();
- return;
}
else if ( sender() == smpTab )
{
myAttractorCheck->setChecked(false);
myConstSizeCheck->setChecked(false);
}
+
+ if ( tab == SMP_TAB ) // [#16954] limit local size by Min and User Size
+ {
+ double minSize = 0, maxSize = COORD_MAX;
+
+ if ( !myStdWidget->myMinSizeRel->isChecked() &&
+ !myStdWidget->myMinSize->text().isEmpty() )
+ minSize = myStdWidget->myMinSize->GetValue();
+
+ if ( !myStdWidget->myPhySizeRel->isChecked() &&
+ !myStdWidget->myPhySize->text().isEmpty() )
+ maxSize = myStdWidget->myPhySize->GetValue();
+
+ mySmpSizeSpin->RangeStepAndValidator(minSize, maxSize, 1.0, "length_precision");
+ myAttSizeSpin->RangeStepAndValidator(minSize, maxSize, 1.0, "length_precision");
+ }
}
void BLSURFPluginGUI_HypothesisCreator::onAttractorClicked(int state)