├── Qt Graphiz Visualizer
├── CMakeLists.txt
├── FAQ.txt
├── LICENSE.txt
├── QGVCore
│ ├── CMakeLists.txt
│ ├── GraphViz.pri
│ ├── QGVCore-uninstalled.pc.in
│ ├── QGVCore.pc.in
│ ├── QGVCore.pro
│ ├── QGVEdge.cpp
│ ├── QGVEdge.h
│ ├── QGVNode.cpp
│ ├── QGVNode.h
│ ├── QGVScene.cpp
│ ├── QGVScene.h
│ ├── QGVSubGraph.cpp
│ ├── QGVSubGraph.h
│ ├── private
│ │ ├── QGVCore.cpp
│ │ ├── QGVCore.h
│ │ ├── QGVEdgePrivate.cpp
│ │ ├── QGVEdgePrivate.h
│ │ ├── QGVGraphPrivate.cpp
│ │ ├── QGVGraphPrivate.h
│ │ ├── QGVGvcPrivate.cpp
│ │ ├── QGVGvcPrivate.h
│ │ ├── QGVNodePrivate.cpp
│ │ └── QGVNodePrivate.h
│ └── qgv.h
├── QGraphViz.pro
├── QGraphViz.pro.user
├── QGraphViz.pro.user.98d90d7
├── README.md
├── Sample
│ ├── CMakeLists.txt
│ ├── Gnome-Network-Server-64.png
│ ├── Gnome-Network-Transmit-64.png
│ ├── Gnome-Stock-Person-64.png
│ ├── Gnome-System-Run-64.png
│ ├── MainWindow.cpp
│ ├── MainWindow.h
│ ├── MainWindow.ui
│ ├── QGraphicsViewEc.cpp
│ ├── QGraphicsViewEc.h
│ ├── Sample.pro
│ ├── graphvizwrapper.h
│ ├── main.cpp
│ └── ress.qrc
└── cmake
│ ├── cmake_uninstall.cmake.in
│ └── modules
│ └── FindGraphviz.cmake
├── README.md
├── build-QGraphViz-Desktop_Qt_5_10_0_MinGW_32bit-Debug
├── .qmake.stash
├── Makefile
├── QGVCore
│ ├── Makefile
│ ├── Makefile.Debug
│ ├── Makefile.Release
│ └── debug
│ │ ├── QGVCore.o
│ │ ├── QGVEdge.o
│ │ ├── QGVEdgePrivate.o
│ │ ├── QGVGraphPrivate.o
│ │ ├── QGVGvcPrivate.o
│ │ ├── QGVNode.o
│ │ ├── QGVNodePrivate.o
│ │ ├── QGVScene.o
│ │ ├── QGVSubGraph.o
│ │ ├── moc_QGVScene.cpp
│ │ └── moc_predefs.h
├── Sample
│ ├── Makefile
│ ├── Makefile.Debug
│ ├── Makefile.Release
│ ├── debug
│ │ ├── MainWindow.o
│ │ ├── QGraphicsViewEc.o
│ │ ├── main.o
│ │ ├── moc_MainWindow.cpp
│ │ ├── moc_QGraphicsViewEc.cpp
│ │ ├── moc_predefs.h
│ │ ├── qrc_ress.cpp
│ │ └── qrc_ress.o
│ └── ui_MainWindow.h
├── bin
│ ├── Pathplan.dll
│ ├── QGVCore.dll
│ ├── Sample.exe
│ ├── cdt.dll
│ ├── cgraph.dll
│ ├── config6
│ ├── gvc.dll
│ ├── gvplugin_core.dll
│ ├── gvplugin_dot_layout.dll
│ ├── gvplugin_neato_layout.dll
│ ├── libexpat.dll
│ ├── ltdl.dll
│ ├── vmalloc.dll
│ └── zlib1.dll
└── lib
│ ├── QGVCore.dll
│ └── libQGVCore.a
└── build-QGraphViz-Desktop_Qt_5_10_0_MinGW_32bit-Release
├── .qmake.stash
├── Makefile
├── QGVCore
├── Makefile
├── Makefile.Debug
├── Makefile.Release
└── release
│ ├── QGVCore.o
│ ├── QGVEdge.o
│ ├── QGVEdgePrivate.o
│ ├── QGVGraphPrivate.o
│ ├── QGVGvcPrivate.o
│ ├── QGVNode.o
│ ├── QGVNodePrivate.o
│ ├── QGVScene.o
│ ├── QGVSubGraph.o
│ ├── moc_QGVScene.cpp
│ └── moc_predefs.h
├── Sample
├── Makefile
├── Makefile.Debug
├── Makefile.Release
├── release
│ ├── MainWindow.o
│ ├── QGraphicsViewEc.o
│ ├── main.o
│ ├── moc_MainWindow.cpp
│ ├── moc_QGraphicsViewEc.cpp
│ ├── moc_predefs.h
│ ├── qrc_ress.cpp
│ └── qrc_ress.o
└── ui_MainWindow.h
├── bin
├── Pathplan.dll
├── QGVCore.dll
├── Sample.exe
├── cdt.dll
├── cgraph.dll
├── config6
├── gvc.dll
├── gvplugin_core.dll
├── gvplugin_dot_layout.dll
├── gvplugin_neato_layout.dll
├── libexpat.dll
├── ltdl.dll
├── vmalloc.dll
└── zlib1.dll
└── lib
├── QGVCore.dll
└── libQGVCore.a
/Qt Graphiz Visualizer/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | ######################
2 | #
3 | # Copyright (C) 2014 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
4 | #
5 | # This program is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with this program. If not, see .
17 | #
18 | ######################
19 |
20 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
21 | PROJECT(qgv)
22 |
23 | SET(TARGET_VERSION_MAJOR 0 )
24 | SET(TARGET_VERSION_MINOR 1 )
25 | SET(${PROJECT_NAME}_PATCH_LEVEL 0 )
26 | SET(${PROJECT_NAME}_SOVERSION ${TARGET_VERSION_MAJOR})
27 | SET(${PROJECT_NAME}_VERSION
28 | "${TARGET_VERSION_MAJOR}.${TARGET_VERSION_MINOR}.${${PROJECT_NAME}_PATCH_LEVEL}" )
29 |
30 | # INCLUDE(CTest)
31 |
32 | # Extending the Module path with the local module path of desuto
33 | SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules )
34 |
35 | OPTION(BUILD_DEV "Build development version of qgv" ON)
36 | OPTION(BUILD_DEBUG "Build in debug mode" ON)
37 | OPTION(BINDINGS_QT4 "Build with Qt4" OFF)
38 | OPTION(BINDINGS_QT5 "Build with Qt5" OFF)
39 |
40 | SET(BUILD_DEBUG_WANTED ${BUILD_DEBUG})
41 | SET(BUILD_DEV_WANTED ${BUILD_DEV})
42 | SET(BINDINGS_QT4_WANTED ${BINDINGS_QT4})
43 | SET(BINDINGS_QT5_WANTED ${BINDINGS_QT5})
44 |
45 | IF(BUILD_DEBUG)
46 | SET(CMAKE_BUILD_TYPE Debug)
47 | ELSE()
48 | SET(CMAKE_BUILD_TYPE Release)
49 | ENDIF()
50 |
51 | IF(NOT BINDINGS_QT4 AND NOT BINDINGS_QT5)
52 | MESSAGE("Trying to autodetect Qt version")
53 | FIND_PACKAGE(Qt4 QUIET)
54 | IF(Qt4_FOUND OR QT4_FOUND)
55 | SET(BINDINGS_QT4 ON)
56 | MESSAGE("Found Qt4 --> Prefer Qt4 over Qt5")
57 | ELSE(Qt4_FOUND OR QT4_FOUND)
58 | SET(BINDINGS_QT5 ON)
59 | MESSAGE("Qt4 not found --> Try to build with Qt5")
60 | ENDIF(Qt4_FOUND OR QT4_FOUND)
61 | ENDIF(NOT BINDINGS_QT4 AND NOT BINDINGS_QT5)
62 | IF(BINDINGS_QT4)
63 | # Qt4 must be included after setting the build type
64 | FIND_PACKAGE(Qt4 REQUIRED)
65 | ENDIF(BINDINGS_QT4)
66 | IF(BINDINGS_QT5)
67 | IF(BINDINGS_QT4)
68 | MESSAGE("Qt4 and Qt5 enabled --> Preferring Qt4 and therefore disabling Qt5")
69 | SET(BINDINGS_QT5 OFF)
70 | ELSE(BINDINGS_QT4)
71 | FIND_PACKAGE(Qt5Core REQUIRED)
72 | FIND_PACKAGE(Qt5Widgets REQUIRED)
73 | FIND_PACKAGE(Qt5Xml REQUIRED)
74 | FIND_PACKAGE(Qt5XmlPatterns REQUIRED)
75 | FIND_PACKAGE(Qt5Sql REQUIRED)
76 | FIND_PACKAGE(Qt5Network REQUIRED)
77 | FIND_PACKAGE(Qt5LinguistTools REQUIRED)
78 | # Do not automatically link against qtmain
79 | CMAKE_POLICY(SET CMP0020 OLD)
80 | ENDIF(BINDINGS_QT4)
81 | ENDIF(BINDINGS_QT5)
82 | # enable automatic moc by CMAKE
83 | SET(CMAKE_AUTOMOC ON)
84 |
85 | IF(NOT KDE)
86 | IF(NOT APPLE)
87 | SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
88 | ENDIF(NOT APPLE)
89 | IF(MSVC)
90 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_EXCEPTIONS -Zc:wchar_t-")
91 | ELSE(MSVC)
92 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -DQT_NO_EXCEPTIONS -fno-check-new -fno-common")
93 | ENDIF(MSVC)
94 | IF(NOT WIN32 AND NOT APPLE)
95 | # SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--fatal-warnings -lc -Wl,--disable-auto-import")
96 | SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--fatal-warnings -lc")
97 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi")
98 | ENDIF(NOT WIN32 AND NOT APPLE)
99 | ENDIF(NOT KDE)
100 | IF(BUILD_DEBUG AND NOT MSVC)
101 | SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
102 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
103 | ENDIF(BUILD_DEBUG AND NOT MSVC)
104 | ADD_DEFINITIONS(${QT_DEFINITIONS})
105 |
106 | # directory to install binaries
107 | SET(bin_DIR ${CMAKE_INSTALL_PREFIX}/bin)
108 | IF(WIN32)
109 | SET(bin_DIR .)
110 | ENDIF(WIN32)
111 |
112 | IF(NOT WIN32)
113 | SET(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib/" CACHE STRING "Where to install the library files to")
114 | ENDIF(NOT WIN32)
115 | SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
116 | IF(UNIX)
117 | # SET(designer_DIR "/usr/lib/qt4/plugins/designer")
118 | SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
119 | SET(include_DIR ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME})
120 | SET(find_cmake_DIR ${CMAKE_ROOT}/Modules/)
121 | ELSE(UNIX)
122 | SET(LIB_INSTALL_DIR ${bin_DIR})
123 | SET(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
124 | SET(include_DIR ${bin_DIR}/include/${PROJECT_NAME})
125 | SET(find_cmake_DIR ${CMAKE_ROOT}/Modules/)
126 | ENDIF(UNIX)
127 |
128 | IF(WIN32)
129 | IF(BUILD_DEBUG)
130 | SET(qt_LIBS ${qt_LIBS}/Debug)
131 | ELSE(BUILD_DEBUG)
132 | SET(qt_LIBS ${qt_LIBS}/Release)
133 | ENDIF(BUILD_DEBUG)
134 | ENDIF()
135 |
136 | FIND_PACKAGE(Qt4 REQUIRED)
137 | ADD_DEFINITIONS(${QT_DEFINITIONS})
138 | FIND_PACKAGE(Graphviz REQUIRED)
139 |
140 | ######################
141 | #
142 | # include source tree
143 | #
144 | ######################
145 | SET(libqgv_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/QGVCore)
146 | SET(libqgv_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/QGVCore)
147 | ADD_SUBDIRECTORY(QGVCore)
148 | ADD_SUBDIRECTORY(Sample)
149 |
150 | ######################
151 | #
152 | # printing choosen configuration
153 | #
154 | ######################
155 | MESSAGE("######################################################")
156 | MESSAGE("")
157 | MESSAGE("CONFIGURATION")
158 | MESSAGE("")
159 | MESSAGE("CMAKE_SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}")
160 | MESSAGE("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
161 | MESSAGE("CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
162 | MESSAGE("")
163 | MESSAGE("OPTIONS:")
164 | MESSAGE(" Name Wanted Used")
165 | # MESSAGE(" BUILD_PACKAGE: ${BUILD_PACKAGE_WANTED} ${BUILD_PACKAGE}")
166 | MESSAGE(" BUILD_DEBUG: ${BUILD_DEBUG_WANTED} ${BUILD_DEBUG}")
167 | # MESSAGE(" BUILD_TESTING: ${BUILD_TESTING_WANTED} ${BUILD_TESTING}")
168 | MESSAGE(" BUILD_DEV: ${BUILD_DEV} ${BUILD_DEV}")
169 | MESSAGE(" BINDINGS_QT4: ${BINDINGS_QT4_WANTED} ${BINDINGS_QT4}")
170 | MESSAGE(" BINDINGS_QT5: ${BINDINGS_QT5_WANTED} ${BINDINGS_QT5}")
171 | # MESSAGE(" L10N_ALL: ${L10N_ALL_WANTED} ${L10N_ALL}")
172 | # MESSAGE(" L10N_DE: ${L10N_DE_WANTED} ${L10N_DE}")
173 | # MESSAGE(" L10N_EN: ${L10N_EN_WANTED} ${L10N_EN}")
174 | # MESSAGE(" L10N_FR: ${L10N_FR_WANTED} ${L10N_FR}")
175 | MESSAGE("")
176 | MESSAGE("######################################################")
177 |
178 | ######################
179 | #
180 | # Add uninstall target
181 | #
182 | ######################
183 | CONFIGURE_FILE(
184 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
185 | "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
186 | IMMEDIATE @ONLY)
187 | ADD_CUSTOM_TARGET(uninstall
188 | "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake")
189 |
190 |
191 | ######################
192 | #
193 | # CPACK
194 | #
195 | ######################
196 | SET(CPACK_GENERATOR "NSIS")
197 | SET(CPACK_PACKAGE_NAME "QGV")
198 | SET(CPACK_PACKAGE_VENDOR "")
199 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Qt interface for Graphviz")
200 | SET(CPACK_PACKAGE_VERSION ${${PROJECT_NAME}_VERSION})
201 | SET(CPACK_PACKAGE_VERSION_MAJOR ${TARGET_MAJOR_VERSION})
202 | SET(CPACK_PACKAGE_VERSION_MINOR ${TARGET_MINOR_VERSION})
203 | SET(CPACK_PACKAGE_VERSION_PATCH ${${PROJECT_NAME}_PATCH_LEVEL})
204 | SET(CPACK_PACKAGE_INSTALL_DIRECTORY "qgv")
205 |
206 | # add all components which should be installable via the package
207 | IF(WIN32)
208 | SET(external_DLL
209 | qtlibs
210 | graphvizlibs
211 | )
212 | ENDIF(WIN32)
213 |
214 | SET(CPACK_COMPONENTS_ALL
215 | library
216 | ${external_DLL}
217 | headerfiles
218 | sample
219 | )
220 |
221 | # License file
222 | SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt)
223 |
224 | # Pre selected installation profiles
225 | SET(CPACK_ALL_INSTALL_TYPES Full Minimal)
226 |
227 | # groups for components
228 | SET(CPACK_COMPONENT_GROUP_3RDPARTYLIBS_DISPLAY_NAME "3rd Party Libraries")
229 | SET(CPACK_COMPONENT_GROUP_3RDPARTYLIBS_DESCRIPTION "Libraries which are needed, but not belonging to this project. They must not be installed, if they are already installed at path")
230 |
231 | # the scheme of the variable names are: CPACK_COMPNONENT_%COMPONENTNAMEINUPPERCASE%_DISPLAY_NAME
232 | # where %COMPONENTNAMEINUPPERCASE% must be replaced by the upper cased name of the component
233 | # see below for example
234 | SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "QGV")
235 | SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
236 | "The qgv library")
237 | # SET(CPACK_COMPONENT_LIBRARY_GROUP "Base")
238 | SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Full Minimal)
239 |
240 | IF(BUILD_DEV)
241 | SET(CPACK_COMPONENT_HEADERFILES_DISPLAY_NAME "Header files")
242 | SET(CPACK_COMPONENT_HEADERFILES_DESCRIPTION
243 | "Header files of qgv library")
244 | SET(CPACK_COMPONENT_HEADERFILES_DEPENDS library)
245 | SET(CPACK_COMPONENT_HEADERFILES_INSTALL_TYPES Full)
246 | ENDIF(BUILD_DEV)
247 |
248 | SET(CPACK_COMPONENT_QTLIBS_DISPLAY_NAME "QT")
249 | SET(CPACK_COMPONENT_QTLIBS_DESCRIPTION
250 | "Qt libraries")
251 | SET(CPACK_COMPONENT_QTLIBS_GROUP "3rdPartyLibs")
252 | SET(CPACK_COMPONENT_QTLIBS_INSTALL_TYPES Full)
253 |
254 | SET(CPACK_COMPONENT_GRAPHVIZLIBS_DISPLAY_NAME "Graphviz")
255 | SET(CPACK_COMPONENT_GRAPHVIZLIBS_DESCRIPTION
256 | "Graphviz libraries")
257 | SET(CPACK_COMPONENT_GRAPHVIZLIBS_GROUP "3rdPartyLibs")
258 | SET(CPACK_COMPONENT_GRAPHVIZLIBS_INSTALL_TYPES Full)
259 |
260 | SET(CPACK_COMPONENT_SAMPLE_DISPLAY_NAME "Sample")
261 | SET(CPACK_COMPONENT_SAMPLE_DESCRIPTION
262 | "Example application")
263 | SET(CPACK_COMPONENT_SAMPLE_DEPENDS library)
264 | SET(CPACK_COMPONENT_SAMPLE_INSTALL_TYPES Full)
265 |
266 | # used by NSIS to create startmenu links to the executables
267 | # this entrys are only useful if a bin folder is used, otherwise use the empty EXECUTABLES
268 | # and fill out the NSIS_MENU_LINKS
269 | SET(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "Sample" "Sample")
270 |
271 | # This must always be last!
272 | INCLUDE(CPack)
273 |
--------------------------------------------------------------------------------
/Qt Graphiz Visualizer/FAQ.txt:
--------------------------------------------------------------------------------
1 |
2 | For Windows user :
3 | - Download GraphViz librairie : http://www.graphviz.org/Download.php
4 | - Configure GRAPHVIZ_PATH in GraphViz.pro
5 | - Open with Qt Creator & compile
6 | - copy GraphViz dll to /bin :
7 | cdt.dll
8 | cgraph.dll
9 | gvc.dll
10 | gvplugin_core.dll
11 | gvplugin_dot_layout.dll (Sample use dot layout)
12 | libexpat.dll
13 | ltdl.dll
14 | Pathplan.dll
15 | vmalloc.dll
16 | zlib1.dll
17 | config6 (dont forget !)
18 |
19 | - copy Qt dll to /bin :
20 | QtCore4.dll
21 | QtGui4.dll
22 | mingwm10.dll and libgcc_s_dw2-1.dll (if using mingw32 compiler)
23 |
24 |
25 | COMPILATION BUG :
26 | - Graphviz2.36 Windows bundle forget to add "textspan.h"
27 | * Download missing file at : https://github.com/ellson/graphviz/blob/master/lib/common/textspan.h?source=cc
--------------------------------------------------------------------------------
/Qt Graphiz Visualizer/LICENSE.txt:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 |
9 | This version of the GNU Lesser General Public License incorporates
10 | the terms and conditions of version 3 of the GNU General Public
11 | License, supplemented by the additional permissions listed below.
12 |
13 | 0. Additional Definitions.
14 |
15 | As used herein, "this License" refers to version 3 of the GNU Lesser
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
17 | General Public License.
18 |
19 | "The Library" refers to a covered work governed by this License,
20 | other than an Application or a Combined Work as defined below.
21 |
22 | An "Application" is any work that makes use of an interface provided
23 | by the Library, but which is not otherwise based on the Library.
24 | Defining a subclass of a class defined by the Library is deemed a mode
25 | of using an interface provided by the Library.
26 |
27 | A "Combined Work" is a work produced by combining or linking an
28 | Application with the Library. The particular version of the Library
29 | with which the Combined Work was made is also called the "Linked
30 | Version".
31 |
32 | The "Minimal Corresponding Source" for a Combined Work means the
33 | Corresponding Source for the Combined Work, excluding any source code
34 | for portions of the Combined Work that, considered in isolation, are
35 | based on the Application, and not on the Linked Version.
36 |
37 | The "Corresponding Application Code" for a Combined Work means the
38 | object code and/or source code for the Application, including any data
39 | and utility programs needed for reproducing the Combined Work from the
40 | Application, but excluding the System Libraries of the Combined Work.
41 |
42 | 1. Exception to Section 3 of the GNU GPL.
43 |
44 | You may convey a covered work under sections 3 and 4 of this License
45 | without being bound by section 3 of the GNU GPL.
46 |
47 | 2. Conveying Modified Versions.
48 |
49 | If you modify a copy of the Library, and, in your modifications, a
50 | facility refers to a function or data to be supplied by an Application
51 | that uses the facility (other than as an argument passed when the
52 | facility is invoked), then you may convey a copy of the modified
53 | version:
54 |
55 | a) under this License, provided that you make a good faith effort to
56 | ensure that, in the event an Application does not supply the
57 | function or data, the facility still operates, and performs
58 | whatever part of its purpose remains meaningful, or
59 |
60 | b) under the GNU GPL, with none of the additional permissions of
61 | this License applicable to that copy.
62 |
63 | 3. Object Code Incorporating Material from Library Header Files.
64 |
65 | The object code form of an Application may incorporate material from
66 | a header file that is part of the Library. You may convey such object
67 | code under terms of your choice, provided that, if the incorporated
68 | material is not limited to numerical parameters, data structure
69 | layouts and accessors, or small macros, inline functions and templates
70 | (ten or fewer lines in length), you do both of the following:
71 |
72 | a) Give prominent notice with each copy of the object code that the
73 | Library is used in it and that the Library and its use are
74 | covered by this License.
75 |
76 | b) Accompany the object code with a copy of the GNU GPL and this license
77 | document.
78 |
79 | 4. Combined Works.
80 |
81 | You may convey a Combined Work under terms of your choice that,
82 | taken together, effectively do not restrict modification of the
83 | portions of the Library contained in the Combined Work and reverse
84 | engineering for debugging such modifications, if you also do each of
85 | the following:
86 |
87 | a) Give prominent notice with each copy of the Combined Work that
88 | the Library is used in it and that the Library and its use are
89 | covered by this License.
90 |
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 | document.
93 |
94 | c) For a Combined Work that displays copyright notices during
95 | execution, include the copyright notice for the Library among
96 | these notices, as well as a reference directing the user to the
97 | copies of the GNU GPL and this license document.
98 |
99 | d) Do one of the following:
100 |
101 | 0) Convey the Minimal Corresponding Source under the terms of this
102 | License, and the Corresponding Application Code in a form
103 | suitable for, and under terms that permit, the user to
104 | recombine or relink the Application with a modified version of
105 | the Linked Version to produce a modified Combined Work, in the
106 | manner specified by section 6 of the GNU GPL for conveying
107 | Corresponding Source.
108 |
109 | 1) Use a suitable shared library mechanism for linking with the
110 | Library. A suitable mechanism is one that (a) uses at run time
111 | a copy of the Library already present on the user's computer
112 | system, and (b) will operate properly with a modified version
113 | of the Library that is interface-compatible with the Linked
114 | Version.
115 |
116 | e) Provide Installation Information, but only if you would otherwise
117 | be required to provide such information under section 6 of the
118 | GNU GPL, and only to the extent that such information is
119 | necessary to install and execute a modified version of the
120 | Combined Work produced by recombining or relinking the
121 | Application with a modified version of the Linked Version. (If
122 | you use option 4d0, the Installation Information must accompany
123 | the Minimal Corresponding Source and Corresponding Application
124 | Code. If you use option 4d1, you must provide the Installation
125 | Information in the manner specified by section 6 of the GNU GPL
126 | for conveying Corresponding Source.)
127 |
128 | 5. Combined Libraries.
129 |
130 | You may place library facilities that are a work based on the
131 | Library side by side in a single library together with other library
132 | facilities that are not Applications and are not covered by this
133 | License, and convey such a combined library under terms of your
134 | choice, if you do both of the following:
135 |
136 | a) Accompany the combined library with a copy of the same work based
137 | on the Library, uncombined with any other library facilities,
138 | conveyed under the terms of this License.
139 |
140 | b) Give prominent notice with the combined library that part of it
141 | is a work based on the Library, and explaining where to find the
142 | accompanying uncombined form of the same work.
143 |
144 | 6. Revised Versions of the GNU Lesser General Public License.
145 |
146 | The Free Software Foundation may publish revised and/or new versions
147 | of the GNU Lesser General Public License from time to time. Such new
148 | versions will be similar in spirit to the present version, but may
149 | differ in detail to address new problems or concerns.
150 |
151 | Each version is given a distinguishing version number. If the
152 | Library as you received it specifies that a certain numbered version
153 | of the GNU Lesser General Public License "or any later version"
154 | applies to it, you have the option of following the terms and
155 | conditions either of that published version or of any later version
156 | published by the Free Software Foundation. If the Library as you
157 | received it does not specify a version number of the GNU Lesser
158 | General Public License, you may choose any version of the GNU Lesser
159 | General Public License ever published by the Free Software Foundation.
160 |
161 | If the Library as you received it specifies that a proxy can decide
162 | whether future versions of the GNU Lesser General Public License shall
163 | apply, that proxy's public statement of acceptance of any version is
164 | permanent authorization for you to choose that version for the
165 | Library.
166 |
--------------------------------------------------------------------------------
/Qt Graphiz Visualizer/QGVCore/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # enable all QT-Stuff we need
2 | # see http://cmake.org/cmake/help/cmake2.6docs.html#module:FindQt4 for a complete list
3 |
4 | SET(qgvlib_TS
5 | )
6 |
7 | SET(qgvlib_UI
8 |
9 | )
10 |
11 | # all files which may be mocced
12 | SET(qgvlib_CPP
13 | private/QGVCore.cpp
14 | private/QGVGraphPrivate.cpp
15 | private/QGVEdgePrivate.cpp
16 | private/QGVGvcPrivate.cpp
17 | private/QGVNodePrivate.cpp
18 | QGVEdge.cpp
19 | QGVNode.cpp
20 | QGVScene.cpp
21 | QGVSubGraph.cpp
22 | )
23 |
24 | SET(TARGET_NAME "QGVCore")
25 |
26 | # include with QT_USE selected library parts
27 | INCLUDE(${QT_USE_FILE})
28 |
29 | INCLUDE_DIRECTORIES(
30 | ${GRAPHVIZ_INCLUDE_DIR}
31 | ${CMAKE_CURRENT_BINARY_DIR}
32 | ${CMAKE_CURRENT_SOURCE_DIR}
33 | ${CMAKE_CURRENT_SOURCE_DIR}/private
34 | ${CMAKE_CURRENT_BINARY_DIR}/private
35 |
36 | )
37 | # Activate Export macro for building the library itself
38 | # if QGVCORE_LIB is not set or equal 0 (null), import macro is used
39 | ADD_DEFINITIONS(-DQGVCORE_LIB -D_PACKAGE_ast -D_dll_import -D_BLD_cdt -D_DLL_BLD)
40 |
41 | IF(BINDINGS_QT4)
42 | # QT5 does not declare and does not need QT_INCLUDES
43 | SET(INCLUDE_DIRECTORIES ${INCLUDES_DIRECTORIES} ${QT_INCLUDES})
44 | INCLUDE(${QT_USE_FILE})
45 | ENDIF(BINDINGS_QT4)
46 | ADD_DEFINITIONS(-DQVGCORE_LIB)
47 |
48 | IF(BINDINGS_QT4)
49 | QT4_AUTOMOC(${qgvlib_CPP})
50 | QT4_WRAP_UI(qgvlib_UI_H ${qgvlib_UI})
51 | QT4_ADD_TRANSLATION(qgvlib_TRANS ${qgvlib_TS})
52 | # -binary is not working
53 | # QT4_ADD_RESOURCES(RCCS "${QRCS}" OPTIONS "-binary")
54 | # QT4_ADD_RESOURCES(qgvlib_RCCS ${qgvlib_QRC})
55 | ENDIF(BINDINGS_QT4)
56 | IF(BINDINGS_QT5)
57 | QT5_WRAP_UI(qgvlib_UI_H ${qgvlib_UI})
58 | QT5_ADD_TRANSLATION(qgvlib_TRANS ${qgvlib_TS})
59 | QT5_ADD_RESOURCES(qgvlib_RCCS ${qgvlib_QRC})
60 | ENDIF(BINDINGS_QT5)
61 |
62 | ADD_LIBRARY(qgvcore SHARED
63 | ${qgvlib_CPP}
64 | ${qgvlib_UI_H}
65 | ${qgvlib_TRANS}
66 | )
67 |
68 | TARGET_LINK_LIBRARIES(qgvcore
69 | ${QT_LIBRARIES}
70 | ${GRAPHVIZ_GVC_LIBRARY}
71 | ${GRAPHVIZ_CGRAPH_LIBRARY}
72 | ${GRAPHVIZ_CDT_LIBRARY}
73 | )
74 |
75 | IF(BINDINGS_QT5)
76 | qt5_use_modules(QVGCore Core Widgets)
77 | ENDIF(BINDINGS_QT5)
78 |
79 | SET_TARGET_PROPERTIES(qgvcore PROPERTIES
80 | OUTPUT_NAME "QGVCore"
81 | VERSION ${TARGET_VERSION_MAJOR}.${TARGET_VERSION_MINOR}.${${PROJECT_NAME}_PATCH_LEVEL}
82 | SOVERSION ${TARGET_VERSION_MAJOR})
83 | IF(WIN32)
84 | # this extra install command is needed by the nsis installer
85 | INSTALL(TARGETS qgvcore
86 | RUNTIME DESTINATION ${LIB_INSTALL_DIR}
87 | COMPONENT library
88 | )
89 | ELSE(WIN32)
90 | INSTALL(TARGETS qgvcore
91 | ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
92 | LIBRARY DESTINATION ${LIB_INSTALL_DIR}
93 | COMPONENT library
94 | )
95 | ENDIF(WIN32)
96 |
97 | # The COMPONENT option only defines the internal belonging of the INSTALL'ed thing
98 | # INSTALL(
99 | # FILES ${qgvlib_TRANS}
100 | # DESTINATION ${qm_DIR}
101 | # COMPONENT library
102 | # )
103 |
104 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_NAME}.pc.in
105 | ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.pc @ONLY)
106 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_NAME}-uninstalled.pc.in
107 | ${CMAKE_BINARY_DIR}/${TARGET_NAME}-uninstalled.pc @ONLY)
108 |
109 | INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.pc
110 | DESTINATION lib/pkgconfig)
111 |
112 | IF(WIN32)
113 | # QuaZip
114 | # FIND_FILE(PACK_zlib zlib.dll PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH)
115 | # INSTALL(FILES ${QUAZIP_LIBRARIES} ${PACK_zlib} DESTINATION ${bin_DIR} COMPONENT library)
116 |
117 | # Qt itself
118 | FIND_FILE(PACK_qtcore QtCore4.dll PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH)
119 | FIND_FILE(PACK_qtgui QtGui4.dll PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH)
120 |
121 | FIND_FILE(PACK_mingwm10 mingwm10.dll PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH)
122 | FIND_FILE(PACK_libgcc_s_dw libgcc_s_dw2-1.dll PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH)
123 |
124 | INSTALL(
125 | FILES
126 | ${PACK_qtcore}
127 | ${PACK_qtgui}
128 | # ${PACK_qtnetwork}
129 | # ${PACK_qtsql}
130 | # ${PACK_libmysql}
131 | # ${PACK_qtxml}
132 | # ${PACK_qtxml_patterns}
133 | ${PACK_mingwm10}
134 | ${PACK_libgcc_s_dw}
135 | DESTINATION ${bin_DIR}
136 | COMPONENT qtlibs
137 | )
138 |
139 | INSTALL(
140 | FILES
141 | ${GRAPHVIZ_GVC_LIBRARY}
142 | ${GRAPHVIZ_CGRAPH_LIBRARY}
143 | ${GRAPHVIZ_CDT_LIBRARY}
144 | DESTINATION ${bin_DIR}
145 | COMPONENT graphvizlibs
146 | )
147 | ENDIF(WIN32)
148 |
149 | IF(BUILD_DEV)
150 | FILE(GLOB header "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
151 | INSTALL(
152 | FILES ${header}
153 | DESTINATION ${include_DIR}
154 | COMPONENT headerfiles
155 | )
156 | ENDIF(BUILD_DEV)
157 |
--------------------------------------------------------------------------------
/Qt Graphiz Visualizer/QGVCore/GraphViz.pri:
--------------------------------------------------------------------------------
1 | #GraphViz librairie
2 | DEFINES += WITH_CGRAPH
3 | INCLUDEPATH += private
4 | QMAKE_CXXFLAGS += -DQGVCORE_LIB
5 |
6 | unix {
7 | CONFIG += link_pkgconfig
8 | PKGCONFIG += libcdt libgvc libcgraph libgraph
9 | }
10 | win32 {
11 | #Configure Windows GraphViz path here :
12 | GRAPHVIZ_PATH = "C:/Program Files (x86)/Graphviz2.38/"
13 | DEFINES += WIN32_DLL
14 | DEFINES += GVDLL
15 | INCLUDEPATH += $$GRAPHVIZ_PATH/include/graphviz
16 | LIBS += -L$$GRAPHVIZ_PATH/lib/release/lib -lgvc -lcgraph -lgraph -lcdt
17 | }
18 |
--------------------------------------------------------------------------------
/Qt Graphiz Visualizer/QGVCore/QGVCore-uninstalled.pc.in:
--------------------------------------------------------------------------------
1 | libdir=@CMAKE_BINARY_DIR@/lib
2 | includedir=@CMAKE_CURRENT_SOURCE_DIR@
3 |
4 | Name: @TARGET_NAME@
5 | Description: @PROJECT_DESCRIPTION@
6 | Version: @PROJECT_VERSION@
7 | Requires: @PKGCONFIG_REQUIRES@
8 | Libs: -L${libdir} -l@TARGET_NAME@ @PKGCONFIG_LIBS@
9 | Cflags: -I${includedir} @PKGCONFIG_CFLAGS@
10 |
11 |
--------------------------------------------------------------------------------
/Qt Graphiz Visualizer/QGVCore/QGVCore.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@CMAKE_INSTALL_PREFIX@
2 | exec_prefix=@CMAKE_INSTALL_PREFIX@
3 | libdir=${prefix}/lib
4 | includedir=${prefix}/include
5 |
6 | Name: @TARGET_NAME@
7 | Description: @PROJECT_DESCRIPTION@
8 | Version: @PROJECT_VERSION@
9 | Requires: @PKGCONFIG_REQUIRES@
10 | Libs: -L${libdir} -l@TARGET_NAME@ @PKGCONFIG_LIBS@
11 | Cflags: -I${includedir} @PKGCONFIG_CFLAGS@
12 |
13 |
--------------------------------------------------------------------------------
/Qt Graphiz Visualizer/QGVCore/QGVCore.pro:
--------------------------------------------------------------------------------
1 | #-------------------------------------------------
2 | #
3 | # Project created by QtCreator 2013-04-17T09:06:06
4 | #
5 | #-------------------------------------------------
6 |
7 | QT += core
8 |
9 | greaterThan(QT_MAJOR_VERSION, 4){
10 | QT += widgets
11 | }
12 | lessThan(QT_MAJOR_VERSION, 5) {
13 | QT += gui
14 | }
15 |
16 | TARGET = QGVCore
17 | TEMPLATE = lib
18 | CONFIG += shared
19 |
20 | DESTDIR = ../lib
21 | DLLDESTDIR = ../bin
22 |
23 | #GraphViz librairie
24 | !include(GraphViz.pri) {
25 | error("fail open GraphViz.pri")
26 | }
27 |
28 | SOURCES += QGVScene.cpp \
29 | QGVNode.cpp \
30 | QGVEdge.cpp \
31 | QGVSubGraph.cpp \
32 | private/QGVCore.cpp \
33 | private/QGVGraphPrivate.cpp \
34 | private/QGVGvcPrivate.cpp \
35 | private/QGVEdgePrivate.cpp \
36 | private/QGVNodePrivate.cpp
37 |
38 | HEADERS += QGVScene.h \
39 | QGVNode.h \
40 | QGVEdge.h \
41 | QGVSubGraph.h \
42 | private/QGVCore.h \
43 | private/QGVGraphPrivate.h \
44 | private/QGVGvcPrivate.h \
45 | private/QGVEdgePrivate.h \
46 | private/QGVNodePrivate.h \
47 | qgv.h
48 |
--------------------------------------------------------------------------------
/Qt Graphiz Visualizer/QGVCore/QGVEdge.cpp:
--------------------------------------------------------------------------------
1 | /***************************************************************
2 | QGVCore
3 | Copyright (c) 2014, Bergont Nicolas, All rights reserved.
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 3.0 of the License, or (at your option) any later version.
9 |
10 | This library is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | Lesser General Public License for more details.
14 |
15 | You should have received a copy of the GNU Lesser General Public
16 | License along with this library.
17 | ***************************************************************/
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 |
26 | QGVEdge::QGVEdge(QGVEdgePrivate *edge, QGVScene *scene) : _scene(scene), _edge(edge)
27 | {
28 | setFlag(QGraphicsItem::ItemIsSelectable, true);
29 | }
30 |
31 | QGVEdge::~QGVEdge()
32 | {
33 | _scene->removeItem(this);
34 | delete _edge;
35 | }
36 |
37 | QString QGVEdge::label() const
38 | {
39 | return getAttribute("xlabel");
40 | }
41 |
42 | QRectF QGVEdge::boundingRect() const
43 | {
44 | return _path.boundingRect() | _head_arrow.boundingRect() | _tail_arrow.boundingRect() | _label_rect;
45 | }
46 |
47 | QPainterPath QGVEdge::shape() const
48 | {
49 | QPainterPathStroker ps;
50 | ps.setCapStyle(_pen.capStyle());
51 | ps.setWidth(_pen.widthF() + 10);
52 | ps.setJoinStyle(_pen.joinStyle());
53 | ps.setMiterLimit(_pen.miterLimit());
54 | return ps.createStroke(_path);
55 | }
56 |
57 | void QGVEdge::setLabel(const QString &label)
58 | {
59 | setAttribute("xlabel", label);
60 | }
61 |
62 | void QGVEdge::paint(QPainter * painter, const QStyleOptionGraphicsItem *, QWidget *)
63 | {
64 | painter->save();
65 |
66 | if(isSelected())
67 | {
68 | QPen tpen(_pen);
69 | tpen.setColor(_pen.color().darker(120));
70 | tpen.setStyle(Qt::DotLine);
71 | painter->setPen(tpen);
72 | }
73 | else
74 | painter->setPen(_pen);
75 |
76 |
77 | painter->drawPath(_path);
78 |
79 | /*
80 | QRectF pp = _path.controlPointRect();
81 | if(pp.width() < pp.height())
82 | {
83 | painter->save();
84 | painter->translate(_label_rect.topLeft());
85 | painter->rotate(90);
86 | painter->drawText(QRectF(QPointF(0, -_label_rect.width()), _label_rect.size()), Qt::AlignCenter, _label);
87 | painter->restore();
88 | }
89 | else
90 | */
91 | painter->drawText(_label_rect, Qt::AlignHCenter, _label);
92 |
93 | painter->setBrush(QBrush(_pen.color(), Qt::SolidPattern));
94 | painter->drawPolygon(_head_arrow);
95 | painter->drawPolygon(_tail_arrow);
96 | painter->restore();
97 | }
98 |
99 | void QGVEdge::setAttribute(const QString &name, const QString &value)
100 | {
101 | char empty[] = "";
102 | agsafeset(_edge->edge(), name.toLocal8Bit().data(), value.toLocal8Bit().data(), empty);
103 | }
104 |
105 | QString QGVEdge::getAttribute(const QString &name) const
106 | {
107 | char* value = agget(_edge->edge(), name.toLocal8Bit().data());
108 | if(value)
109 | return value;
110 | return QString();
111 | }
112 |
113 | void QGVEdge::updateLayout()
114 | {
115 | prepareGeometryChange();
116 |
117 | qreal gheight = QGVCore::graphHeight(_scene->_graph->graph());
118 |
119 | const splines* spl = ED_spl(_edge->edge());
120 | _path = QGVCore::toPath(spl, gheight);
121 |
122 |
123 | //Edge arrows
124 | if((spl->list != 0) && (spl->list->size%3 == 1))
125 | {
126 | if(spl->list->sflag)
127 | {
128 | _tail_arrow = toArrow(QLineF(QGVCore::toPoint(spl->list->list[0], gheight), QGVCore::toPoint(spl->list->sp, gheight)));
129 | }
130 |
131 | if(spl->list->eflag)
132 | {
133 | _head_arrow = toArrow(QLineF(QGVCore::toPoint(spl->list->list[spl->list->size-1], gheight), QGVCore::toPoint(spl->list->ep, gheight)));
134 | }
135 | }
136 |
137 | _pen.setWidth(1);
138 | _pen.setColor(QGVCore::toColor(getAttribute("color")));
139 | _pen.setStyle(QGVCore::toPenStyle(getAttribute("style")));
140 |
141 | //Edge label
142 | textlabel_t *xlabel = ED_xlabel(_edge->edge());
143 | if(xlabel)
144 | {
145 | _label = xlabel->text;
146 | _label_rect.setSize(QSize(xlabel->dimen.x, xlabel->dimen.y));
147 | _label_rect.moveCenter(QGVCore::toPoint(xlabel->pos, QGVCore::graphHeight(_scene->_graph->graph())));
148 | }
149 |
150 | setToolTip(getAttribute("tooltip"));
151 | }
152 |
153 | QPolygonF QGVEdge::toArrow(const QLineF &line) const
154 | {
155 | QLineF n = line.normalVector();
156 | QPointF o(n.dx() / 3.0, n.dy() / 3.0);
157 |
158 | //Only support normal arrow type
159 | QPolygonF polygon;
160 | polygon.append(line.p1() + o);
161 | polygon.append(line.p2());
162 | polygon.append(line.p1() - o);
163 |
164 | return polygon;
165 | }
166 |
--------------------------------------------------------------------------------
/Qt Graphiz Visualizer/QGVCore/QGVEdge.h:
--------------------------------------------------------------------------------
1 | /***************************************************************
2 | QGVCore
3 | Copyright (c) 2014, Bergont Nicolas, All rights reserved.
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 3.0 of the License, or (at your option) any later version.
9 |
10 | This library is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | Lesser General Public License for more details.
14 |
15 | You should have received a copy of the GNU Lesser General Public
16 | License along with this library.
17 | ***************************************************************/
18 | #ifndef QGVEDGE_H
19 | #define QGVEDGE_H
20 |
21 | #include "qgv.h"
22 | #include
23 | #include
24 |
25 | class QGVNode;
26 | class QGVScene;
27 | class QGVEdgePrivate;
28 |
29 | /**
30 | * @brief Edge item
31 | *
32 | */
33 | class QGVCORE_EXPORT QGVEdge : public QGraphicsItem
34 | {
35 | public:
36 | ~QGVEdge();
37 |
38 | QString label() const;
39 | QRectF boundingRect() const;
40 | QPainterPath shape() const;
41 |
42 | void setLabel(const QString &label);
43 |
44 | void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
45 |
46 | void setAttribute(const QString &name, const QString &value);
47 | QString getAttribute(const QString &name) const;
48 |
49 | void updateLayout();
50 |
51 | enum { Type = UserType + 3 };
52 | int type() const
53 | {
54 | return Type;
55 | }
56 |
57 | private:
58 | QGVEdge(QGVEdgePrivate *edge, QGVScene *scene);
59 |
60 | QPolygonF toArrow(const QLineF &normal) const;
61 |
62 | friend class QGVScene;
63 | //friend class QGVSubGraph;
64 |
65 | QGVScene *_scene;
66 | QGVEdgePrivate* _edge;
67 |
68 | QPainterPath _path;
69 | QPen _pen;
70 | QPolygonF _head_arrow;
71 | QPolygonF _tail_arrow;
72 |
73 | QString _label;
74 | QRectF _label_rect;
75 | };
76 |
77 | #endif // QGVEDGE_H
78 |
--------------------------------------------------------------------------------
/Qt Graphiz Visualizer/QGVCore/QGVNode.cpp:
--------------------------------------------------------------------------------
1 | /***************************************************************
2 | QGVCore
3 | Copyright (c) 2014, Bergont Nicolas, All rights reserved.
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 3.0 of the License, or (at your option) any later version.
9 |
10 | This library is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | Lesser General Public License for more details.
14 |
15 | You should have received a copy of the GNU Lesser General Public
16 | License along with this library.
17 | ***************************************************************/
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 |
26 | QGVNode::QGVNode(QGVNodePrivate *node, QGVScene *scene): _scene(scene), _node(node)
27 | {
28 | setFlag(QGraphicsItem::ItemIsSelectable, true);
29 | }
30 |
31 | QGVNode::~QGVNode()
32 | {
33 | _scene->removeItem(this);
34 | delete _node;
35 | }
36 |
37 | QString QGVNode::label() const
38 | {
39 | return getAttribute("label");
40 | }
41 |
42 | QString QGVNode::getfrequnecy() const
43 | {
44 | return QString::number(frequency);
45 | }
46 |
47 | void QGVNode::setLabel(const QString &label)
48 | {
49 | setAttribute("label", label);
50 | }
51 |
52 | QRectF QGVNode::boundingRect() const
53 | {
54 | return _path.boundingRect();
55 | }
56 |
57 | void QGVNode::paint(QPainter * painter, const QStyleOptionGraphicsItem *, QWidget *)
58 | {
59 | painter->save();
60 |
61 | painter->setPen(_pen);
62 |
63 | if(isSelected())
64 | {
65 | QBrush tbrush(_brush);
66 | tbrush.setColor(tbrush.color().darker(120));
67 | painter->setBrush(tbrush);
68 | }
69 | else
70 | painter->setBrush(_brush);
71 |
72 | painter->drawPath(_path);
73 |
74 | painter->setPen(QGVCore::toColor(getAttribute("labelfontcolor")));
75 |
76 | const QRectF rect = boundingRect().adjusted(2,2,-2,-2); //Margin
77 |
78 | painter->drawText(rect, Qt::AlignCenter , alable);
79 | painter->drawText(rect, Qt::AlignTop | Qt::AlignHCenter, QGVNode::getfrequnecy());
80 | painter->restore();
81 | }
82 |
83 | void QGVNode::setAttribute(const QString &name, const QString &value)
84 | {
85 | char empty[] = "";
86 | agsafeset(_node->node(), name.toLocal8Bit().data(), value.toLocal8Bit().data(), empty);
87 | }
88 |
89 | QString QGVNode::getAttribute(const QString &name) const
90 | {
91 | char* value = agget(_node->node(), name.toLocal8Bit().data());
92 | if(value)
93 | return value;
94 | return QString();
95 | }
96 |
97 | void QGVNode::setIcon(const QImage &icon)
98 | {
99 | _icon = icon;
100 | }
101 |
102 | void QGVNode::updateLayout()
103 | {
104 | prepareGeometryChange();
105 | qreal width = ND_width(_node->node())*DotDefaultDPI;
106 | qreal height = ND_height(_node->node())*DotDefaultDPI;
107 |
108 | //Node Position (center)
109 | qreal gheight = QGVCore::graphHeight(_scene->_graph->graph());
110 | setPos(QGVCore::centerToOrigin(QGVCore::toPoint(ND_coord(_node->node()), gheight), width, height));
111 |
112 | //Node on top
113 | setZValue(1);
114 |
115 | //Node path
116 | _path = QGVCore::toPath(ND_shape(_node->node())->name, (polygon_t*)ND_shape_info(_node->node()), width, height);
117 | _pen.setWidth(1);
118 |
119 | _brush.setStyle(QGVCore::toBrushStyle(getAttribute("style")));
120 | _brush.setColor(QGVCore::toColor(getAttribute("fillcolor")));
121 | _pen.setColor(QGVCore::toColor(getAttribute("color")));
122 |
123 | setToolTip(getAttribute("tooltip"));
124 | }
125 |
--------------------------------------------------------------------------------
/Qt Graphiz Visualizer/QGVCore/QGVNode.h:
--------------------------------------------------------------------------------
1 | /***************************************************************
2 | QGVCore
3 | Copyright (c) 2014, Bergont Nicolas, All rights reserved.
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 3.0 of the License, or (at your option) any later version.
9 |
10 | This library is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | Lesser General Public License for more details.
14 |
15 | You should have received a copy of the GNU Lesser General Public
16 | License along with this library.
17 | ***************************************************************/
18 | #ifndef QGVNODE_H
19 | #define QGVNODE_H
20 |
21 | #include "qgv.h"
22 | #include
23 | #include
24 |
25 | class QGVEdge;
26 | class QGVScene;
27 | class QGVNodePrivate;
28 |
29 | /**
30 | * @brief Node item
31 | *
32 | */
33 | class QGVCORE_EXPORT QGVNode : public QGraphicsItem
34 | {
35 | public:
36 | ~QGVNode();
37 |
38 | QString label() const;
39 | QString alable;
40 | QString getfrequnecy() const;
41 | void setLabel(const QString &label);
42 |
43 | QRectF boundingRect() const;
44 | void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
45 | void setAttribute(const QString &label, const QString &value);
46 | QString getAttribute(const QString &name) const;
47 |
48 | void setIcon(const QImage &icon);
49 |
50 | enum { Type = UserType + 2 };
51 | int type() const
52 | {
53 | return Type;
54 | }
55 |
56 | private:
57 | friend class QGVScene;
58 | friend class QGVSubGraph;
59 | void updateLayout();
60 | QGVNode(QGVNodePrivate* node, QGVScene *scene);
61 |
62 | // Not implemented in QGVNode.cpp
63 | // QPainterPath makeShape(Agnode_t* node) const;
64 | // QPolygonF makeShapeHelper(Agnode_t* node) const;
65 |
66 | QPainterPath _path;
67 | QPen _pen;
68 | QBrush _brush;
69 | QImage _icon;
70 | int frequency;
71 | QGVScene *_scene;
72 | QGVNodePrivate* _node;
73 | };
74 |
75 |
76 | #endif // QGVNODE_H
77 |
--------------------------------------------------------------------------------
/Qt Graphiz Visualizer/QGVCore/QGVScene.cpp:
--------------------------------------------------------------------------------
1 | /***************************************************************
2 | QGVCore
3 | Copyright (c) 2014, Bergont Nicolas, All rights reserved.
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 3.0 of the License, or (at your option) any later version.
9 |
10 | This library is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | Lesser General Public License for more details.
14 |
15 | You should have received a copy of the GNU Lesser General Public
16 | License along with this library.
17 | ***************************************************************/
18 | #include "QGVScene.h"
19 | // The following include allows the automoc to detect, that it must moc this class
20 | #include "moc_QGVScene.cpp"
21 | #include
22 |
23 | #include
24 | #include
25 | #include
26 |
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 |
34 | QGVScene::QGVScene(const QString &name, QObject *parent) : QGraphicsScene(parent)
35 | {
36 | _context = new QGVGvcPrivate(gvContext());
37 | _graph = new QGVGraphPrivate(agopen(name.toLocal8Bit().data(), Agdirected, NULL));
38 | //setGraphAttribute("fontname", QFont().family());
39 | }
40 |
41 | QGVScene::~QGVScene()
42 | {
43 | gvFreeLayout(_context->context(), _graph->graph());
44 | agclose(_graph->graph());
45 | gvFreeContext(_context->context());
46 | delete _graph;
47 | delete _context;
48 | }
49 |
50 | void QGVScene::setGraphAttribute(const QString &name, const QString &value)
51 | {
52 | agattr(_graph->graph(), AGRAPH, name.toLocal8Bit().data(), value.toLocal8Bit().data());
53 | }
54 |
55 | void QGVScene::setNodeAttribute(const QString &name, const QString &value)
56 | {
57 | agattr(_graph->graph(), AGNODE, name.toLocal8Bit().data(), value.toLocal8Bit().data());
58 | }
59 |
60 | void QGVScene::setEdgeAttribute(const QString &name, const QString &value)
61 | {
62 | agattr(_graph->graph(), AGEDGE, name.toLocal8Bit().data(), value.toLocal8Bit().data());
63 | }
64 |
65 | QGVNode *QGVScene::addNode(const QString &label , int frequency)
66 | {
67 | Agnode_t *node = agnode(_graph->graph(), NULL, TRUE);
68 | if(node == NULL)
69 | {
70 | qWarning()<<"Invalid node :"<