Skip to content

Commit

Permalink
Merge pull request #504 from jongough/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
jongough authored Mar 9, 2022
2 parents d60cc4f + 4dd374e commit 191afa2
Show file tree
Hide file tree
Showing 6 changed files with 215 additions and 125 deletions.
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ jobs:
- BUILD_GTK3: true
- OCPN_TARGET: bionic-gtk3
- DEPLOY_USE_ORB: true
- BUILD_ENV=ubuntu
steps:
- checkout
- run: >
Expand All @@ -332,6 +333,7 @@ jobs:
- BUILD_GTK3: true
- OCPN_TARGET: focal-gtk3
- DEPLOY_USE_ORB: true
- BUILD_ENV=ubuntu
steps:
- checkout
- run: >
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ set(PACKAGE "ocpn_draw")

set(VERSION_MAJOR "1")
set(VERSION_MINOR "8")
set(VERSION_PATCH "13")
set(VERSION_TWEAK "2")
set(VERSION_DATE "02/02/2021") # DD/MM/YYYY format
set(VERSION_PATCH "14")
set(VERSION_TWEAK "0")
set(VERSION_DATE "09/03/2021") # DD/MM/YYYY format
set(OCPN_MIN_VERSION "ov50")
set(OCPN_API_VERSION_MAJOR "1")
set(OCPN_API_VERSION_MINOR "16")
Expand Down
9 changes: 5 additions & 4 deletions cmake/PluginConfigure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,11 @@ if(MINGW)
endif(MINGW)

if(APPLE)
add_definitions("-Wall -Wno-unused -fexceptions -Wno-overloaded-virtual")
add_definitions(" -g -fno-strict-aliasing")
add_definitions(" -Wno-deprecated -Wno-deprecated-declarations -Wno-unknown-pragmas")
add_definitions(" -D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_")
string(APPEND CMAKE_CXX_FLAGS " -Wall -Wno-unused -fexceptions -Wno-overloaded-virtual")
string(APPEND CMAKE_CXX_FLAGS " -g -fno-strict-aliasing")
string(APPEND CMAKE_CXX_FLAGS " -Wno-deprecated -Wno-deprecated-declarations -Wno-unknown-pragmas")
string(APPEND CMAKE_CXX_FLAGS " -D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_")
string(APPEND CMAKE_CXX_FLAGS " -DAPPLE")
endif(APPLE)

# Add some definitions to satisfy MS
Expand Down
53 changes: 24 additions & 29 deletions src/Boundary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Boundary::Boundary() : ODPath()
CreateColourSchemes();
SetColourScheme();
SetActiveColours();

}

Boundary::~Boundary()
Expand Down Expand Up @@ -125,7 +125,7 @@ void Boundary::Draw( ODDC& dc, PlugIn_ViewPort &piVP )
GetCanvasPixLL( &piVP, &r, pOp->m_lat, pOp->m_lon );
m_bpts[ l_iBoundaryPointCount++ ] = r;
}

if( m_bExclusionBoundary && !m_bInclusionBoundary ) {
// fill boundary with hatching
#if wxUSE_GRAPHICS_CONTEXT == 1
Expand Down Expand Up @@ -168,7 +168,7 @@ void Boundary::Draw( ODDC& dc, PlugIn_ViewPort &piVP )
}
if(l_imaxpointdiffX < 10 && l_imaxpointdiffY < 10 ) return;

// Use ClipperLib to manage Polygon
// Use ClipperLib to manage Polygon
// If needed simplify polygons to make shading stay outside
Paths poly(1);
for( size_t i = 0; i < m_pODPointList->GetCount(); i++ ) {
Expand All @@ -180,7 +180,7 @@ void Boundary::Draw( ODDC& dc, PlugIn_ViewPort &piVP )
Paths ExpandedBoundaries;
co.AddPaths( polys, jtSquare, etClosedPolygon );
co.Execute( ExpandedBoundaries, m_iInclusionBoundarySize );

wxPoint *l_InclusionBoundary = new wxPoint[ ExpandedBoundaries[0].size() + 1 ];
for( size_t i = 0; i < ExpandedBoundaries[0].size(); i++ )
{
Expand All @@ -194,7 +194,7 @@ void Boundary::Draw( ODDC& dc, PlugIn_ViewPort &piVP )
int l_iPolygonPointCount[2];
l_iPolygonPointCount[0] = m_pODPointList->GetCount();
l_iPolygonPointCount[1] = ExpandedBoundaries[0].size() + 1;

#if wxUSE_GRAPHICS_CONTEXT == 1
wxGraphicsContext *wxGC = NULL;
wxMemoryDC *pmdc = wxDynamicCast(dc.GetDC(), wxMemoryDC);
Expand Down Expand Up @@ -231,10 +231,8 @@ void Boundary::Draw( ODDC& dc, PlugIn_ViewPort &piVP )
co.Clear();
delete [] l_InclusionBoundary;
}
wxDELETEA( m_bpts );
}


