Tulip Developer Handbook Tulip Developer Handbook Table of Contents 1
Total Page:16
File Type:pdf, Size:1020Kb
Tulip Developer Handbook Tulip Developer Handbook Table of Contents 1. Introduction ................................................................................ 1 2. Installation ................................................................................. 2 2.1. Options ............................................................................. 2 3. Tulip Library ............................................................................... 4 3.1. Introduction ......................................................................... 4 3.2. Graphs ............................................................................. 4 3.3. Hierarchy of graphs .................................................................. 5 3.4. Attributes ........................................................................... 6 3.5. Properties ........................................................................... 6 3.6. TUTORIAL Intro. ................................................................... 8 3.7. TUTORIAL 001 : Graphs creation, adding and deleting nodes or edges. ................... 8 3.7.1. 1. Header files ............................................................... 8 3.7.2. 2. Creation of a Graph ........................................................ 9 3.7.3. 3. Add nodes ................................................................. 9 3.7.4. 4. Add edges ................................................................. 9 3.7.5. 5. Delete an edge and a node ................................................. 10 3.7.6. 6. Printing the graph ......................................................... 11 3.7.7. 7. Saving a graph ............................................................ 11 3.7.8. 8. Graph deletion ............................................................ 11 3.7.9. 9. Compiling and running the program. ........................................ 12 3.7.10. 10. Source Code ........................................................... 12 3.8. TUTORIAL 002 : Iterating over a graph (class Iterator and the macro forEach) ............ 13 3.8.1. 1. Header files (Same as Tutorial 1) ........................................... 14 3.8.2. 2. Iterating over all nodes .................................................... 14 3.8.3. 3. Iterating through a node predecessors ....................................... 15 3.8.4. 4. Iterating through a node successors ......................................... 15 3.8.5. 5. Iterating through a node neighbors (predecessors and successors) ............... 15 3.8.6. 6. Iterating through a node incoming edges ..................................... 16 3.8.7. 7. Iterating through a node outgoing edges ..................................... 16 3.8.8. 8. Iterating through a node adjacent edges ...................................... 16 3.8.9. Don’t forget memory leaks ................................................... 17 3.8.10. 9. Iterating on edges (all edges). ............................................. 17 3.8.11. 10. The forEach Macro ..................................................... 17 3.8.12. Source Code ............................................................... 18 3.9. TUTORIAL 003 : Properties ........................................................ 20 3.9.1. 1. Header files and predefined properties ....................................... 20 3.9.2. 2. Creation of a property. .................................................... 21 3.9.3. 3. Initialize all properties. .................................................... 21 3.9.4. 4. Iterating over properties. .................................................. 22 3.9.5. Source Code ................................................................ 22 3.10. TUTORIAL 004 : Create your first subgraph. ........................................ 24 3.10.1. Source Code ............................................................... 25 3.11. TUTORIAL 005 : Properties and subgraphs .......................................... 26 3.11.1. 1. Introduction ............................................................ 26 3.11.2. 2. Properties of subgraph1 .................................................. 27 3.11.3. 3. Properties of subgraph2 .................................................. 28 3.11.4. Source Code ............................................................... 29 3.12. TUTORIAL 006 : Edges order. ..................................................... 31 3.12.1. 1. Creation of the graph and its edges ........................................ 31 3.12.2. 2. Swap edges ............................................................. 32 3.12.3. 3. Setting an order .......................................................... 33 3.12.4. Source Code ............................................................... 33 3.13. TUTORIAL 007 : Mutable Collection ............................................... 34 3.14. TUTORIAL 008 : Graph Tests ...................................................... 35 3.15. TUTORIAL 009 : ObservableGraph ................................................. 36 3.15.1. 1. Our new class, GraphObserverTest : ....................................... 36 iii Tulip De- opervel- Hand- book 3.15.2. 2. The Main function ....................................................... 37 4. Tulip Open GL Library ..................................................................... 38 4.1. Introduction ....................................................................... 38 4.2. 2D/3D for Tulip .................................................................... 38 4.2.1. Augmented Displays with GlEntity system ..................................... 38 4.2.2. GlSimpleEntity ............................................................. 38 4.2.3. Gl 2D/3D classes ............................................................ 38 4.2.4. Scene and layers ............................................................ 39 4.2.5. Examples of Gl shape uses ................................................... 39 5. Tulip QT Library .......................................................................... 44 5.1. Introduction ....................................................................... 44 5.2. Interactors ......................................................................... 45 5.2.1. Interactor example ........................................................... 45 5.2.2. Interactor Component ........................................................ 45 5.2.3. Interactor itself .............................................................. 46 5.2.4. INTERACTORPLUGIN macro ............................................... 48 5.3. Views ............................................................................. 48 5.3.1. View example ............................................................... 48 5.3.2. How to create a view ......................................................... 49 5.3.3. An other solution : Use AbstractView or GlMainView ........................... 50 5.4. Controllers ........................................................................ 53 5.4.1. Empty Controller ............................................................ 54 5.4.2. Controller example .......................................................... 55 5.4.3. ControllerPluginExample .................................................... 55 5.4.4. ControllerAlgorithmTools class ............................................... 58 5.4.5. ControllerViewsTools class ................................................... 58 5.4.6. ControllerViewsManager class ................................................ 59 6. Plug-ins development ...................................................................... 60 6.1. The PropertyAlgorithm class. ........................................................ 60 6.1.1. Overview of the class ........................................................ 61 6.1.2. Parameters : ................................................................ 62 6.1.3. The PluginProgress class. .................................................... 65 6.1.4. Example of a plugin skeleton ................................................. 66 6.2. The Algorithm class. ............................................................... 67 6.2.1. Public members ............................................................. 67 6.2.2. Protected members .......................................................... 68 6.3. Import plug-ins ..................................................................... 68 6.3.1. Public members ............................................................. 68 6.3.2. Protected members .......................................................... 69 6.3.3. Skeleton an ImportModule derived class ....................................... 69 6.4. Export plug-ins ..................................................................... 70 6.4.1. Public members ............................................................. 70 6.4.2. Protected members .......................................................... 70 6.4.3. Skeleton of an ExportModule derived class ..................................... 71 6.5. Compilation ( Makefiles ) ........................................................... 71 7. Tulip graph format ......................................................................... 74 7.1. Nodes ............................................................................. 74 7.2. Edges ............................................................................. 74 7.3. Clusters ..........................................................................