org.opentcs.modeleditor.util.FigureCloner Maven / Gradle / Ivy
The newest version!
/**
* Copyright (c) The openTCS Authors.
*
* This program is free software and subject to the MIT license. (For details,
* see the licensing information (LICENSE.txt) you should have received with
* this copy of the software.)
*/
package org.opentcs.modeleditor.util;
import static java.util.Objects.requireNonNull;
import jakarta.inject.Inject;
import java.awt.geom.AffineTransform;
import java.io.File;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;
import org.jhotdraw.draw.Figure;
import org.jhotdraw.draw.connector.Connector;
import org.opentcs.guing.base.model.ConnectableModelComponent;
import org.opentcs.guing.base.model.ModelComponent;
import org.opentcs.guing.base.model.elements.AbstractConnection;
import org.opentcs.guing.common.components.drawing.OpenTCSDrawingEditor;
import org.opentcs.guing.common.components.drawing.OpenTCSDrawingView;
import org.opentcs.guing.common.components.drawing.figures.BitmapFigure;
import org.opentcs.guing.common.components.drawing.figures.FigureConstants;
import org.opentcs.guing.common.components.drawing.figures.LabeledFigure;
import org.opentcs.guing.common.components.drawing.figures.SimpleLineConnection;
import org.opentcs.guing.common.persistence.ModelManager;
/**
* A helper class for cloning figures.
*/
public class FigureCloner {
/**
* The application's model manager.
*/
private final ModelManager fModelManager;
/**
* The application's drawing editor.
*/
private final OpenTCSDrawingEditor fDrawingEditor;
/**
* Creates a new instance.
*
* @param modelManager The application's model manager.
* @param drawingEditor The application's drawing editor.
*/
@Inject
public FigureCloner(ModelManager modelManager, OpenTCSDrawingEditor drawingEditor) {
this.fModelManager = requireNonNull(modelManager, "modelManager");
this.fDrawingEditor = requireNonNull(drawingEditor, "drawingEditor");
}
public List