Commit ff75be3e authored by Matthias Möller's avatar Matthias Möller

fix hole selection

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@19633 383ad7c9-94d9-4d36-a494-682f7c89f535
parent dd55bd8a
......@@ -106,30 +106,27 @@ void HoleFillerPlugin::pluginsInitialized()
update_menu();
}
/// Fill all selected holes
void HoleFillerPlugin::slotFillSelection(){
//get selected rows
std::vector< int > rows;
void HoleFillerPlugin::getSelectedHoles(std::vector<int>& _holeIds, std::vector<int>& _objIds)
{
QModelIndexList indices = tool_->tableWidget->selectionModel()->selectedRows();
QList<QTableWidgetItem *> items = tool_->tableWidget->selectedItems();
//get a map from objectID to (selected) holeIDs
for (int i=0; i < indices.size(); i++){
int objID = holeMapping_[ indices[i].row() ].first;
int holeID = holeMapping_[ indices[i].row() ].second;
int itemCount = items.count() / 3;
_holeIds.push_back ( holeID );
_objIds.push_back( objID );
}
}
for (int i=0; i < itemCount ; i++)
rows.push_back( items[i]->row() );
/// Fill all selected holes
void HoleFillerPlugin::slotFillSelection(){
//get a map from objectID to (selected) holeIDs
std::vector< int > holes;
std::vector< int > objects;
for (uint i=0; i < rows.size(); i++){
int objID = holeMapping_[ rows[i] ].first;
int holeID = holeMapping_[ rows[i] ].second;
holes.push_back ( holeID );
objects.push_back( objID );
}
getSelectedHoles(holes,objects);
//init progressDialog
QProgressDialog progress(tr("Filling holes..."), tr("Abort"), 0, holes.size(), 0);
......@@ -193,27 +190,9 @@ void HoleFillerPlugin::slotFillSelection(){
/// slot for displaying selected holes
void HoleFillerPlugin::slotItemSelectionChanged() {
//get selected rows
std::vector< int > rows;
QList<QTableWidgetItem *> items = tool_->tableWidget->selectedItems();
int itemCount = items.count() / 3;
for (int i=0; i < itemCount ; i++)
rows.push_back( items[i]->row() );
//get a map from objectID to (selected) holeIDs
std::vector< int > holes;
std::vector< int > objects;
for (uint i=0; i < rows.size(); i++){
int objID = holeMapping_[ rows[i] ].first;
int holeID = holeMapping_[ rows[i] ].second;
holes.push_back ( holeID );
objects.push_back( objID );
}
getSelectedHoles(holes,objects);
//iterate over all objects with holes that should be displayed
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ; o_it != PluginFunctions::objectsEnd(); ++o_it) {
......
......@@ -59,6 +59,9 @@
#include "holefillerToolbar.hh"
#include <vector>
#include <utility>
class HoleFillerPlugin : public QObject, BaseInterface, MouseInterface, PickingInterface, ToolboxInterface, LoggingInterface, ScriptInterface, BackupInterface
{
Q_OBJECT
......@@ -124,6 +127,9 @@ class HoleFillerPlugin : public QObject, BaseInterface, MouseInterface, PickingI
void update_menu();
/// get a map from objectID to (selected) holeIDs
void getSelectedHoles(std::vector<int>& _holeIds, std::vector<int>& _objIds);
/// Widget for Toolbox
HoleFillerToolbarWidget* tool_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment