Point northEastToSouthWest(Point2D p,PositionableIcon l,int oldWidth,int oldHeight,double angle,boolean right,double fromPoint){
  angle=angle - 180;
  if (angle < 45) {
    int tmpWidth=oldWidth;
    int tmpHeight=oldHeight;
    oldWidth=tmpHeight;
    oldHeight=tmpWidth;
  }
  double ang=angle;
  double oppAng=90 - ang;
  angle=Math.toRadians(angle);
  double oppAngRad=Math.toRadians(oppAng);
  double iconAdj=Math.sin(angle) * oldHeight;
  double iconAdjOpp=Math.sin(oppAngRad) * oldHeight;
  double bpa=Math.sin(angle) * (offSetFromPoint + fromPoint);
  double bpo=Math.sin(oppAngRad) * (offSetFromPoint + fromPoint);
  double ta=Math.sin(angle) * offSetFromPoint;
  double to=Math.sin(oppAngRad) * offSetFromPoint;
  if (log.isDebugEnabled()) {
    log.debug("north east to south west " + angle);
    log.debug("oldWidth " + oldWidth + " oldHeight "+ oldHeight);
    log.debug("newWidth " + l.maxWidth() + " newHeight "+ l.maxHeight());
    log.debug("Icon adj: " + iconAdj + " opp adj: "+ iconAdjOpp);
    log.debug("boundary point opp " + bpo);
    log.debug("boundary point adj " + bpa);
    log.debug("track opp " + to);
    log.debug("track adj " + ta);
  }
  int xpos=0;
  int ypos=0;
  if (right) {
    double x_dist_to_Icon=(iconAdjOpp) - (bpa - to);
    double y_dist_to_Icon=ta + bpo + l.maxHeight();
    log.debug("x dist " + x_dist_to_Icon + ", y dist "+ y_dist_to_Icon);
    xpos=(int)(p.getX() - x_dist_to_Icon);
    ypos=(int)(p.getY() - y_dist_to_Icon);
  }
 else {
    double y_dist_to_Icon=iconAdjOpp + (bpo - ta);
    double x_dist_to_Icon=to + bpa;
    log.debug("x dist " + x_dist_to_Icon + ", y dist "+ y_dist_to_Icon);
    xpos=(int)(p.getX() + x_dist_to_Icon);
    ypos=(int)(p.getY() - y_dist_to_Icon);
  }
  if (log.isDebugEnabled()) {
    log.debug("xpos " + xpos);
    log.debug("yPos " + ypos);
  }
  return new Point(xpos,ypos);
}

Point northEastToSouthWest ( Point2D p , PositionableIcon l , int oldWidth , int oldHeight , double angle , boolean right , double fromPoint ) { angle = angle - 180 ; if ( angle < 45 ) { int tmpWidth = oldWidth ; int tmpHeight = oldHeight ; oldWidth = tmpHeight ; oldHeight = tmpWidth ; } double ang = angle ; double oppAng = 90 - ang ; angle = Math . toRadians ( angle ) ; double oppAngRad = Math . toRadians ( oppAng ) ; double iconAdj = Math . sin ( angle ) * oldHeight ; double iconAdjOpp = Math . sin ( oppAngRad ) * oldHeight ; double bpa = Math . sin ( angle ) * ( offSetFromPoint + fromPoint ) ; double bpo = Math . sin ( oppAngRad ) * ( offSetFromPoint + fromPoint ) ; double ta = Math . sin ( angle ) * offSetFromPoint ; double to = Math . sin ( oppAngRad ) * offSetFromPoint ; if ( log . isDebugEnabled ( ) ) { log . debug ( "north east to south west " + angle ) ; log . debug ( "oldWidth " + oldWidth + " oldHeight " + oldHeight ) ; log . debug ( "newWidth " + l . maxWidth ( ) + " newHeight " + l . maxHeight ( ) ) ; log . debug ( "Icon adj: " + iconAdj + " opp adj: " + iconAdjOpp ) ; log . debug ( "boundary point opp " + bpo ) ; log . debug ( "boundary point adj " + bpa ) ; log . debug ( "track opp " + to ) ; log . debug ( "track adj " + ta ) ; } int xpos = 0 ; int ypos = 0 ; if ( right ) { double x_dist_to_Icon = ( iconAdjOpp ) - ( bpa - to ) ; double y_dist_to_Icon = ta + bpo + l . maxHeight ( ) ; log . debug ( "x dist " + x_dist_to_Icon + ", y dist " + y_dist_to_Icon ) ; xpos = ( int ) ( p . getX ( ) - x_dist_to_Icon ) ; ypos = ( int ) ( p . getY ( ) - y_dist_to_Icon ) ; } else { double y_dist_to_Icon = iconAdjOpp + ( bpo - ta ) ; double x_dist_to_Icon = to + bpa ; log . debug ( "x dist " + x_dist_to_Icon + ", y dist " + y_dist_to_Icon ) ; xpos = ( int ) ( p . getX ( ) + x_dist_to_Icon ) ; ypos = ( int ) ( p . getY ( ) - y_dist_to_Icon ) ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "xpos " + xpos ) ; log . debug ( "yPos " + ypos ) ; } return new Point ( xpos , ypos ) ; }
come back to this as its a bit tight to the rail on sm110 need re checking