ODPath::Draw( dc, piVP );
}

Expand All @@ -256,7 +254,7 @@ void Boundary::DrawGL( PlugIn_ViewPort &piVP )
GetCanvasPixLL( &piVP, &r, pOp->m_lat, pOp->m_lon );
m_bpts[ l_iBoundaryPointCount++ ] = r;
}

if( !m_bExclusionBoundary && m_bInclusionBoundary && m_pODPointList->GetCount() > 3 ) {
// surround boundary with hatching if there is more than 10 pixels different between points
int l_imaxpointdiffX = 0;
Expand All @@ -269,7 +267,7 @@ void Boundary::DrawGL( PlugIn_ViewPort &piVP )
}

if(l_imaxpointdiffX < 10 && l_imaxpointdiffY < 10 ) return;
// Use ClipperLib to manage Polygon
// Use ClipperLib to manage Polygon
// If needed simplify polygons to make shading stay outside
Paths poly(1);
for( int i = 0; i < l_iBoundaryPointCount; i++ ) {
Expand All @@ -281,7 +279,7 @@ void Boundary::DrawGL( PlugIn_ViewPort &piVP )
Paths ExpandedBoundaries;
co.AddPaths( simplePolys, jtSquare, etClosedPolygon );
co.Execute( ExpandedBoundaries, m_iInclusionBoundarySize );

int l_iInclusionBoundarySize = ExpandedBoundaries[0].size();
wxPoint *l_InclusionBoundary = new wxPoint[ l_iInclusionBoundarySize + 1 ];
for( int i = 0; i < l_iInclusionBoundarySize; i++ )
Expand All @@ -306,7 +304,7 @@ void Boundary::DrawGL( PlugIn_ViewPort &piVP )
delete [] l_InclusionBoundary;
ExpandedBoundaries.clear();
}

// Each byte represents a single pixel for Alpha. This provides a cross hatch in a 16x16 pixel square
GLubyte slope_cross_hatch[] = {
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand All @@ -316,7 +314,7 @@ void Boundary::DrawGL( PlugIn_ViewPort &piVP )
0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00,
0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00,
0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00,
Expand All @@ -325,7 +323,7 @@ void Boundary::DrawGL( PlugIn_ViewPort &piVP )
0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00,
0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00,
0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF
};
};

GLuint textureID;
checkGlError("Before glGenTextures", __FILE__, __LINE__);
Expand Down Expand Up @@ -393,11 +391,8 @@ void Boundary::DrawGL( PlugIn_ViewPort &piVP )
#endif
glDeleteTextures(1, &textureID);
checkGlError("glDeleteTextures", __FILE__, __LINE__);
}

wxDELETEA( m_bpts );

}

}
ODPath::DrawGL( piVP );
#else
Expand All @@ -409,21 +404,21 @@ void Boundary::DeletePoint( ODPoint *op, bool bRenamePoints )
{
// n.b. must delete Selectables and update config before deleting the point
if( op->m_bIsInLayer ) return;

if((ODPoint *)m_pODPointList->GetFirst()->GetData() == op) {
m_pODPointList->DeleteObject( op );
m_pODPointList->Append( (ODPoint *)m_pODPointList->GetFirst()->GetData() );
}

ODPath::DeletePoint( op, bRenamePoints );
}

void Boundary::SetActiveColours( void )
{
wxString fillcolour;

ODPath::SetActiveColours();

if( m_bVisible && m_bPathIsActive ) m_fillcol = m_wxcSchemeActiveFillColour;
else m_fillcol = m_wxcSchemeInActiveFillColour;
}
Expand All @@ -449,24 +444,24 @@ ODPoint *Boundary::InsertPointAfter( ODPoint *pOP, double lat, double lon, bool
if( nOP >= m_nPoints - 1 )
return NULL;
nOP++;

BoundaryPoint *newpoint = new BoundaryPoint( lat, lon, g_sODPointIconName, GetNewMarkSequenced(), wxT("") );
newpoint->m_bIsInPath = true;
newpoint->m_bDynamicName = true;
newpoint->SetNameShown( false );
newpoint->SetTypeString( wxT("Boundary Point") );

m_pODPointList->Insert( nOP, newpoint );

ODPointGUIDList.Insert( pOP->m_GUID, nOP );

m_nPoints++;

if( bRenamePoints ) RenameODPoints();

FinalizeForRendering();
UpdateSegmentDistances();

return ( newpoint );
}

Expand All @@ -485,7 +480,7 @@ void Boundary::RemovePointFromPath(ODPoint* point, ODPath* path)
m_pODPointList->DeleteObject( point );
m_pODPointList->Append( (ODPoint *)m_pODPointList->GetFirst()->GetData() );
}

ODPath::RemovePointFromPath(point, path);
}

Expand Down
Loading

0 comments on commit 191afa2

Please sign in to comment.