Don't import ogdf namespace
[TortoiseGit.git] / ext / OGDF / ogdf / planarity / PlanRepUML.h
blobee48f28c930ce6d98af80c78e0ba91000a661551
1 /*
2 * $Revision: 2577 $
4 * last checkin:
5 * $Author: klein $
6 * $Date: 2012-07-11 08:08:37 +0200 (Mi, 11. Jul 2012) $
7 ***************************************************************/
9 /** \file
10 * \brief Declaration of class PlanRepUML.
12 * \author Carsten Gutwenger
14 * \par License:
15 * This file is part of the Open Graph Drawing Framework (OGDF).
17 * \par
18 * Copyright (C)<br>
19 * See README.txt in the root directory of the OGDF installation for details.
21 * \par
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License
24 * Version 2 or 3 as published by the Free Software Foundation;
25 * see the file LICENSE.txt included in the packaging of this file
26 * for details.
28 * \par
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
34 * \par
35 * You should have received a copy of the GNU General Public
36 * License along with this program; if not, write to the Free
37 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
38 * Boston, MA 02110-1301, USA.
40 * \see http://www.gnu.org/copyleft/gpl.html
41 ***************************************************************/
44 #ifdef _MSC_VER
45 #pragma once
46 #endif
48 #ifndef OGDF_PLAN_REP_UML_H
49 #define OGDF_PLAN_REP_UML_H
53 #include <ogdf/planarity/PlanRep.h>
54 #include <ogdf/basic/UMLGraph.h>
56 #include <ogdf/planarity/EdgeTypePatterns.h>
57 #include <ogdf/planarity/NodeTypePatterns.h>
61 namespace ogdf {
63 class Layout;
64 class GridLayoutMapped;
65 class OrthoRep;
68 //---------------------------------------------------------
69 // PlanRepUML
70 // Planarized representation (of a connected component)
71 // of a UMLGraph; allows special handling of hierarchies
72 // in the graph
73 //---------------------------------------------------------
74 class OGDF_EXPORT PlanRepUML : public PlanRep {
75 public:
77 // construction
78 PlanRepUML(const UMLGraph &umlGraph);
79 PlanRepUML(const GraphAttributes &GA);
81 // deconstruction
82 ~PlanRepUML() {}
84 void initCC(int i);
86 // Returns true if an edge splits a face into two subfaces to
87 // guarantee generalizations to be on opposite sides of a node.
88 bool faceSplitter(edge e) const{
89 return m_faceSplitter[e];
92 // Removes all face splitting edges.
93 void removeFaceSplitter(){
94 edge e;
95 forall_edges(e,(*this))
96 if (m_faceSplitter[e])
97 delEdge(e);
100 //-------------------
101 //incremental drawing
102 //-------------------
103 //initialize incremental stuff, e.g. insert incremental mergers
104 void setupIncremental(int indexCC, CombinatorialEmbedding &E);
105 //Return the list of inserted incremental mergers
106 const SList<node>& incrementalMergers(int indexCC) const { return m_incMergers[indexCC]; }
109 //**********************************************************
110 //set generic types
112 //the edges that are embedded next to outgoing generalizations if alignment set
113 //attention: this information is NOT updated during graph changes and only
114 //to be used during the embedding phase
115 bool alignUpward(adjEntry ae) {return m_alignUpward[ae];}
116 void alignUpward(adjEntry ae, bool b) {m_alignUpward[ae] = b;}
119 //*************************************************************************
122 const UMLGraph &getUMLGraph() const {
123 return *m_pUmlGraph;
126 //*************************************************************************
127 //structural alterations
129 // inserts a generalization merge node for all incoming
130 // generalizations of v and returns it
131 //conserving embedding
132 node insertGenMerger(node v, const SList<edge> &inGens,
133 CombinatorialEmbedding &E);
135 // Expands nodes with degree > 4 and merge nodes for generalizations
136 void expand(bool lowDegreeExpand = false);
138 //expands nodes with degree <= 4 and aligns opposite edges at degree 2 nodes
139 void expandLowDegreeVertices(OrthoRep &OR, bool alignSmallDegree = false);
141 void collapseVertices(const OrthoRep &OR, Layout &drawing);
143 //*************************************************************************
147 // extension of methods defined by GraphCopy/PlanRep
150 // splits edge e
151 virtual edge split(edge e) {
153 edge eNew = PlanRep::split(e);
155 //check this
156 if (m_alignUpward[e->adjSource()]) m_alignUpward[eNew->adjSource()] = true;
157 if (m_alignUpward[e->adjTarget()]) m_alignUpward[eNew->adjTarget()] = true;
159 return eNew;
163 // writes attributed graph in GML format to file fileName
164 // For Debugging only
165 void writeGML(const char *fileName, const Layout &drawing);
166 void writeGML(const char *fileName);
167 void writeGML(const char *fileName, GraphAttributes &AG);
169 // writes attributed graph in GML format to output stream os
170 // For Debugging only
171 void writeGML(ostream &os, const Layout &drawing);
172 void writeGML(const char *fileName, const OrthoRep &OR, const Layout &drawing);
173 void writeGML(ostream &os, const OrthoRep &OR, const Layout &drawing);
174 void writeGML(const char *fileName, const OrthoRep &OR, const GridLayoutMapped &drawing);
175 void writeGML(ostream &os, const OrthoRep &OR, const GridLayoutMapped &drawing);
178 protected:
179 //insert mergers of generalizations in copy
180 void prepareIncrementalMergers(int indexCC, CombinatorialEmbedding &E);
183 protected:
184 //still some AdjEntry type: used by alignment procedures
185 //attention: this information is NOT updated during graph changes and only
186 //to be used during the embedding phase
187 AdjEntryArray<bool> m_alignUpward;
189 private:
190 const UMLGraph *m_pUmlGraph;
192 EdgeArray<bool> m_faceSplitter;
194 SListPure<edge> m_mergeEdges;
195 Array< SList<node> > m_incMergers; //stores all incremental mergers in CC
199 } // end namespace ogdf
201 #endif