Blender  V2.93
Chain.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
24 #include "Curve.h"
25 
26 #include "../view_map/ViewMap.h"
27 
28 namespace Freestyle {
29 
33 class Chain : public Curve {
34  protected:
35  // tmp
37  FEdge *
38  _fedgeB; // the last FEdge of the ViewEdge passed to the last call for push_viewedge_back().
39 
40  public:
42  Chain() : Curve()
43  {
44  _splittingId = 0;
45  _fedgeB = 0;
46  }
47 
49  Chain(const Id &id) : Curve(id)
50  {
51  _splittingId = 0;
52  _fedgeB = 0;
53  }
54 
56  Chain(const Chain &iBrother) : Curve(iBrother)
57  {
58  _splittingId = iBrother._splittingId;
59  _fedgeB = iBrother._fedgeB;
60  }
61 
63  virtual ~Chain()
64  {
65  // only the last splitted deletes this id
66  if (_splittingId) {
67  if (*_splittingId == _Id) {
68  delete _splittingId;
69  }
70  }
71  }
72 
74  virtual string getExactTypeName() const
75  {
76  return "Chain";
77  }
78 
85  void push_viewedge_back(ViewEdge *iViewEdge, bool orientation);
86 
93  void push_viewedge_front(ViewEdge *iViewEdge, bool orientation);
94 
95  inline void setSplittingId(Id *sid)
96  {
97  _splittingId = sid;
98  }
99 
100  inline Id *getSplittingId()
101  {
102  return _splittingId;
103  }
104 
105 #ifdef WITH_CXX_GUARDEDALLOC
106  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Chain")
107 #endif
108 };
109 
110 } /* namespace Freestyle */
Class to define a container for curves.
Id * getSplittingId()
Definition: Chain.h:100
void push_viewedge_front(ViewEdge *iViewEdge, bool orientation)
Definition: Chain.cpp:92
Chain(const Chain &iBrother)
Definition: Chain.h:56
void push_viewedge_back(ViewEdge *iViewEdge, bool orientation)
Definition: Chain.cpp:29
Chain(const Id &id)
Definition: Chain.h:49
virtual string getExactTypeName() const
Definition: Chain.h:74
Id * _splittingId
Definition: Chain.h:36
FEdge * _fedgeB
Definition: Chain.h:38
virtual ~Chain()
Definition: Chain.h:63
void setSplittingId(Id *sid)
Definition: Chain.h:95
inherits from class Rep
Definition: AppCanvas.cpp:32