public abstract class SimpleLayoutAlgorithm extends Object implements LayoutAlgorithm
SimpleLayoutAlgorithm is a partial implementation of the
LayoutAlgorithm interface which collects functions which are
independent of the output format of the LayoutDirector.| Modifier and Type | Class and Description |
|---|---|
static class |
SimpleLayoutAlgorithm.RelativePosition
Enumeration types (enums) for relative positions.
|
| Modifier and Type | Field and Description |
|---|---|
protected Layout |
layout
|
protected int |
level
SBML level
|
protected Set<GraphicalObject> |
setOfLayoutedGlyphs
Set to hold all layouted glyphs
|
protected Set<GraphicalObject> |
setOfUnlayoutedGlyphs
Set to hold all unlayouted glyphs
|
protected int |
version
SBML version
|
| Constructor and Description |
|---|
SimpleLayoutAlgorithm() |
| Modifier and Type | Method and Description |
|---|---|
protected Point |
calculateAverageCurvePosition(SpeciesReferenceRole specRefRole,
List<SpeciesReferenceGlyph> specRefGlyphList)
This method calculates the average position of a curve at the direction of the reaction glyph,
if the role of a species reference glyph is PRODUCT, the start point of the curve is at the
reaction glyph, else the start point is at the species and the end point at the reaction glyph.
|
protected Point |
calculateAverageSpeciesPosition(SpeciesReferenceRole specRefRole,
List<SpeciesReferenceGlyph> specRefGlyphList)
method calculates the average position of the species glyphs belonging to
the given list of species reference glyphs, the role of the species
reference glyph must be of the given type
|
protected Point |
calculateCenter(GraphicalObject graphicalObject)
Compute the coordinates of the central point of a
GraphicalObject. |
static Point |
calculateCenter(GraphicalObject graphicalObject,
int level,
int version) |
protected Point |
calculateOldSpeciesGlyphDockingPosition(Point middleOfSpecies,
SimpleLayoutAlgorithm.RelativePosition relativeSpeciesGlyphPosition,
SpeciesGlyph specGlyph)
Deprecated.
|
protected Point |
calculateReactionGlyphDockingPoint(ReactionGlyph reacGlyph,
double rotationAngle,
SpeciesReferenceGlyph specRef)
c
|
double |
calculateReactionGlyphRotationAngle(ReactionGlyph reactionGlyph)
method to calculate the rotation angle of the lines from the reaction box,
in degrees
|
static double |
calculateRotationAngle(Point startPoint,
Point endPoint)
Calculate the rotation angle for a line determined by two
Points. |
protected Point |
calculateSpeciesGlyphDockingPosition(Point centerOfSpecies,
ReactionGlyph reactionGlyph,
SpeciesReferenceRole speciesReferenceRole,
SpeciesGlyph speciesGlyph)
Compute the docking
Point at the species for the curve defined by
the ReactionGlyph and the SpeciesGlyph. |
void |
correctDimensions(GraphicalObject glyph)
Correct the dimensions of a
GraphicalObject by changing its
BoundingBox. |
protected double |
correctRotationAngle(double rotationAngle)
Normalize a given rotation angle, i.e., express the angle in the range from
0° to 90° (excluding 90°).
|
protected BoundingBox |
createBoundingBoxWithLevelAndVersion()
Creates a
BoundingBox with the level and version of this layout. |
Dimensions |
createReactionGlyphDimension(ReactionGlyph reactionGlyph)
method to create a
Dimensions for a ReactionGlyph if it
was missing in the layout model |
protected Point |
createReactionGlyphPosition(ReactionGlyph reactionGlyph) |
protected Point |
createReactionGlyphPositionNew(ReactionGlyph reactionGlyph) |
protected Point |
createSpeciesReferenceGlyphPosition(ReactionGlyph reactionGlyph,
SpeciesReferenceGlyph specRefGlyph) |
Layout |
findLayout(GraphicalObject graphicalObject)
Find the
Layout to which the given GraphicalObject
belongs. |
protected SpeciesGlyph |
findSpeciesGlyphByRole(List<SpeciesReferenceGlyph> speciesReferenceGlyphList,
SpeciesReferenceRole speciesReferenceRole)
Return the first
SpeciesGlyph from a list of
SpeciesReferenceGlyphs which has the given
SpeciesReferenceRole. |
Layout |
getLayout() |
protected static SimpleLayoutAlgorithm.RelativePosition |
getRelativePosition(Point startGlyph,
Point endGlyph)
method calculates the relative position of the second bounding box with
respect to the first bounding box
ABOVE: middle of the second bounding box is directly above the middle of the first bounding box
BELOW: middle of the second bounding box is directly below the middle of the first bounding box
LEFT: middle of the second bounding box is directly left of the middle of the first bounding box
RIGHT: middle of the second bounding box is directly right of the middle of the first bounding box
|
boolean |
isSetLayout() |
void |
setLayout(Layout layout) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddLayoutedEdge, addLayoutedGlyph, addUnlayoutedEdge, addUnlayoutedGlyph, completeGlyphs, createCompartmentGlyphDimension, createCompartmentGlyphPosition, createCurve, createGlyphBoundingBox, createLayoutDimension, createSpeciesGlyphDimension, createSpeciesReferenceGlyphDimension, createTextGlyphDimensionprotected int level
protected int version
protected Layout layout
protected Set<GraphicalObject> setOfLayoutedGlyphs
protected Set<GraphicalObject> setOfUnlayoutedGlyphs
public Layout getLayout()
getLayout in interface LayoutAlgorithmLayout set for this LayoutAlgorithm;public boolean isSetLayout()
isSetLayout in interface LayoutAlgorithmLayout is set for this LayoutAlgorithm, else falsepublic void setLayout(Layout layout)
setLayout in interface LayoutAlgorithmlayout - the Layout to be set for this LayoutAlgorithmprotected static SimpleLayoutAlgorithm.RelativePosition getRelativePosition(Point startGlyph, Point endGlyph)
startGlyphBB - endGlyphBB - protected Point calculateAverageCurvePosition(SpeciesReferenceRole specRefRole, List<SpeciesReferenceGlyph> specRefGlyphList)
specRefRole - specRefGlyphList - protected Point calculateAverageSpeciesPosition(SpeciesReferenceRole specRefRole, List<SpeciesReferenceGlyph> specRefGlyphList)
specRefRole - the species reference glyphs of the given list must havespecRefGlyphList - protected Point calculateCenter(GraphicalObject graphicalObject)
GraphicalObject.graphicalObject - the GraphicalObject for which to calculate the centerPoint of the graphical objectpublic static Point calculateCenter(GraphicalObject graphicalObject, int level, int version)
graphicalObject - level - version - protected Point calculateReactionGlyphDockingPoint(ReactionGlyph reacGlyph, double rotationAngle, SpeciesReferenceGlyph specRef)
reacGlyph - rotationAngle - specRef - protected double correctRotationAngle(double rotationAngle)
rotationAngle - in degreesprotected Point createSpeciesReferenceGlyphPosition(ReactionGlyph reactionGlyph, SpeciesReferenceGlyph specRefGlyph)
reactionGlyph - specRefGlyph - protected Point createReactionGlyphPositionNew(ReactionGlyph reactionGlyph)
reactionGlyph - protected Point createReactionGlyphPosition(ReactionGlyph reactionGlyph)
public Dimensions createReactionGlyphDimension(ReactionGlyph reactionGlyph)
LayoutAlgorithmDimensions for a ReactionGlyph if it
was missing in the layout modelcreateReactionGlyphDimension in interface LayoutAlgorithmreactionGlyph - for which the Dimensions is missingDimensionspublic double calculateReactionGlyphRotationAngle(ReactionGlyph reactionGlyph)
LayoutAlgorithmcalculateReactionGlyphRotationAngle in interface LayoutAlgorithmreactionGlyph - for which the rotation angle shall be calculatedpublic static double calculateRotationAngle(Point startPoint, Point endPoint)
Points.@Deprecated protected Point calculateOldSpeciesGlyphDockingPosition(Point middleOfSpecies, SimpleLayoutAlgorithm.RelativePosition relativeSpeciesGlyphPosition, SpeciesGlyph specGlyph)
Point at the species depending on the
SimpleLayoutAlgorithm.RelativePosition of the SpeciesGlyph.
This method is deprecated because we decided to allow docking at any
point rather than restricting the docking to the four orientations left,
right, above and below. Use
calculateSpeciesGlyphDockingPosition(Point, ReactionGlyph, SpeciesReferenceRole, SpeciesGlyph)
instead.middleOfSpecies - center Point of the speciesrelativeSpeciesGlyphPosition - the SimpleLayoutAlgorithm.RelativePosition of the speciesspecGlyph - the SpeciesGlyphPointprotected Point calculateSpeciesGlyphDockingPosition(Point centerOfSpecies, ReactionGlyph reactionGlyph, SpeciesReferenceRole speciesReferenceRole, SpeciesGlyph speciesGlyph)
Point at the species for the curve defined by
the ReactionGlyph and the SpeciesGlyph.centerOfSpecies - the center Point of the SpeciesGlyphreactionGlyph - the ReactionGlyph of the arcspeciesReferenceRole - the SpeciesReferenceRole of the involved
SpeciesReferenceGlyphspeciesGlyph - the SpeciesGlyph of the arcPointprotected BoundingBox createBoundingBoxWithLevelAndVersion()
BoundingBox with the level and version of this layout.BoundingBox with the level and version of the layoutpublic Layout findLayout(GraphicalObject graphicalObject)
Layout to which the given GraphicalObject
belongs.graphicalObject - GraphicalObject for which to find the layoutGraphicalObjectprotected SpeciesGlyph findSpeciesGlyphByRole(List<SpeciesReferenceGlyph> speciesReferenceGlyphList, SpeciesReferenceRole speciesReferenceRole)
SpeciesGlyph from a list of
SpeciesReferenceGlyphs which has the given
SpeciesReferenceRole. Return null if no such SpeciesGlyph
is found.speciesReferenceGlyphList - List containing the SpeciesReferenceGlyphsspeciesReferenceRole - the SpeciesReferenceRole for which to lookSpeciesGlyph which has the given
SpeciesReferenceRolepublic void correctDimensions(GraphicalObject glyph)
GraphicalObject by changing its
BoundingBox. According to the SBGN specification, some objects
have to be represented as a circle or square and not as an ellipse or
rectangle. fit to the glyph. If not this method corrects the layout
informations.glyph - the GraphicalObject for which to correct the
dimensionsCopyright © 2009–2018. All rights reserved.