src/editmodes/magicWandMode.h

Thu, 23 Feb 2017 19:32:36 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 23 Feb 2017 19:32:36 +0200
changeset 1154
a426a335e586
parent 1104
edddb9b0db9e
child 1251
e75cc5bff076
permissions
-rw-r--r--

Some cleanup in mainwindow.cpp, use QSet<QString> for the 'ignore' variable.

818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
1072
9ce9496427f2 Happy new year 2017!
Teemu Piippo <teemu@hecknology.net>
parents: 1031
diff changeset
3 * Copyright (C) 2013 - 2017 Teemu Piippo
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #pragma once
830
a741a0b9df49 - updated filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents: 824
diff changeset
20 #include "abstractEditMode.h"
823
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 818
diff changeset
21 #include "../basics.h"
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include <QMap>
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include <QVector>
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24
823
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 818
diff changeset
25 class MagicWandMode : public AbstractSelectMode
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 {
1031
55c0d3beea0d removed removeDuplicates in favor of QSet, and the unused ObjectList class
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
27 QMap<Vertex, QSet<LDObject*>> m_vertices;
944
1a6f1997fcbe Replace casts
Teemu Piippo <crimsondusk64@gmail.com>
parents: 861
diff changeset
28 QVector<LDObject*> m_selection;
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29
823
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 818
diff changeset
30 DEFINE_CLASS (MagicWandMode, AbstractSelectMode)
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 818
diff changeset
31
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 public:
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 using BoundaryType = std::tuple<Vertex, Vertex>;
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 enum MagicType
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 {
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 Set,
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 Additive,
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 Subtractive,
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 InternalRecursion
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 };
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41
1104
edddb9b0db9e Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents: 1072
diff changeset
42 MagicWandMode (Canvas* canvas);
944
1a6f1997fcbe Replace casts
Teemu Piippo <crimsondusk64@gmail.com>
parents: 861
diff changeset
43 void doMagic (LDObject* obj, MagicType type);
823
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 818
diff changeset
44 virtual EditModeType type() const override;
824
6add2126e7ff - more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents: 823
diff changeset
45 virtual bool mouseReleased (MouseEventData const& data) override;
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 private:
1031
55c0d3beea0d removed removeDuplicates in favor of QSet, and the unused ObjectList class
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
48 void fillBoundaries (LDObject* obj, QVector<BoundaryType>& boundaries, QSet<LDObject *> &candidates);
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 };

mercurial