From 37d81682ff57958196278ddbd6373c089c9db4a5 Mon Sep 17 00:00:00 2001
From: stefan <stefan@5a81b35b-ba03-0410-adc8-b2c5c5119f08>
Date: Thu, 5 Aug 2010 14:16:03 +0000
Subject: [PATCH] Added QueryFlags support for QueryViewWrapper, ColorOps and
 PresetEditor

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2628 5a81b35b-ba03-0410-adc8-b2c5c5119f08
---
 modules/gfx/pymod/export_color_ops.cc         |  2 +
 .../gfx/src/color_ops/by_chain_color_op.cc    |  4 +-
 .../gfx/src/color_ops/by_element_color_op.cc  |  4 +-
 modules/gfx/src/color_ops/color_op.cc         | 16 +++-
 modules/gfx/src/color_ops/color_op.hh         |  3 +
 .../gfx/src/color_ops/entity_view_color_op.cc |  1 -
 .../gfx/src/color_ops/gradient_color_op.cc    |  6 +-
 .../src/color_ops/gradient_level_color_op.cc  |  6 +-
 .../gfx/src/color_ops/map_handle_color_op.cc  |  4 +-
 modules/gfx/src/color_ops/uniform_color_op.cc |  4 +-
 modules/gfx/src/impl/connect_renderer_base.cc | 19 ++--
 modules/gfx/src/impl/trace_renderer_base.cc   | 28 +++---
 modules/gui/pymod/CMakeLists.txt              |  1 +
 .../gui/pymod/scene/preset_editor_widget.py   | 88 +++++++++----------
 modules/gui/pymod/scene/presets.xml           | 22 ++---
 modules/gui/pymod/scene/query_editor.py       | 54 ++++++++++++
 modules/gui/pymod/scene/render_op.py          | 16 +++-
 modules/gui/pymod/scene/visibility_op.py      | 16 +++-
 modules/gui/src/scene_win/entity_node.cc      |  8 +-
 .../base/pymod/export_query_view_wrapper.cc   |  6 +-
 modules/mol/base/src/query_view_wrapper.cc    | 44 ++++++++--
 modules/mol/base/src/query_view_wrapper.hh    |  8 +-
 22 files changed, 236 insertions(+), 124 deletions(-)
 create mode 100644 modules/gui/pymod/scene/query_editor.py

diff --git a/modules/gfx/pymod/export_color_ops.cc b/modules/gfx/pymod/export_color_ops.cc
index 3999960e9..efce2b6db 100644
--- a/modules/gfx/pymod/export_color_ops.cc
+++ b/modules/gfx/pymod/export_color_ops.cc
@@ -46,6 +46,8 @@ void export_ColorOps()
     .def("CanApplyTo",&ColorOp::CanApplyTo)
     .def("SetSelection",&ColorOp::SetSelection)
     .def("GetSelection",&ColorOp::GetSelection)
+    .def("SetSelectionFlags",&ColorOp::SetSelectionFlags)
+    .def("GetSelectionFlags",&ColorOp::GetSelectionFlags)
     .def("SetMask",&ColorOp::SetMask)
     .def("GetMask",&ColorOp::GetMask)
     .def("ToInfo",&ColorOp::ToInfo)
diff --git a/modules/gfx/src/color_ops/by_chain_color_op.cc b/modules/gfx/src/color_ops/by_chain_color_op.cc
index 67279f893..a0fd3b12d 100644
--- a/modules/gfx/src/color_ops/by_chain_color_op.cc
+++ b/modules/gfx/src/color_ops/by_chain_color_op.cc
@@ -65,9 +65,9 @@ void ByChainColorOp::SetChainCount(int chain_count)
 
 gfx::ByChainColorOp ByChainColorOp::FromInfo(info::InfoGroup& group){
   gfx::ColorOp op = ColorOp::FromInfo(group);
-  String selection = op.GetSelection();
+  mol::QueryViewWrapper wrapper(op.GetSelection(),op.GetSelectionFlags());
   int mask = op.GetMask();
-  return gfx::ByChainColorOp(selection, mask);
+  return gfx::ByChainColorOp(wrapper, mask);
 }
 
 gfx::Color ByChainColorOp::GenerateColor(String& ident) const{
diff --git a/modules/gfx/src/color_ops/by_element_color_op.cc b/modules/gfx/src/color_ops/by_element_color_op.cc
index e2bac71b0..b27669d79 100644
--- a/modules/gfx/src/color_ops/by_element_color_op.cc
+++ b/modules/gfx/src/color_ops/by_element_color_op.cc
@@ -46,9 +46,9 @@ void ByElementColorOp::ApplyTo(GfxObjP& objP) const{
 
 gfx::ByElementColorOp ByElementColorOp::FromInfo(info::InfoGroup& group){
   gfx::ColorOp op = ColorOp::FromInfo(group);
-  String selection = op.GetSelection();
+  mol::QueryViewWrapper wrapper(op.GetSelection(),op.GetSelectionFlags());
   int mask = op.GetMask();
-  return gfx::ByElementColorOp(selection, mask);
+  return gfx::ByElementColorOp(wrapper, mask);
 }
 
 }}
diff --git a/modules/gfx/src/color_ops/color_op.cc b/modules/gfx/src/color_ops/color_op.cc
index bca45b744..f9fa131db 100644
--- a/modules/gfx/src/color_ops/color_op.cc
+++ b/modules/gfx/src/color_ops/color_op.cc
@@ -53,6 +53,16 @@ String ColorOp::GetSelection() const
   return query_view_.GetQuery().GetQueryString();
 }
 
+void ColorOp::SetSelectionFlags(mol::QueryFlags flags)
+{
+  query_view_.SetFlags(flags);
+}
+
+mol::QueryFlags ColorOp::GetSelectionFlags() const
+{
+  return query_view_.GetFlags();
+}
+
 bool ColorOp::IsSelectionOnly() const
 {
   return !query_view_.IsDataValid();
@@ -71,7 +81,7 @@ void ColorOp::SetView(const mol::EntityView& view)
 void ColorOp::ToInfo(info::InfoGroup& group) const
 {
   std::ostringstream ss;
-  ss << (int)mask_ << "\t" << query_view_.GetQuery().GetQueryString();
+  ss << (int)mask_ << "\t" << query_view_.GetFlags() << "\t" << query_view_.GetQuery().GetQueryString();
   group.SetTextData(ss.str());
 }
 
@@ -80,7 +90,8 @@ gfx::ColorOp ColorOp::FromInfo(ost::info::InfoGroup& group)
   ColorOp op;
   std::istringstream ss(group.GetTextData());
   int mask;
-  ss >> mask;
+  mol::QueryFlags flags;
+  ss >> mask >> flags;
   op.SetMask(mask);
   String selection;
   String part;
@@ -91,6 +102,7 @@ gfx::ColorOp ColorOp::FromInfo(ost::info::InfoGroup& group)
     part.clear();
   }
   op.SetSelection(selection);
