Files
ResInsight/ApplicationLibCode/ProjectDataModel/Surfaces/RimTriangulatedSurface.h
T
Stefan Crooijmans 707cec5b7f #12460 Python: Fail the project save when a triangulated surface can not be written
Review follow-up for #15127: onProjectBeingSaved() returns false when the
surface has data that could not be written, and saveProjectAs() then fails
with a message naming the surface before the project file is written, so a
write error no longer reports a successful save with the surface data lost.
2026-11-09 19:48:06 +01:00

66 lines
2.2 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026- Equinor ASA
//
// 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.
//
// 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.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimSurface.h"
#include "cafFilePath.h"
#include <memory>
class RigTriangleMeshData;
//==================================================================================================
/// Surface with geometry and properties set from scripting, saved as a GOCAD TSurf file next to the project file
//==================================================================================================
class RimTriangulatedSurface : public RimSurface
{
CAF_PDM_HEADER_INIT;
public:
RimTriangulatedSurface();
~RimTriangulatedSurface() override;
bool onLoadData() override;
RimSurface* createCopy() override;
void setGeometry( const std::vector<cvf::Vec3d>& vertices, const std::vector<unsigned>& triangleIndices );
void setProperty( const QString& key, const std::vector<float>& values );
size_t vertexCount() const;
std::vector<float> getProperty( const QString& key ) const;
std::vector<QString> propertyNames() const;
bool onProjectBeingSaved();
private:
bool updateSurfaceData() override;
void clearCachedNativeData() override;
bool loadDataFromFile();
QString fileNameInProjectFolder();
private:
caf::PdmField<caf::FilePath> m_surfaceFilePath;
caf::PdmField<QString> m_fileId;
std::unique_ptr<RigTriangleMeshData> m_triangleMeshData;
bool m_hasUnsavedChanges;
};