Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jongough committed Nov 15, 2017
1 parent b49bf1c commit d99b000
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 72 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SET(CPACK_PACKAGE_CONTACT "Jon Gough")

SET(VERSION_MAJOR "1")
SET(VERSION_MINOR "4")
SET(VERSION_PATCH "15")
SET(VERSION_PATCH "16")
SET(VERSION_DATE "16/11/2017")

SET(BUNDLE_DATA FALSE)
Expand Down
2 changes: 2 additions & 0 deletions src/Boundary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ void Boundary::Draw( ODDC& dc, PlugIn_ViewPort &piVP )
wxClientDC *pcdc = wxDynamicCast(dc.GetDC(), wxClientDC);
if( pcdc ) wxGC = wxGraphicsContext::Create( *pcdc );
}
assert(wxGC);

wxGC->SetPen(*wxTRANSPARENT_PEN);
wxColour tCol;
Expand Down Expand Up @@ -215,6 +216,7 @@ void Boundary::Draw( ODDC& dc, PlugIn_ViewPort &piVP )
wxClientDC *pcdc = wxDynamicCast(dc.GetDC(), wxClientDC);
if( pcdc ) wxGC = wxGraphicsContext::Create( *pcdc );
}
assert(wxGC);

wxGC->SetPen(*wxTRANSPARENT_PEN);
wxColour tCol;
Expand Down
25 changes: 8 additions & 17 deletions src/GZ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,8 @@ void GZ::UpdateGZSelectablePath( void )
l_iSteps = ceil(24 * (fabs((360 - m_dFirstLineDirection) + m_dSecondLineDirection))/360) - 1;
l_dStepSize = fabs((360 - m_dFirstLineDirection) + m_dSecondLineDirection) / l_iSteps;
}
double firstDirection;
double secondDirection;
double firstDirection = m_dFirstLineDirection;
double secondDirection = m_dSecondLineDirection;
if(m_bRotateWithBoat) {
switch(m_iMaintainWith) {
case ID_MAINTAIN_WITH_HEADING:
Expand All @@ -434,10 +434,7 @@ void GZ::UpdateGZSelectablePath( void )
}
break;
}
} else {
firstDirection = m_dFirstLineDirection;
secondDirection = m_dSecondLineDirection;
}
}

PositionBearingDistanceMercator_Plugin( m_dCentreLat, m_dCentreLon, firstDirection, m_dFirstDistance, &l_dPrevLat, &l_dPrevLon);
PositionBearingDistanceMercator_Plugin( m_dCentreLat, m_dCentreLon, firstDirection, m_dSecondDistance, &l_dLat, &l_dLon);
Expand Down Expand Up @@ -508,8 +505,8 @@ void GZ::GetLatLonPoints( PlugIn_ViewPort &piVP, wxPoint *l_pCentre, wxPoint *l_
{
double l_dLat;
double l_dLon;
double firstDirection;
double secondDirection;
double firstDirection = m_dFirstLineDirection;
double secondDirection = m_dSecondLineDirection;
if(m_bRotateWithBoat) {
switch(m_iMaintainWith) {
case ID_MAINTAIN_WITH_HEADING:
Expand All @@ -531,10 +528,7 @@ void GZ::GetLatLonPoints( PlugIn_ViewPort &piVP, wxPoint *l_pCentre, wxPoint *l_
}
break;
}
} else {
firstDirection = m_dFirstLineDirection;
secondDirection = m_dSecondLineDirection;
}
}
// get x, y of first point on first line
ODPoint *l_point = m_pODPointList->GetFirst()->GetData();
GetCanvasPixLL( &piVP, *&l_l1p1, l_point->m_lat, l_point->m_lon );
Expand Down Expand Up @@ -574,8 +568,8 @@ LLBBox GZ::GetBBox( void )

double l_dLat;
double l_dLon;
double firstDirection;
double secondDirection;
double firstDirection = m_dFirstLineDirection;
double secondDirection = m_dSecondLineDirection;
if(m_bRotateWithBoat) {
switch(m_iMaintainWith) {
case ID_MAINTAIN_WITH_HEADING:
Expand All @@ -597,9 +591,6 @@ LLBBox GZ::GetBBox( void )
}
break;
}
} else {
firstDirection = m_dFirstLineDirection;
secondDirection = m_dSecondLineDirection;
}

