Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
a1447453
Commit
a1447453
authored
Feb 10, 2026
by
Luna Riegel
Browse files
Feat: Implement getCandidates
parent
09ecf2bf
Changes
3
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/database/CityObjectCache.java
View file @
a1447453
...
...
@@ -22,6 +22,8 @@ public interface CityObjectCache {
*/
CityObject
get
(
GmlId
id
);
Collection
<
CityObject
>
getCandidates
(
CityObject
subject
,
double
collectionRadius
);
Collection
<
CityObject
>
getAll
(
List
<
GmlId
>
ids
);
/**
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/database/FeatureCache.java
View file @
a1447453
...
...
@@ -119,6 +119,12 @@ public class FeatureCache implements CityObjectCache{
return
cache
.
get
(
id
);
}
@Override
public
Collection
<
CityObject
>
getCandidates
(
CityObject
subject
,
double
collectionRadius
){
List
<
GmlId
>
ids
=
handler
.
getBufferCollisionCandidates
(
subject
,
collectionRadius
);
return
this
.
getAll
(
ids
);
}
@Override
public
Collection
<
CityObject
>
getAll
(
List
<
GmlId
>
ids
){
Map
<
GmlId
,
CityObject
>
map
=
cache
.
getAll
(
new
HashSet
<>(
ids
));
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/database/UnconnectedCache.java
View file @
a1447453
...
...
@@ -38,6 +38,19 @@ public class UnconnectedCache implements CityObjectCache{
return
cache
.
get
(
id
);
}
@Override
public
Collection
<
CityObject
>
getCandidates
(
CityObject
subject
,
double
collectionRadius
)
{
List
<
CityObject
>
candidates
=
new
ArrayList
<>();
// Quick and dirty candidate selection
cache
.
forEach
((
gmlId
,
cityObject
)
->
{
double
distance
=
cityObject
.
getBbox
().
getCenter
().
getDistance
(
subject
.
getBbox
().
getCenter
());
if
(
distance
-
cityObject
.
getBbox
().
getLongestSide
()
-
subject
.
getBbox
().
getLongestSide
()
<
collectionRadius
){
candidates
.
add
(
cityObject
);
}
});
return
candidates
;
}
@Override
public
Collection
<
CityObject
>
getAll
(
List
<
GmlId
>
ids
)
{
return
ids
.
stream
().
map
(
cache:
:
get
).
toList
();
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment