Skip to content
Snippets Groups Projects
Commit a87a6fc2 authored by marco's avatar marco
Browse files

fix query evaluation bug affecting nested within expressions

The evaluation bug caused query statements like
(8.0 <> [cname=A] and cname!=A) or 8.0 <> ([cname=B] and cname!=B)
to be misinterpreted. Fixes BZDNG-95.

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@1875 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent a4761b7d
No related branches found
No related tags found
No related merge requests found
...@@ -93,8 +93,12 @@ bool WithinParam::HasValidRef() const { ...@@ -93,8 +93,12 @@ bool WithinParam::HasValidRef() const {
WithinParam::WithinParam() WithinParam::WithinParam()
: center_(geom::Vec3(0,0,0)), radius_(0.0), lazily_bound_ref_(-1) { : center_(geom::Vec3(0,0,0)), radius_(0.0), lazily_bound_ref_(-1) {
} }
bool WithinParam::operator==(const WithinParam& p) const { bool WithinParam::operator==(const WithinParam& p) const {
return center_ == p.center_ && p.radius_==radius_; if (lazily_bound_ref_>-1) {
return lazily_bound_ref_==p.lazily_bound_ref_ && p.radius_==radius_;
}
return center_==p.center_;
} }
float WithinParam::GetRadiusSquare() const { float WithinParam::GetRadiusSquare() const {
......
...@@ -988,7 +988,7 @@ Node* QueryImpl::ParseWithinExpr(QueryLexer& lexer) { ...@@ -988,7 +988,7 @@ Node* QueryImpl::ParseWithinExpr(QueryLexer& lexer) {
// index of the query for later access. // index of the query for later access.
QueryImplP q(new QueryImpl(rhs)); QueryImplP q(new QueryImpl(rhs));
bracketed_expr_.push_back(q); bracketed_expr_.push_back(q);
ParamType pt(WithinParam(bracketed_expr_.size()-1, rv*rv)); ParamType pt(WithinParam(bracketed_expr_.size()-1, rv*rv));
inversion_stack_.pop_back(); inversion_stack_.pop_back();
CompOP comp_op= COP_LE; CompOP comp_op= COP_LE;
if (inversion_stack_.back()) if (inversion_stack_.back())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment