Commit d857a08c authored by Valérie Maquil's avatar Valérie Maquil

added methods for the spatial positioning manager

parent 93b096f2
...@@ -284,7 +284,10 @@ public class SpatialMatrix { ...@@ -284,7 +284,10 @@ public class SpatialMatrix {
* are tied. * are tied.
*/ */
public TangibleObject getLeftMostObject() { public TangibleObject getLeftMostObject() {
return horizontal.get(0); if (horizontal.size() > 0)
return horizontal.get(0);
return null;
} }
/** /**
...@@ -295,7 +298,10 @@ public class SpatialMatrix { ...@@ -295,7 +298,10 @@ public class SpatialMatrix {
* tied. * tied.
*/ */
public TangibleObject getRightMostObject() { public TangibleObject getRightMostObject() {
return horizontal.get(horizontal.size() - 1); if (horizontal.size() > 0)
return horizontal.get(horizontal.size() - 1);
return null;
} }
/** /**
...@@ -306,7 +312,10 @@ public class SpatialMatrix { ...@@ -306,7 +312,10 @@ public class SpatialMatrix {
* are tied. * are tied.
*/ */
public TangibleObject getTopObject() { public TangibleObject getTopObject() {
return vertical.get(0); if (vertical.size() > 0)
return vertical.get(0);
return null;
} }
/** /**
...@@ -317,7 +326,10 @@ public class SpatialMatrix { ...@@ -317,7 +326,10 @@ public class SpatialMatrix {
* tied. * tied.
*/ */
public TangibleObject getBottomObject() { public TangibleObject getBottomObject() {
return vertical.get(vertical.size() - 1); if (vertical.size() > 0)
return vertical.get(vertical.size() - 1);
return null;
} }
/** /**
......
...@@ -164,9 +164,22 @@ public class SpatialPositioningManager implements SpatialEventListener { ...@@ -164,9 +164,22 @@ public class SpatialPositioningManager implements SpatialEventListener {
* are tied. * are tied.
*/ */
public BaseWidget getLeftMostWidget() { public BaseWidget getLeftMostWidget() {
if (spatialMatrix.getLeftMostObject() == null)
return null;
return TangibleObjectManager.getWidget(spatialMatrix.getLeftMostObject().getObjectId()); return TangibleObjectManager.getWidget(spatialMatrix.getLeftMostObject().getObjectId());
} }
/**
* The method will return the left-most tangible object.
*
* @return The object with the smallest x coordinate.
*/
public TangibleObject getLeftMostObject() {
return spatialMatrix.getLeftMostObject();
}
/** /**
* The method will return the right-most widget, that is, the last widget found based based on * The method will return the right-most widget, that is, the last widget found based based on
* its x-axis coordinate. The retrieval is based on the underlying handles. * its x-axis coordinate. The retrieval is based on the underlying handles.
...@@ -175,9 +188,21 @@ public class SpatialPositioningManager implements SpatialEventListener { ...@@ -175,9 +188,21 @@ public class SpatialPositioningManager implements SpatialEventListener {
* tied. * tied.
*/ */
public BaseWidget getRightMostWidget() { public BaseWidget getRightMostWidget() {
if (spatialMatrix.getRightMostObject() == null)
return null;
return TangibleObjectManager.getWidget(spatialMatrix.getRightMostObject().getObjectId()); return TangibleObjectManager.getWidget(spatialMatrix.getRightMostObject().getObjectId());
} }
/**
* The method will return the right-most tangible object.
*
* @return The object with the largest x coordinate.
*/
public TangibleObject getRightMostObject() {
return spatialMatrix.getRightMostObject();
}
/** /**
* The method will return the top-most widget, that is, the first widget found based based on * The method will return the top-most widget, that is, the first widget found based based on
* its y-axis coordinate. The retrieval is based on the underlying handles. * its y-axis coordinate. The retrieval is based on the underlying handles.
...@@ -186,9 +211,21 @@ public class SpatialPositioningManager implements SpatialEventListener { ...@@ -186,9 +211,21 @@ public class SpatialPositioningManager implements SpatialEventListener {
* are tied. * are tied.
*/ */
public BaseWidget getTopWidget() { public BaseWidget getTopWidget() {
if (spatialMatrix.getTopObject() == null)
return null;
return TangibleObjectManager.getWidget(spatialMatrix.getTopObject().getObjectId()); return TangibleObjectManager.getWidget(spatialMatrix.getTopObject().getObjectId());
} }
/**
* The method will return the top-most tangible object.
*
* @return The object with the smallest y coordinate.
*/
public TangibleObject getTopObject() {
return spatialMatrix.getTopObject();
}
/** /**
* The method will return the bottom-most widget, that is, the last widget found based based on * The method will return the bottom-most widget, that is, the last widget found based based on
* its y-axis coordinate. The retrieval is based on the underlying handles. * its y-axis coordinate. The retrieval is based on the underlying handles.
...@@ -197,9 +234,21 @@ public class SpatialPositioningManager implements SpatialEventListener { ...@@ -197,9 +234,21 @@ public class SpatialPositioningManager implements SpatialEventListener {
* tied. * tied.
*/ */
public BaseWidget getBottomWidget() { public BaseWidget getBottomWidget() {
if (spatialMatrix.getBottomObject() == null)
return null;
return TangibleObjectManager.getWidget(spatialMatrix.getBottomObject().getObjectId()); return TangibleObjectManager.getWidget(spatialMatrix.getBottomObject().getObjectId());
} }
/**
* The method will return the bottom-most tangible object.
*
* @return The object with the largest y coordinate.
*/
public TangibleObject getBottomObject() {
return spatialMatrix.getBottomObject();
}
/** /**
* Method for returning a list of widgets that are to the left of a given widget. The method * Method for returning a list of widgets that are to the left of a given widget. The method
* either returns all objects no matter their alignment with this widget, or only returns * either returns all objects no matter their alignment with this widget, or only returns
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment