src/editmodes/magicWandMode.h

Thu, 15 Mar 2018 18:51:58 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 15 Mar 2018 18:51:58 +0200
changeset 1287
f1da43b7f5c6
parent 1251
e75cc5bff076
child 1326
69a90bd2dba2
permissions
-rw-r--r--

begin work on document loading rework

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"
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1104
diff changeset
22 #include "../geometry/linesegment.h"
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include <QMap>
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 #include <QVector>
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25
823
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 818
diff changeset
26 class MagicWandMode : public AbstractSelectMode
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 {
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1104
diff changeset
28 QMap<Vertex, QSet<QPersistentModelIndex>> m_vertices;
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1104
diff changeset
29 QMap<LineSegment, QSet<QPersistentModelIndex>> segments;
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1104
diff changeset
30 QItemSelection m_selection;
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31
823
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 818
diff changeset
32 DEFINE_CLASS (MagicWandMode, AbstractSelectMode)
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 818
diff changeset
33
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 public:
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1104
diff changeset
35 MagicWandMode(Canvas* canvas);
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1104
diff changeset
37 QItemSelection doMagic(const QModelIndex& index) const;
823
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 818
diff changeset
38 virtual EditModeType type() const override;
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1104
diff changeset
39 virtual bool mouseReleased(MouseEventData const& data) override;
818
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 private:
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1104
diff changeset
42 void edgeFill(
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1104
diff changeset
43 QModelIndex index,
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1104
diff changeset
44 QItemSelection& selection,
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1104
diff changeset
45 QSet<QModelIndex>& processed) const;
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1104
diff changeset
46 void surfaceFill(
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1104
diff changeset
47 QModelIndex index,
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1104
diff changeset
48 QItemSelection& selection,
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1104
diff changeset
49 QSet<QModelIndex>& processed) const;
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 };

mercurial