src/linetypes/triangle.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 1148
96cb15a7611f
child 1186
eae8b3bce545
child 1261
5d2c9d36da9d
permissions
-rw-r--r--

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

1148
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 /*
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3 * Copyright (C) 2013 - 2017 Teemu Piippo
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 *
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 * (at your option) any later version.
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9 *
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 * GNU General Public License for more details.
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 *
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17 */
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 #pragma once
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 #include "modelobject.h"
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22 /*
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 * Represents a single code-3 triangle in the LDraw code file.
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 */
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 class LDTriangle : public LDObject
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26 {
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
27 public:
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 static constexpr LDObjectType SubclassType = LDObjectType::Triangle;
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
30 virtual LDObjectType type() const override
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31 {
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
32 return SubclassType;
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
33 }
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
34
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
35 virtual QString asText() const override;
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
36 virtual void invert() override;
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
37 int triangleCount() const override;
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
38 int numVertices() const override { return 3; }
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
39 QString typeName() const override { return "triangle"; }
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
40
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
41 protected:
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
42 friend class Model;
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
43 LDTriangle (Model* model);
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
44 LDTriangle (Vertex const& v1, Vertex const& v2, Vertex const& v3, Model* model = nullptr);
96cb15a7611f Moved LDTriangle into its own source pair.
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
45 };

mercurial