mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-04 13:16:56 -06:00
#3724 Added cycling default color to polyline import. Set default line thickness to 2.
Refactored away unneccesary complexity. loadAndUpdate when opening project file. Toggle now working
This commit is contained in:
1 parent
d138770a2a
commit
29e6e08779
11 files changed
+114
-138
No files matched your search
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "QMessageBox"
|
||||
#include <QString>
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimAnnotationCollection, "RimAnnotationCollection");
|
||||
@@ -159,33 +160,25 @@ RimPolylinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylines
|
||||
}
|
||||
}
|
||||
|
||||
size_t newLinesIdx = 0;
|
||||
for(const QString& newFileName : newFileNames)
|
||||
{
|
||||
RimPolylinesFromFileAnnotation* newPolyLinesAnnot = new RimPolylinesFromFileAnnotation;
|
||||
|
||||
auto newColor = RiaColorTables::categoryPaletteColors().cycledColor3f(formationListBeforeImportCount + newLinesIdx);
|
||||
|
||||
newPolyLinesAnnot->setFileName(newFileName);
|
||||
newPolyLinesAnnot->setDescriptionFromFileName();
|
||||
newPolyLinesAnnot->appearance()->setColor(newColor);
|
||||
|
||||
m_polylineFromFileAnnotations.push_back(newPolyLinesAnnot);
|
||||
polyLinesObjsToReload.push_back(newPolyLinesAnnot);
|
||||
newPolyLinesAnnot->setDescriptionFromFileName();
|
||||
|
||||
++newLinesIdx;
|
||||
}
|
||||
|
||||
QString totalErrorMessage;
|
||||
reloadPolylinesFromFile(polyLinesObjsToReload);
|
||||
|
||||
for (RimPolylinesFromFileAnnotation* polyLinesAnnot: polyLinesObjsToReload)
|
||||
{
|
||||
QString errormessage;
|
||||
|
||||
polyLinesAnnot->readPolyLinesFile(&errormessage);
|
||||
if (!errormessage.isEmpty())
|
||||
{
|
||||
totalErrorMessage += "\nError in: " + polyLinesAnnot->fileName()
|
||||
+ "\n\t" + errormessage;
|
||||
}
|
||||
}
|
||||
|
||||
if (!totalErrorMessage.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(nullptr, "Import Formation Names", totalErrorMessage);
|
||||
}
|
||||
|
||||
if (m_polylineFromFileAnnotations.size() > formationListBeforeImportCount)
|
||||
{
|
||||
@@ -198,6 +191,31 @@ RimPolylinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylines
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::reloadPolylinesFromFile(const std::vector<RimPolylinesFromFileAnnotation *>& polyLinesObjsToReload)
|
||||
{
|
||||
QString totalErrorMessage;
|
||||
|
||||
for ( RimPolylinesFromFileAnnotation* polyLinesAnnot: polyLinesObjsToReload )
|
||||
{
|
||||
QString errormessage;
|
||||
|
||||
polyLinesAnnot->readPolyLinesFile(&errormessage);
|
||||
if ( !errormessage.isEmpty() )
|
||||
{
|
||||
totalErrorMessage += "\nError in: " + polyLinesAnnot->fileName()
|
||||
+ "\n\t" + errormessage;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !totalErrorMessage.isEmpty() )
|
||||
{
|
||||
QMessageBox::warning(nullptr, "Import Formation Names", totalErrorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -235,3 +253,11 @@ std::vector<RimGridView*> RimAnnotationCollection::gridViewsContainingAnnotation
|
||||
}
|
||||
return views;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::loadDataAndUpdate()
|
||||
{
|
||||
reloadPolylinesFromFile(m_polylineFromFileAnnotations.childObjects());
|
||||
}
|
||||
Reference in new issue
Block a user