Skip to content

Commit

Permalink
#47: simplify
Browse files Browse the repository at this point in the history
getAnchorBounds to just return the xrange,yrange box.  This is simpler
and consistent with documentation I see in several places.
  • Loading branch information
jbfaden committed Dec 7, 2023
1 parent 4790c43 commit e083750
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions dasCore/src/org/das2/graph/DasAnnotation.java
Original file line number Diff line number Diff line change
Expand Up @@ -839,33 +839,8 @@ private Rectangle getAnchorBounds() {
Rectangle anchorRect= new Rectangle();
if ( ( anchorType==AnchorType.DATA ) ) {
if ( plot!=null && xrange!=null && yrange!=null ) {
if ( anchorBorderType==BorderType.NONE && showArrow ) { // this is really confusing, when you can't see the anchor.
try {
anchorRect.x= (int)(plot.getXAxis().transform( pointAtX ) );
} catch ( InconvertibleUnitsException ex ) {
if ( pointAtX.getUnits()==Units.dimensionless && UnitsUtil.isRatioMeasurement(plot.getXAxis().getUnits()) ) {
anchorRect.x= (int)(plot.getXAxis().transform( pointAtX.value(), plot.getXAxis().getUnits() ) );
} else {
logger.info("unable to convert x units for annotation");
anchorRect.x= getColumn().getDMiddle();
}
}
try {
anchorRect.y= (int)(plot.getYAxis().transform( pointAtY ) );
} catch ( InconvertibleUnitsException ex ) {
if ( pointAtY.getUnits()==Units.dimensionless && UnitsUtil.isRatioMeasurement(plot.getYAxis().getUnits()) ) {
anchorRect.y= (int)(plot.getYAxis().transform( pointAtY.value(), plot.getYAxis().getUnits() ) );
} else {
logger.info("unable to convert y units for annotation");
anchorRect.y= getRow().getDMiddle();
}
}
anchorRect.width= 1;
anchorRect.height= 1;
} else {
anchorXToData(anchorRect);
anchorYToData(anchorRect);
}
anchorXToData(anchorRect);
anchorYToData(anchorRect);
if ( splitAnchorType ) {
if ( verticalAnchorType==AnchorType.CANVAS ) {
anchorRect.y= getRow().getDMinimum();
Expand Down

0 comments on commit e083750

Please sign in to comment.