+  op.SetSelectionFlags(flags);
   return op;
 }
 
diff --git a/modules/gfx/src/color_ops/color_op.hh b/modules/gfx/src/color_ops/color_op.hh
index d1a98d88e..929501411 100644
--- a/modules/gfx/src/color_ops/color_op.hh
+++ b/modules/gfx/src/color_ops/color_op.hh
@@ -58,6 +58,9 @@ public:
   virtual void SetSelection(const String& selection);
   virtual String GetSelection() const;
 
+  virtual void SetSelectionFlags(mol::QueryFlags flags);
+  virtual mol::QueryFlags GetSelectionFlags() const;
+
   virtual bool IsSelectionOnly() const;
   virtual void SetView(const mol::EntityView& view);
   virtual mol::EntityView GetView() const;
diff --git a/modules/gfx/src/color_ops/entity_view_color_op.cc b/modules/gfx/src/color_ops/entity_view_color_op.cc
index 6cdbd75a1..de21ceab3 100644
--- a/modules/gfx/src/color_ops/entity_view_color_op.cc
+++ b/modules/gfx/src/color_ops/entity_view_color_op.cc
@@ -84,7 +84,6 @@ gfx::EntityViewColorOp EntityViewColorOp::FromInfo(info::InfoGroup& group){
   info::InfoGroup super_group = group.GetGroup("GradientColorOp");
   gfx::GradientColorOp gop = GradientColorOp::FromInfo(super_group);
   std::istringstream ss(group.GetTextData());
-  String selection = gop.GetSelection();
   gfx::Gradient gradient = gop.GetGradient();
   int mask = gop.GetMask();
   String property = gop.GetProperty();
diff --git a/modules/gfx/src/color_ops/gradient_color_op.cc b/modules/gfx/src/color_ops/gradient_color_op.cc
index 82c06e144..83205dc17 100644
--- a/modules/gfx/src/color_ops/gradient_color_op.cc
+++ b/modules/gfx/src/color_ops/gradient_color_op.cc
@@ -150,12 +150,12 @@ gfx::GradientColorOp GradientColorOp::FromInfo(info::InfoGroup& group)
     if(ss.good())property.append(" ");
     part.clear();
   }
-  String selection = op.GetSelection();
+  mol::QueryViewWrapper wrapper(op.GetSelection(),op.GetSelectionFlags());
   if(calculate) {
-    return gfx::GradientColorOp(selection,mask,property,gradient);
+    return gfx::GradientColorOp(wrapper,mask,property,gradient);
   }
   else {
-    return gfx::GradientColorOp(selection,mask,property,gradient, minv, maxv);
+    return gfx::GradientColorOp(wrapper,mask,property,gradient, minv, maxv);
   }
 }
 
diff --git a/modules/gfx/src/color_ops/gradient_level_color_op.cc b/modules/gfx/src/color_ops/gradient_level_color_op.cc
index e1e0f2940..bd9400a23 100644
--- a/modules/gfx/src/color_ops/gradient_level_color_op.cc
+++ b/modules/gfx/src/color_ops/gradient_level_color_op.cc
@@ -143,17 +143,17 @@ gfx::GradientLevelColorOp GradientLevelColorOp::FromInfo(info::InfoGroup& group)
   int l;
   ss >> l;
   mol::Prop::Level level = mol::Prop::Level(l);
-  String selection = gop.GetSelection();
+  mol::QueryViewWrapper wrapper(gop.GetSelection(),gop.GetSelectionFlags());
   String property = gop.GetProperty();
   int mask = gop.GetMask();
   gfx::Gradient gradient = gop.GetGradient();
   float minv = gop.GetMinV();
   float maxv = gop.GetMaxV();
   if(gop.GetCalculateMinMax()){
-    return gfx::GradientLevelColorOp(selection, mask, property, gradient, level);
+    return gfx::GradientLevelColorOp(wrapper, mask, property, gradient, level);
   }
   else{
-    return gfx::GradientLevelColorOp(selection, mask, property, gradient, minv, maxv, level);
+    return gfx::GradientLevelColorOp(wrapper, mask, property, gradient, minv, maxv, level);
   }
 }
 
diff --git a/modules/gfx/src/color_ops/map_handle_color_op.cc b/modules/gfx/src/color_ops/map_handle_color_op.cc
index c8cf2ebb7..3c45f77fc 100644
--- a/modules/gfx/src/color_ops/map_handle_color_op.cc
+++ b/modules/gfx/src/color_ops/map_handle_color_op.cc
@@ -82,14 +82,14 @@ gfx::MapHandleColorOp MapHandleColorOp::FromInfo(info::InfoGroup& group){
   info::InfoGroup super_group = group.GetGroup("GradientColorOp");
   gfx::GradientColorOp gop = GradientColorOp::FromInfo(super_group);
   std::istringstream ss(group.GetTextData());
-  String selection = gop.GetSelection();
+  mol::QueryViewWrapper wrapper(gop.GetSelection(),gop.GetSelectionFlags());
   gfx::Gradient gradient = gop.GetGradient();
   int mask = gop.GetMask();
   String property = gop.GetProperty();
   float minv = gop.GetMinV();
   float maxv = gop.GetMaxV();
   //TODO load map handle
-  return gfx::MapHandleColorOp(selection, mask, property, gradient, minv, maxv, img::MapHandle());
+  return gfx::MapHandleColorOp(wrapper, mask, property, gradient, minv, maxv, img::MapHandle());
 }
 
 }}
diff --git a/modules/gfx/src/color_ops/uniform_color_op.cc b/modules/gfx/src/color_ops/uniform_color_op.cc
index 8247fb0d2..3b7fa9e2c 100644
--- a/modules/gfx/src/color_ops/uniform_color_op.cc
+++ b/modules/gfx/src/color_ops/uniform_color_op.cc
@@ -97,9 +97,9 @@ gfx::UniformColorOp UniformColorOp::FromInfo(info::InfoGroup& group)
   float r, g, b, a;
   ss >> r >> g >> b >> a;
   Color c = Color(r,g,b,a);
