20 package net.sf.gridarta.gui.copybuffer;
22 import java.awt.Point;
23 import java.awt.Rectangle;
24 import java.util.Collection;
25 import java.util.HashSet;
26 import java.util.List;
42 import org.jetbrains.annotations.NotNull;
86 public CopyBuffer(@NotNull
final MapViewSettings mapViewSettings, @NotNull
final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull
final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull
final MapModelFactory<G, A, R> mapModelFactory, @NotNull
final InsertionModeSet<G, A, R> insertionModeSet) {
88 final A mapArchObject = mapArchObjectFactory.newMapArchObject(
false);
89 mapArchObject.setMapName(
"cb");
90 mapModel = mapModelFactory.newMapModel(mapArchObject);
150 copyMode.prepare(
mapModel,
new Size2D(selectedRec.width, selectedRec.height));
155 final Collection<G> gameObjectsToDelete =
new HashSet<>();
156 final Point pos =
new Point();
158 square.getMapLocation(pos, -selectedRec.x, -selectedRec.y);
159 for (
final G gameObject : square) {
185 final Point pos =
new Point();
187 square.getMapLocation(pos);
188 pos.translate(startLocation.x, startLocation.y);
191 if (!gameObject.isMulti()) {
199 square.getMapLocation(pos);
200 pos.translate(startLocation.x, startLocation.y);
203 if (gameObject.isMulti()) {
221 final Point sourcePoint =
new Point();
222 final Point destinationPoint =
new Point();
228 sourcePoint.x =
MathUtils.
mod(destinationMapSquare.getMapX() - origin.x, mapModelSize.
getWidth());
232 if (!gameObject.isMulti()) {
233 destinationPoint.x = destinationMapSquare.
getMapX();
234 destinationPoint.y = destinationMapSquare.getMapY();
241 sourcePoint.x =
MathUtils.
mod(destinationMapSquare.getMapX() - origin.x, mapModelSize.
getWidth());
245 if (gameObject.isMulti()) {
246 destinationPoint.x = destinationMapSquare.
getMapX();
247 destinationPoint.y = destinationMapSquare.getMapY();