List<AreaOwner> areaOwners = new ArrayList<AreaOwner>(); JobPainter painter = new JobPainter( gc, jobMeta, area, bar, bar, null, null, null, areaOwners, new ArrayList<JobEntryCopy>(), iconsize, 1, 0, 0, true, "FreeSans", 10 ); painter.setMagnification( magnification ); painter.setTranslationX( ( -min.x ) * magnification ); painter.setTranslationY( ( -min.y ) * magnification ); painter.drawJob();
private BufferedImage generateJobImage( JobMeta jobMeta ) throws Exception { float magnification = 1.0f; Point maximum = jobMeta.getMaximum(); maximum.multiply( magnification ); SwingGC gc = new SwingGC( null, maximum, 32, 0, 0 ); JobPainter jobPainter = new JobPainter( gc, jobMeta, maximum, null, null, null, null, null, new ArrayList<AreaOwner>(), new ArrayList<JobEntryCopy>(), 32, 1, 0, 0, true, "Arial", 10 ); jobPainter.setMagnification( magnification ); jobPainter.drawJob(); BufferedImage image = (BufferedImage) gc.getImage(); return image; }
new JobPainter( gc, jobMeta, new Point( x, y ), new SwtScrollBar( hori ), new SwtScrollBar( vert ), hop_candidate, drop_candidate, selectionRegion, areaOwners, mouseOverEntries, PropsUI.getInstance().getIconSize(), .getInstance().getNoteFont().getName(), PropsUI.getInstance().getNoteFont().getHeight() ); jobPainter.setMagnification( magnificationFactor ); jobPainter.setEntryLogMap( entryLogMap ); jobPainter.setStartHopEntry( startHopEntry ); jobPainter.setEndHopLocation( endHopLocation ); jobPainter.setEndHopEntry( endHopEntry ); jobPainter.setNoInputEntry( noInputEntry ); if ( job != null ) { jobPainter.setJobEntryResults( job.getJobEntryResults() ); } else { jobPainter.setJobEntryResults( new ArrayList<JobEntryResult>() ); jobPainter.setActiveJobEntries( activeJobEntries ); jobPainter.drawJob();
private void drawJobElements() { if ( !shadow && gridSize > 1 ) { drawGrid(); drawNote( ni ); drawJobHop( hi, false ); drawJobHop( candidate, true ); } else { if ( startHopEntry != null && endHopLocation != null ) { Point start = real2screen( fr.x + iconsize / 2, fr.y + iconsize / 2 ); Point end = real2screen( to.x, to.y ); drawArrow( arrow, start.x, start.y, end.x, end.y, theta, calcArrowLength(), 1.2, null, startHopEntry, endHopEntry == null ? endHopLocation : endHopEntry ); } else if ( endHopEntry != null && endHopLocation != null ) { Point start = real2screen( fr.x, fr.y ); Point end = real2screen( to.x + iconsize / 2, to.y + iconsize / 2 ); drawArrow( arrow, start.x, start.y, end.x, end.y + iconsize / 2, theta, calcArrowLength(), 1.2, null, startHopEntry == null ? endHopLocation : startHopEntry, endHopEntry ); drawJobEntryCopy( je ); gc.setLineStyle( ELineStyle.SOLID ); gc.setForeground( EColor.BLACK ); Point screen = real2screen( drop_candidate.x, drop_candidate.y ); gc.drawRectangle( screen.x, screen.y, iconsize, iconsize );
public void drawJob() { Point max = jobMeta.getMaximum(); Point thumb = getThumb( area, max ); offset = getOffset( thumb, area ); gc.setBackground( EColor.BACKGROUND ); if ( hori != null ) { hori.setThumb( thumb.x ); } if ( vert != null ) { vert.setThumb( thumb.y ); } // If there is a shadow, we draw the transformation first with an alpha // setting // if ( shadowSize > 0 ) { gc.setAlpha( 20 ); gc.setTransform( translationX, translationY, shadowSize, magnification ); shadow = true; drawJobElements(); } // Draw the transformation onto the image // gc.setAlpha( 255 ); gc.setTransform( translationX, translationY, 0, magnification ); shadow = false; drawJobElements(); gc.dispose(); }
@Override protected void drawArrow( EImage arrow, int x1, int y1, int x2, int y2, double theta, int size, double factor, JobHopMeta jobHop, Object startObject, Object endObject ) { int mx, my; int a, b, dist; double angle; // gc.setLineWidth(1); // WuLine(gc, black, x1, y1, x2, y2); gc.drawLine( x1, y1, x2, y2 ); // What's the distance between the 2 points? a = Math.abs( x2 - x1 ); b = Math.abs( y2 - y1 ); dist = (int) Math.sqrt( a * a + b * b ); // determine factor (position of arrow to left side or right side // 0-->100%) if ( factor < 0 ) { if ( dist >= 2 * iconsize ) { factor = 1.3; } else { factor = 1.2; } } // in between 2 points mx = (int) ( x1 + factor * ( x2 - x1 ) / 2 ); my = (int) ( y1 + factor * ( y2 - y1 ) / 2 );
List<AreaOwner> areaOwners = new ArrayList<AreaOwner>(); JobPainter painter = new JobPainter( gc, jobMeta, area, bar, bar, null, null, null, areaOwners, new ArrayList<JobEntryCopy>(), iconsize, 1, 0, 0, true, "FreeSans", 10 ); painter.setMagnification( 0.25f ); painter.drawJob(); BufferedImage bufferedImage = (BufferedImage) gc.getImage(); int newWidth = bufferedImage.getWidth() - min.x;