RbDe rbde-349 (20120127151154)

edu.mssm.crover.domain2d
Interface Domain2D

All Superinterfaces:
Drawing
All Known Implementing Classes:
BetaStrandDomain, CtermDomain, ExtremityDomain, FreeLoop, HelicalDomain, InvalidDomain, ProteinSegmentDomain, TwoEndsDomain

public interface Domain2D
extends Drawing

This interface is implemented by all the sequence domains rendered on a DrawingSurface.


Method Summary
 void calculateDeltas()
          Compute delta_start and delta_end: the position of the first and last residue as drawn by the domain2D.
 void connectEnd(Domain2D next)
          Instructs the domain to connect its end to the start of the next domain passed as argument.
 void connectStart(Domain2D previous)
          Instructs the domain to connect its start to the end of the previous domain passed as argument.
 ConstrainedPoint firstResiduePos()
          Returns the position of the first residue of this domain as a ConstrainedPoint.
 Component getComp()
           
 Point2D getDirection()
          Returns the direction of drawing of this domain, defined as the vector tangent to the direction of drawing of the residue chain at the exit of the domain.
 String getId()
          Returns the id of this domain.
 void hideFirst(boolean hs)
          Loop spacer adjustments require that the last residue of the last domain and the first residue of the next domain not to be displayed/controlled by the other domains.
 void hideLast(boolean hs)
          see hideFirst.
 ConstrainedPoint lastResiduePos()
          Returns the position of the last residue of this domain as a ConstrainedPoint.
 void layoutResidues()
          Layout the residues in the domain.
 void setDirection(Point2D direction)
          Sets the direction vector for this domain.
 void setId(String id)
          Sets the id for this domain.
 void setRange(BiologicalSequence sequence, int start, int end)
          Instructs the domain to render the part of sequence seq made of the residues between start and end, extremities included.
 void setSpacer(Point2D spacer)
          Sets the spacer vector for this domain.
 void useResidueModelFactory(ResidueModelFactory rmf)
          Change the ResidueModelFactory used to create the residue models.
 
Methods inherited from interface edu.mssm.crover.domain2d.Drawing
dispose, getComponent, getParent, getSurface, position, suggestLocation, suggestLocation
 

Method Detail

setId

void setId(String id)
Sets the id for this domain.

Parameters:
id - The id to use for this domain

getId

String getId()
Returns the id of this domain. The identifier can be used to track domains.

Returns:
The id of this domain

setRange

void setRange(BiologicalSequence sequence,
              int start,
              int end)
              throws InvalidRange
Instructs the domain to render the part of sequence seq made of the residues between start and end, extremities included. Calling this method could be expensive as the number of residues may be altered and the layout recalculated. Implementers are advised to optimize their code to enable a dynamic adjustment of the range of the domain provided by the diagram editor (yet to be written). Interestingly, it has to be noted that this kind of dynamic adjustment is likely to translate the range over the sequence, add or remove a residue from the range. So some implementations can be chosen to accommodate these local changes that will reuse the previous layout and residues (from the previous invocation of setRange()).

Throws:
InvalidRange

getComp

Component getComp()

firstResiduePos

ConstrainedPoint firstResiduePos()
Returns the position of the first residue of this domain as a ConstrainedPoint.


lastResiduePos

ConstrainedPoint lastResiduePos()
Returns the position of the last residue of this domain as a ConstrainedPoint.


getDirection

Point2D getDirection()
Returns the direction of drawing of this domain, defined as the vector tangent to the direction of drawing of the residue chain at the exit of the domain. This is used by loops to determine their tangential orientation when connecting two domains. Strictly, there should be two directions: a entry direction and an exit direction. At the moment, for helices and strands it is not expected that the directions will be different so we conveniently keep only one method. This could change as needed.


useResidueModelFactory

void useResidueModelFactory(ResidueModelFactory rmf)
Change the ResidueModelFactory used to create the residue models. The change is taken into account the next time setRange() is invoked on this Domain2D.


connectStart

void connectStart(Domain2D previous)
Instructs the domain to connect its start to the end of the previous domain passed as argument. This is experimental..


connectEnd

void connectEnd(Domain2D next)
Instructs the domain to connect its end to the start of the next domain passed as argument. This is experimental..


calculateDeltas

void calculateDeltas()
Compute delta_start and delta_end: the position of the first and last residue as drawn by the domain2D.


hideFirst

void hideFirst(boolean hs)
Loop spacer adjustments require that the last residue of the last domain and the first residue of the next domain not to be displayed/controlled by the other domains. To do so, the loop domain uses hideFirst and hideLast on its previous and follower domain.


hideLast

void hideLast(boolean hs)
see hideFirst.


setSpacer

void setSpacer(Point2D spacer)
Sets the spacer vector for this domain. The spacer is only indicative: different implementations of Domain2D can interpret it differently. For instance, loops will try to adjust to fit the spacer vector as closely as possible, helices will change the direction of their drawing to fit the direction of the indicated spacer.


setDirection

void setDirection(Point2D direction)
Sets the direction vector for this domain. Some domain display depend on the value of direction (general direction of drawing), other do not. The choice is left to the domain implementor. Helices should adjust to allow rotations of the domain. Loops are highly constrained by surrounding domains and aesthetic constrained, so are unlikely to adjust their display to this parameter.


layoutResidues

void layoutResidues()
Layout the residues in the domain. Determine the size of the domain and set it. After this method has executed the positions of the first and last residue are know relatively to the domain position.

See Also:
firstResiduePos(), lastResiduePos()

RbDe rbde-349 (20120127151154)

Copyright © 2003-2012 Institute for Computational Biomedicine, All Rights Reserved.