-  String selection = op.GetSelection();
+  mol::QueryViewWrapper wrapper(op.GetSelection(),op.GetSelectionFlags());
   int mask = op.GetMask();
-  return gfx::UniformColorOp(selection,mask,c);
+  return gfx::UniformColorOp(wrapper,mask,c);
 }
 
 }}
diff --git a/modules/gfx/src/impl/connect_renderer_base.cc b/modules/gfx/src/impl/connect_renderer_base.cc
index bc1dab565..e54763a16 100644
--- a/modules/gfx/src/impl/connect_renderer_base.cc
+++ b/modules/gfx/src/impl/connect_renderer_base.cc
@@ -137,21 +137,16 @@ inline void apply_color_op(ConnectRendererBase* rend, GfxView* v, T1 get_col, co
     return;
   }
   rend->UpdateViews();
+  mol::EntityView view;
   if(op.IsSelectionOnly()){
-    mol::Query q(op.GetSelection());
-    for (AtomEntryMap::iterator it=v->atom_map.begin();
-         it!=v->atom_map.end();++it) {
-      if (q.IsAtomSelected(it->second.atom)) {
-        it->second.color=get_col.ColorOfAtom(it->second.atom);
-      }
-    }
+    view = rend->GetEffectiveView().Select(op.GetSelection(),op.GetSelectionFlags());
   }
   else{
-    mol::EntityView view = op.GetView();
-    for(AtomEntryMap::iterator it=v->atom_map.begin();it!=v->atom_map.end();++it){
-      if(view.FindAtom(it->second.atom)){
-        it->second.color=get_col.ColorOfAtom(it->second.atom);
-      }
+    view = op.GetView();
+  }
+  for(AtomEntryMap::iterator it=v->atom_map.begin();it!=v->atom_map.end();++it){
+    if(view.FindAtom(it->second.atom)){
+      it->second.color=get_col.ColorOfAtom(it->second.atom);
     }
   }
 };
