2017-08-04 08:47:23 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017- Statoil ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2017-08-04 08:47:23 -05:00
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2017-08-04 08:47:23 -05:00
|
|
|
// ResInsight 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2017-08-04 08:47:23 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RicFractureNameGenerator.h"
|
|
|
|
|
|
|
|
#include "RimFracture.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RimOilField.h"
|
|
|
|
#include "RimProject.h"
|
2017-08-04 08:47:23 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-08-04 08:47:23 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString RicFractureNameGenerator::nameForNewFracture()
|
|
|
|
{
|
|
|
|
std::vector<RimFracture*> oldFractures;
|
2020-05-12 02:50:38 -05:00
|
|
|
RimProject::current()->activeOilField()->descendantsIncludingThisOfType( oldFractures );
|
2017-08-04 08:47:23 -05:00
|
|
|
|
|
|
|
size_t fractureNum = oldFractures.size();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
bool found;
|
2017-08-04 08:47:23 -05:00
|
|
|
QString name;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
do
|
|
|
|
{
|
2017-08-04 08:47:23 -05:00
|
|
|
found = false;
|
2019-09-06 03:40:57 -05:00
|
|
|
name = QString( "Fracture_%1" ).arg( fractureNum, 2, 10, QChar( '0' ) );
|
|
|
|
for ( RimFracture* fracture : oldFractures )
|
2017-08-04 08:47:23 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( fracture->name() == name )
|
2017-08-04 08:47:23 -05:00
|
|
|
{
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fractureNum++;
|
2019-09-06 03:40:57 -05:00
|
|
|
} while ( found );
|
2017-08-04 08:47:23 -05:00
|
|
|
|
|
|
|
return name;
|
|
|
|
}
|