-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement Visualizer multi select of bots
See merge request main/Sumatra!1882 sumatra-commit: b6968c028d84b859804e6f9e72c9c7e7c1816c9e
- Loading branch information
Showing
8 changed files
with
279 additions
and
6 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
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
15 changes: 15 additions & 0 deletions
15
...-visualizer/src/main/java/edu/tigers/sumatra/visualizer/field/ISelectedRobotsChanged.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,15 @@ | ||
/* | ||
* Copyright (c) 2009 - 2024, DHBW Mannheim - TIGERs Mannheim | ||
*/ | ||
|
||
package edu.tigers.sumatra.visualizer.field; | ||
|
||
import edu.tigers.sumatra.ids.BotID; | ||
|
||
import java.util.List; | ||
|
||
|
||
public interface ISelectedRobotsChanged | ||
{ | ||
void selectedRobotsChanged(List<BotID> selectedBots); | ||
} |
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
56 changes: 56 additions & 0 deletions
56
...main/java/edu/tigers/sumatra/visualizer/field/components/RobotPositionerMouseAdapter.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,56 @@ | ||
/* | ||
* Copyright (c) 2009 - 2022, DHBW Mannheim - TIGERs Mannheim | ||
*/ | ||
|
||
package edu.tigers.sumatra.visualizer.field.components; | ||
|
||
import edu.tigers.sumatra.drawable.DrawableLine; | ||
import edu.tigers.sumatra.math.line.ILineSegment; | ||
import edu.tigers.sumatra.math.line.Lines; | ||
import edu.tigers.sumatra.math.vector.IVector2; | ||
import edu.tigers.sumatra.visualizer.field.callbacks.MousePointTransformer; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import javax.swing.SwingUtilities; | ||
import java.awt.event.MouseAdapter; | ||
import java.awt.event.MouseEvent; | ||
import java.util.function.Consumer; | ||
|
||
|
||
@RequiredArgsConstructor | ||
public class RobotPositionerMouseAdapter extends MouseAdapter | ||
{ | ||
private final MousePointTransformer mousePointTransformer; | ||
private final Consumer<DrawableLine> drawableLineConsumer; | ||
private final Consumer<ILineSegment> lineConsumer; | ||
private IVector2 dragPointStart; | ||
|
||
@Override | ||
public void mousePressed(final MouseEvent e) | ||
{ | ||
dragPointStart = mousePointTransformer.toGlobal(e.getX(), e.getY()); | ||
} | ||
|
||
|
||
@Override | ||
public void mouseDragged(final MouseEvent e) | ||
{ | ||
if (SwingUtilities.isRightMouseButton(e) && (e.isControlDown()) && dragPointStart != null) | ||
{ | ||
IVector2 dragPointEnd = mousePointTransformer.toGlobal(e.getX(), e.getY()); | ||
ILineSegment line = Lines.segmentFromPoints(dragPointStart, dragPointEnd); | ||
DrawableLine drawableLine = new DrawableLine(line); | ||
drawableLineConsumer.accept(drawableLine); | ||
lineConsumer.accept(line); | ||
} | ||
} | ||
|
||
|
||
@Override | ||
public void mouseReleased(final MouseEvent e) | ||
{ | ||
dragPointStart = null; | ||
drawableLineConsumer.accept(null); | ||
lineConsumer.accept(null); | ||
} | ||
} |
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
Oops, something went wrong.