T - The template of the classes that can be added to this Geometrypublic abstract class Geometry<T extends Geometry> extends Object
| Constructor and Description |
|---|
Geometry(String name,
Dimension dimension)
Create a new Geometry with no children.
|
Geometry(String name,
Dimension dimension,
int p,
int s)
Create a new Geometry with a maximum set of components in the (p,s)
coordinate system.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChildGeometry(T child,
int p,
int s)
Add a child to the grid to a given position in the parallel,serial coordinate
system.
|
protected void |
addGeometry(T child,
int x,
int y)
Add a Geometry to this Geometry at a given (x,y) location.
|
protected abstract void |
addGeometryToGrid(T child,
int p,
int s)
This method must be implemented by all classes extending Geometry.
|
Geometry |
findGeometry(String geometryUniqueId)
Find a Geometry by name.
|
Geometry<?> |
findParentOfType(Class clazz)
Find the closest containing Geometry of a given type.
|
Point |
getAbsolutePoint(Point p)
Convert a point within this Geometry to the absolute coordinate system
of the topmost Geometry.
|
T |
getChild(int p,
int s)
Get child at position (p,s).
|
List<T> |
getChildrenList()
Get the list of children for this Geometry.
|
Map<Geometry,Point> |
getChildrenWithAbsoluteCoordinates()
Get a map for all the children contained in this Geometry with the
corresponding Point which represent the location
of the child Geometry in the topmost geometry.
|
Dimension |
getDimension()
Get the Dimension of this Geometry.
|
Point |
getGeometryAbsolutePosition()
Get the absolute location of this Geometry with respect to the topmost
geometry, that is the one without a parent.
|
Point |
getGeometryPoint(Geometry geometry)
Get the location Point of a child Geometry within this Geometry.
|
int |
getHeight()
Get the Geometry height;
|
String |
getName()
Get the Geometry name
|
int |
getNumberOfChildren()
Get the number of children added to this Geometry.
|
int |
getParallelChildrenCount()
The maximum number of children in the parallel direction.
|
int |
getParallelPosition()
The parallel position of this Geometry within its parent.
|
Geometry |
getParent()
Get the parent of this Geometry.
|
int |
getSerialChildrenCount()
The maximum number of children in the serial direction.
|
int |
getSerialPosition()
The serial position of this Geometry within its parent.
|
String |
getUniqueId()
Get this Geometry unique id.
|
int |
getWidth()
Get the Geometry width.
|
boolean |
hasChildren()
Check if this Geometry has children.
|
boolean |
hasParent()
Check if this Geometry has a Parent.
|
protected void |
replaceExistingGeometry(T oldChild,
T newChild)
Replace a Geometry with a new one in the same place.
|
protected void |
setParallelPosition(int parallelPosition) |
protected void |
setParent(Geometry parent) |
protected void |
setSerialPosition(int serialPosition) |
protected String name
public Geometry(String name, Dimension dimension, int p, int s)
addGeometryToGrid.name - The name of this Geometrydimension - The dimension of this Geometry. Children must fit within this dimension.p - The number of allowed components in the parallel direction.s - The number of allowed components in the serial directionpublic String getName()
public int getWidth()
public int getHeight()
public Dimension getDimension()
public Geometry getParent()
public Geometry<?> findParentOfType(Class clazz)
clazz - The type of the parent to be foundpublic boolean hasParent()
protected final void setParent(Geometry parent)
protected void addGeometry(T child, int x, int y)
addChildGeometry
method to place a geometry in the (p,s) coordinate system.
The convention is the the new Geometry upper left corner will be placed at (x,y).
Child Geometries cannot be added to a Geometry that already has a parent AND
does not have a fixed dimension. The reason for this choice is to simplify
the logic of boundaries breaking.
Coordinate x and y must be positive otherwise an exception will be thrown.
If the this parent Geometry has fixed boundaries an exception will be thrown if the
child Geometry to be added does not fit inside its boundaries.
An exception will be thrown if the child Geometry being added already
belongs to another Geometry.child - The Geometry to be addedx - The x coordinate of the child Geometry locationy - The y coordinate of the child Geometry locationprotected void replaceExistingGeometry(T oldChild, T newChild)
oldChild - The existing child.newChild - The new child.public int getSerialChildrenCount()
public int getParallelChildrenCount()
public int getSerialPosition()
public int getParallelPosition()
protected void setSerialPosition(int serialPosition)
protected void setParallelPosition(int parallelPosition)
public void addChildGeometry(T child, int p, int s)
child - The child to be addeds - The serial position to add it top - The parallel position to add it toprotected abstract void addGeometryToGrid(T child, int p, int s)
child - The child to be added.p - The parallel positions - The serial position.public T getChild(int p, int s)
p - The parallel position to add it tos - The serial position to add it topublic boolean hasChildren()
public final Map<Geometry,Point> getChildrenWithAbsoluteCoordinates()
public final List<T> getChildrenList()
public String getUniqueId()
public final Geometry findGeometry(String geometryUniqueId)
geometryUniqueId - The unique id of the geometry to be found.public final int getNumberOfChildren()
public Point getGeometryAbsolutePosition()
public Point getAbsolutePoint(Point p)
p - The point to convert.Copyright © 2022 LSST. All rights reserved.