diff --git a/modules/gfx/pymod/export_gfx_node.cc b/modules/gfx/pymod/export_gfx_node.cc index f11814317d3b6666d1345f068da68b7068e323a1..b7791e8e67e51232d3988876d2b44d6a697fb179 100644 --- a/modules/gfx/pymod/export_gfx_node.cc +++ b/modules/gfx/pymod/export_gfx_node.cc @@ -39,6 +39,7 @@ void export_GfxNode() .def("Add",node_add1) .def("Remove",node_rem1) .def("Add",node_add2) + .add_property("name", &GfxNode::GetName) .def("Remove",node_rem2) .def("Remove",node_rem3) ; diff --git a/modules/gfx/pymod/export_scene.cc b/modules/gfx/pymod/export_scene.cc index 1f9b2c459c68217e804777b513ef4ef332dcc987..fab0931f04baebbc357a50458f875d02844be74a 100644 --- a/modules/gfx/pymod/export_scene.cc +++ b/modules/gfx/pymod/export_scene.cc @@ -90,6 +90,7 @@ void export_Scene() .def("InitGL", &Scene::InitGL) .def("RenderGL", &Scene::RenderGL) .def("Resize", &Scene::Resize) + .def("HasNode", &Scene::HasNode) .def("SetBackground", &Scene::SetBackground) .add_property("transform", &Scene::GetTransform, &Scene::SetTransform) .add_property("fov", &Scene::GetFOV, &Scene::SetFOV) diff --git a/modules/gfx/src/scene.cc b/modules/gfx/src/scene.cc index 715d5ba211bd42e3b2a1c7fc9a7bf43e0fac7a96..b5f4bcd605e98190cdef3663de0c4018af1583ba 100644 --- a/modules/gfx/src/scene.cc +++ b/modules/gfx/src/scene.cc @@ -656,6 +656,13 @@ GfxObjP Scene::operator[](const String& name) return nrvo; } +bool Scene::HasNode(const String& name) const +{ + FindNode fn(name); + this->Apply(fn); + return fn.node; +} + void Scene::Apply(const InputEvent& e, bool request_redraw) { LOG_TRACE("Scene: received input: c=" << e.GetCommand() << " i=" << e.GetIndex() << " t=" << e.GetTarget() << std::endl); diff --git a/modules/gfx/src/scene.hh b/modules/gfx/src/scene.hh index f4763be55f690af3cf525dfe427162118d67588e..b1a5fa4ba4541b7d5f595308dbce16f89779f254 100644 --- a/modules/gfx/src/scene.hh +++ b/modules/gfx/src/scene.hh @@ -292,6 +292,9 @@ class DLLEXPORT_OST_GFX Scene { /// \brief retrieve gfx object by name GfxObjP operator[](const String& name); + /// \brief whether the scene contains a node of the given name + bool HasNode(const String& name) const; + /// \brief actual event handling for scene (internal use) void Apply(const InputEvent& ie, bool request_redraw=true); diff --git a/modules/gui/pymod/export_scene_win.cc b/modules/gui/pymod/export_scene_win.cc index 1d659c420b6de545bd22ece7daea12333dbe546c..38056d017e315fff4711db72434ecfd8657adf4d 100644 --- a/modules/gui/pymod/export_scene_win.cc +++ b/modules/gui/pymod/export_scene_win.cc @@ -53,6 +53,7 @@ void export_SceneWin() .value("NOT_VISIBLE", NOT_VISIBLE) .value("NOT_HIDDEN", NOT_HIDDEN) .value("NOT_SCENE", NOT_SCENE) + .value("VIEWS_SAME_OBJECT", VIEWS_SAME_OBJECT) .value("SINGLE", SINGLE) .value("MULTI", MULTI) #if OST_IMG_ENABLED diff --git a/modules/gui/pymod/init_context_menu.py b/modules/gui/pymod/init_context_menu.py index b26e5d3d71d7c6e1f0e35697af3f8db1d339fb81..2d243b920fc140b86a5f8f40fe9f64e4dde9787c 100644 --- a/modules/gui/pymod/init_context_menu.py +++ b/modules/gui/pymod/init_context_menu.py @@ -8,10 +8,11 @@ from subprocess import CalledProcessError from ost import geom, gfx, gui, seq from ost import settings -from ost import LogError +from ost import LogError, mol from ost.bindings import tmtools from ost.bindings import msms from ost.seq import alg +from ost.gui.scene.query_editor import QueryEditorWidget,QueryDialog class SelectRefDialog(QtGui.QDialog): def __init__(self, ent_list, parent=None): @@ -234,7 +235,6 @@ class SurfaceContextMenu(QtCore.QObject): LogError("WARNING: Entry with the same name already present in scene") return - class AlignmentContextMenu(QtCore.QObject): def __init__(self, context_menu): @@ -308,8 +308,71 @@ class AlignmentContextMenu(QtCore.QObject): self.seq_viewer.AddAlignment(alignment) self.seq_viewer.ChangeDisplayMode("Highlight conservation 1") self.seq_viewer.Show() - + +class SelectMenuPoints(QtCore.QObject): + def __init__(self, context_menu): + QtCore.QObject.__init__(self, context_menu.qobject) + action=QtGui.QAction("Select...", self) + QtCore.QObject.connect(action, QtCore.SIGNAL('triggered()'), + self._Select) + context_menu.AddAction(action, gui.ENTITY) + action=QtGui.QAction("Copy Selection...", self) + QtCore.QObject.connect(action, QtCore.SIGNAL('triggered()'), + self._CopyViews) + context_menu.AddAction(action, gui.ENTITY) + action=QtGui.QAction('Select...', self) + QtCore.QObject.connect(action, QtCore.SIGNAL('triggered()'), + self._SelectViewsSameEntity) + context_menu.AddAction(action, gui.ENTITY_VIEW|gui.VIEWS_SAME_OBJECT) + def _Select(self): + scene_selection=gui.SceneSelection.Instance() + ent=scene_selection.GetActiveNode(0) + dialog=QueryDialog('Select...') + if dialog.exec_(): + ent.selection=ent.view.Select(dialog.query, dialog.query_flags) + + def _UniqueName(self, ent): + """ + Returns a name based on ent that is unique within the scene + """ + ent_name=ent.GetName() + num=2 + while True: + candidate_name='%s-%d' % (ent_name, num) + if not gfx.Scene().HasNode(candidate_name): + return candidate_name + num+=1 + + def _SelectViewsSameEntity(self): + + union=gui.SceneSelection.Instance().GetViewUnion() + dialog=QueryDialog('Select...') + if dialog.exec_(): + q=mol.Query(dialog.query) + if q.IsValid(): + ve=gui.SceneSelection.Instance().GetViewEntity() + ve.selection=union.Select(q, dialog.query_flags) + else: + ost.LogError("invalid query: %s" % q.error) + + def _CopyViews(self): + views_to_add=[] + scene_selection=gui.SceneSelection.Instance() + ent=scene_selection.GetActiveNode(0) + dialog=QueryDialog('Select...') + if dialog.exec_(): + q=mol.Query(dialog.query) + if q.IsValid(): + for i in range(scene_selection.GetActiveNodeCount()): + ent=scene_selection.GetActiveNode(i) + selected=ent.view.Select(q, dialog.query_flags) + gfx_ent=gfx.Entity(self._UniqueName(ent),selected) + gfx.Scene().Add(gfx_ent) + else: + ost.LogError("invalid query: %s" % q.error) + def _InitContextMenu(app): cm=app.scene_win.GetContextMenu() AlignmentContextMenu(cm) SurfaceContextMenu(cm) + SelectMenuPoints(cm) diff --git a/modules/gui/pymod/scene/query_editor.py b/modules/gui/pymod/scene/query_editor.py index 186ab48dd1e7006660042e338a97ffb916a689ba..5b5ed1787bae4e4182aa0e691b299e51f52819ad 100644 --- a/modules/gui/pymod/scene/query_editor.py +++ b/modules/gui/pymod/scene/query_editor.py @@ -2,54 +2,60 @@ from ost import mol from PyQt4 import QtCore, QtGui class QueryEditorWidget(QtGui.QWidget): - def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) - self.default_font_= QtGui.QTextCharFormat() + self.default_font_=QtGui.QTextCharFormat() self.default_font_.setForeground(QtGui.QBrush(QtGui.QColor(0,0,0))) - self.error_font_= QtGui.QTextCharFormat() + self.error_font_=QtGui.QTextCharFormat() self.error_font_.setForeground(QtGui.QBrush(QtGui.QColor(255,0,0))) - self.selection_edit_ = QtGui.QTextEdit(self) - self.selection_edit_.setMinimumHeight(50) - self.selection_edit_.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.MinimumExpanding)) + self.selection_edit_=QtGui.QTextEdit(self) + self.selection_edit_.setFixedHeight(40) self.selection_edit_.updateGeometry() - selection_label = QtGui.QLabel("Selection",self) - - self.status_=QtGui.QLabel("",self); + self.status_=QtGui.QLabel(" ",self); self.status_.setWordWrap(True) self.status_.setMargin(0) - self.status_.setHidden(True) self.status_.setAlignment(QtCore.Qt.AlignRight) - self.status_.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding)) - 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) + self.status_.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Expanding)) + vl=QtGui.QVBoxLayout() + vl.addWidget(self.selection_edit_) + self.no_bonds_=QtGui.QRadioButton('none') + self.ex_bonds_=QtGui.QRadioButton('exclusive') + self.in_bonds_=QtGui.QRadioButton('inclusive') + self.in_bonds_.setChecked(True) + self.match_res_=QtGui.QCheckBox('match residues') - flag_label = QtGui.QLabel("Query flags") - grid = QtGui.QGridLayout(self) - grid.setContentsMargins(0,5,0,0) - grid.addWidget(selection_label,0,0,1,1,QtCore.Qt.AlignTop|QtCore.Qt.AlignLeft) - grid.addWidget(self.selection_edit_,0,1,1,1) - grid.addWidget(self.status_,1,0,1,2,QtCore.Qt.AlignRight) - grid.addWidget(flag_label,2,0,3,1,QtCore.Qt.AlignTop|QtCore.Qt.AlignLeft) - grid.addLayout(v_checkbox_layout,2,1,3,1) - grid.setRowStretch(0,1) + vl.setMargin(0) + vl.setSpacing(0) + self.setLayout(vl) + vl.addWidget(self.status_) + hl=QtGui.QHBoxLayout() + l=QtGui.QLabel("bonds:") + + hl.addWidget(l) + hl.addSpacing(5) + hl.addWidget(self.no_bonds_) + hl.addWidget(self.ex_bonds_) + hl.addWidget(self.in_bonds_) + hl.addStretch(1) + hl.addWidget(self.match_res_) + vl.addLayout(hl) + self.changing_text_=False; - self.connect(self.selection_edit_,QtCore.SIGNAL("textChanged()"),self.UpdateMessage) - + self.connect(self.selection_edit_,QtCore.SIGNAL("textChanged()"), + self._StartTimer) + self.timer_=QtCore.QTimer() + QtCore.QObject.connect(self.timer_, QtCore.SIGNAL('timeout()'), + self._UpdateMessage) def GetQueryFlags(self): - flag = 0 - for k,v in self.checkboxes_.iteritems(): - if k.isChecked(): - flag += v - return flag + flags=0 + if self.no_bonds_.isChecked(): + flags|=mol.NO_BONDS + if self.ex_bonds_.isChecked(): + flags|=mol.EXCLUSIVE_BONDS + if self.match_res_.isChecked(): + flags|=mol.MATCH_RESIDUES + return flags def GetQuery(self): return mol.Query(str(self.selection_edit_.toPlainText())) @@ -58,16 +64,19 @@ class QueryEditorWidget(QtGui.QWidget): return str(self.selection_edit_.toPlainText()) def SetQueryFlags(self,flags): - for k,v in self.checkboxes_.iteritems(): - if (flags & v)>0: - k.setChecked(True) - else: - k.setChecked(False) + self.no_bonds_.setChecked(flags & mol.NO_BONDS) + self.ex_bonds_.setChecked(flags & mol.EXCLUSIVE_BONDS) + self.in_bonds_.setChecked(not (flags & mol.NO_BONDS|mol.EXCLUSIVE_BONDS)) + self.match_res_.setChecked(flags & mol.MATCH_RESIDUES) def SetQuery(self,query): self.selection_edit_.setText(query) - def UpdateMessage(self): + def _StartTimer(self): + self.timer_.stop() + self.timer_.start(500) + + def _UpdateMessage(self): if self.changing_text_: return self.changing_text_ = True @@ -79,15 +88,41 @@ class QueryEditorWidget(QtGui.QWidget): if query.IsValid(): self.status_.setText("") - self.status_.setHidden(True) else: d=query.GetErrorDescription() self.status_.setText("<font color='red'>%s</font>"%d.msg) - self.status_.setVisible(True) self.status_.setFixedSize(self.width(),self.status_.height()) - cursor.movePosition(QtGui.QTextCursor.Start) - cursor.movePosition(QtGui.QTextCursor.NextCharacter, QtGui.QTextCursor.MoveAnchor, d.range.Loc) - cursor.movePosition(QtGui.QTextCursor.NextCharacter, QtGui.QTextCursor.KeepAnchor, d.range.Length) - cursor.setCharFormat(self.error_font_) - self.changing_text_ = False \ No newline at end of file + if d.range.Loc<len(query.string): + + cursor.movePosition(QtGui.QTextCursor.NextCharacter, + QtGui.QTextCursor.MoveAnchor, d.range.Loc) + cursor.movePosition(QtGui.QTextCursor.NextCharacter, + QtGui.QTextCursor.KeepAnchor, d.range.Length) + cursor.setCharFormat(self.error_font_) + self.changing_text_=False + +class QueryDialog(QtGui.QDialog): + def __init__(self, title, parent=None): + QtGui.QDialog.__init__(self, parent) + l=QtGui.QVBoxLayout(self) + self.setWindowTitle(title) + self.editor=QueryEditorWidget(self) + l.addWidget(self.editor) + l.addSpacing(10) + l3=QtGui.QHBoxLayout() + ab=QtGui.QPushButton('OK') + ab.setDefault(True) + cb=QtGui.QPushButton('Cancel') + l3.addStretch(1) + l3.addWidget(cb, 0) + l3.addWidget(ab, 0) + l.addLayout(l3) + QtCore.QObject.connect(cb, QtCore.SIGNAL('clicked()'), self.reject) + QtCore.QObject.connect(ab, QtCore.SIGNAL('clicked()'), self.accept) + @property + def query_flags(self): + return self.editor.GetQueryFlags() + @property + def query(self): + return self.editor.GetQueryText() \ No newline at end of file diff --git a/modules/gui/src/CMakeLists.txt b/modules/gui/src/CMakeLists.txt index 0c5806c2cc431859aba50af11a836c438ae3de7e..463d2ecd5008cff8f7d452da0f5697cbefa436ea 100644 --- a/modules/gui/src/CMakeLists.txt +++ b/modules/gui/src/CMakeLists.txt @@ -178,7 +178,6 @@ main.hh main_area.hh module_config.hh perspective.hh -query_dialog.hh remote_site_loader.hh scene_selection.hh main_window.hh @@ -235,7 +234,6 @@ sequence_viewer/base_view_object.cc sequence_viewer/sequence_view_object.cc gosty_app.cc main_area.cc -query_dialog.cc widget_state_saver.cc scene_selection.cc widget_geom_handler.cc @@ -340,7 +338,6 @@ gosty_app.hh main.hh main_area.hh perspective.hh -query_dialog.hh dock_widget.hh main_window.hh scene_selection.hh diff --git a/modules/gui/src/query_dialog.cc b/modules/gui/src/query_dialog.cc deleted file mode 100644 index fcaac5755d038a31d5e2d73f89df738b2c1dbab1..0000000000000000000000000000000000000000 --- a/modules/gui/src/query_dialog.cc +++ /dev/null @@ -1,105 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#include "query_dialog.hh" - -#include <QPushButton> -#include <QVBoxLayout> -#include <QHBoxLayout> -#include <QKeyEvent> - -#include <iostream> - -#include <ost/mol/query.hh> - -namespace ost { namespace gui { - -QueryDialog::QueryDialog(QWidget* parent): - QDialog(parent), flag_set_(false) -{ - error_.setForeground(QBrush(QColor(150,0,0))); - default_.setForeground(QBrush(QColor(0,0,0))); - delete layout(); - QVBoxLayout* vb=new QVBoxLayout(this); - edit_=new QTextEdit(this); - edit_->setAcceptRichText(false); - edit_->setTabChangesFocus(true); - status_=new QLabel(QString(""), this); - status_->setWordWrap(true); - status_->setMargin(0); - QHBoxLayout* hb=new QHBoxLayout(); - vb->addWidget(status_); - vb->addWidget(edit_); - hb->setDirection(QBoxLayout::LeftToRight); - QPushButton* select_btn = new QPushButton(tr("Select"), this); - QPushButton* cancel_btn = new QPushButton(tr("Cancel"), this); - hb->addWidget(cancel_btn); - hb->addWidget(select_btn); - vb->addLayout(hb); - select_btn->setDefault(true); - connect(select_btn, SIGNAL(clicked()), this, SLOT(accept())); - connect(cancel_btn, SIGNAL(clicked()), this, SLOT(reject())); - connect(edit_, SIGNAL(textChanged()), this, - SLOT(OnTextChanged())); -} - -void QueryDialog::OnTextChanged() -{ - if (flag_set_) - return; - int l=edit_->document()->size().height()/edit_->fontMetrics().lineSpacing(); - if (l>1) { - edit_->document()->undo(); - } - flag_set_=true; - this->Colorize(); - flag_set_=false; -} - -void QueryDialog::Colorize() -{ - mol::Query q(edit_->toPlainText().toStdString()); - QTextCursor c=edit_->textCursor(); - c.select(QTextCursor::Document); - c.setCharFormat(default_); - if (!q.IsValid()) { - mol::QueryErrorDesc d=q.GetErrorDescription(); - c.movePosition(QTextCursor::Start); - c.movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor, - d.range.Loc); - c.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, - d.range.Length); - c.setCharFormat(error_); - status_->setText(QString(d.msg.c_str())); - } else { - status_->setText(QString("")); - } -} - -QString QueryDialog::GetQueryString() const -{ - return edit_->toPlainText(); -} - -void QueryDialog::keyPressEvent(QKeyEvent* event){ - if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) { - this->accept(); - } -} - -}} diff --git a/modules/gui/src/query_dialog.hh b/modules/gui/src/query_dialog.hh deleted file mode 100644 index dc2deb91337e4760770b5e4f17928f37227d2f56..0000000000000000000000000000000000000000 --- a/modules/gui/src/query_dialog.hh +++ /dev/null @@ -1,59 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef OST_GUI_QUERY_DIALOG_HH -#define OST_GUI_QUERY_DIALOG_HH - -/* - Author: Marco Biasini - */ - -#include <ost/gui/module_config.hh> - -#include <QLabel> -#include <QDialog> -#include <QTextEdit> - -namespace ost { namespace gui { - -/// \brief dialog to enter query statement -class DLLEXPORT_OST_GUI QueryDialog : public QDialog { - Q_OBJECT -public: - QueryDialog(QWidget* parent=NULL); - QString GetQueryString() const; - -public slots: - void OnTextChanged(); - -protected: - virtual void keyPressEvent(QKeyEvent* event); - -private: - - void Colorize(); - QTextEdit* edit_; - QLabel* status_; - QTextCharFormat default_; - QTextCharFormat error_; - bool flag_set_; -}; - -}} - -#endif diff --git a/modules/gui/src/scene_selection.cc b/modules/gui/src/scene_selection.cc index b408907f4282f62bf1600abb06b6d1a8305d93c3..5e1caea6c799a52fd262063d62ed3cc6164a23ea 100644 --- a/modules/gui/src/scene_selection.cc +++ b/modules/gui/src/scene_selection.cc @@ -166,26 +166,6 @@ void SceneSelection::ShowOriginalMap() #endif // OST_IMG_ENABLED -void SceneSelection::Select() { - QueryDialog d; - if (d.exec() == QDialog::Accepted) { - QString query = d.GetQueryString(); - for(unsigned int i = 0; i < nodes_.size(); i++){ - gfx::GfxNodeP node = nodes_[i]; - if (node) { - gfx::Entity* obj = dynamic_cast<gfx::Entity*> (node.get()); - if (obj) { - mol::Query q(query.toStdString()); - if (q.IsValid()) { - mol::EntityView ent = obj->GetView().Select(q); - obj->SetSelection(ent); - } - } - } - } - } -} - void SceneSelection::Deselect(){ for(unsigned int i = 0; i < nodes_.size(); i++){ gfx::GfxNodeP node = nodes_[i]; @@ -198,32 +178,6 @@ void SceneSelection::Deselect(){ } } -void SceneSelection::CopyViews() { - QueryDialog d; - QList<gfx::GfxObjP> objects_to_add; - if (d.exec() == QDialog::Accepted) { - QString query = d.GetQueryString(); - for(unsigned int i = 0; i < nodes_.size(); i++){ - gfx::GfxNodeP node = nodes_[i]; - if (node) { - gfx::Entity* obj = dynamic_cast<gfx::Entity*> (node.get()); - if (obj) { - mol::Query q(query.toStdString()); - if (q.IsValid()) { - mol::EntityView ent = obj->GetView().Select(q); - gfx::EntityP new_obj(new gfx::Entity(obj->GetName() - + " *", ent)); - objects_to_add.append(new_obj); - } - } - } - } - for(int i=0; i < objects_to_add.size(); i++){ - gfx::Scene::Instance().Add(objects_to_add[i]); - } - } -} - void SceneSelection::Show() { gfx::Scene::Instance().GetRootNode()->Show(); for(unsigned int i = 0; i < nodes_.size(); i++){ @@ -293,17 +247,6 @@ void SceneSelection::DeselectAllViews(){ } } -void SceneSelection::SelectViews(){ - QueryDialog d; - if (d.exec() == QDialog::Accepted) { - QString query = d.GetQueryString(); - mol::Query q(query.toStdString()); - mol::EntityView union_view = this->GetViewUnion(); - if(union_view.IsValid() && q.IsValid()){ - view_entity_->SetSelection(union_view.Select(q)); - } - } -} gfx::EntityP SceneSelection::GetViewEntity() const{ diff --git a/modules/gui/src/scene_selection.hh b/modules/gui/src/scene_selection.hh index 7bbcb2e38416152138f1cd48b2f817ff98174855..292a59e4a0a663e662847a9f68ec5b0363bc0e17 100644 --- a/modules/gui/src/scene_selection.hh +++ b/modules/gui/src/scene_selection.hh @@ -49,14 +49,11 @@ public slots: void ShowDownsampledMap(); void ShowOriginalMap(); #endif // OST_IMG_ENABLED - void CopyViews(); - void Select(); void Deselect(); void Show(); void Hide(); void SelectAllViews(); void DeselectAllViews(); - void SelectViews(); void MakeVisible(); void MakeHidden(); void ShowExclusive(); diff --git a/modules/gui/src/scene_win/context_menu.cc b/modules/gui/src/scene_win/context_menu.cc index dff6fbee6e8fbce72da02c0c9d5d81a9b10f4951..4cdaca60adb350be23601df7bd407752eca63474 100644 --- a/modules/gui/src/scene_win/context_menu.cc +++ b/modules/gui/src/scene_win/context_menu.cc @@ -53,15 +53,6 @@ ContextMenu::ContextMenu(QTreeView* view, SceneWinModel* model): connect(action, SIGNAL(triggered()), SceneSelection::Instance(), SLOT(CenterOnObjects())); this->AddAction(action, GFX_OBJECT); - action = new QAction("Copy",this); - connect(action, SIGNAL(triggered()), SceneSelection::Instance(), SLOT(CopyViews())); - this->AddAction(action, ENTITY); - action = new QAction("Create Custom View",this); - connect(action, SIGNAL(triggered()), this, SLOT(AddViewFromEntity())); - this->AddAction(action, ENTITY); - action = new QAction("Select..", this); - connect(action, SIGNAL(triggered()), SceneSelection::Instance(), SLOT(Select())); - this->AddAction(action, ENTITY); action = new QAction("Deselect",this); connect(action, SIGNAL(triggered()), SceneSelection::Instance(), SLOT(Deselect())); this->AddAction(action, ENTITY); @@ -95,9 +86,6 @@ ContextMenu::ContextMenu(QTreeView* view, SceneWinModel* model): action = new QAction("Deselect All",this); connect(action, SIGNAL(triggered()), SceneSelection::Instance(), SLOT(DeselectAllViews())); this->AddAction(action, ENTITY_VIEW | VIEWS_SAME_OBJECT); - action = new QAction("Select..",this); - connect(action, SIGNAL(triggered()), SceneSelection::Instance(), SLOT(SelectViews())); - this->AddAction(action, ENTITY_VIEW | VIEWS_SAME_OBJECT); action = new QAction("Create Custom View",this); connect(action, SIGNAL(triggered()), this, SLOT(AddView())); this->AddAction(action, ENTITY_VIEW); @@ -232,30 +220,6 @@ void ContextMenu::AddAction(QAction* action,ContextActionTypes type){ actions_[action] = type; } -void ContextMenu::AddViewFromEntity() { - QueryDialog d; - if (d.exec() == QDialog::Accepted) { - QString query = d.GetQueryString(); - int node_count = SceneSelection::Instance()->GetActiveNodeCount(); - for(int i = 0; i < node_count; i++){ - gfx::GfxNodeP node = SceneSelection::Instance()->GetActiveNode(i); - if (node) { - EntityNode* ent_node = qobject_cast<EntityNode*>(model_->FindGfxNode(node)); - if (ent_node) { - mol::Query q(query.toStdString()); - if (q.IsValid()) { - gfx::EntityP entity = boost::dynamic_pointer_cast<gfx::Entity>(ent_node->GetGfxNode()); - if(entity){ - CustomPartNode* child_node = new CustomPartNode("New View", entity, mol::QueryViewWrapper(q,entity->GetView()),ent_node->GetCustomViewNode()); - model_->AddNode(ent_node->GetCustomViewNode(),child_node); - } - } - } - } - } - } -} - void ContextMenu::AddView(){ gfx::EntityP entity = SceneSelection::Instance()->GetViewEntity(); diff --git a/modules/gui/src/scene_win/context_menu.hh b/modules/gui/src/scene_win/context_menu.hh index 06890baea5611db74a12ab9956c308c4c746db93..486f9b8bdabe4923dd48677980d12a3dcfe41c8e 100644 --- a/modules/gui/src/scene_win/context_menu.hh +++ b/modules/gui/src/scene_win/context_menu.hh @@ -68,7 +68,6 @@ public: void AddAction(QAction* action,ContextActionTypes type); private slots: - void AddViewFromEntity(); void AddView(); void Rename(); void DeleteView();