1 /** \file 2 * \brief Declaration of class EdgeAttributes. 3 * 4 * \author Stefan Hachul 5 * 6 * \par License: 7 * This file is part of the Open Graph Drawing Framework (OGDF). 8 * 9 * \par 10 * Copyright (C)<br> 11 * See README.md in the OGDF root directory for details. 12 * 13 * \par 14 * This program is free software; you can redistribute it and/or 15 * modify it under the terms of the GNU General Public License 16 * Version 2 or 3 as published by the Free Software Foundation; 17 * see the file LICENSE.txt included in the packaging of this file 18 * for details. 19 * 20 * \par 21 * This program is distributed in the hope that it will be useful, 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 * GNU General Public License for more details. 25 * 26 * \par 27 * You should have received a copy of the GNU General Public 28 * License along with this program; if not, see 29 * http://www.gnu.org/copyleft/gpl.html 30 */ 31 32 #pragma once 33 34 #include <ogdf/basic/geometry.h> 35 #include <ogdf/basic/Graph.h> 36 37 namespace ogdf { 38 namespace energybased { 39 namespace fmmm { 40 41 //! helping data structure that stores the graphical attributes of an edge 42 //! that are needed for the force-directed algorithms. 43 class OGDF_EXPORT EdgeAttributes 44 { 45 //! outputstream for EdgeAttributes 46 friend OGDF_EXPORT std::ostream &operator<< (std::ostream &, const EdgeAttributes &); 47 48 //! inputstream for EdgeAttributes 49 friend OGDF_EXPORT std::istream &operator>> (std::istream &, EdgeAttributes &); 50 51 public: 52 //! Constructor 53 EdgeAttributes(); 54 set_EdgeAttributes(double len,edge e_orig,edge e_sub)55 void set_EdgeAttributes(double len, edge e_orig, edge e_sub) 56 { 57 length = len; 58 e_original = e_orig; 59 e_subgraph = e_sub; 60 } 61 set_length(double len)62 void set_length(double len) { length = len; } get_length()63 double get_length() const { return length; } 64 65 //! \name for the divide et impera step in FMMM @{ 66 set_original_edge(edge e)67 void set_original_edge (edge e) { e_original = e; } set_subgraph_edge(edge e)68 void set_subgraph_edge (edge e) { e_subgraph = e; } get_original_edge()69 edge get_original_edge() const { return e_original; } get_subgraph_edge()70 edge get_subgraph_edge() const { return e_subgraph; } 71 72 //! @} 73 //! \name for the preprocessing step in FMMM (set/get_original_edge are needed, too) @{ 74 set_copy_edge(edge e)75 void set_copy_edge (edge e) {e_subgraph = e;} get_copy_edge()76 edge get_copy_edge() const {return e_subgraph;} 77 78 //! @} 79 //! \name for multilevel step @{ 80 set_higher_level_edge(edge e)81 void set_higher_level_edge (edge e) { e_subgraph = e; } get_higher_level_edge()82 edge get_higher_level_edge() const { return e_subgraph; } is_moon_edge()83 bool is_moon_edge() const { return moon_edge; } make_moon_edge()84 void make_moon_edge() { moon_edge = true; } is_extra_edge()85 bool is_extra_edge() const { return extra_edge; } make_extra_edge()86 void make_extra_edge() { extra_edge = true; } mark_as_normal_edge()87 void mark_as_normal_edge() { extra_edge = false; } init_mult_values()88 void init_mult_values() { e_subgraph = nullptr; moon_edge = false; } 89 90 //! @} 91 92 private: 93 double length; 94 edge e_original; 95 edge e_subgraph; 96 97 //! indicates if this edge is associasted with a moon node 98 bool moon_edge; 99 100 //! indicates if this edge is an extra edge that is added to 101 //! enforce few edge crossings 102 bool extra_edge; 103 }; 104 105 } 106 } 107 } 108