dyng
DynamicGraphLayout
node.h
1 /*
2  Copyright 2020 František Bráblík
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 #pragma once
17 
18 #include "coords.h"
19 #include "identifiers.h"
20 
21 namespace dyng {
22 
32 class node {
33 public:
36  : m_id(id) {}
37 
39  node_id id() const { return m_id; }
40 
42  bool is_new() const { return m_newly_added; }
43 
45  void is_new(bool value) { m_newly_added = value; }
46 
48  bool is_old() const { return m_to_be_deleted; }
49 
51  void is_old(bool value) { m_to_be_deleted = value; }
52 
54 
60  float alpha() const { return m_alpha; }
61 
63  void alpha(float value) { m_alpha = value; }
64 
66  const coords& pos() const { return m_coords; }
67 
69  coords& pos() { return m_coords; }
70 
71 private:
72  coords m_coords;
73  node_id m_id;
74  float m_alpha = 1.0;
75  bool m_newly_added = false;
76  bool m_to_be_deleted = false;
77 };
78 
79 } // namespace dyng
dyng::node::alpha
float alpha() const
Returns current alpha value.
Definition: node.h:60
dyng::node::pos
coords & pos()
Returns current coordinates.
Definition: node.h:69
dyng::node
Definition: node.h:32
dyng::coords
Class representing coordinates in 2D space.
Definition: coords.h:21
dyng::node::is_new
void is_new(bool value)
Sets if the node is new in its current state.
Definition: node.h:45
dyng::node::id
node_id id() const
Returns the id.
Definition: node.h:39
dyng::node::alpha
void alpha(float value)
Sets the current alpha value.
Definition: node.h:63
dyng::node::pos
const coords & pos() const
Returns current coordinates.
Definition: node.h:66
dyng::node::is_old
bool is_old() const
Returns if the node is going to be deleted in the next state.
Definition: node.h:48
dyng::node_id
Type used as an identifier for nodes.
Definition: identifiers.h:77
dyng::node::is_old
void is_old(bool value)
Sets if the node is going to be deleted in the next state.
Definition: node.h:51
dyng::node::is_new
bool is_new() const
Returns if the node is new in its current state.
Definition: node.h:42
dyng::node::node
node(node_id id)
Sets the id of the node.
Definition: node.h:35