Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data quality #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/oesenc_pi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ void oesenc_pi::SetPluginMessage(wxString &message_id, wxString &message_body)
ps52plib->m_bShowSoundg = root[_T("OpenCPN S52PLIB ShowSoundings")].AsBool();
ps52plib->SetAnchorOn( root[_T("OpenCPN S52PLIB ShowAnchorConditions")].AsBool() );
ps52plib->SetLightsOff( !root[_T("OpenCPN S52PLIB ShowLights")].AsBool() );
ps52plib->SetQualityOfDataOn( root[_T("OpenCPN S52PLIB ShowQualityOfData")].AsBool());

int icat;
if( root[_T("OpenCPN S52PLIB DisplayCategory")].AsInt(icat) ){
Expand Down Expand Up @@ -2537,7 +2538,7 @@ static GLboolean QueryExtension( const char *extName )
}

typedef void (*GenericFunction)(void);
void (*glXGetProcAddress(const GLubyte *procname))( void );
extern "C" void (*glXGetProcAddress(const GLubyte *procname))( void );

#if defined(__WXMSW__)
#define systemGetProcAddress(ADDR) wglGetProcAddress(ADDR)
Expand Down
51 changes: 45 additions & 6 deletions src/s52plib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ s52plib::s52plib( const wxString& PLib, bool b_forceLegacy )
m_lightsOff = false;
m_anchorOn = false;

m_qualityOfDataOn = false;

GenerateStateHash();

HPGL = new RenderFromHPGL( this );
Expand Down Expand Up @@ -632,20 +634,42 @@ bool s52plib::GetAnchorOn()
old_vis = pOLE->nViz;
break;
}
pOLE = NULL;
}
}
else if(OTHER == GetDisplayCategory())
old_vis = true;

const char * categories[] = { "ACHBRT", "ACHARE", "CBLSUB", "PIPARE", "PIPSOL", "TUNNEL", "SBDARE" };
unsigned int num = sizeof(categories) / sizeof(categories[0]);
// const char * categories[] = { "ACHBRT", "ACHARE", "CBLSUB", "PIPARE", "PIPSOL", "TUNNEL", "SBDARE" };

old_vis &= !IsObjNoshow("SBDARE");

return (old_vis != 0);
}

bool s52plib::GetQualityOfDataOn()
{
// Investigate and report the logical condition that "Quality of Data Condition" is shown

int old_vis = 0;
OBJLElement *pOLE = NULL;

if( MARINERS_STANDARD == GetDisplayCategory()){
for( unsigned int iPtr = 0; iPtr < pOBJLArray->GetCount(); iPtr++ ) {
OBJLElement *pOLE = (OBJLElement *) ( pOBJLArray->Item( iPtr ) );
if( !strncmp( pOLE->OBJLName, "M_QUAL", 6 ) ) {
old_vis = pOLE->nViz;
break;
}
}
}
else if(OTHER == GetDisplayCategory())
old_vis = true;

old_vis &= !IsObjNoshow("M_QUAL");

return (old_vis != 0);
}


void s52plib::SetGLRendererString(const wxString &renderer)
{
Expand Down Expand Up @@ -9621,7 +9645,7 @@ int s52plib::RenderAreaToGL( const wxGLContext &glcc, ObjRazRules *rzRules, View
//if(rzRules->obj->Index != 1434)
// return 0;

if( !ObjectRenderCheckRules( rzRules, vp ) )
if( !ObjectRenderCheckRules( rzRules, vp, true ) )
return 0;

Rules *rules = rzRules->LUP->ruleList;
Expand Down Expand Up @@ -10074,7 +10098,7 @@ int s52plib::RenderAreaToDC( wxDC *pdcin, ObjRazRules *rzRules, ViewPort *vp,
render_canvas_parms *pb_spec )
{

if( !ObjectRenderCheckRules( rzRules, vp ) )
if( !ObjectRenderCheckRules( rzRules, vp, true ) )
return 0;

m_pdc = pdcin; // use this DC
Expand Down Expand Up @@ -10271,7 +10295,7 @@ bool s52plib::ObjectRenderCheckCat( ObjRazRules *rzRules, ViewPort *vp )
if( m_nDisplayCategory == OTHER ){
if(OTHER == obj_cat){
if( !strncmp( rzRules->LUP->OBCL, "M_", 2 ) )
if( !m_bShowMeta ) return false;
if( !m_bShowMeta && strncmp( rzRules->LUP->OBCL, "M_QUAL", 6 )) return false;
}
}

Expand Down Expand Up @@ -10672,6 +10696,21 @@ void PrepareS52ShaderUniforms(ViewPort *vp);
if( cnt == num ) break;
}
}
// Handle Quality of data toggle
bool bQuality = m_qualityOfDataOn;
if(!bQuality){
AddObjNoshow("M_QUAL");
}
else{
RemoveObjNoshow("M_QUAL");
for( unsigned int iPtr = 0; iPtr < pOBJLArray->GetCount(); iPtr++ ) {
OBJLElement *pOLE = (OBJLElement *) ( pOBJLArray->Item( iPtr ) );
if( !strncmp( pOLE->OBJLName, "M_QUAL", 6 ) ) {
pOLE->nViz = 1; // force on
break;
}
}
}
}

m_myConfig = PI_GetPLIBStateHash();
Expand Down
6 changes: 5 additions & 1 deletion src/s52plib.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ class s52plib {

void SetAnchorOn(bool val){ m_anchorOn = val; }
bool GetAnchorOn();

void SetQualityOfDataOn(bool val){ m_qualityOfDataOn = val; }
bool GetQualityOfDataOn();

int GetMajorVersion( void ) { return m_VersionMajor; }
int GetMinorVersion( void ) { return m_VersionMinor; }
Expand Down Expand Up @@ -410,7 +413,8 @@ class s52plib {

bool m_lightsOff;
bool m_anchorOn;

bool m_qualityOfDataOn;

long m_state_hash;

bool m_txf_ready;
Expand Down