src/editmodes/circleMode.h

Thu, 09 Feb 2017 00:32:24 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 09 Feb 2017 00:32:24 +0200
changeset 1097
9a9e6ce0c5dc
parent 1089
97a539057536
child 1104
edddb9b0db9e
permissions
-rw-r--r--

Made a new renderer be created for each document, instead of reusing the same renderer for all documents.

829
bb903e89e23c - now with license headers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 825
diff changeset
1 /*
bb903e89e23c - now with license headers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 825
diff changeset
2 * LDForge: LDraw parts authoring CAD
1072
9ce9496427f2 Happy new year 2017!
Teemu Piippo <teemu@hecknology.net>
parents: 1030
diff changeset
3 * Copyright (C) 2013 - 2017 Teemu Piippo
829
bb903e89e23c - now with license headers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 825
diff changeset
4 *
bb903e89e23c - now with license headers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 825
diff changeset
5 * This program is free software: you can redistribute it and/or modify
bb903e89e23c - now with license headers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 825
diff changeset
6 * it under the terms of the GNU General Public License as published by
bb903e89e23c - now with license headers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 825
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
1006
a6b462051ae0 Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
8 * (at your option) any later version.
829
bb903e89e23c - now with license headers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 825
diff changeset
9 *
bb903e89e23c - now with license headers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 825
diff changeset
10 * This program is distributed in the hope that it will be useful,
bb903e89e23c - now with license headers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 825
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bb903e89e23c - now with license headers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 825
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bb903e89e23c - now with license headers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 825
diff changeset
13 * GNU General Public License for more details.
bb903e89e23c - now with license headers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 825
diff changeset
14 *
bb903e89e23c - now with license headers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 825
diff changeset
15 * You should have received a copy of the GNU General Public License
bb903e89e23c - now with license headers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 825
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
bb903e89e23c - now with license headers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 825
diff changeset
17 */
bb903e89e23c - now with license headers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 825
diff changeset
18
830
a741a0b9df49 - updated filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents: 829
diff changeset
19 #pragma once
a741a0b9df49 - updated filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents: 829
diff changeset
20 #include "abstractEditMode.h"
823
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 class CircleMode : public AbstractDrawMode
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 {
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 DEFINE_CLASS (CircleMode, AbstractDrawMode)
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 public:
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 CircleMode (GLRenderer* renderer);
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28
1030
d931a7547578 Fixed circle mode not building the circle anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
29 void endDraw() override;
1089
97a539057536 minor amendment
Teemu Piippo <teemu@compsta2.com>
parents: 1088
diff changeset
30 double getCircleDrawDist (int position) const;
824
6add2126e7ff - more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents: 823
diff changeset
31 Matrix getCircleDrawMatrix (double scale);
1030
d931a7547578 Fixed circle mode not building the circle anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
32 int maxVertices() const override;
873
201083693300 - circle mode now locks the angle offset on final confirmation stage
Teemu Piippo <crimsondusk64@gmail.com>
parents: 869
diff changeset
33 bool preAddVertex (Vertex const&) override;
1030
d931a7547578 Fixed circle mode not building the circle anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
34 void render (QPainter& painter) const override;
d931a7547578 Fixed circle mode not building the circle anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
35 EditModeType type() const override;
825
f7649c9bfd9a - more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents: 824
diff changeset
36
f7649c9bfd9a - more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents: 824
diff changeset
37 private:
1030
d931a7547578 Fixed circle mode not building the circle anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
38 double m_angleOffset;
d931a7547578 Fixed circle mode not building the circle anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
39
825
f7649c9bfd9a - more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents: 824
diff changeset
40 void buildCircle();
1088
c6d242d2b619 Reworked and cleaned up the circle mode
Teemu Piippo <teemu@compsta2.com>
parents: 1072
diff changeset
41 double orientation() const;
823
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 };

mercurial