Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#51 make geometryitems clickable #95

Closed
wants to merge 26 commits into from

Conversation

DorianRec
Copy link
Collaborator

@DorianRec DorianRec commented Dec 19, 2019

This recognizes the GeometryItem nearest to the mouse-clicked position.
GeometryItem will be printed out via log.info() and "highlighted".

Changes:

  • Added a class Treasure.
  • Added class Selectable, which SearchPath, Hint and Treasure extend.
  • Gave all Selectables a method getGeometry, since all contain one selectable Geometry - object.
  • GameEngine now creates new SearchPath-Objects containing all LineSegments, of the searchers searchPath, instead of lacking the first LineSegment. This makes the SearchPath Class much easier to use, since we do not need to give it the first point of the searchpath in order to get the search path.
  • Gave GameManager the method List<Selectable> pickGeometry(Coordinate mouse, double distance), which returns a list of Selectables, the user may have selected.
  • Gave GameManager the method void refreshHighlighter(Coordinate coordinate, double scale), which selects a new Selecable. Thus, the method is called, when the user clicks the coordinate-system.
  • Gave Turn the method void unselect(), which unselects the SearchPath, Hint and Treasure, the Turn contains.
  • Gave Turn the method List<GeometryItem<?>> getSelectedGeometryItems(Point movementStart).
  • Removed the variable visible from the class GeometryStyle, since it was never used and is useless.
  • Gave JTSUtils the method static Polygon toPolygon(Envelope envelope).
  • Gave the Renderer the method static Stream<GeometryItem<?>> getHighlighter(List<Turn> turns, int viewIndex).
  • Changed the method void onCanvasClicked(MouseEvent mouseEvent) in CanvasController, such that selecting of an Selectable.

Issues:

  • Non-Scaling GeometryItems, like AngleHint are not highlighted correctly,
    but this is out of the scope of this issue!

