private double adjustTransform(){
  double xMin=Double.POSITIVE_INFINITY;
  double xMax=Double.NEGATIVE_INFINITY;
  double yMin=Double.POSITIVE_INFINITY;
  double yMax=Double.NEGATIVE_INFINITY;
  for (  Variable var : csp.getVariables()) {
    Point2D point=getPosition(var);
    xMin=Math.min(xMin,point.getX());
    xMax=Math.max(xMax,point.getX());
    yMin=Math.min(yMin,point.getY());
    yMax=Math.max(yMax,point.getY());
  }
  double scale=Math.min(pane.getWidth() / (xMax - xMin + 300),pane.getHeight() / (yMax - yMin + 150));
  pane.setTranslateX((scale * (pane.getWidth() - xMin - xMax) / 2.0));
  pane.setTranslateY((scale * (pane.getHeight() - yMin - yMax) / 2.0));
  pane.setScaleX(scale);
  pane.setScaleY(scale);
  return scale;
}

private double adjustTransform ( ) { double xMin = Double . POSITIVE_INFINITY ; double xMax = Double . NEGATIVE_INFINITY ; double yMin = Double . POSITIVE_INFINITY ; double yMax = Double . NEGATIVE_INFINITY ; for ( Variable var : csp . getVariables ( ) ) { Point2D point = getPosition ( var ) ; xMin = Math . min ( xMin , point . getX ( ) ) ; xMax = Math . max ( xMax , point . getX ( ) ) ; yMin = Math . min ( yMin , point . getY ( ) ) ; yMax = Math . max ( yMax , point . getY ( ) ) ; } double scale = Math . min ( pane . getWidth ( ) / ( xMax - xMin + 300 ) , pane . getHeight ( ) / ( yMax - yMin + 150 ) ) ; pane . setTranslateX ( ( scale * ( pane . getWidth ( ) - xMin - xMax ) / 2.0 ) ) ; pane . setTranslateY ( ( scale * ( pane . getHeight ( ) - yMin - yMax ) / 2.0 ) ) ; pane . setScaleX ( scale ) ; pane . setScaleY ( scale ) ; return scale ; }
computes transforms ( translations and scaling ) and applies them to the environment state view . those transforms map logical positions to screen positions in the viewer pane . the purpose is to show the graphical state representation as large as possible .