diff --git a/modules/gfx/src/impl/trace_renderer_base.cc b/modules/gfx/src/impl/trace_renderer_base.cc
index 6a49d7c16..51c9c35d3 100644
--- a/modules/gfx/src/impl/trace_renderer_base.cc
+++ b/modules/gfx/src/impl/trace_renderer_base.cc
@@ -40,27 +40,19 @@ inline void apply_color_op(TraceRendererBase* rend,
 {
   rend->UpdateViews();
   ColorMask mask = op.GetMask();
+  mol::EntityView view;
   if(op.IsSelectionOnly()){
-    mol::Query q(op.GetSelection());
-    for (int node_list=0; node_list<trace_subset.GetSize(); ++node_list) {
-      NodeListSubset& nl=trace_subset[node_list];
-      for (int i=0; i<nl.GetSize();++i) {
-        if (q.IsAtomSelected(nl[i].atom)) {
-          Color clr =get_col.ColorOfAtom(nl[i].atom);
-          set_node_entry_color(nl[i],mask,clr);
-        }
-      }
-    }
+    view = rend->GetEffectiveView().Select(op.GetSelection(),op.GetSelectionFlags());
   }
   else{
-    mol::EntityView view = op.GetView();
-    for (int node_list=0; node_list<trace_subset.GetSize(); ++node_list) {
-      NodeListSubset& nl=trace_subset[node_list];
-      for (int i=0; i<nl.GetSize();++i) {
-        if(view.FindAtom(nl[i].atom)){
-          Color clr =get_col.ColorOfAtom(nl[i].atom);
-          set_node_entry_color(nl[i],mask,clr);
-        }
+    view = op.GetView();
+  }
+  for (int node_list=0; node_list<trace_subset.GetSize(); ++node_list) {
+    NodeListSubset& nl=trace_subset[node_list];
+    for (int i=0; i<nl.GetSize();++i) {
+      if(view.FindAtom(nl[i].atom)){
+        Color clr =get_col.ColorOfAtom(nl[i].atom);
+        set_node_entry_color(nl[i],mask,clr);
       }
     }
   }
diff --git a/modules/gui/pymod/CMakeLists.txt b/modules/gui/pymod/CMakeLists.txt
index 61a4faa0b..a9b647083 100644
--- a/modules/gui/pymod/CMakeLists.txt
+++ b/modules/gui/pymod/CMakeLists.txt
@@ -62,6 +62,7 @@ loader_manager_widget.py
 immutable_loader_info_handler.py
 line_trace_widget.py
 wireframe_widget.py
+query_editor.py
 )
 if (ENABLE_IMG)
   list(APPEND OST_GUI_PYMOD_SOURCES
diff --git a/modules/gui/pymod/scene/preset_editor_widget.py b/modules/gui/pymod/scene/preset_editor_widget.py
index 513040bfc..65ff8947c 100644
--- a/modules/gui/pymod/scene/preset_editor_widget.py
+++ b/modules/gui/pymod/scene/preset_editor_widget.py
@@ -20,6 +20,7 @@
 
 from ost import gui
 from ost import gfx
+from ost import mol
 from datetime import datetime
 from datetime import datetime
 from PyQt4 import QtCore, QtGui
@@ -29,6 +30,7 @@ from gradient_editor_widget import GradientPreview
 from gradient_editor_widget import GradientEdit
 from preset_editor_list_model import PresetEditorListModel
 from immutable_gradient_info_handler import ImmutableGradientInfoHandler
+from query_editor import QueryEditor
 from ost.mol import Prop
 from ost.gfx import ByElementColorOp
 from ost.gfx import ByChainColorOp
@@ -181,8 +183,7 @@ class PresetEditor(QtGui.QDialog):
 class UniformColorOpWidget(QtGui.QDialog):
   def __init__(self, parent=None):
     QtGui.QDialog.__init__(self, parent)
-    selection_label = QtGui.QLabel("Selection")
-    self.selection_edit_ = QtGui.QLineEdit()
+    self.query_editor_ = QueryEditor(self)
 
     detail_label = QtGui.QLabel("Parts")
     self.detail_selection_cb_ = QtGui.QComboBox()
@@ -203,8 +204,7 @@ class UniformColorOpWidget(QtGui.QDialog):
         
     grid = QtGui.QGridLayout()
     grid.setContentsMargins(0,5,0,0)
-    grid.addWidget(selection_label, 0, 0, 1, 1)
-    grid.addWidget(self.selection_edit_, 0, 1, 1, 1)
+    grid.addWidget(self.query_editor_, 0, 0, 1, 2)
     grid.addWidget(detail_label, 1, 0, 1, 1)
     grid.addWidget(self.detail_selection_cb_, 1, 1, 1, 1)
     grid.addWidget(color_label, 2, 0, 1, 1)
@@ -217,18 +217,19 @@ class UniformColorOpWidget(QtGui.QDialog):
     QtCore.QObject.connect(self.cancel_button_, QtCore.SIGNAL("clicked()"), self.Cancel)
     
   def GetOp(self):
-    ufco = UniformColorOp("",gfx.Color(1,1,1,1))
+    qv=mol.QueryViewWrapper(self.query_editor_.GetQuery(),self.query_editor_.GetQueryFlags())
+    ufco = UniformColorOp(qv,gfx.Color(1,1,1,1))
     
     detail = self.detail_selection_cb_.itemData(self.detail_selection_cb_.currentIndex()).toPyObject()
     ufco.SetMask(detail)
     qcolor = self.color_select_widget_.GetColor()
     color=gfx.Color(qcolor.red()/255.0,qcolor.green()/255.0,qcolor.blue()/255.0,qcolor.alpha()/255.0)
     ufco.SetColor(color)
-    ufco.SetSelection(str(self.selection_edit_.text()))
     return ufco
 
   def SetOp(self, ufco):
-    self.selection_edit_.setText(ufco.GetSelection())
+    self.query_editor_.SetQuery(ufco.GetSelection())
+    self.query_editor_.SetQueryFlags(ufco.GetSelectionFlags())
     found=False
     for i in range(0,self.detail_selection_cb_.count()):
       mask = self.detail_selection_cb_.itemData(i).toPyObject()
@@ -253,8 +254,7 @@ class GradientLevelColorOpWidget(QtGui.QDialog):
   def __init__(self, parent=None):
     QtGui.QDialog.__init__(self, parent)
     
-    selection_label = QtGui.QLabel("Selection")
-    self.selection_edit_ = QtGui.QLineEdit()
+    self.query_editor_ = QueryEditor(self)
     
     detail_label = QtGui.QLabel("Parts")
     self.detail_selection_cb_ = QtGui.QComboBox()
@@ -313,8 +313,7 @@ class GradientLevelColorOpWidget(QtGui.QDialog):
         
     grid = QtGui.QGridLayout()
     grid.setContentsMargins(0,5,0,0)
-    grid.addWidget(selection_label, 0, 0, 1, 1)
-    grid.addWidget(self.selection_edit_, 0, 1, 1, 1)
+    grid.addWidget(self.query_editor_, 0, 0, 1, 2)
     grid.addWidget(detail_label, 1, 0, 1, 1)
     grid.addWidget(self.detail_selection_cb_, 1, 1, 1, 1)
     grid.addWidget(property_label, 2, 0, 1, 1)
@@ -347,7 +346,7 @@ class GradientLevelColorOpWidget(QtGui.QDialog):
     gradient = self.gradient_edit_.GetGfxGradient()
     
     detail = self.detail_selection_cb_.itemData(self.detail_selection_cb_.currentIndex()).toPyObject()
-    selection = str(self.selection_edit_.text())
+    qv=mol.QueryViewWrapper(self.query_editor_.GetQuery(),self.query_editor_.GetQueryFlags())
     prop = str()
     level = Prop.Level()
     if(self.property_edit_.isEnabled()):
@@ -357,15 +356,16 @@ class GradientLevelColorOpWidget(QtGui.QDialog):
       prop = str(self.prop_combo_box_.itemData(self.prop_combo_box_.currentIndex()).toPyObject())
     
     if(self.auto_calc_.isChecked()):
-      return GradientLevelColorOp(selection, detail, prop, gradient, level)
+      return GradientLevelColorOp(qv, detail, prop, gradient, level)
     else:
       minv = self.minv_.value()
       maxv = self.maxv_.value()
-      return GradientLevelColorOp(selection, detail, prop, gradient, minv, maxv, level)
+      return GradientLevelColorOp(qv, detail, prop, gradient, minv, maxv, level)
       
     
   def SetOp(self, glco):
-    self.selection_edit_.setText(glco.GetSelection())
+    self.query_editor_.SetQuery(glco.GetSelection())
+    self.query_editor_.SetQueryFlags(glco.GetSelectionFlags())
     found=False
     for i in range(0,self.detail_selection_cb_.count()):
       mask = self.detail_selection_cb_.itemData(i).toPyObject()
@@ -422,8 +422,7 @@ class GradientLevelColorOpWidget(QtGui.QDialog):
 class ByElementColorOpWidget(QtGui.QDialog):
   def __init__(self, parent=None):
     QtGui.QDialog.__init__(self, parent)
-    selection_label = QtGui.QLabel("Selection")
-    self.selection_edit_ = QtGui.QLineEdit()
+    self.query_editor_ = QueryEditor(self)
 
     detail_label = QtGui.QLabel("Parts")
     self.detail_selection_cb_ = QtGui.QComboBox()
@@ -440,8 +439,7 @@ class ByElementColorOpWidget(QtGui.QDialog):
     
     grid = QtGui.QGridLayout()
     grid.setContentsMargins(0,5,0,0)
-    grid.addWidget(selection_label, 0, 0, 1, 1)
-    grid.addWidget(self.selection_edit_, 0, 1, 1, 1)
+    grid.addWidget(self.query_editor_, 0, 0, 1, 2)
     grid.addWidget(detail_label, 1, 0, 1, 1)
     grid.addWidget(self.detail_selection_cb_, 1, 1, 1, 1)
     grid.addLayout(self.hbox_,2,0,1,2)
@@ -453,12 +451,13 @@ class ByElementColorOpWidget(QtGui.QDialog):
     
   def GetOp(self):
     detail = self.detail_selection_cb_.itemData(self.detail_selection_cb_.currentIndex()).toPyObject()
-    selection = str(self.selection_edit_.text())
-    beco = ByElementColorOp(selection, detail)
+    qv=mol.QueryViewWrapper(self.query_editor_.GetQuery(),self.query_editor_.GetQueryFlags())
+    beco = ByElementColorOp(qv, detail)
     return beco
 
   def SetOp(self, beco):
-    self.selection_edit_.setText(beco.GetSelection())
+    self.query_editor_.SetQuery(beco.GetSelection())
+    self.query_editor_.SetQueryFlags(beco.GetSelectionFlags())
     found=False
     for i in range(0,self.detail_selection_cb_.count()):
       mask = self.detail_selection_cb_.itemData(i).toPyObject()
@@ -479,8 +478,7 @@ class ByElementColorOpWidget(QtGui.QDialog):
 class ByChainColorOpWidget(QtGui.QDialog):
   def __init__(self, parent=None):
     QtGui.QDialog.__init__(self, parent)
-    selection_label = QtGui.QLabel("Selection")
-    self.selection_edit_ = QtGui.QLineEdit()
+    self.query_editor_ = QueryEditor(self)
 
     detail_label = QtGui.QLabel("Parts")
     self.detail_selection_cb_ = QtGui.QComboBox()
@@ -497,8 +495,7 @@ class ByChainColorOpWidget(QtGui.QDialog):
     
     grid = QtGui.QGridLayout()
     grid.setContentsMargins(0,5,0,0)
-    grid.addWidget(selection_label, 0, 0, 1, 1)
-    grid.addWidget(self.selection_edit_, 0, 1, 1, 1)
+    grid.addWidget(self.query_editor_, 0, 0, 1, 2)
     grid.addWidget(detail_label, 1, 0, 1, 1)
     grid.addWidget(self.detail_selection_cb_, 1, 1, 1, 1)
     grid.addLayout(self.hbox_,2,0,1,2)
@@ -510,12 +507,13 @@ class ByChainColorOpWidget(QtGui.QDialog):
     
   def GetOp(self):
     detail = self.detail_selection_cb_.itemData(self.detail_selection_cb_.currentIndex()).toPyObject()
-    selection = str(self.selection_edit_.text())
-    bcco = ByChainColorOp(selection, detail)
+    qv=mol.QueryViewWrapper(self.query_editor_.GetQuery(),self.query_editor_.GetQueryFlags())
+    bcco = ByChainColorOp(qv, detail)
     return bcco
 
   def SetOp(self, bcco):
-    self.selection_edit_.setText(bcco.GetSelection())
+    self.query_editor_.SetQuery(bcco.GetSelection())
+    self.query_editor_.SetQueryFlags(bcco.GetSelectionFlags())
     found=False
     for i in range(0,self.detail_selection_cb_.count()):
       mask = self.detail_selection_cb_.itemData(i).toPyObject()
@@ -536,8 +534,7 @@ class ByChainColorOpWidget(QtGui.QDialog):
 class RenderOpWidget(QtGui.QDialog):
   def __init__(self, parent=None):
     QtGui.QDialog.__init__(self, parent)
-    selection_label = QtGui.QLabel("Selection")
-    self.selection_edit_ = QtGui.QLineEdit()
+    self.query_editor_ = QueryEditor(self)
   
     self.keep_ = QtGui.QCheckBox("Keep")
     self.keep_.setChecked(False)
@@ -571,8 +568,7 @@ class RenderOpWidget(QtGui.QDialog):
     
     grid = QtGui.QGridLayout()
     grid.setContentsMargins(0,5,0,0)
-    grid.addWidget(selection_label, 0, 0, 1, 1)
-    grid.addWidget(self.selection_edit_, 0, 1, 1, 1)
+    grid.addWidget(self.query_editor_, 0, 0, 1, 2)
     grid.addWidget(self.keep_, 1, 1, 1, 1)
     grid.addWidget(render_label,2,0,1,1)
     grid.addWidget(self.render_modes_,2,1,1,1)
@@ -584,13 +580,15 @@ class RenderOpWidget(QtGui.QDialog):
     QtCore.QObject.connect(self.cancel_button_, QtCore.SIGNAL("clicked()"), self.Cancel)
     
   def GetOp(self):
-    selection = str(self.selection_edit_.text())
+    selection = self.query_editor_.GetQueryText()
+    flags = self.query_editor_.GetQueryFlags()
     render_mode = self.render_modes_list_[self.render_modes_.currentIndex()]
-    ro = RenderOp(render_mode, selection, self.keep_.isChecked())
+    ro = RenderOp(render_mode, selection, flags, self.keep_.isChecked())
     return ro
 
   def SetOp(self, ro):
-    self.selection_edit_.setText(ro.GetSelection())
+    self.query_editor_.SetQuery(ro.GetSelection())
+    self.query_editor_.SetQueryFlags(ro.GetSelectionFlags())
     found=False
     for i in range(0,self.render_modes_.count()):
       render_mode = self.render_modes_list_[i]
@@ -611,8 +609,7 @@ class RenderOpWidget(QtGui.QDialog):
 class VisibilityOpWidget(QtGui.QDialog):
   def __init__(self, parent=None):
     QtGui.QDialog.__init__(self, parent)
-    selection_label = QtGui.QLabel("Selection")
-    self.selection_edit_ = QtGui.QLineEdit()
+    self.query_editor_ = QueryEditor(self)
   
     self.visible_ = QtGui.QCheckBox("Visible")
     self.visible_.setChecked(True)
@@ -626,8 +623,7 @@ class VisibilityOpWidget(QtGui.QDialog):
     
     grid = QtGui.QGridLayout()
     grid.setContentsMargins(0,5,0,0)
-    grid.addWidget(selection_label, 0, 0, 1, 1)
-    grid.addWidget(self.selection_edit_, 0, 1, 1, 1)
+    grid.addWidget(self.query_editor_, 0, 0, 1, 2)
     grid.addWidget(self.visible_, 1, 1, 1, 1)
     grid.addLayout(self.hbox_,2,0,1,2)
     grid.setRowStretch(1, 1)
@@ -637,13 +633,15 @@ class VisibilityOpWidget(QtGui.QDialog):
     QtCore.QObject.connect(self.cancel_button_, QtCore.SIGNAL("clicked()"), self.Cancel)
     
   def GetOp(self):
-    selection = str(self.selection_edit_.text())
-    vo = VisibilityOp(selection, self.visible_.isChecked())
+    selection = self.query_editor_.GetQueryText()
+    flags = self.query_editor_.GetQueryFlags()
+    vo = VisibilityOp(selection, flags, self.visible_.isChecked())
     return vo
 
-  def SetOp(self, ro):
-    self.selection_edit_.setText(ro.GetSelection())
-    self.visible_.setChecked(ro.IsVisible())
+  def SetOp(self, vo):
+    self.query_editor_.SetQuery(vo.GetSelection())
+    self.query_editor_.SetQueryFlags(vo.GetSelectionFlags())
+    self.visible_.setChecked(vo.IsVisible())
   
   def Ok(self):
     self.accept()
diff --git a/modules/gui/pymod/scene/presets.xml b/modules/gui/pymod/scene/presets.xml
index f73dbd879..4a1f8d214 100644
--- a/modules/gui/pymod/scene/presets.xml
+++ b/modules/gui/pymod/scene/presets.xml
@@ -2,28 +2,28 @@
 <EMDataInfo>
  <Presets>
   <Preset Name="Secondary Structure" >
-   <Op ClassName="VisibilityOp" Index="0"  Visible="1" />
+   <Op ClassName="VisibilityOp" Index="0"  Visible="1" Flags="0"/>
    <Op ClassName="UniformColorOp" Index="1">
-    <ColorOp>2 rtype=helix</ColorOp>0	1	0	1</Op>
+    <ColorOp>2 0 rtype=helix</ColorOp>0	1	0	1</Op>
    <Op ClassName="UniformColorOp" Index="2">
-    <ColorOp>2 rtype=ext</ColorOp>1	0	0	1</Op>
+    <ColorOp>2 0 rtype=ext</ColorOp>1	0	0	1</Op>
    <Op ClassName="UniformColorOp" Index="3">
-    <ColorOp>2 rtype!=ext,helix</ColorOp>0.5  0.5	0.5	1</Op>
+    <ColorOp>2 0 rtype!=ext,helix</ColorOp>0.5  0.5	0.5	1</Op>
    <Op ClassName="UniformColorOp" Index="4">
-    <ColorOp>1 rtype=helix</ColorOp>0.7 1.0 0.8 1</Op>
+    <ColorOp>1 0 rtype=helix</ColorOp>0.7 1.0 0.8 1</Op>
    <Op ClassName="UniformColorOp" Index="5">
-    <ColorOp>1 rtype!=ext,helix</ColorOp>1.0 0.8 0.2 1</Op>
+    <ColorOp>1 0 rtype!=ext,helix</ColorOp>1.0 0.8 0.2 1</Op>
   </Preset>
   <Preset Name="Highlight Ligand (Carbon)" >
-   <Op Keep="0" RenderMode="HSC" ClassName="RenderOp" Index="0" ></Op>
-   <Op Keep="0" RenderMode="CUSTOM" ClassName="RenderOp" Index="1" >ishetatm=1 and not rname==HOH</Op>
-   <Op ClassName="ByElementColorOp" Index="2" >3 </Op>
+   <Op Keep="0" RenderMode="HSC" ClassName="RenderOp" Index="0" Flags="0"></Op>
+   <Op Keep="0" RenderMode="CUSTOM" ClassName="RenderOp" Index="1" Flags="0">ishetatm=1 and not rname==HOH</Op>
+   <Op ClassName="ByElementColorOp" Index="2" >3 0</Op>
    <Op ClassName="UniformColorOp" Index="3">
-    <ColorOp>2 ishetatm=1 and ele=C</ColorOp>0     1       0       1</Op>
+    <ColorOp>2 0 ishetatm=1 and ele=C</ColorOp>0     1       0       1</Op>
   </Preset>
   <Preset Name="Hydrophobic" >
    <Op ClassName="UniformColorOp" Index="0" >
-    <ColorOp>3  rname=GLY,ALA,VAL,LEU,ILE,PHE,TYR,TRP,LYS,HIS,CYS,THR</ColorOp>0  0.666667  1 1</Op>
+    <ColorOp>3  0 rname=GLY,ALA,VAL,LEU,ILE,PHE,TYR,TRP,LYS,HIS,CYS,THR</ColorOp>0  0.666667  1 1</Op>
   </Preset>
  </Presets>
 </EMDataInfo>
diff --git a/modules/gui/pymod/scene/query_editor.py b/modules/gui/pymod/scene/query_editor.py
new file mode 100644
index 000000000..7bd05a89d
--- /dev/null
+++ b/modules/gui/pymod/scene/query_editor.py
@@ -0,0 +1,54 @@
+from ost import mol
+from PyQt4 import QtCore, QtGui
+
+class QueryEditor(QtGui.QWidget):
+   
+  def __init__(self, parent=None): 
+    QtGui.QWidget.__init__(self, parent)
+    self.selection_edit_ = QtGui.QLineEdit()
+    selection_label = QtGui.QLabel("Selection")    
+
+    self.checkboxes_ = dict()
+    for k,v in mol.QueryFlag.__dict__["values"].iteritems():
+      checkbox = QtGui.QCheckBox(str(v),self)
+      self.checkboxes_[checkbox]=k
+      
+    v_checkbox_layout = QtGui.QVBoxLayout()
+    v_checkbox_layout.setMargin(0)
+    v_checkbox_layout.setSpacing(0)
+    for k,v in self.checkboxes_.iteritems():
+      v_checkbox_layout.addWidget(k)
+    
+    flag_label = QtGui.QLabel("Query flags")       
+    grid = QtGui.QGridLayout(self)
+    grid.setContentsMargins(0,5,0,0)
+    grid.addWidget(selection_label,0,0,1,1)
+    grid.addWidget(self.selection_edit_,0,1,1,1)
+    grid.addWidget(flag_label,1,0,1,1)
+    grid.addLayout(v_checkbox_layout,1,1,1,1)
+    grid.setRowStretch(1, 1)
+    #group_box = QtGui.QGroupBox("Selection",self)
+    #group_box.setLayout(h_layout)
+    
+  def GetQueryFlags(self):
+    flag = 0
+    for k,v in self.checkboxes_.iteritems():
+      if k.isChecked():
+        flag += v
+    return flag
+  
+  def GetQuery(self):
+    return mol.Query(str(self.selection_edit_.text()))
+
+  def GetQueryText(self):
+    return str(self.selection_edit_.text())
+  
+  def SetQueryFlags(self,flags):
+    for k,v in self.checkboxes_.iteritems():
+      if (flags & v)>0:
+        k.setChecked(True)
+      else:
+        k.setChecked(False)
+  
+  def SetQuery(self,query):
+    self.selection_edit_.setText(query)
\ No newline at end of file
diff --git a/modules/gui/pymod/scene/render_op.py b/modules/gui/pymod/scene/render_op.py
index 722bf7bc8..feab4451a 100644
--- a/modules/gui/pymod/scene/render_op.py
+++ b/modules/gui/pymod/scene/render_op.py
@@ -25,11 +25,13 @@ from PyQt4 import QtGui
 class RenderOp():
   RENDERMODE_ATTRIBUTE_NAME = "RenderMode"
   KEEP_ATTRIBUTE_NAME = "Keep"
+  FLAGS_ATTRIBUTE_NAME = "Flags"
     
-  def __init__(self, render_mode, selection, keep=False):
+  def __init__(self, render_mode, selection, flags, keep=False):
     self.render_mode_ = render_mode
     self.selection_ = selection
     self.keep_ = keep
+    self.flags_ = flags
     
   def SetRenderMode(self, render_mode):
     self.render_mode_ = render_mode
@@ -43,6 +45,12 @@ class RenderOp():
   def GetSelection(self):
     return self.selection_
 
+  def SetSelectionFlags(self, flags):
+    self.flags_ = flags
+    
+  def GetSelectionFlags(self):
+    return self.flags_
+
   def SetKeep(self, keep):
     self.keep_ = keep
 
@@ -51,11 +59,12 @@ class RenderOp():
 
   def ApplyOn(self, entity):
     if (entity is not None) and isinstance(entity, gfx.Entity):
-      entity.SetRenderMode(self.GetRenderMode(),entity.view.Select(self.GetSelection()),self.IsKept())
+      entity.SetRenderMode(self.GetRenderMode(),entity.view.Select(self.GetSelection(),self.GetSelectionFlags()),self.IsKept())
   
   def ToInfo(self,group):
     group.SetAttribute(RenderOp.RENDERMODE_ATTRIBUTE_NAME, str(self.GetRenderMode().name))
     group.SetAttribute(RenderOp.KEEP_ATTRIBUTE_NAME, str(int(self.IsKept())))
+    group.SetAttribute(RenderOp.FLAGS_ATTRIBUTE_NAME, str(self.GetSelectionFlags()))
     group.SetTextData(str(self.GetSelection()))
     
   @staticmethod
@@ -65,6 +74,7 @@ class RenderOp():
     and  group.HasAttribute(RenderOp.KEEP_ATTRIBUTE_NAME)):
       render_mode = getattr(gfx.RenderMode, group.GetAttribute(RenderOp.RENDERMODE_ATTRIBUTE_NAME))
       keep = bool(int(group.GetAttribute(RenderOp.KEEP_ATTRIBUTE_NAME)))
+      flags = int(group.GetAttribute(RenderOp.FLAGS_ATTRIBUTE_NAME))
       selection = group.GetTextData()
-      render_op = RenderOp(render_mode,selection,keep)
+      render_op = RenderOp(render_mode,selection,flags,keep)
     return render_op
diff --git a/modules/gui/pymod/scene/visibility_op.py b/modules/gui/pymod/scene/visibility_op.py
index cb6ec07d6..5eeb3bffd 100644
--- a/modules/gui/pymod/scene/visibility_op.py
+++ b/modules/gui/pymod/scene/visibility_op.py
@@ -24,10 +24,12 @@ from PyQt4 import QtGui
 
 class VisibilityOp():
   VISIBLE_ATTRIBUTE_NAME = "Visible"
+  FLAGS_ATTRIBUTE_NAME = "Flags"
     
-  def __init__(self, selection, visible=False):    
+  def __init__(self, selection, flags, visible=False):    
     self.selection_ = selection
     self.visible_ = visible
+    self.flags_ = flags
     
   def SetSelection(self, selection):
     self.selection_ = selection
@@ -38,15 +40,22 @@ class VisibilityOp():
   def SetVisible(self, visible):
     self.visible_ = visible
 
+  def SetSelectionFlags(self, flags):
+    self.flags_ = flags
+    
+  def GetSelectionFlags(self):
+    return self.flags_
+
   def IsVisible(self):
     return self.visible_
 
   def ApplyOn(self, entity):
     if (entity is not None) and isinstance(entity, gfx.Entity):
-      entity.SetVisible(entity.view.Select(self.GetSelection()),self.IsVisible())
+      entity.SetVisible(entity.view.Select(self.GetSelection(),self.GetSelectionFlags()),self.IsVisible())
   
   def ToInfo(self,group):
       group.SetAttribute(VisibilityOp.VISIBLE_ATTRIBUTE_NAME, str(int(self.IsVisible())))
+      group.SetAttribute(VisibilityOp.FLAGS_ATTRIBUTE_NAME, str(self.GetSelectionFlags()))
       group.SetTextData(str(self.GetSelection()))
     
   @staticmethod
@@ -54,6 +63,7 @@ class VisibilityOp():
     visible_op = None
     if group.HasAttribute(VisibilityOp.VISIBLE_ATTRIBUTE_NAME):
       visible = bool(int(group.GetAttribute(VisibilityOp.VISIBLE_ATTRIBUTE_NAME)))
+      flags = int(group.GetAttribute(VisibilityOp.FLAGS_ATTRIBUTE_NAME))
       selection = group.GetTextData()
-      visible_op = VisibilityOp(selection,visible)
+      visible_op = VisibilityOp(selection,flags,visible)
     return visible_op
diff --git a/modules/gui/src/scene_win/entity_node.cc b/modules/gui/src/scene_win/entity_node.cc
index 62c646ed8..0b618ea1e 100644
--- a/modules/gui/src/scene_win/entity_node.cc
+++ b/modules/gui/src/scene_win/entity_node.cc
@@ -60,13 +60,13 @@ EntityNode::EntityNode(gfx::EntityP& entity, SceneNode* parent):
   SceneNode* quick_selection = new LabelNode("Quick Selection",this);
   model->AddNode(this, quick_selection);
 
-  SceneNode* node = new EntityPartNode("Backbone", entity, mol::QueryViewWrapper(entity->GetView().Select("aname=CA,C,N,O and peptide=true")), quick_selection);
+  SceneNode* node = new EntityPartNode("Backbone", entity, mol::QueryViewWrapper(mol::Query("aname=CA,C,N,O and peptide=true"),entity->GetView()), quick_selection);
   model->AddNode(quick_selection, node);
-  node = new EntityPartNode("Sidechains", entity, mol::QueryViewWrapper(entity->GetView().Select("aname!=CA,C,N,O and peptide=true",mol::QueryFlag::EXCLUSIVE_BONDS)), quick_selection);
+  node = new EntityPartNode("Sidechains", entity, mol::QueryViewWrapper(mol::Query("aname!=CA,C,N,O and peptide=true"),mol::QueryFlag::EXCLUSIVE_BONDS,entity->GetView()), quick_selection);
   model->AddNode(quick_selection, node);
-  node = new EntityPartNode("Ligands", entity, mol::QueryViewWrapper(entity->GetView().Select("ishetatm=1 and rname!=HOH,WAT")), quick_selection);
+  node = new EntityPartNode("Ligands", entity, mol::QueryViewWrapper(mol::Query("ishetatm=1 and rname!=HOH,WAT"),entity->GetView()), quick_selection);
   model->AddNode(quick_selection, node);
-  node = new EntityPartNode("Water", entity, mol::QueryViewWrapper(entity->GetView().Select("rname=HOH,WAT")), quick_selection);
+  node = new EntityPartNode("Water", entity, mol::QueryViewWrapper(mol::Query("rname=HOH,WAT"),entity->GetView()), quick_selection);
   model->AddNode(quick_selection, node);
 
 
diff --git a/modules/mol/base/pymod/export_query_view_wrapper.cc b/modules/mol/base/pymod/export_query_view_wrapper.cc
index 4af480ff1..9bc933069 100644
--- a/modules/mol/base/pymod/export_query_view_wrapper.cc
+++ b/modules/mol/base/pymod/export_query_view_wrapper.cc
@@ -33,13 +33,17 @@ void export_QueryViewWrapper()
     .def(init<const EntityHandle&>())
     .def(init<const EntityView&>())
     .def(init<const Query&, const EntityHandle&>())
-    .def(init<const Query&, const EntityView&>())
+    .def(init<const Query&, optional<const EntityView&> >())
+    .def(init<const Query&, QueryFlags, const EntityHandle&>())
+    .def(init<const Query&, QueryFlags, optional<const EntityView&> >())
     .def("GetEntityView",&QueryViewWrapper::GetEntityView)
     .def("DependsOnQuery",&QueryViewWrapper::DependsOnQuery)
     .def("IsDataValid", &QueryViewWrapper::IsDataValid)
     .def("SetQuery", &QueryViewWrapper::SetQuery)
     .def("GetQuery", &QueryViewWrapper::GetQuery
         ,return_value_policy<copy_const_reference>())
+    .def("GetFlags", &QueryViewWrapper::GetFlags)
+    .def("SetFlags", &QueryViewWrapper::SetFlags)
     .add_property("entity_view", &QueryViewWrapper::GetEntityView)
     .add_property("query", make_function(&QueryViewWrapper::GetQuery
         ,return_value_policy<copy_const_reference>()))
diff --git a/modules/mol/base/src/query_view_wrapper.cc b/modules/mol/base/src/query_view_wrapper.cc
index fc755f6e0..5774b1cfb 100644
--- a/modules/mol/base/src/query_view_wrapper.cc
+++ b/modules/mol/base/src/query_view_wrapper.cc
@@ -26,43 +26,62 @@ QueryViewWrapper::QueryViewWrapper():
         view_set_(false),
         entity_handle_(),
         entity_view_(),
-        query_(){}
+        query_(),
+        flags_(0){}
 
 QueryViewWrapper::QueryViewWrapper(const EntityHandle& entity_handle):
     view_set_(false),
     entity_handle_(entity_handle),
     entity_view_(),
-    query_(){}
+    query_(),
+    flags_(0){}
 
 QueryViewWrapper::QueryViewWrapper(const EntityView& entity_view):
     view_set_(true),
     entity_handle_(),
     entity_view_(entity_view),
-    query_(){}
+    query_(),
+    flags_(0){}
 
 QueryViewWrapper::QueryViewWrapper(const Query& query, 
                                    const EntityHandle& entity_handle):
     view_set_(false),
     entity_handle_(entity_handle),
     entity_view_(),
-    query_(query)
-{ }
+    query_(query),
+    flags_(0){}
 
 QueryViewWrapper::QueryViewWrapper(const Query& query, 
                                    const EntityView& view):
     view_set_(true),
     entity_handle_(),
     entity_view_(view),
-    query_(query)
-{ }
+    query_(query),
+    flags_(0){}
+
+QueryViewWrapper::QueryViewWrapper(const Query& query, QueryFlags flags,
+                                   const EntityHandle& entity_handle):
+    view_set_(false),
+    entity_handle_(entity_handle),
+    entity_view_(),
+    query_(query),
+    flags_(flags){}
+
+QueryViewWrapper::QueryViewWrapper(const Query& query, QueryFlags flags,
+                                   const EntityView& view):
+    view_set_(true),
+    entity_handle_(),
+    entity_view_(view),
+    query_(query),
+    flags_(flags){}
 
 EntityView QueryViewWrapper::GetEntityView() const
 {
   if(view_set_) {
-    return query_.MatchAll() ? entity_view_ : entity_view_.Select(query_);
+    return query_.MatchAll() ? entity_view_ : entity_view_.Select(query_,flags_);
   } else {
     if(entity_handle_.IsValid()){
-      return entity_handle_.Select(query_);
+      return entity_handle_.Select(query_,flags_);
     }
     return entity_view_;
   }
@@ -76,6 +95,13 @@ void QueryViewWrapper::SetQuery(const Query& query){
   query_ = query;
 }
 
+void QueryViewWrapper::SetFlags(QueryFlags flags){
+  flags_ = flags;
+}
+QueryFlags QueryViewWrapper::GetFlags() const{
+  return flags_;
+}
+
 bool QueryViewWrapper::IsDataValid() const{
   if(view_set_){
     return entity_view_.IsValid();
diff --git a/modules/mol/base/src/query_view_wrapper.hh b/modules/mol/base/src/query_view_wrapper.hh
index 596b5cbf1..44ec53d3b 100644
--- a/modules/mol/base/src/query_view_wrapper.hh
+++ b/modules/mol/base/src/query_view_wrapper.hh
@@ -33,7 +33,9 @@ public:
   explicit QueryViewWrapper(const EntityView& entity_view);
   QueryViewWrapper();
   QueryViewWrapper(const Query& query, const EntityHandle& handle);
-  QueryViewWrapper(const Query& query, const EntityView& view);  
+  QueryViewWrapper(const Query& query, const EntityView& view = mol::EntityView());
+  QueryViewWrapper(const Query& query, QueryFlags flags, const EntityHandle& handle);
+  QueryViewWrapper(const Query& query, QueryFlags flags, const EntityView& view = mol::EntityView());
   EntityView GetEntityView() const;
   bool DependsOnQuery() const;
   bool IsDataValid() const;
@@ -41,11 +43,15 @@ public:
   void SetQuery(const Query& query);
   const Query& GetQuery() const;
 
+  void SetFlags(QueryFlags flags);
+  QueryFlags GetFlags() const;
+
 private:
   bool view_set_;
   EntityHandle entity_handle_;
   EntityView entity_view_;
   Query query_;
+  QueryFlags flags_;
 };
 
 } } // ns
-- 
GitLab