Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
course-material
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IT1901
course-material
Commits
eb58c3f3
There was an error fetching the commit references. Please try again later.
Commit
eb58c3f3
authored
5 years ago
by
Hallvard Trætteberg
Browse files
Options
Downloads
Patches
Plain Diff
Remove use of Optional and isEmpty
parent
b5460e64
No related branches found
No related tags found
No related merge requests found
Pipeline
#46705
passed
5 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
simpleexample/src/main/java/simpleex/core/LatLong.java
+0
-1
0 additions, 1 deletion
simpleexample/src/main/java/simpleex/core/LatLong.java
simpleexample/src/main/java/simpleex/ui/FxAppController.java
+10
-12
10 additions, 12 deletions
simpleexample/src/main/java/simpleex/ui/FxAppController.java
with
10 additions
and
13 deletions
simpleexample/src/main/java/simpleex/core/LatLong.java
+
0
−
1
View file @
eb58c3f3
...
...
@@ -13,7 +13,6 @@ public class LatLong {
this
.
longitude
=
longitude
;
}
public
double
getLatitude
()
{
return
latitude
;
}
...
...
This diff is collapsed.
Click to expand it.
simpleexample/src/main/java/simpleex/ui/FxAppController.java
+
10
−
12
View file @
eb58c3f3
...
...
@@ -12,7 +12,6 @@ import java.io.FileOutputStream;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.util.Optional
;
import
javafx.collections.FXCollections
;
import
javafx.event.ActionEvent
;
import
javafx.fxml.FXML
;
...
...
@@ -73,7 +72,7 @@ public class FxAppController {
private
MapBase
mapView
;
private
MapItemsControl
<
MapNode
>
markersParent
;
private
Optional
<
MapMarker
>
marker
=
Optional
.
empty
()
;
private
MapMarker
marker
=
null
;
private
DraggableNodeController
draggableMapController
=
null
;
private
DraggableNodeController
draggableMarkerController
=
null
;
...
...
@@ -107,7 +106,7 @@ public class FxAppController {
private
void
handleMarkerDragged
(
final
Node
node
,
final
double
dx
,
final
double
dy
)
{
final
MapProjection
projection
=
mapView
.
getProjection
();
final
Point2D
point
=
projection
.
locationToViewportPoint
(
marker
.
get
().
getLocation
());
final
Point2D
point
=
projection
.
locationToViewportPoint
(
marker
.
getLocation
());
final
Location
newLocation
=
projection
.
viewportPointToLocation
(
point
.
add
(
dx
,
dy
));
getLatLongs
().
setLatLong
(
locationListView
.
getSelectionModel
().
getSelectedIndex
(),
location2LatLong
(
newLocation
));
...
...
@@ -123,23 +122,22 @@ public class FxAppController {
if
(
num
<
0
||
num
>=
getLatLongs
().
getLatLongCount
())
{
markersParent
.
getItems
().
clear
();
if
(
draggableMarkerController
!=
null
)
{
draggableMarkerController
.
detach
(
marker
.
get
()
);
draggableMarkerController
.
detach
(
marker
);
}
marker
=
Optional
.
empty
()
;
marker
=
null
;
}
else
{
final
LatLong
latLong
=
getLatLongs
().
getLatLong
(
num
);
if
(
marker
.
isEmpty
()
)
{
final
MapMarker
aM
arker
=
new
MapMarker
(
latLong
);
markersParent
.
getItems
().
add
(
aM
arker
);
if
(
marker
==
null
)
{
m
arker
=
new
MapMarker
(
latLong
);
markersParent
.
getItems
().
add
(
m
arker
);
if
(
draggableMarkerController
!=
null
)
{
draggableMarkerController
.
attach
(
aM
arker
);
draggableMarkerController
.
attach
(
m
arker
);
}
marker
=
Optional
.
of
(
aMarker
);
}
else
{
marker
.
get
().
setLocation
(
latLong
);
marker
.
setLocation
(
latLong
);
}
if
(
centerOnMarker
)
{
mapView
.
setCenter
(
marker
.
get
().
getLocation
());
mapView
.
setCenter
(
marker
.
getLocation
());
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment