Add operations on polygon : Duplicate, exportCsv, exportPol and simplify

SimplfyPolygon applies an operation on polygon to reduce the number of points in a way that the shape of the polygon is conserved.
This commit is contained in:
Magne Sjaastad
2024-03-04 07:28:04 +01:00
parent 5217ab5c8b
commit 3689cccae7
19 changed files with 621 additions and 19 deletions

View File

@@ -118,7 +118,7 @@ void RifCsvDataTableFormatter::tableCompleted()
//--------------------------------------------------------------------------------------------------
void RifCsvDataTableFormatter::outputBuffer()
{
if ( !m_columnHeaders.empty() )
if ( isAnyTextInHeader() )
{
for ( size_t i = 0; i < m_columnHeaders.size(); i++ )
{
@@ -152,3 +152,21 @@ void RifCsvDataTableFormatter::outputBuffer()
m_columnHeaders.clear();
m_buffer.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifCsvDataTableFormatter::isAnyTextInHeader() const
{
for ( auto& header : m_columnHeaders )
{
for ( const auto& titleRow : header.titles )
{
if ( !titleRow.trimmed().isEmpty() )
{
return true;
}
}
}
return false;
}

View File

@@ -42,6 +42,7 @@ public:
private:
void outputBuffer();
bool isAnyTextInHeader() const;
private:
QTextStream& m_out;

View File

@@ -320,7 +320,13 @@ bool RifTextDataTableFormatter::isAllHeadersEmpty( const std::vector<RifTextData
{
for ( auto& header : headers )
{
if ( !header.titles.empty() ) return false;
for ( const auto& titleRow : header.titles )
{
if ( !titleRow.trimmed().isEmpty() )
{
return false;
}
}
}
return true;
}

View File

@@ -92,7 +92,7 @@ struct RifTextDataTableColumn
, alignment( alignment )
, width( width )
{
titles.push_back( title );
titles.emplace_back( title );
}
RifTextDataTableColumn( const QString& title,
@@ -104,8 +104,8 @@ struct RifTextDataTableColumn
, alignment( alignment )
, width( width )
{
titles.push_back( title );
titles.push_back( subTitle );
titles.emplace_back( title );
titles.emplace_back( subTitle );
}
RifTextDataTableColumn( const QString& title,
@@ -118,9 +118,9 @@ struct RifTextDataTableColumn
, alignment( alignment )
, width( width )
{
titles.push_back( title );
titles.push_back( subTitle1 );
titles.push_back( subTitle2 );
titles.emplace_back( title );
titles.emplace_back( subTitle1 );
titles.emplace_back( subTitle2 );
}
QString title() const