Bugs:

  • Does not works after scolling
  • Distance between mouse and clicked GeometryItem should not be dependend on the inGame distance, but on the distance on the canvas
  • Dragging the canvas also executes the mouseClicked-Method
  • Selecting a LineString highlights its first point
  • There are some invisible LineStrings on the canvas getting selected by my algorithm (?) EDIT: This is the fixed-scaled AngleHints
  • Repaint the canvas after new GeometryItem selected (and not dragged the canvas)
  • Add selected GeometryItem to an EventBus
  • Change Guava EventBus to the newer one
  • Iterate through Items, when clicked on same spot.
  • Pick GeometryItems correctly regarding distance.
  • Exclude older treasure locations from being selectable.
  • Exclude 0-element LineStrings from being selectable. (This will be fixed with Invariant: SearchPath 0 or ≥2 Points #186)

Fixes #51
Fixes #181

@DorianRec DorianRec assigned DorianRec and unassigned DorianRec Dec 19, 2019
@DorianRec DorianRec added 🐛 bug Something isn't working and removed 🐛 bug Something isn't working labels Dec 19, 2019
@DorianRec DorianRec requested review from jotoh98, 1-alex98, rukemn, anLeid, rank-and-files and Trampeltier and removed request for jotoh98 December 19, 2019 15:00
@1-alex98
Copy link
Collaborator

1-alex98 commented Dec 19, 2019

@DorianRec wenn noch einmal jemand System.out.println benutzt, **** ich jemanden XD

Copy link
Owner

@jotoh98 jotoh98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good first state, some changes for selection need. Have you implemented a neighborhood distance in which to search for clicked elements? For example, if just one element is present, clicking everywhere selects this item.

@DorianRec DorianRec added the 🐛 bug Something isn't working label Dec 20, 2019
@DorianRec DorianRec self-assigned this Dec 20, 2019
@DorianRec DorianRec added 🚀 enhancement New feature or request and removed 🐛 bug Something isn't working labels Dec 21, 2019
src/main/java/com/treasure/hunt/game/GameEngine.java Outdated Show resolved Hide resolved
src/main/java/com/treasure/hunt/game/GameManager.java Outdated Show resolved Hide resolved
src/main/java/com/treasure/hunt/view/CanvasController.java Outdated Show resolved Hide resolved
src/main/java/com/treasure/hunt/view/CanvasController.java Outdated Show resolved Hide resolved
@DorianRec DorianRec dismissed 1-alex98’s stale review December 21, 2019 21:58

Fixed with last commit

Copy link
Collaborator

@1-alex98 1-alex98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the end highlighting the stuff with additional object seems a bad idea to be especially because be need to create specially designed Geometries for this.

Maybe we can look into it and see if we come up with a simpilier solution 🤔

src/main/java/com/treasure/hunt/game/GameEngine.java Outdated Show resolved Hide resolved
DorianRec added a commit that referenced this pull request Jan 5, 2020
@DorianRec DorianRec added the 🚫 please dont merge Please do not merge yet label Jan 7, 2020
src/main/java/com/treasure/hunt/analysis/Statistic.java Outdated Show resolved Hide resolved
src/main/java/com/treasure/hunt/game/GameManager.java Outdated Show resolved Hide resolved
src/main/java/com/treasure/hunt/game/GameManager.java Outdated Show resolved Hide resolved
src/main/java/com/treasure/hunt/view/CanvasController.java Outdated Show resolved Hide resolved
src/main/java/com/treasure/hunt/view/CanvasController.java Outdated Show resolved Hide resolved
src/main/resources/layout/scaling.fxml Outdated Show resolved Hide resolved
src/test/java/com/treasure/hunt/game/GameEngineTest.java Outdated Show resolved Hide resolved
src/main/java/com/treasure/hunt/view/CanvasController.java Outdated Show resolved Hide resolved
@1-alex98
Copy link
Collaborator

Also this has conflicts

@DorianRec DorianRec removed the 🚫 please dont merge Please do not merge yet label Jan 13, 2020
@DorianRec DorianRec dismissed 1-alex98’s stale review January 14, 2020 14:19

fixes all comments

@1-alex98
Copy link
Collaborator

If i highlight somthing and then go back it won't remove the highlight:
grafik

@1-alex98
Copy link
Collaborator

Also what about the maybe we remove the highlight things ountil we have some Ui and stuff to it

Copy link
Collaborator

@1-alex98 1-alex98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well what I said above

# Conflicts:
#	src/main/java/com/treasure/hunt/strategy/geom/GeometryItem.java
#	src/main/java/com/treasure/hunt/strategy/geom/GeometryStyle.java
#	src/main/java/com/treasure/hunt/strategy/geom/GeometryType.java
#	src/main/java/com/treasure/hunt/view/CanvasController.java
@1-alex98
Copy link
Collaborator

1-alex98 commented Mar 2, 2020

has conflicts

DorianRec and others added 13 commits March 5, 2020 21:24
# Conflicts:
#	src/main/java/com/treasure/hunt/game/GameEngine.java
#	src/main/java/com/treasure/hunt/game/GameManager.java
#	src/main/java/com/treasure/hunt/strategy/geom/GeometryType.java
#	src/main/java/com/treasure/hunt/strategy/hider/impl/MaxAreaAngularHintStrategy.java
#	src/main/java/com/treasure/hunt/strategy/searcher/impl/NaiveAngleSearcher.java
#	src/main/java/com/treasure/hunt/utils/JTSUtils.java
#	src/main/java/com/treasure/hunt/utils/Renderer.java
src/main/java/com/treasure/hunt/game/GameManager.java Outdated Show resolved Hide resolved
src/main/java/com/treasure/hunt/game/GameManager.java Outdated Show resolved Hide resolved
src/main/java/com/treasure/hunt/utils/Renderer.java Outdated Show resolved Hide resolved
src/main/java/com/treasure/hunt/view/CanvasController.java Outdated Show resolved Hide resolved
@DorianRec DorianRec closed this Mar 9, 2020
@DorianRec DorianRec deleted the feature/#51-make-geometryitems-clickable branch March 16, 2020 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Hint, SearchPath, Treasure selectable Make Geometry Items clickable/selectable
3 participants