Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a Crossing Minimizer that does nothing. (#795)
Note that this does only work as intended if greedySwitch.type is set to off. This also includes a small debugging addition to the SortByInputModel processor. Signed-off-by: Soeren Domroes <sdo@informatik.uni-kiel.de>
- Loading branch information
1 parent
6a0fdeb
commit 1ddffd3
Showing
3 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
....eclipse.elk.alg.layered/src/org/eclipse/elk/alg/layered/p3order/NoCrossingMinimizer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Kiel University and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package org.eclipse.elk.alg.layered.p3order; | ||
|
||
import org.eclipse.elk.alg.layered.LayeredPhases; | ||
import org.eclipse.elk.alg.layered.graph.LGraph; | ||
import org.eclipse.elk.alg.layered.intermediate.IntermediateProcessorStrategy; | ||
import org.eclipse.elk.alg.layered.options.GreedySwitchType; | ||
import org.eclipse.elk.core.alg.ILayoutPhase; | ||
import org.eclipse.elk.core.alg.LayoutProcessorConfiguration; | ||
import org.eclipse.elk.core.util.IElkProgressMonitor; | ||
|
||
/** | ||
* This class does nothing instead of minimizing crossing. Everything remains as it was before. | ||
* <dl> | ||
* <dt>Precondition:</dt> | ||
* <dd>The graph has a proper layering, i.e. all long edges have been splitted; all nodes have at least fixed port | ||
* sides. This is, however, not checked but preceding processors or phases might depend on this.</dd> | ||
* <dt>Postcondition:</dt> | ||
* <dd>The order of nodes and ports remains as it was before this phase.</dd> | ||
* <dt>Dependencies:</dt> | ||
* <dd>It is advised to set {@link GreedySwitchType} to OFF. Otherwise, nodes and ports might be reordered | ||
* if crossings are created.</dd> | ||
* </dl> | ||
* | ||
*/ | ||
public class NoCrossingMinimizer implements ILayoutPhase<LayeredPhases, LGraph> { | ||
|
||
@Override | ||
public void process(final LGraph graph, final IElkProgressMonitor progressMonitor) { | ||
progressMonitor.begin("No crossing minimization", 1); | ||
progressMonitor.done(); | ||
|
||
} | ||
|
||
@Override | ||
public LayoutProcessorConfiguration<LayeredPhases, LGraph> getLayoutProcessorConfiguration(final LGraph graph) { | ||
LayoutProcessorConfiguration<LayeredPhases, LGraph> configuration = | ||
LayoutProcessorConfiguration.createFrom(INTERMEDIATE_PROCESSING_CONFIGURATION); | ||
configuration.addBefore(LayeredPhases.P3_NODE_ORDERING, IntermediateProcessorStrategy.PORT_LIST_SORTER); | ||
|
||
return configuration; | ||
} | ||
|
||
|
||
|
||
/** intermediate processing configuration. */ | ||
private static final LayoutProcessorConfiguration<LayeredPhases, LGraph> INTERMEDIATE_PROCESSING_CONFIGURATION = | ||
LayoutProcessorConfiguration.<LayeredPhases, LGraph>create() | ||
.addBefore(LayeredPhases.P3_NODE_ORDERING, IntermediateProcessorStrategy.LONG_EDGE_SPLITTER) | ||
.addBefore(LayeredPhases.P4_NODE_PLACEMENT, | ||
IntermediateProcessorStrategy.IN_LAYER_CONSTRAINT_PROCESSOR) | ||
.after(LayeredPhases.P5_EDGE_ROUTING) | ||
.add(IntermediateProcessorStrategy.LONG_EDGE_JOINER); | ||
|
||
} |