public boolean generate(Projection proj){
  if (!updateImageForProjection(proj)) {
    if (getNeedToReposition()) {
      position(proj);
      setShape();
    }
 else {
      setShape();
      setNeedToRegenerate(false);
      return true;
    }
  }
  setShape(null);
  if (!position(proj)) {
    if (DEBUG) {
      logger.fine("OMRaster.generate(): positioning failed!");
    }
    return false;
  }
  if (colorModel != COLORMODEL_IMAGEICON) {
    if (bitmap == null || getNeedToRegenerate()) {
      if (DEBUG) {
        logger.fine("OMScalingRaster: generating image");
      }
      super.generate(proj);
      setImage(bitmap);
      pixels=null;
      bits=null;
    }
  }
  scaleTo(proj);
  if (bitmap != null) {
    if (corners == null) {
      GeneralPath projectedShape=createBoxShape(point1.x,point1.y,point2.x - point1.x,point2.y - point1.y);
      int w=bitmap.getWidth(this);
      int h=bitmap.getHeight(this);
      double anchorX=point1.x + w / 2;
      double anchorY=point1.y + h / 2;
      setShape(adjustShapeForRotation(projectedShape,anchorX,anchorY));
    }
 else {
      int numRects=corners.size();
      GeneralPath projectedShape=null;
      for (int i=0; i < numRects; i+=2) {
        GeneralPath gp=createShape(corners.get(i),corners.get(i + 1),true);
        projectedShape=appendShapeEdge(projectedShape,gp,false);
      }
      if (projectedShape != null) {
        Rectangle rect=projectedShape.getBounds();
        double anchorX=rect.getX() + rect.getWidth() / 2;
        double anchorY=rect.getY() + rect.getHeight() / 2;
        projectedShape=adjustShapeForRotation(projectedShape,anchorX,anchorY);
      }
      setShape(projectedShape);
    }
    setLabelLocation(getShape(),proj);
    setNeedToRegenerate(false);
  }
 else {
    hasLabel=false;
  }
  return true;
}

public boolean generate ( Projection proj ) { if ( ! updateImageForProjection ( proj ) ) { if ( getNeedToReposition ( ) ) { position ( proj ) ; setShape ( ) ; } else { setShape ( ) ; setNeedToRegenerate ( false ) ; return true ; } } setShape ( null ) ; if ( ! position ( proj ) ) { if ( DEBUG ) { logger . fine ( "OMRaster.generate(): positioning failed!" ) ; } return false ; } if ( colorModel != COLORMODEL_IMAGEICON ) { if ( bitmap == null || getNeedToRegenerate ( ) ) { if ( DEBUG ) { logger . fine ( "OMScalingRaster: generating image" ) ; } super . generate ( proj ) ; setImage ( bitmap ) ; pixels = null ; bits = null ; } } scaleTo ( proj ) ; if ( bitmap != null ) { if ( corners == null ) { GeneralPath projectedShape = createBoxShape ( point1 . x , point1 . y , point2 . x - point1 . x , point2 . y - point1 . y ) ; int w = bitmap . getWidth ( this ) ; int h = bitmap . getHeight ( this ) ; double anchorX = point1 . x + w / 2 ; double anchorY = point1 . y + h / 2 ; setShape ( adjustShapeForRotation ( projectedShape , anchorX , anchorY ) ) ; } else { int numRects = corners . size ( ) ; GeneralPath projectedShape = null ; for ( int i = 0 ; i < numRects ; i += 2 ) { GeneralPath gp = createShape ( corners . get ( i ) , corners . get ( i + 1 ) , true ) ; projectedShape = appendShapeEdge ( projectedShape , gp , false ) ; } if ( projectedShape != null ) { Rectangle rect = projectedShape . getBounds ( ) ; double anchorX = rect . getX ( ) + rect . getWidth ( ) / 2 ; double anchorY = rect . getY ( ) + rect . getHeight ( ) / 2 ; projectedShape = adjustShapeForRotation ( projectedShape , anchorX , anchorY ) ; } setShape ( projectedShape ) ; } setLabelLocation ( getShape ( ) , proj ) ; setNeedToRegenerate ( false ) ; } else { hasLabel = false ; } return true ; }
prepare the graphics for rendering . for all image types , it positions the image relative to the projection . for direct and indexed colormodel images , it creates the imageicon used for drawing to the window ( internal to object ) . for indexed colormodel images , it also calls computepixels , to resolve the colortable and the bytes to create the image pixels .
