use of org.eclipse.elk.graph.properties.IPropertyHolder in project elk by eclipse.
the class DiagramLayoutEngine method handleAncestors.
/**
* Handle the ancestors of the parent element if {@link CoreOptions#LAYOUT_ANCESTORS} is set.
* For every ancestor node of the parent element (i.e. {@link LayoutMapping#getParentElement()}),
* all containing elements that are not ancestors are excluded from layout.
*
* @param mapping
* a mapping for the layout graph
* @param params
* layout parameters
*/
protected void handleAncestors(final LayoutMapping mapping, final Parameters params) {
boolean layoutAncestors = params.getGlobalSettings().getProperty(CoreOptions.LAYOUT_ANCESTORS);
if (layoutAncestors) {
// Mark all parallel areas for exclusion from layout
ElkGraphElement graphElem = mapping.getGraphMap().inverse().get(mapping.getParentElement());
if (graphElem instanceof ElkNode && ((ElkNode) graphElem).getParent() != null) {
if (params.configurators.isEmpty()) {
params.configurators.add(new LayoutConfigurator());
}
ElkNode node = (ElkNode) graphElem;
do {
ElkNode parent = node.getParent();
for (ElkNode child : parent.getChildren()) {
if (child != node) {
for (IGraphElementVisitor c : params.configurators) {
if (c instanceof LayoutConfigurator) {
IPropertyHolder childConfig = ((LayoutConfigurator) c).configure(child);
// Do not layout the content of the child node
childConfig.setProperty(CoreOptions.NO_LAYOUT, true);
// Do not change the size of the child node
childConfig.setProperty(CoreOptions.NODE_SIZE_CONSTRAINTS, SizeConstraint.fixed());
// Do not move the ports of the child node
childConfig.setProperty(CoreOptions.PORT_CONSTRAINTS, PortConstraints.FIXED_POS);
}
}
}
}
node = parent;
} while (node.getParent() != null);
}
}
}
use of org.eclipse.elk.graph.properties.IPropertyHolder in project elk by eclipse.
the class CompoundGraphPreprocessor method createExternalPortProperties.
/**
* Create suitable port properties for dummy external ports.
*
* @param graph
* the graph for which the dummy external port is created
* @return properties to apply to the dummy port
*/
private static IPropertyHolder createExternalPortProperties(final LGraph graph) {
IPropertyHolder propertyHolder = new MapPropertyHolder();
// FIXME No idea why ...
double offset = graph.getProperty(LayeredOptions.SPACING_EDGE_EDGE) / 2;
propertyHolder.setProperty(LayeredOptions.PORT_BORDER_OFFSET, offset);
return propertyHolder;
}
use of org.eclipse.elk.graph.properties.IPropertyHolder in project sirius-components by eclipse-sirius.
the class SiriusWebLayoutConfigurator method visit.
@Override
public void visit(final ElkGraphElement element) {
super.visit(element);
IPropertyHolder typeProperties = this.getPropertiesByType(element.getProperty(ELKDiagramConverter.PROPERTY_TYPE));
this.applyProperties(element, typeProperties);
IPropertyHolder idProperties = this.getPropertiesById(element.getIdentifier());
this.applyProperties(element, idProperties);
}
Aggregations