Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TULIP
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
14
Issues
14
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NUI
TULIP
Commits
7b304a28
Commit
7b304a28
authored
Nov 04, 2015
by
Eric Tobias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added fucntionality
parent
460f29e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
3 deletions
+32
-3
TULIP/src/lu/list/itis/dkd/tui/space/SpatialPositioningManager.java
...lu/list/itis/dkd/tui/space/SpatialPositioningManager.java
+32
-3
No files found.
TULIP/src/lu/list/itis/dkd/tui/space/SpatialPositioningManager.java
View file @
7b304a28
...
...
@@ -40,6 +40,7 @@ import java.util.Set;
import
java.util.logging.FileHandler
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.stream.Collectors
;
/**
* Singleton class managing the relative positioning of all tangible objects. The manger listens to
...
...
@@ -244,6 +245,8 @@ public class SpatialPositioningManager implements SpatialEventListener {
* its x-axis coordinate that is of the provided class. The retrieval is based on the underlying
* handles.
*
* @param <T>
*
* @param _class
* The {@link Class} of the widget that should be returned.
*
...
...
@@ -251,7 +254,8 @@ public class SpatialPositioningManager implements SpatialEventListener {
* the first if more than one are tied. Will return <code>null</code> if no object is
* present.
*/
public
@Nullable
BaseWidget
getLeftMostWidget
(
Class
<?>
_class
)
{
@SuppressWarnings
(
"unchecked"
)
public
@Nullable
<
T
>
T
getLeftMostWidget
(
Class
<
T
>
_class
)
{
if
(
getLeftMostObject
()
==
null
)
{
return
null
;
}
...
...
@@ -259,7 +263,7 @@ public class SpatialPositioningManager implements SpatialEventListener {
for
(
TangibleObject
object
:
spatialMatrix
.
getHorizontal
())
{
BaseWidget
widget
=
TangibleObjectManager
.
getWidget
(
object
.
getObjectId
());
if
(
widget
.
getClass
().
equals
(
_class
))
{
return
widget
;
return
(
T
)
widget
;
}
}
...
...
@@ -393,6 +397,31 @@ public class SpatialPositioningManager implements SpatialEventListener {
return
widgets
;
}
/**
* Method for returning a list of widgets that are to the right of a given widget. The method
* either returns all objects no matter their alignment with this widget, or only returns
* horizontally aligned widgets, that is, more or less on the same horizontal plane as the given
* widget. The alignment is determined by the shape of the widget.
*
* @param widget
* The widget to retrieve all other aligned or non-aligned widgets to the right.
* @param aligned
* Whether all widgets (to the left) are retrieved or only those that are horizontally
* aligned.
* @param _class
* @return A list of widgets that are to the left, either all or only those that are aligned.
*/
@SuppressWarnings
(
"unchecked"
)
public
<
T
extends
BaseWidget
>
List
<
T
>
getWidgetsToRightOf
(
BaseWidget
widget
,
boolean
aligned
,
Class
<
T
>
_class
)
{
List
<
BaseWidget
>
widgets
=
objectsToWidgets
(
spatialMatrix
.
rightOf
(
TangibleObjectManager
.
getIdentifier
(
widget
)));
widgets
=
widgets
.
stream
().
filter
(
_widget
->
_widget
.
getClass
().
equals
(
_class
)).
collect
(
Collectors
.
toList
());
if
(
aligned
)
{
widgets
.
retainAll
(
getAlignedWidgets
(
widgets
,
widget
,
SpatialAlignment
.
HORIZONTAL
));
}
return
(
List
<
T
>)
widgets
;
}
/**
* Method for returning a list of widgets that are above of a given widget. The method either
* returns all objects no matter their alignment with this widget, or only returns vertically
...
...
@@ -448,7 +477,7 @@ public class SpatialPositioningManager implements SpatialEventListener {
* widget's handle centre y coordinates lies within the inclusive bounds defined by the
* returned widgets defining shape's max and minimum y-axis coordinates.
*/
private
Set
<
BaseWidget
>
getAlignedWidgets
(
Array
List
<
BaseWidget
>
widgets
,
BaseWidget
widget
,
SpatialAlignment
alignment
)
{
private
Set
<
BaseWidget
>
getAlignedWidgets
(
List
<
BaseWidget
>
widgets
,
BaseWidget
widget
,
SpatialAlignment
alignment
)
{
Collection
<
Point
>
centres
=
widget
.
getPositions
().
values
();
Set
<
BaseWidget
>
alignedWidgets
=
new
HashSet
<>();
for
(
BaseWidget
_widget
:
widgets
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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