Using a Layout Report
Layout reports are objects used to store information about the particular behavior of a layout algorithm. After the layout is completed, this information is available to be read from the layout report.
Layout Report Classes
Each layout class instantiates a particular class of
IlvGraphLayoutReport each time the layout is performed. Table 5.1 shows the layout classes and their corresponding layout reports.
Layout Report Classes
Layout Class | Layout Report Class |
| |
| |
| |
| |
| |
Creating a Layout Report
All layout classes inherit the
IlvGraphLayout::performLayout method from the
IlvGraphLayout class. This method calls
IlvGraphLayout::createLayoutReport to obtain a new instance of the layout report. This instance is returned when
IlvGraphLayout::performLayout returns. The default implementation in the base layout class creates an instance of
IlvGraphLayoutReport. Some subclasses override this method to return an appropriate subclass. Other classes, such as
IlvRandomLayout, do not need specific information to be stored in the layout report and do not override
IlvGraphLayout::createLayoutReport. In this case, the base class
IlvGraphLayoutReport is used.
When using the layout classes provided with Rogue Wave Views, you do not need to instantiate the layout report yourself. This is done automatically.
The instantiation is made by internal methods and is managed by the class. Thus, you do not need to delete the instance returned by the IlvGraphLayout::performLayout method.
Reading a Layout Report
To read a layout report, all you need to do is store the layout report instance returned by the
IlvGraphLayout::performLayout method and read the information, as shown in the following example for the Spring Embedder Layout:
IlvGraphLayoutReport* layoutReport = layout->performLayout(); if (layoutReport->getCode() == IlvLayoutReportLayoutDone) IlvPrint("Layout done."); else IlvWarning("Layout not done. Error code = %d\n", layoutReport->getCode()); |
Information Stored in a Layout Report
The base class
IlvGraphLayoutReport stores the following information:
Code
This field contains information about special, predefined cases that may have occurred during the layout. The possible values are the following:
IlvLayoutReportLayoutDone appears if the layout was performed successfully.
IlvLayoutReportNotNeeded appears if the layout was not performed because no changes occurred in the grapher and parameters since the last time the layout was performed successfully.
IlvLayoutReportEmptyGrapher appears if the grapher is empty.
IlvLayoutReportNoMoveableNode appears if you specified all the nodes as fixed.
To read the code, use the method:
Layout Time
This field contains the total duration of the layout algorithm at the end of the layout. To read the time (in milliseconds), use the method:
Version 6.2.1
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.