PositionBearingDistanceMercator_Plugin( m_dCentreLat, m_dCentreLon, firstDirection, m_dFirstDistance, &l_dLat, &l_dLon);
Expand Down
71 changes: 33 additions & 38 deletions src/ODNavObjectChanges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ bool ODNavObjectChanges::GPXCreateODPoint( pugi::xml_node node, ODPoint *pop, un
wxString s;
pugi::xml_node child;
pugi::xml_attribute attr;
TextPoint *tp;
BoundaryPoint *bp;
ODPoint *pp;

#ifndef __WXMSW__
wxString *l_locale = new wxString(wxSetlocale(LC_NUMERIC, NULL));
Expand All @@ -174,49 +171,45 @@ bool ODNavObjectChanges::GPXCreateODPoint( pugi::xml_node node, ODPoint *pop, un
#endif
#endif

if(pop->m_sTypeString == wxT("Text Point"))
tp = (TextPoint *)pop;
else if(pop->m_sTypeString == wxT("Boundary Point"))
bp = (BoundaryPoint *)pop;
pp = pop;

s.Printf(_T("%.9f"), pp->m_lat);
s.Printf(_T("%.9f"), pop->m_lat);
node.append_attribute("lat") = s.mb_str();
s.Printf(_T("%.9f"), pp->m_lon);
s.Printf(_T("%.9f"), pop->m_lon);
node.append_attribute("lon") = s.mb_str();

if(flags & OUT_TYPE) {
child = node.append_child("opencpn:type");
child.append_child(pugi::node_pcdata).set_value(pp->GetTypeString().mb_str());
child.append_child(pugi::node_pcdata).set_value(pop->GetTypeString().mb_str());
}

if(flags & OUT_TIME) {
child = node.append_child("time");
if( pp->m_timestring.Len() )
child.append_child(pugi::node_pcdata).set_value(pp->m_timestring.mb_str());
if( pop->m_timestring.Len() )
child.append_child(pugi::node_pcdata).set_value(pop->m_timestring.mb_str());
else {
wxString t = pp->GetCreateTime().FormatISODate().Append(_T("T")).Append(pp->GetCreateTime().FormatISOTime()).Append(_T("Z"));
wxString t = pop->GetCreateTime().FormatISODate().Append(_T("T")).Append(pop->GetCreateTime().FormatISOTime()).Append(_T("Z"));
child.append_child(pugi::node_pcdata).set_value(t.mb_str());
}
}

if ( (!pp->GetName().IsEmpty() && (flags & OUT_NAME)) || (flags & OUT_NAME_FORCE) ) {
wxCharBuffer buffer=pp->GetName().ToUTF8();
if ( (!pop->GetName().IsEmpty() && (flags & OUT_NAME)) || (flags & OUT_NAME_FORCE) ) {
wxCharBuffer buffer = pop->GetName().ToUTF8();
if(buffer.data()) {
child = node.append_child("name");
child.append_child(pugi::node_pcdata).set_value(buffer.data());
}
}

if ( (!pp->GetDescription().IsEmpty() && (flags & OUT_DESC)) || (flags & OUT_DESC_FORCE) ) {
wxCharBuffer buffer=pp->GetDescription().ToUTF8();
if ( (!pop->GetDescription().IsEmpty() && (flags & OUT_DESC)) || (flags & OUT_DESC_FORCE) ) {
wxCharBuffer buffer = pop->GetDescription().ToUTF8();
if(buffer.data()) {
child = node.append_child("desc");
child.append_child(pugi::node_pcdata).set_value(buffer.data());
}
}

if(pp->m_sTypeString == wxT("Text Point")) {
if(pop->m_sTypeString == wxT("Text Point")) {
TextPoint *tp = dynamic_cast<TextPoint *>(pop);
assert(tp !=0);
if ( !tp->GetPointText().IsEmpty() && (flags & OUT_POINTTEXT) ) {
wxCharBuffer buffer=tp->GetPointText().ToUTF8();
if(buffer.data()) {
Expand Down Expand Up @@ -263,7 +256,9 @@ bool ODNavObjectChanges::GPXCreateODPoint( pugi::xml_node node, ODPoint *pop, un
}
}

if(pp->m_sTypeString == wxT("Boundary Point")) {
if(pop->m_sTypeString == wxT("Boundary Point")) {
BoundaryPoint *bp = dynamic_cast<BoundaryPoint *>(pop);
assert(bp != 0);
child = node.append_child("opencpn:boundary_type");
if( bp->m_bExclusionBoundaryPoint && !bp->m_bInclusionBoundaryPoint )
child.append_child(pugi::node_pcdata).set_value( "Exclusion" );
Expand All @@ -276,7 +271,7 @@ bool ODNavObjectChanges::GPXCreateODPoint( pugi::xml_node node, ODPoint *pop, un

// Hyperlinks
if(flags & OUT_HYPERLINKS ){
HyperlinkList *linklist = pp->m_HyperlinkList;
HyperlinkList *linklist = pop->m_HyperlinkList;
if( linklist && linklist->GetCount() ) {
wxHyperlinkListNode *linknode = linklist->GetFirst();
while( linknode ) {
Expand Down Expand Up @@ -306,8 +301,8 @@ bool ODNavObjectChanges::GPXCreateODPoint( pugi::xml_node node, ODPoint *pop, un

if (flags & OUT_SYM_FORCE) {
child = node.append_child("sym");
if (!pp->GetIconName().IsEmpty()) {
child.append_child(pugi::node_pcdata).set_value(pp->GetIconName().mb_str());
if (!pop->GetIconName().IsEmpty()) {
child.append_child(pugi::node_pcdata).set_value(pop->GetIconName().mb_str());
}
else {
child.append_child("empty");
Expand All @@ -319,56 +314,56 @@ bool ODNavObjectChanges::GPXCreateODPoint( pugi::xml_node node, ODPoint *pop, un

//pugi::xml_node child_ext = node.append_child("extensions");

if (!pp->m_GUID.IsEmpty() && (flags & OUT_GUID) ) {
if (!pop->m_GUID.IsEmpty() && (flags & OUT_GUID) ) {
child = node.append_child("opencpn:guid");
child.append_child(pugi::node_pcdata).set_value(pp->m_GUID.mb_str());
child.append_child(pugi::node_pcdata).set_value(pop->m_GUID.mb_str());
}

if(flags & OUT_VIZ) {
child = node.append_child("opencpn:viz");
if ( pp->m_bIsVisible )
if ( pop->m_bIsVisible )
child.append_child(pugi::node_pcdata).set_value("1");
else
child.append_child(pugi::node_pcdata).set_value("0");
}

if(flags & OUT_VIZ_NAME) {
child = node.append_child("opencpn:viz_name");
if ( pp->m_bShowName )
if ( pop->m_bShowName )
child.append_child(pugi::node_pcdata).set_value("1");
else
child.append_child(pugi::node_pcdata).set_value("0");
}

if((flags & OUT_AUTO_NAME) && pp->m_bDynamicName) {
if((flags & OUT_AUTO_NAME) && pop->m_bDynamicName) {
child = node.append_child("opencpn:auto_name");
child.append_child(pugi::node_pcdata).set_value("1");
}
if((flags & OUT_SHARED) && pp->m_bKeepXPath) {
if((flags & OUT_SHARED) && pop->m_bKeepXPath) {
child = node.append_child("opencpn:shared");
child.append_child(pugi::node_pcdata).set_value("1");
}
if(flags & OUT_ARRIVAL_RADIUS) {
child = node.append_child("opencpn:arrival_radius");
s.Printf(_T("%.3f"), pp->GetODPointArrivalRadius());
s.Printf(_T("%.3f"), pop->GetODPointArrivalRadius());
child.append_child(pugi::node_pcdata).set_value( s.mbc_str() );
}
if(flags & OUT_OCPNPOINT_RANGE_RINGS) {
child = node.append_child("opencpn:ODPoint_range_rings");
pugi::xml_attribute viz = child.append_attribute( "visible" );
viz.set_value( pp->m_bShowODPointRangeRings );
viz.set_value( pop->m_bShowODPointRangeRings );
pugi::xml_attribute number = child.append_attribute( "number" );
number.set_value( pp->m_iODPointRangeRingsNumber );
number.set_value( pop->m_iODPointRangeRingsNumber );
pugi::xml_attribute step = child.append_attribute( "step" );
step.set_value( pp->m_fODPointRangeRingsStep );
step.set_value( pop->m_fODPointRangeRingsStep );
pugi::xml_attribute units = child.append_attribute( "units" );
units.set_value( pp->m_iODPointRangeRingsStepUnits );
units.set_value( pop->m_iODPointRangeRingsStepUnits );
pugi::xml_attribute colour = child.append_attribute( "colour" );
colour.set_value( pp->m_wxcODPointRangeRingsColour.GetAsString( wxC2S_HTML_SYNTAX ).utf8_str() ) ;
colour.set_value( pop->m_wxcODPointRangeRingsColour.GetAsString( wxC2S_HTML_SYNTAX ).utf8_str() ) ;
pugi::xml_attribute width = child.append_attribute( "width" );
width.set_value( pp->m_iRangeRingWidth );
width.set_value( pop->m_iRangeRingWidth );
pugi::xml_attribute style = child.append_attribute( "line_style" );
style.set_value( pp->m_iRangeRingStyle );
style.set_value( pop->m_iRangeRingStyle );
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/PILPropertiesDialogImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ void PILPropertiesDialogImpl::SaveChanges()
if(it->iID == m_iID) break;
++it;
}
assert(it != m_pPIL->m_PilLineList.end());
it->sName = m_textCtrlName->GetValue();
it->sDescription = m_textCtrlDesctription->GetValue();
it->dOffset = wxAtof(m_textCtrlOffset->GetValue());
Expand All @@ -110,6 +111,7 @@ void PILPropertiesDialogImpl:: UpdateProperties( PIL *pPIL, int iID )
if(it->iID == iID) break;
++it;
}
assert(it != pPIL->m_PilLineList.end());
m_textCtrlIDNum->SetValue(wxString::Format("%i", iID));
m_textCtrlName->Clear();
m_textCtrlName->AppendText(it->sName);
Expand Down
34 changes: 18 additions & 16 deletions src/ocpn_draw_pi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3685,22 +3685,24 @@ void ocpn_draw_pi::DrawAllPathsAndODPoints( PlugIn_ViewPort &pivp )
DR *pDRDraw = NULL;
GZ *pGZDraw = NULL;
PIL *pPILDraw = NULL;

if(pTempPath->m_sTypeString == wxT("Boundary")) {
pBoundaryDraw = (Boundary *)pTempPath;
pPathDraw = pBoundaryDraw;
} else if(pTempPath->m_sTypeString == wxT("EBL")) {
pEBLDraw = (EBL *)pTempPath;
pPathDraw = pEBLDraw;
} else if(pTempPath->m_sTypeString == wxT("DR")) {
pDRDraw = (DR *)pTempPath;
pPathDraw = pDRDraw;
} else if(pTempPath->m_sTypeString == wxT("Guard Zone")) {
pGZDraw = (GZ *)pTempPath;
pPathDraw = pGZDraw;
} else if(pTempPath->m_sTypeString == wxT("PIL")) {
pPILDraw = (PIL *)pTempPath;
pPathDraw = pPILDraw;
{
if(pTempPath->m_sTypeString == wxT("Boundary")) {
pBoundaryDraw = (Boundary *)pTempPath;
pPathDraw = pBoundaryDraw;
} else if(pTempPath->m_sTypeString == wxT("EBL")) {
pEBLDraw = (EBL *)pTempPath;
pPathDraw = pEBLDraw;
} else if(pTempPath->m_sTypeString == wxT("DR")) {
pDRDraw = (DR *)pTempPath;
pPathDraw = pDRDraw;
} else if(pTempPath->m_sTypeString == wxT("Guard Zone")) {
pGZDraw = (GZ *)pTempPath;
pPathDraw = pGZDraw;
} else if(pTempPath->m_sTypeString == wxT("PIL")) {
pPILDraw = (PIL *)pTempPath;
pPathDraw = pPILDraw;
}
assert(pPathDraw != 0);
}

/* defer rendering active routes until later */
Expand Down

0 comments on commit d99b000

Please sign in to comment.