Graph Layout offers the facility to convert graph layout
parameters into named properties of IlvGrapher. The same facility is available
to convert label layout parameters into named properties of the
IlvManager
. Named properties can be stored in
.ivl
files.
The following method indicates whether a
label layout class supports this mechanism:
It returns
true
if the layout class can transfer the parameter settings to named
properties.
Saving layout parameters to .ivl files
The following example shows how to save an
IlvManager
instance, including all label layout parameter settings, to an
.ivl
file.
IlvDefaultLabelingModel labelingModel = (IlvDefaultLabelingModel)labelLayout.getLabelingModel(); // transfer the layout parameters to named properties if (labelLayout.supportsSaveParametersToNamedProperties()) labelingModel.saveParametersToNamedProperties(labelLayout, false); // save the attached manager with the named layout properties to file labelingModel.getManager().write("abcd.ivl"); // remove the named layout properties because they are no longer needed labelingModel.removeParametersFromNamedProperties();
The mechanism is the same as in the graph layout module. See Saving layout parameters to .ivl files.
Loading layout parameters from .ivl files
The following example shows how to load and recover the
parameters of the label layout when the layout settings are
stored in an
.ivl
file:
// Read the IVL file. This reads all named properties as well. manager.read("abcd.ivl"); IlvDefaultLabelingModel labelingModel = (IlvDefaultLabelingModel)labelLayout.getLabelingModel(); // Transfer the parameter settings from the named properties to the layout. // At this time point, the manager must be attached to the label layout labelingModel.loadParametersFromNamedProperties(labelLayout); // just to be sure that no named layout properties remain in the memory labelingModel.removeParametersFromNamedProperties();
The mechanism is the same as in the graph layout Module. See Loading layout parameters from .ivl files.