List of usage examples for java.awt Color orange
Color orange
To view the source code for java.awt Color orange.
Click Source Link
From source file:de.tor.tribes.ui.panels.MinimapPanel.java
@Override public void paintComponent(Graphics g) { super.paintComponent(g); try {//from ww w .ja va 2s. c o m Graphics2D g2d = (Graphics2D) g; g2d.clearRect(0, 0, getWidth(), getHeight()); g2d.drawImage(mBuffer, 0, 0, null); if (iCurrentView == ID_MINIMAP) { g2d.setColor(Color.YELLOW); int mapWidth = rVisiblePart.width; int mapHeight = rVisiblePart.height; int w = (int) Math.rint(((double) getWidth() / mapWidth) * (double) iWidth); int h = (int) Math.rint(((double) getHeight() / mapHeight) * (double) iHeight); double posX = ((double) getWidth() / mapWidth * (double) (iX - rVisiblePart.x)) - w / 2; double posY = ((double) getHeight() / mapHeight * (double) (iY - rVisiblePart.y)) - h / 2; g2d.drawRect((int) Math.rint(posX), (int) Math.rint(posY), w, h); if (iCurrentCursor == ImageManager.CURSOR_SHOT) { if (rDrag != null) { g2d.setColor(Color.ORANGE); g2d.drawRect((int) rDrag.getMinX(), (int) rDrag.getMinY(), (int) (rDrag.getWidth() - rDrag.getX()), (int) (rDrag.getHeight() - rDrag.getY())); } } else if (iCurrentCursor == ImageManager.CURSOR_ZOOM) { if (rDrag != null) { g2d.setColor(Color.CYAN); g2d.drawRect((int) rDrag.getX(), (int) rDrag.getY(), (int) (rDrag.getWidth() - rDrag.getX()), (int) ((rDrag.getWidth() - rDrag.getX()) * ((double) getHeight()) / getWidth())); } } } if (showControls) { //g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .2f)); Rectangle r = minimapButtons.get(ID_MINIMAP); g2d.setColor(Color.WHITE); Point menuPos = r.getLocation(); menuPos.translate(-2, -2); //draw border g2d.fillRect(menuPos.x, menuPos.y, 88, 30); g2d.setColor(Color.BLACK); //check if mouse is inside minimap button if (getMousePosition() != null && r.contains(getMousePosition())) { g2d.setColor(Color.YELLOW); g2d.fillRect(r.x, r.y, r.width, r.height); g2d.setColor(Color.BLACK); } g2d.drawImage(minimapIcons.get(ID_MINIMAP), r.x, r.y, null); g2d.drawRect(r.x, r.y, r.width, r.height); r = minimapButtons.get(ID_ALLY_CHART); //check if mouse is inside ally chart button if (getMousePosition() != null && r.contains(getMousePosition())) { g2d.setColor(Color.YELLOW); g2d.fillRect(r.x, r.y, r.width, r.height); g2d.setColor(Color.BLACK); } g2d.drawImage(minimapIcons.get(ID_ALLY_CHART), r.x, r.y, null); g2d.drawRect(r.x, r.y, r.width, r.height); r = minimapButtons.get(ID_TRIBE_CHART); //check if mouse is inside tribe chart button if (getMousePosition() != null && r.contains(getMousePosition())) { g2d.setColor(Color.YELLOW); g2d.fillRect(r.x, r.y, r.width, r.height); g2d.setColor(Color.BLACK); } g2d.drawImage(minimapIcons.get(ID_TRIBE_CHART), r.x, r.y, null); g2d.drawRect(r.x, r.y, r.width, r.height); } g2d.dispose(); } catch (Exception e) { logger.error("Failed painting Minimap", e); } }
From source file:windows.sensorWindow.java
/** * creates all relevant data and adds it into the corresponding maps * /*from w w w. ja va 2 s .c om*/ * @param UID * UID of the plotting sensor */ @SuppressWarnings("deprecation") public static void addPlot(Brick newBrick) { // create series TimeSeries newSeries = new TimeSeries("" + 0, Millisecond.class); TimeSeries newSeries2 = new TimeSeries("" + 0, Millisecond.class); TimeSeries newSeries3 = new TimeSeries("" + 0, Millisecond.class); TimeSeries newSeries4 = new TimeSeries("" + 0, Millisecond.class); TimeSeries newSeries5 = new TimeSeries("" + 0, Millisecond.class); TimeSeries newSeries6 = new TimeSeries("" + 0, Millisecond.class); Measurement m1 = new Measurement(maxValues, maxCycles, newBrick.uid, 0); valuesMap.put(newBrick.uid, m1); if (newBrick.checked3 == true) { Measurement m2 = new Measurement(maxValues, maxCycles, newBrick.uid, 1); values2Map.put(newBrick.uid, m2); } // create entry in state map plot1StateMap.put(newBrick.uid, 0); plot2StateMap.put(newBrick.uid, 0); // create index map entry tmplindex.put(newBrick.uid, 0); // create avrgCtrlEnabled maps if (newBrick.controlAverage == true) avrgCtrl1Enabled.put(newBrick.uid, true); else avrgCtrl1Enabled.put(newBrick.uid, false); if (newBrick.controlAverage2 == true) avrgCtrl2Enabled.put(newBrick.uid, true); else avrgCtrl2Enabled.put(newBrick.uid, false); // create series map entry seriesMap.put(newBrick.uid, newSeries); seriesMap2.put(newBrick.uid, newSeries2); seriesMap3.put(newBrick.uid, newSeries3); seriesMap4.put(newBrick.uid, newSeries4); seriesMap5.put(newBrick.uid, newSeries3); seriesMap6.put(newBrick.uid, newSeries4); // create collection map entry seriesCollectionMap.put(newBrick.uid, new TimeSeriesCollection(newSeries)); seriesCollectionMap2.put(newBrick.uid, new TimeSeriesCollection(newSeries2)); tmplCollection1_1.put(newBrick.uid, new TimeSeriesCollection(newSeries3)); tmplCollection1_2.put(newBrick.uid, new TimeSeriesCollection(newSeries4)); tmplCollection2_1.put(newBrick.uid, new TimeSeriesCollection(newSeries5)); tmplCollection2_2.put(newBrick.uid, new TimeSeriesCollection(newSeries6)); // create plot map entry, special case for current/voltage brick, since // it has 2 parallel measurements and therefore 2 graphs must be treated XYPlot tmpSubPlot; tmpSubPlot = new XYPlot(seriesCollectionMap.get(newBrick.uid), null, null, new StandardXYItemRenderer()); // create the 1st graph if (newBrick.checked2 == true) { // create plot map entry NumberAxis rangeAxis = new NumberAxis( String.valueOf(constants.brickUnitMap.get(newBrick.deviceIdentifier))); rangeAxis.setAutoRangeIncludesZero(true); tmpSubPlot.setRangeAxis(0, rangeAxis); rangeAxis.setLabelPaint(Color.BLUE); rangeAxis.setVisible(newBrick.checked2); tmpSubPlot.setDataset(0, seriesCollectionMap.get(newBrick.uid)); // set dot - shape // Shape cross = ShapeUtilities.createDiagonalCross(3, 1); // create and store renderer XYItemRenderer renderer1 = new XYLineAndShapeRenderer(); renderer1 = tmpSubPlot.getRenderer(); renderer1.setSeriesPaint(0, Color.BLUE); renderer1.setSeriesStroke(0, new BasicStroke(3)); // line = dashes: // float dash[] = {5.0f}; // renderer1.setSeriesStroke( 0, new // BasicStroke(3,BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, // 10.0f, dash, 0.0f)); // renderer1.setSeriesShape(0, cross); tmpSubPlot.setRenderer(0, renderer1); // set colors tmpSubPlot.setBackgroundPaint(Color.white); tmpSubPlot.setDomainGridlinePaint(Color.lightGray); tmpSubPlot.setRangeGridlinePaint(Color.lightGray); // tmpSubPlot.setRenderer(renderer2); // set font rangeAxis.setLabelFont(customFonts.get("axisLabelFont")); rangeAxis.setTickLabelFont(customFonts.get("axisValueFont")); // create template graph // if (newBrick.ctrlTmpl[0] == true) // { tmpSubPlot.setDataset(2, tmplCollection1_1.get(newBrick.uid)); XYItemRenderer renderer3 = new XYLineAndShapeRenderer(); int width = computeTmplPlotWidth(newBrick.tmpl1Width); BasicStroke stroke = new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND);// , 10.0f, dash, 0.0f); renderer3.setSeriesPaint(0, Color.GREEN); // renderer3.setSeriesStroke( 0, new BasicStroke( 1 ) ); renderer3.setSeriesStroke(0, stroke); renderer3.setSeriesVisible(0, newBrick.ctrlTmpl[0]); rendererMap3.put(newBrick.uid, renderer3); tmpSubPlot.setRenderer(2, rendererMap3.get(newBrick.uid)); // } // put everything to the maps rendererMap.put(newBrick.uid, renderer1); plotMap.put(newBrick.uid, tmpSubPlot); axisMap.put(newBrick.uid, rangeAxis); } // create the 2nd graph if (newBrick.checked3 == true) { // set second axis for voltage/ampere brick NumberAxis secondaryAxis = new NumberAxis( String.valueOf(constants.brick2ndUnitMap.get(newBrick.deviceIdentifier))); secondaryAxis.setAutoRangeIncludesZero(true); tmpSubPlot.setRangeAxis(1, secondaryAxis); secondaryAxis.setLabelPaint(Color.RED); secondaryAxis.setVisible(newBrick.checked3); tmpSubPlot.setDataset(1, seriesCollectionMap2.get(newBrick.uid)); tmpSubPlot.mapDatasetToRangeAxis(1, 1); // set font secondaryAxis.setLabelFont(customFonts.get("axisLabelFont")); secondaryAxis.setTickLabelFont(customFonts.get("axisValueFont")); // create and store renderer XYItemRenderer renderer2 = new StandardXYItemRenderer(); // renderer2 = tmpSubPlot.getRenderer(); renderer2.setSeriesPaint(1, Color.RED); renderer2.setSeriesStroke(0, new BasicStroke(3)); tmpSubPlot.setRenderer(1, renderer2); // set colors tmpSubPlot.setBackgroundPaint(Color.white); tmpSubPlot.setDomainGridlinePaint(Color.lightGray); tmpSubPlot.setRangeGridlinePaint(Color.lightGray); // ---------------------------------------------------------------------------------- // create min1 critical map value ValueMarker vm5 = new ValueMarker(newBrick.tresholdMin2); markerMapMin2Critical.put(newBrick.uid, vm5); // set critical line markerMapMin2Critical.get(newBrick.uid).setPaint(Color.red); markerMapMin2Critical.get(newBrick.uid).setLabel( String.valueOf(constants.brick2ndUnitMap.get(newBrick.deviceIdentifier)) + " critical min"); markerMapMin2Critical.get(newBrick.uid).setLabelAnchor(RectangleAnchor.TOP_RIGHT); markerMapMin2Critical.get(newBrick.uid).setLabelTextAnchor(TextAnchor.TOP_RIGHT); tmpSubPlot.addRangeMarker(1, markerMapMin2Critical.get(newBrick.uid), Layer.BACKGROUND); // create min1 warning map value ValueMarker vm6 = new ValueMarker( newBrick.tresholdMin2 + newBrick.tresholdMin2 * warningPercentage / 100); markerMapMin2Warning.put(newBrick.uid, vm6); // set warning line markerMapMin2Warning.get(newBrick.uid).setPaint(Color.orange); markerMapMin2Warning.get(newBrick.uid).setLabel( String.valueOf(constants.brick2ndUnitMap.get(newBrick.deviceIdentifier)) + " warning min"); markerMapMin2Warning.get(newBrick.uid).setLabelAnchor(RectangleAnchor.TOP_RIGHT); markerMapMin2Warning.get(newBrick.uid).setLabelTextAnchor(TextAnchor.TOP_RIGHT); // tmpSubPlot.addRangeMarker(markerMapMin2Warning.get(newBrick.uid)); tmpSubPlot.addRangeMarker(1, markerMapMin2Warning.get(newBrick.uid), Layer.BACKGROUND); // create max1 critical map value ValueMarker vm7 = new ValueMarker(newBrick.tresholdMax2); markerMapMax2Critical.put(newBrick.uid, vm7); // set critical line markerMapMax2Critical.get(newBrick.uid).setPaint(Color.red); markerMapMax2Critical.get(newBrick.uid).setLabel( String.valueOf(constants.brick2ndUnitMap.get(newBrick.deviceIdentifier)) + " critical max"); markerMapMax2Critical.get(newBrick.uid).setLabelAnchor(RectangleAnchor.TOP_RIGHT); markerMapMax2Critical.get(newBrick.uid).setLabelTextAnchor(TextAnchor.TOP_RIGHT); tmpSubPlot.addRangeMarker(1, markerMapMax2Critical.get(newBrick.uid), Layer.BACKGROUND); // create max1 warning map value ValueMarker vm8 = new ValueMarker( newBrick.tresholdMax2 + newBrick.tresholdMax2 * warningPercentage / 100); markerMapMax2Warning.put(newBrick.uid, vm8); // set warning line markerMapMax2Warning.get(newBrick.uid).setPaint(Color.orange); markerMapMax2Warning.get(newBrick.uid).setLabel( String.valueOf(constants.brick2ndUnitMap.get(newBrick.deviceIdentifier)) + " warning max"); markerMapMax2Warning.get(newBrick.uid).setLabelAnchor(RectangleAnchor.TOP_RIGHT); markerMapMax2Warning.get(newBrick.uid).setLabelTextAnchor(TextAnchor.TOP_RIGHT); tmpSubPlot.addRangeMarker(1, markerMapMax2Warning.get(newBrick.uid), Layer.BACKGROUND); // create and add min, max and average markers // create maxima marker ValueMarker vmMax = new ValueMarker(0); vmMax.setPaint(Color.orange); vmMax.setLabel("max"); vmMax.setLabelAnchor(RectangleAnchor.TOP_RIGHT); vmMax.setLabelTextAnchor(TextAnchor.TOP_RIGHT); // create minima marker ValueMarker vmMin = new ValueMarker(0); vmMin.setPaint(Color.orange); vmMin.setLabel("min"); vmMin.setLabelAnchor(RectangleAnchor.TOP_RIGHT); vmMin.setLabelTextAnchor(TextAnchor.TOP_RIGHT); // create average marker ValueMarker vmAvg = new ValueMarker(0); vmAvg.setPaint(Color.red); vmAvg.setLabel("average"); vmAvg.setLabelAnchor(RectangleAnchor.TOP_RIGHT); vmAvg.setLabelTextAnchor(TextAnchor.TOP_RIGHT); // add to maps marker2Maxima.put(newBrick.uid, vmMax); marker2Minima.put(newBrick.uid, vmMin); marker2Average.put(newBrick.uid, vmAvg); // add to plot tmpSubPlot.addRangeMarker(1, vmMax, Layer.BACKGROUND); tmpSubPlot.addRangeMarker(1, vmMin, Layer.BACKGROUND); tmpSubPlot.addRangeMarker(1, vmAvg, Layer.BACKGROUND); // create and add avrgCntrMarkers // create upper marker ValueMarker avrgCtrl2high = new ValueMarker(newBrick.getAvg2high()); avrgCtrl2high.setPaint(Color.orange); avrgCtrl2high.setLabel("avrg high"); avrgCtrl2high.setLabelAnchor(RectangleAnchor.TOP_RIGHT); avrgCtrl2high.setLabelTextAnchor(TextAnchor.TOP_RIGHT); // create lower marker ValueMarker avrgCtrl2low = new ValueMarker(newBrick.getAvg2low()); avrgCtrl2low.setPaint(Color.orange); avrgCtrl2low.setLabel("avrg low"); avrgCtrl2low.setLabelAnchor(RectangleAnchor.TOP_RIGHT); avrgCtrl2low.setLabelTextAnchor(TextAnchor.TOP_RIGHT); // add both markers avrg2High.put(newBrick.uid, avrgCtrl2high); avrg2Low.put(newBrick.uid, avrgCtrl2low); // add both to plot if (newBrick.controlAverage2) { tmpSubPlot.addRangeMarker(1, avrgCtrl2high, Layer.BACKGROUND); tmpSubPlot.addRangeMarker(1, avrgCtrl2low, Layer.BACKGROUND); } // ---------------------------------------------------------------------------------- // put everything to the map rendererMap2.put(newBrick.uid, renderer2); plotMap.put(newBrick.uid, tmpSubPlot); axisMap2.put(newBrick.uid, secondaryAxis); } // 1st graph // markers-------------------------------------------------------------------------------------------------- // create min1 critical map value ValueMarker vm1 = new ValueMarker(newBrick.tresholdMin1); markerMapMin1Critical.put(newBrick.uid, vm1); // set critical line markerMapMin1Critical.get(newBrick.uid).setPaint(Color.red); // / .setLabel("critical"); // markerMapMin1Critical.get(newBrick.uid).setLabelAnchor(RectangleAnchor.BOTTOM); markerMapMin1Critical.get(newBrick.uid) .setLabel(String.valueOf(constants.brickUnitMap.get(newBrick.deviceIdentifier)) + " critical min"); markerMapMin1Critical.get(newBrick.uid).setLabelAnchor(RectangleAnchor.TOP_LEFT); markerMapMin1Critical.get(newBrick.uid).setLabelTextAnchor(TextAnchor.TOP_LEFT); plotMap.get(newBrick.uid).addRangeMarker(markerMapMin1Critical.get(newBrick.uid)); // create min1 warning map value ValueMarker vm2 = new ValueMarker(newBrick.tresholdMin1 + newBrick.tresholdMin1 * warningPercentage / 100); markerMapMin1Warning.put(newBrick.uid, vm2); // set warning line markerMapMin1Warning.get(newBrick.uid).setPaint(Color.orange); // marker2Map.get(newBrick.uid).setPaint(Color.); // / marker2Map.get(newBrick.uid).setLabel("warning"); markerMapMin1Warning.get(newBrick.uid) .setLabel(String.valueOf(constants.brickUnitMap.get(newBrick.deviceIdentifier)) + " warning min"); markerMapMin1Warning.get(newBrick.uid).setLabelAnchor(RectangleAnchor.TOP_LEFT); markerMapMin1Warning.get(newBrick.uid).setLabelTextAnchor(TextAnchor.TOP_LEFT); plotMap.get(newBrick.uid).addRangeMarker(markerMapMin1Warning.get(newBrick.uid)); // create max1 critical map value ValueMarker vm3 = new ValueMarker(newBrick.tresholdMax1); markerMapMax1Critical.put(newBrick.uid, vm3); // set critical line markerMapMax1Critical.get(newBrick.uid).setPaint(Color.red); // / .setLabel("critical"); // markerMapMax1Critical.get(newBrick.uid).setLabelAnchor(RectangleAnchor.BOTTOM); markerMapMax1Critical.get(newBrick.uid) .setLabel(String.valueOf(constants.brickUnitMap.get(newBrick.deviceIdentifier)) + " critical max"); markerMapMax1Critical.get(newBrick.uid).setLabelAnchor(RectangleAnchor.TOP_LEFT); markerMapMax1Critical.get(newBrick.uid).setLabelTextAnchor(TextAnchor.TOP_LEFT); plotMap.get(newBrick.uid).addRangeMarker(markerMapMax1Critical.get(newBrick.uid)); // create max1 warning map value ValueMarker vm4 = new ValueMarker(newBrick.tresholdMax1 + newBrick.tresholdMax1 * warningPercentage / 100); markerMapMax1Warning.put(newBrick.uid, vm4); // set warning line markerMapMax1Warning.get(newBrick.uid).setPaint(Color.orange); markerMapMax1Warning.get(newBrick.uid) .setLabel(String.valueOf(constants.brickUnitMap.get(newBrick.deviceIdentifier)) + " warning max"); markerMapMax1Warning.get(newBrick.uid).setLabelAnchor(RectangleAnchor.TOP_LEFT); markerMapMax1Warning.get(newBrick.uid).setLabelTextAnchor(TextAnchor.TOP_LEFT); plotMap.get(newBrick.uid).addRangeMarker(markerMapMax1Warning.get(newBrick.uid)); // create and add min, max and average markers // create maxima marker ValueMarker vmMax = new ValueMarker(0); vmMax.setPaint(Color.cyan); vmMax.setLabel("max"); vmMax.setLabelAnchor(RectangleAnchor.TOP_LEFT); vmMax.setLabelTextAnchor(TextAnchor.TOP_LEFT); // create minima marker ValueMarker vmMin = new ValueMarker(0); vmMin.setPaint(Color.cyan); vmMin.setLabel("min"); vmMin.setLabelAnchor(RectangleAnchor.TOP_LEFT); vmMin.setLabelTextAnchor(TextAnchor.TOP_LEFT); // create average marker ValueMarker vmAvg = new ValueMarker(0); vmAvg.setPaint(Color.blue); vmAvg.setLabel("average"); vmAvg.setLabelAnchor(RectangleAnchor.TOP_LEFT); vmAvg.setLabelTextAnchor(TextAnchor.TOP_LEFT); // add to maps markerMaxima.put(newBrick.uid, vmMax); markerMinima.put(newBrick.uid, vmMin); markerAverage.put(newBrick.uid, vmAvg); // add to plot plotMap.get(newBrick.uid).addRangeMarker(vmMax); plotMap.get(newBrick.uid).addRangeMarker(vmMin); plotMap.get(newBrick.uid).addRangeMarker(vmAvg); // create and add avrgCntrMarkers // create upper marker ValueMarker avrgCtrl1high = new ValueMarker(newBrick.getAvg1high()); avrgCtrl1high.setPaint(Color.orange); avrgCtrl1high.setLabel("avrg high"); avrgCtrl1high.setLabelAnchor(RectangleAnchor.TOP_LEFT); avrgCtrl1high.setLabelTextAnchor(TextAnchor.TOP_LEFT); // create lower marker ValueMarker avrgCtrl1low = new ValueMarker(newBrick.getAvg1low()); avrgCtrl1low.setPaint(Color.orange); avrgCtrl1low.setLabel("avrg low"); avrgCtrl1low.setLabelAnchor(RectangleAnchor.TOP_LEFT); avrgCtrl1low.setLabelTextAnchor(TextAnchor.TOP_LEFT); // add both markers avrg1High.put(newBrick.uid, avrgCtrl1high); avrg1Low.put(newBrick.uid, avrgCtrl1low); // add both to plot if (newBrick.controlAverage) { plotMap.get(newBrick.uid).addRangeMarker(avrgCtrl1high); plotMap.get(newBrick.uid).addRangeMarker(avrgCtrl1low); } // ----------------------------------------------------------------------------------------------------- // set title NumberAxis axisForTitleOnly = new NumberAxis( data.constants.brickIdMap.get(newBrick.deviceIdentifier) + " (" + newBrick.uid + ")"); axisForTitleOnly.setLabelFont(customFonts.get("titleFont")); axisForTitleOnly.setTickLabelsVisible(false); axisForTitleOnly.setTickMarksVisible(false); axisForTitleOnly.setMinorTickMarksVisible(false); axisForTitleOnly.setAxisLineVisible(false); plotMap.get(newBrick.uid).setDomainAxis(1, axisForTitleOnly); // add subplot to the main plot plot.add(plotMap.get(newBrick.uid)); }
From source file:de.biomedical_imaging.ij.steger.Lines_.java
private void displayContours() { imp.setOverlay(null);//from w w w. ja v a 2s. c om Overlay ovpoly = new Overlay(); double px, py, nx, ny, px_r = 0, py_r = 0, px_l = 0, py_l = 0; double last_w_r, last_w_l; // Print contour and boundary for (int k = 0; k < result.size(); k++) { for (int i = 0; i < result.get(k).size(); i++) { FloatPolygon polyMitte = new FloatPolygon(); FloatPolygon polyR = new FloatPolygon(); FloatPolygon polyL = new FloatPolygon(); Line cont = result.get(k).get(i); int num_points = cont.num; last_w_r = 0; last_w_l = 0; for (int j = 0; j < num_points; j++) { px = cont.col[j]; py = cont.row[j]; nx = Math.sin(cont.angle[j]); ny = Math.cos(cont.angle[j]); if (doEstimateWidth) { px_r = px + cont.width_r[j] * nx; py_r = py + cont.width_r[j] * ny; px_l = px - cont.width_l[j] * nx; py_l = py - cont.width_l[j] * ny; } polyMitte.addPoint((px + 0.5), (py + 0.5)); if (doEstimateWidth) { if (last_w_r > 0 && cont.width_r[j] > 0) { polyR.addPoint((px_r + 0.5), (py_r + 0.5)); } if (last_w_l > 0 && cont.width_l[j] > 0) { polyL.addPoint((px_l + 0.5), (py_l + 0.5)); } } if (doEstimateWidth) { last_w_r = cont.width_r[j]; last_w_l = cont.width_l[j]; } } PolygonRoi polyRoiMitte = new PolygonRoi(polyMitte, Roi.POLYLINE); polyRoiMitte.setStrokeColor(Color.red); int position = result.get(k).getFrame(); if (!doStack || isPreview) { position = imp.getCurrentSlice(); } polyRoiMitte.setPosition(position); ovpoly.add(polyRoiMitte); if (doEstimateWidth) { if (polyL.npoints > 1) { PolygonRoi polyRoiRand1 = new PolygonRoi(polyL, Roi.POLYLINE); polyRoiRand1.setStrokeColor(Color.green); position = result.get(k).getFrame(); if (!doStack || isPreview) { position = imp.getCurrentSlice(); } polyRoiRand1.setPosition(position); ovpoly.add(polyRoiRand1); PolygonRoi polyRoiRand2 = new PolygonRoi(polyR, Roi.POLYLINE); polyRoiRand2.setStrokeColor(Color.green); polyRoiRand2.setPosition(position); ovpoly.add(polyRoiRand2); } } //Show IDs if (showIDs) {/* int posx = polyMitte.xpoints[0]; int posy = polyMitte.ypoints[0]; if(cont.cont_class == contour_class.cont_start_junc){ posx = polyMitte.xpoints[polyMitte.npoints-1]; posy = polyMitte.ypoints[polyMitte.npoints-1]; } */ int posx = (int) polyMitte.xpoints[polyMitte.npoints / 2]; int posy = (int) polyMitte.ypoints[polyMitte.npoints / 2]; TextRoi tr = new TextRoi(posx, posy, "" + cont.getID()); tr.setCurrentFont(new Font(Font.SANS_SERIF, Font.PLAIN, 9)); tr.setIgnoreClipRect(true); tr.setStrokeColor(Color.orange); tr.setPosition(resultJunction.get(k).getFrame()); ovpoly.add(tr); } } } if (showJunctionPoints) { // Print junctions for (int k = 0; k < resultJunction.size(); k++) { FloatPolygon pointpoly = new FloatPolygon(); for (int i = 0; i < resultJunction.get(k).size(); i++) { pointpoly.addPoint(resultJunction.get(k).get(i).x + 0.5, resultJunction.get(k).get(i).y + 0.5); } PointRoi pointroi = new PointRoi(pointpoly); pointroi.setShowLabels(false); int position = resultJunction.get(k).getFrame(); if (!doStack || isPreview) { position = imp.getCurrentSlice(); } pointroi.setPosition(position); ovpoly.add(pointroi); } } if (ovpoly.size() > 0) { imp.setOverlay(ovpoly); } }
From source file:mil.tatrc.physiology.utilities.csv.plots.RespiratoryPFTPlotter.java
public void createGraph(PlotJob job, Map<String, List<Double>> PFTData, Map<String, List<Double>> data, List<LogEvent> events, List<SEAction> actions) { CSVPlotTool plotTool = new CSVPlotTool(); //to leverage existing functions String title = job.name + "_"; XYSeriesCollection dataSet = new XYSeriesCollection(); double maxY = 0; double minY = Double.MAX_VALUE; for (int i = 0; i < job.headers.size(); i++) { title = title + job.headers.get(i) + "_"; XYSeries dataSeries;// ww w . j a v a 2 s. c o m dataSeries = plotTool.createXYSeries(job.headers.get(i), data.get("Time(s)"), data.get(job.headers.get(i))); dataSet.addSeries(dataSeries); maxY = maxY < dataSeries.getMaxY() ? dataSeries.getMaxY() : maxY; minY = minY > dataSeries.getMinY() ? dataSeries.getMinY() : minY; } //Now make a data series for PFT data and check its max and min XYSeries dataSeries = plotTool.createXYSeries("PFT Total Lung Volume (mL)", PFTData.get("Time"), PFTData.get("Volume")); dataSet.addSeries(dataSeries); maxY = maxY < dataSeries.getMaxY() ? dataSeries.getMaxY() : maxY; minY = minY > dataSeries.getMinY() ? dataSeries.getMinY() : minY; title = title + "vs_Time"; //Override the constructed title if desired if (job.titleOverride != null && !job.titleOverride.isEmpty() && !job.titleOverride.equalsIgnoreCase("None")) title = job.titleOverride; double rangeLength = maxY - minY; if (Math.abs(rangeLength) < 1e-6) { rangeLength = .01; } class AEEntry implements Comparable<AEEntry> { public String name; public List<Double> times = new ArrayList<Double>(); public List<Double> YVals = new ArrayList<Double>(); public String type = ""; public int compareTo(AEEntry entry) { return times.get(0) < entry.times.get(0) ? -1 : times.get(0) > entry.times.get(0) ? 1 : 0; } } List<AEEntry> allActionsAndEvents = new ArrayList<AEEntry>(); if (!job.skipAllEvents) { //Make points for each event //Treat each event like two points on the same vertical line for (LogEvent event : events) { boolean skip = false; for (String eventToSkip : job.eventOmissions) { if (event.text.contains(eventToSkip)) skip = true; } if (skip) continue; AEEntry entry = new AEEntry(); entry.times.add(event.time.getValue()); if (job.logAxis) entry.YVals.add(maxY); else if (job.forceZeroYAxisBound && maxY < 0) entry.YVals.add(-.01); else entry.YVals.add(maxY + 0.15 * rangeLength); entry.times.add(event.time.getValue()); if (job.logAxis) entry.YVals.add(minY); else if (job.forceZeroYAxisBound && minY > 0) entry.YVals.add(-.01); else entry.YVals.add(minY - 0.15 * rangeLength); entry.name = event.text + "\r\nt=" + event.time.getValue(); entry.type = "EVENT:"; allActionsAndEvents.add(entry); } } if (!job.skipAllActions) { //Make similar entries for actions for (SEAction action : actions) { boolean skip = false; for (String actionToSkip : job.actionOmissions) { if (action.toString().contains(actionToSkip)) skip = true; } if (skip) continue; if (action.toString().contains("Advance Time")) continue; AEEntry entry = new AEEntry(); entry.times.add(action.getScenarioTime().getValue()); if (job.logAxis) entry.YVals.add(maxY); else if (job.forceZeroYAxisBound && maxY < 0) entry.YVals.add(-.01); else entry.YVals.add(maxY + 0.15 * rangeLength); entry.times.add(action.getScenarioTime().getValue()); if (job.logAxis) entry.YVals.add(minY); else if (job.forceZeroYAxisBound && minY > 0) entry.YVals.add(-.01); else entry.YVals.add(minY - 0.15 * rangeLength); entry.name = action.toString() + "\r\nt=" + action.getScenarioTime().getValue(); entry.type = "ACTION:"; allActionsAndEvents.add(entry); } } //Sort the list Collections.sort(allActionsAndEvents); //Add a series for each entry for (AEEntry entry : allActionsAndEvents) { dataSet.addSeries(plotTool.createXYSeries(entry.type + entry.name, entry.times, entry.YVals)); } //set labels String XAxisLabel = "Time(s)"; String YAxisLabel = job.headers.get(0); JFreeChart chart = ChartFactory.createXYLineChart( job.titleOverride != null && job.titleOverride.equalsIgnoreCase("None") ? "" : title, // chart title XAxisLabel, // x axis label YAxisLabel, // y axis label dataSet, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); Log.info("Creating Graph " + title); XYPlot plot = (XYPlot) chart.getPlot(); if (!job.logAxis) { // Determine Y range double resMax0 = maxY; double resMin0 = minY; if (Double.isNaN(resMax0) || Double.isNaN(resMin0)) plot.getDomainAxis().setLabel("Range is NaN"); if (DoubleUtils.isZero(resMin0)) resMin0 = -0.000001; if (DoubleUtils.isZero(resMax0)) resMax0 = 0.000001; if (job.forceZeroYAxisBound && resMin0 >= 0) resMin0 = -.000001; if (job.forceZeroYAxisBound && resMax0 <= 0) resMax0 = .000001; rangeLength = resMax0 - resMin0; ValueAxis yAxis = plot.getRangeAxis(); if (rangeLength != 0) yAxis.setRange(resMin0 - 0.15 * rangeLength, resMax0 + 0.15 * rangeLength);//15% buffer so we can see top and bottom clearly //Add another Y axis to the right side for easier reading ValueAxis rightYAxis = new NumberAxis(); rightYAxis.setRange(resMin0 - 0.15 * rangeLength, resMax0 + 0.15 * rangeLength); rightYAxis.setLabel(""); //Override the bounds if desired try { if (job.Y1LowerBound != null) { yAxis.setLowerBound(job.Y1LowerBound); rightYAxis.setLowerBound(job.Y1LowerBound); } if (job.Y1UpperBound != null) { yAxis.setUpperBound(job.Y1UpperBound); rightYAxis.setUpperBound(job.Y1UpperBound); } } catch (Exception e) { Log.error( "Couldn't set Y bounds. You probably tried to set a bound on an axis that doesn't exist."); } plot.setRangeAxis(0, yAxis); plot.setRangeAxis(1, rightYAxis); } else { double resMin = minY; double resMax = maxY; if (resMin <= 0.0) resMin = .00001; LogarithmicAxis yAxis = new LogarithmicAxis("Log(" + YAxisLabel + ")"); LogarithmicAxis rightYAxis = new LogarithmicAxis(""); yAxis.setLowerBound(resMin); rightYAxis.setLowerBound(resMin); yAxis.setUpperBound(resMax); rightYAxis.setUpperBound(resMax); //Override the bounds if desired try { if (job.Y1LowerBound != null) { yAxis.setLowerBound(job.Y1LowerBound); rightYAxis.setLowerBound(job.Y1LowerBound); } if (job.Y1UpperBound != null) { yAxis.setUpperBound(job.Y1UpperBound); rightYAxis.setUpperBound(job.Y1UpperBound); } } catch (Exception e) { Log.error( "Couldn't set Y bounds. You probably tried to set a bound on an axis that doesn't exist."); } plot.setRangeAxis(0, yAxis); plot.setRangeAxis(1, rightYAxis); } //Override X bounds if desired try { if (job.X1LowerBound != null) plot.getDomainAxis(0).setLowerBound(job.X1LowerBound); if (job.X1UpperBound != null) plot.getDomainAxis(0).setUpperBound(job.X1UpperBound); } catch (Exception e) { Log.error("Couldn't set X bounds. You probably tried to set a bound on an axis that doesn't exist."); } //Override labels if desired if (job.X1Label != null && !plot.getDomainAxis(0).getLabel().contains("NaN")) plot.getDomainAxis(0).setLabel(job.X1Label.equalsIgnoreCase("None") ? "" : job.X1Label); if (job.Y1Label != null) plot.getRangeAxis(0).setLabel(job.Y1Label.equalsIgnoreCase("None") ? "" : job.Y1Label); formatRPFTPlot(job, chart); plot.setDomainGridlinesVisible(job.showGridLines); plot.setRangeGridlinesVisible(job.showGridLines); //Changing line widths and colors XYItemRenderer r = plot.getRenderer(); BasicStroke wideLine = new BasicStroke(2.0f); Color[] AEcolors = { Color.red, Color.green, Color.black, Color.magenta, Color.orange }; Color[] dataColors = { Color.blue, Color.cyan, Color.gray, Color.black, Color.red }; for (int i = 0, cIndex = 0; i < dataSet.getSeriesCount(); i++, cIndex++) { r.setSeriesStroke(i, wideLine); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setBaseShapesVisible(false); if (cIndex > 4) cIndex = 0; if (i < job.headers.size()) //Our actual data { renderer.setSeriesFillPaint(i, dataColors[cIndex]); renderer.setSeriesPaint(i, dataColors[cIndex]); } else //actions and events in procession of other colors { renderer.setSeriesFillPaint(i, AEcolors[cIndex]); renderer.setSeriesPaint(i, AEcolors[cIndex]); } } //Split the auto-generated legend into two legends, one for data and one for actions and events LegendItemCollection originalLegendCollection = plot.getLegendItems(); final LegendItemCollection dataLegendCollection = new LegendItemCollection(); int i; for (i = 0; i < job.headers.size() && i < originalLegendCollection.getItemCount(); i++) { if (originalLegendCollection.get(i).getLabel().startsWith("ACTION") || originalLegendCollection.get(i).getLabel().startsWith("EVENT")) break; dataLegendCollection.add(originalLegendCollection.get(i)); } final LegendItemCollection remainingLegendCollection = new LegendItemCollection(); for (; i < originalLegendCollection.getItemCount(); i++) { remainingLegendCollection.add(originalLegendCollection.get(i)); } chart.removeLegend(); LegendItemSource source = new LegendItemSource() { LegendItemCollection lic = new LegendItemCollection(); { lic.addAll(dataLegendCollection); } public LegendItemCollection getLegendItems() { return lic; } }; LegendTitle dataLegend = new LegendTitle(source); dataLegend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0)); dataLegend.setBorder(2, 2, 2, 2); dataLegend.setBackgroundPaint(Color.white); dataLegend.setPosition(RectangleEdge.TOP); dataLegend.setItemFont(new Font("SansSerif", Font.PLAIN, 22)); chart.addLegend(dataLegend); source = new LegendItemSource() { LegendItemCollection lic = new LegendItemCollection(); { lic.addAll(remainingLegendCollection); } public LegendItemCollection getLegendItems() { return lic; } }; LegendTitle actionEventsLegend = new LegendTitle(source); actionEventsLegend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0)); actionEventsLegend.setBorder(2, 2, 2, 2); actionEventsLegend.setBackgroundPaint(Color.white); actionEventsLegend.setPosition(RectangleEdge.BOTTOM); actionEventsLegend.setItemFont(new Font("SansSerif", Font.PLAIN, 22)); if (!job.hideAELegend && !job.removeAllLegends) chart.addLegend(actionEventsLegend); if (job.removeAllLegends) chart.removeLegend(); int verticalPixels = 800 + 170 * (allActionsAndEvents.size() / 5); try { FileUtils.createDirectory(job.outputDir); String filename = job.outputFilename == null ? job.outputDir + "/" + plotTool.MakeFileName(title) + ".jpg" : job.outputDir + "/" + job.outputFilename; if (!filename.endsWith(".jpg")) filename = filename + ".jpg"; File JPGFile = new File(filename); if (job.imageHeight != null && job.imageWidth != null) ChartUtilities.saveChartAsJPEG(JPGFile, chart, job.imageWidth, job.imageHeight); else if (!job.hideAELegend && !job.removeAllLegends) ChartUtilities.saveChartAsJPEG(JPGFile, chart, 1600, verticalPixels); else ChartUtilities.saveChartAsJPEG(JPGFile, chart, 1600, 800); } catch (IOException e) { Log.error(e.getMessage()); } }
From source file:projekt.CustomRenderer.java
public void raport_globalny() throws IOException, ClassNotFoundException, SQLException { String zapytanie = "select count(*) as Aktualne from zadania where Status_zadania='Aktualne'"; String zapytanie1 = "select count(*) as FORTEST from zadania where Status_zadania='FORTEST'"; String zapytanie2 = "select count(*) as Zakonczone from zadania where Status_zadania='Zakonczone'"; Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/pz?characterEncoding=utf8", "root", ""); PreparedStatement statment;//from w w w .j ava2 s . com ResultSet result; double odp = 0, odp1 = 0, odp2 = 0; statment = con.prepareStatement(zapytanie); result = statment.executeQuery(); if (result.next()) { odp = result.getDouble("Aktualne"); } statment = con.prepareStatement(zapytanie1); result = statment.executeQuery(); if (result.next()) { odp1 = result.getDouble("FORTEST"); } statment = con.prepareStatement(zapytanie2); result = statment.executeQuery(); if (result.next()) { odp2 = result.getDouble("Zakonczone"); } loginController login = new loginController(); statment = con.prepareStatement( "SELECT CONCAT(imie, ' ', nazwisko) as osoba from uzytkownicy WHERE idUzytkownika = '" + login.uzytkownikID + "'"); result = statment.executeQuery(); String bbc = ""; if (result.next()) { bbc = result.getString(1); } DefaultCategoryDataset set2 = new DefaultCategoryDataset(); set2.setValue(odp, "", "Aktualne"); set2.setValue(odp1, "", "FORTEST"); set2.setValue(odp2, "", "Zakonczone"); JFreeChart chart = ChartFactory.createBarChart("Wszystkie zadania w bazie", "Zadania", "Ilosc", set2, PlotOrientation.VERTICAL, false, true, false); final CategoryItemRenderer renderer = new CustomRenderer(new Paint[] { Color.red, Color.blue, Color.green, Color.yellow, Color.orange, Color.cyan, Color.magenta, Color.blue }); final CategoryPlot plot = chart.getCategoryPlot(); plot.setNoDataMessage("NO DATA!"); renderer.setItemLabelsVisible(true); final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 45.0); renderer.setPositiveItemLabelPosition(p); plot.setRenderer(renderer); ByteArrayOutputStream out = new ByteArrayOutputStream(); ChartUtilities.writeChartAsJPEG(out, chart, 450, 600); DateFormat dataformat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); DateFormat dataformat1 = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss"); Date data = new Date(); String fileName = "Raport globalny " + dataformat1.format(data) + ".pdf"; try { PDRectangle PAGE_SIZE = PDRectangle.A4; PDDocument doc = new PDDocument(); PDFont font = PDType0Font.load(doc, getClass().getResourceAsStream("/fonts/RobotoCondensed-Regular.ttf")); PDFont font1 = PDType0Font.load(doc, getClass().getResourceAsStream("/fonts/RobotoCondensed-Bold.ttf")); PDPage page = new PDPage(PAGE_SIZE); PDPage page1 = new PDPage(PAGE_SIZE); doc.addPage(page); PDPageContentStream content = new PDPageContentStream(doc, page); //naglowek strona 1 Naglowek(content, dataformat, data); //stopka strona1 Stopka(content, doc); content.beginText(); content.setFont(font1, 48); content.moveTextPositionByAmount(135, 550); content.showText("Raport globalny"); content.endText(); content.beginText(); content.setFont(font, 22); content.moveTextPositionByAmount(30, 250); content.showText("Wersja systemu : 1.0"); content.newLine(); content.moveTextPositionByAmount(0, 35); content.showText("Autor raportu : " + result.getString("osoba")); content.endText(); content.close(); PDPageContentStream content1 = new PDPageContentStream(doc, page1); PDPage page2 = new PDPage(PAGE_SIZE); doc.addPage(page2); PDPageContentStream content2 = new PDPageContentStream(doc, page2); Naglowek(content2, dataformat, data); //stopka strona2 Stopka(content2, doc); content2.beginText(); content2.setFont(font, 14); content2.moveTextPositionByAmount(30, 775); content2.showText("Wszystkie projekty z bazy danych:"); statment = con.prepareStatement("Select Nazwa, Opis, Poczatek, Koniec, ludzie from projekty"); result = statment.executeQuery(); content2.newLine(); int liczba = 615; content2.moveTextPositionByAmount(0, -15); while (result.next()) { content2.newLine(); content2.moveTextPositionByAmount(0, -22); liczba += 22; //content2.showText("Nazwa : "+result.getString("Nazwa")+" Opis: "+result.getString("Opis")+" Data rozpoczecia: "+result.getString("Poczatek")+" Data zakonczenia: "+result.getString("Koniec")); content2.showText("Nazwa : " + result.getString("Nazwa") + " Opis: " + result.getString("Opis")); content2.newLine(); content2.moveTextPositionByAmount(0, -17); liczba += 22; content2.showText("Data rozpoczecia: " + result.getString("Poczatek") + " Data zakonczenia: " + result.getString("Koniec")); } content2.endText(); // content2.setLineWidth(2); // content2.moveTo(10, liczba + 5); // content2.lineTo(10, liczba +5); // content2.closeAndStroke(); DateFormat dataformat2 = new SimpleDateFormat("yyyy-MM-dd"); statment = con.prepareStatement("Select count(*) as 'Aktualne' from projekty where Koniec > '" + dataformat2.format(data) + "'"); result = statment.executeQuery(); int aktualne = 0, zakonczone = 0; if (result.next()) { aktualne = result.getInt("Aktualne"); } System.out.println("aktualne:" + aktualne); statment = con.prepareStatement("Select count(*) as 'Zakonczone' from projekty where Koniec < '" + dataformat2.format(data) + "'"); result = statment.executeQuery(); if (result.next()) { zakonczone = result.getInt("Zakonczone"); } System.out.println("zakonczone:" + zakonczone); DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue("Aktualne", aktualne); pieDataset.setValue("Zakonczone", zakonczone); JFreeChart chart1 = ChartFactory.createPieChart("Zestawienia projektw", // Title pieDataset, // Dataset true, // Show legend true, // Use tooltips false // Configure chart to generate URLs? ); PiePlot plot1 = (PiePlot) chart1.getPlot(); plot1.setSectionPaint("Aktualne", Color.green); plot1.setSectionPaint("Zakonczone", Color.red); plot1.setExplodePercent("Aktualne", 0.10); plot1.setSimpleLabels(true); PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} ({2})", new DecimalFormat("0"), new DecimalFormat("0%")); plot1.setLabelGenerator(gen); ByteArrayOutputStream out1 = new ByteArrayOutputStream(); ChartUtilities.writeChartAsJPEG(out1, chart1, 450, 600); PDImageXObject img1 = JPEGFactory.createFromStream(doc, new ByteArrayInputStream(out1.toByteArray())); content2.close(); PDPage page3 = new PDPage(PAGE_SIZE); doc.addPage(page3); PDPageContentStream content3 = new PDPageContentStream(doc, page3); Naglowek(content3, dataformat, data); //stopka strona2 Stopka(content3, doc); content3.drawImage(img1, 50, 50); content3.close(); PDPage page4 = new PDPage(PAGE_SIZE); doc.addPage(page4); PDPageContentStream content4 = new PDPageContentStream(doc, page4); Naglowek(content4, dataformat, data); //stopka strona2 Stopka(content4, doc); content4.beginText(); content4.setFont(font, 14); content4.moveTextPositionByAmount(30, 780); content4.showText("Wszystkie zadania w bazie:"); statment = con.prepareStatement( "SELECT `Nazwa`,`Opis`,`Status_zadania`,`projekt`, CONCAT(x.imie, \" \", x.nazwisko) as \"UZY\" FROM `zadania` , (SELECT imie, nazwisko, idUzytkownika from uzytkownicy) X WHERE zadania.idUzytkownika=x.idUzytkownika limit 12"); result = statment.executeQuery(); content4.newLine(); int nw = 850; content4.moveTextPositionByAmount(0, -15); nw -= 15; while (result.next()) { content4.newLine(); nw -= 22; content4.moveTextPositionByAmount(0, -22); //content2.showText("Nazwa : "+result.getString("Nazwa")+" Opis: "+result.getString("Opis")+" Data rozpoczecia: "+result.getString("Poczatek")+" Data zakonczenia: "+result.getString("Koniec")); content4.showText("Nazwa : " + result.getString("Nazwa")); content4.newLine(); nw -= 17; content4.moveTextPositionByAmount(0, -17); content4.showText(" Opis: " + result.getString("Opis") + " Status zadania: " + result.getString("Status_zadania")); content4.newLine(); nw -= 17; content4.moveTextPositionByAmount(0, -17); content4.showText(" Projekt: " + result.getString("projekt") + " Przydzielona osoba do zadania: " + result.getString("UZY")); } content4.endText(); content4.close(); statment = con.prepareStatement("SELECT count(*) as 'liczba' FROM `zadania`"); result = statment.executeQuery(); if (result.next()) { } statment = con.prepareStatement( "SELECT `Nazwa`,`Opis`,`Status_zadania`,`projekt`, CONCAT(x.imie, \" \", x.nazwisko) as \"UZY\" FROM `zadania` , (SELECT imie, nazwisko, idUzytkownika from uzytkownicy) X WHERE zadania.idUzytkownika=x.idUzytkownika limit 12," + result.getInt(1) + ""); result = statment.executeQuery(); PDPage page5 = new PDPage(PAGE_SIZE); doc.addPage(page5); PDPageContentStream content5 = new PDPageContentStream(doc, page5); Naglowek(content5, dataformat, data); //stopka strona2 Stopka(content5, doc); content5.beginText(); content5.setFont(font, 14); content5.moveTextPositionByAmount(30, 700); while (result.next()) { content5.newLine(); nw -= 22; content5.moveTextPositionByAmount(0, -22); //content2.showText("Nazwa : "+result.getString("Nazwa")+" Opis: "+result.getString("Opis")+" Data rozpoczecia: "+result.getString("Poczatek")+" Data zakonczenia: "+result.getString("Koniec")); content5.showText("Nazwa : " + result.getString("Nazwa")); content5.newLine(); nw -= 17; content5.moveTextPositionByAmount(0, -17); content5.showText(" Opis: " + result.getString("Opis") + " Status zadania: " + result.getString("Status_zadania")); content5.newLine(); nw -= 17; content5.moveTextPositionByAmount(0, -17); content5.showText(" Projekt: " + result.getString("projekt") + " Przydzielona osoba do zadania: " + result.getString("UZY")); } content5.endText(); content5.close(); doc.addPage(page1); //naglowek strona 2 Naglowek(content1, dataformat, data); //stopka strona2 Stopka(content1, doc); PDImageXObject img = JPEGFactory.createFromStream(doc, new ByteArrayInputStream(out.toByteArray())); content1.drawImage(img, 50, 50); content1.close(); doc.save(fileName); doc.close(); } catch (Exception e) { System.err.println(e.getMessage()); } }
From source file:com.juanhg.pot.PotApplet.java
void updateOutputs() { double Wo = model.getWo(); double Wf = model.getWf(); double Qo = model.getQo(); double Qf = model.getQf(); double To = model.getTo(); double Tf = model.getTf(); double Uo = model.getUo(); double Uf = model.getUf(); double Po = model.getPo(); double Pf = model.getPf(); double Vo = model.getVo(); double Vf = model.getVf(); double aux;/*from w w w.jav a 2s.c om*/ if (Wo > Wf) { aux = Wo; Wo = Wf; Wf = aux; } if (Qo > Qf) { aux = Qo; Qo = Qf; Qf = aux; } if (To > Tf) { aux = To; To = Tf; Tf = aux; } if (Uo > Uf) { aux = Uo; Uo = Uf; Uf = aux; } if (Po > Pf) { aux = Po; Po = Pf; Pf = aux; } if (Vo > Vf) { aux = Vo; Vo = Vf; Vf = aux; } double Wn = normalize(model.getW(), Wo, Wf, 0, 10); double Qn = normalize(model.getQ(), Qo, Qf, 0, 10); double Tn = normalize(model.getT(), To, Tf, 0, 10); double Un = normalize(model.getU(), Uo, Uf, 0, 10); double Pn = normalize(model.getP(), Po, Pf, 0, 10); double Vn = normalize(model.getV(), Vo, Vf, 0, 10); Stroke stroke = new BasicStroke(1f); chartChart.deleteAnnotation(WAnnotation); WAnnotation = chartChart.drawBox(0.5, 0, 1.5, Wn, stroke, Color.BLACK, Color.RED); chartChart.deleteAnnotation(QAnnotation); QAnnotation = chartChart.drawBox(2.5, 0, 3.5, Qn, stroke, Color.BLACK, Color.ORANGE); chartChart.deleteAnnotation(TAnnotation); TAnnotation = chartChart.drawBox(4.5, 0, 5.5, Tn, stroke, Color.BLACK, Color.YELLOW); chartChart.deleteAnnotation(UAnnotation); UAnnotation = chartChart.drawBox(6.5, 0, 7.5, Un, stroke, Color.BLACK, Color.GREEN); chartChart.deleteAnnotation(PAnnotation); PAnnotation = chartChart.drawBox(8.5, 0, 9.5, Pn, stroke, Color.BLACK, Color.BLUE); chartChart.deleteAnnotation(VAnnotation); VAnnotation = chartChart.drawBox(10.5, 0, 11.5, Vn, stroke, Color.BLACK, Color.MAGENTA); }
From source file:org.pentaho.reporting.engine.classic.core.modules.output.pageable.graphics.internal.LogicalPageDrawable.java
protected void drawOutlineBox(final Graphics2D g2, final RenderBox box) { final int nodeType = box.getNodeType(); if (nodeType == LayoutNodeTypes.TYPE_BOX_PARAGRAPH) { g2.setPaint(Color.magenta); } else if (nodeType == LayoutNodeTypes.TYPE_BOX_LINEBOX) { g2.setPaint(Color.orange); } else if ((nodeType & LayoutNodeTypes.MASK_BOX_TABLE) == LayoutNodeTypes.MASK_BOX_TABLE) { g2.setPaint(Color.cyan);/*from w w w . j a v a 2 s .c o m*/ } else { g2.setPaint(Color.lightGray); } final double x = StrictGeomUtility.toExternalValue(box.getX()); final double y = StrictGeomUtility.toExternalValue(box.getY()); final double w = StrictGeomUtility.toExternalValue(box.getWidth()); final double h = StrictGeomUtility.toExternalValue(box.getHeight()); boxArea.setFrame(x, y, w, h); g2.draw(boxArea); }
From source file:tufts.vue.ds.DataAction.java
/** make links from row nodes (full data nodes) to any schematic field nodes found in the link targets, or between row nodes from different schema's that are considered "auto-joined" (e.g., a matching key field appears) */ private static List<LWLink> makeRowNodeLinks(final Collection<? extends LWComponent> linkTargets, final LWComponent rowNode, final Multiset<LWComponent> targetsUsed) { if (!rowNode.isDataRowNode()) Log.warn("making row links to non-row node: " + rowNode, new Throwable("FYI")); final Schema sourceSchema = rowNode.getDataSchema(); final MetaMap sourceRow = rowNode.getRawData(); if (DEBUG.Enabled) { String targets;//w w w. j a va2s. c om if (linkTargets.size() == 1) targets = Util.getFirst(linkTargets).toString(); else targets = Util.tags(linkTargets); Log.debug("makeRowNodeLinks: " + rowNode + "; " + rowNode.getRawData() + "; " + targets); } final List<LWLink> links = Util.skipNullsArrayList(); final List<LWComponent> singletonTargetList = new ArrayList(2); singletonTargetList.add(null); for (LWComponent target : linkTargets) { if (target == rowNode) // never link to ourself continue; try { final Schema targetSchema = target.getDataSchema(); if (targetSchema == null) { //----------------------------------------------------------------------------- // CHECK FOR RESOURCE META-DATA AND LABEL META-DATA //----------------------------------------------------------------------------- continue; } final Field singleValueField = target.getDataValueField(); if (singleValueField != null) { singletonTargetList.set(0, rowNode); final List<LWLink> valueLinks = makeValueNodeLinks(singletonTargetList, target, singleValueField, null); // do NOT accrue reverse targets! //= makeValueNodeLinks(singletonTargetList, target, singleValueField, targetsUsed); if (valueLinks.size() > 0) { targetsUsed.add(target); if (valueLinks.size() > 1) Log.warn("more than 1 link added for single value node: " + Util.tags(valueLinks), new Throwable("HERE")); } links.addAll(valueLinks); } // final String singleValueFieldName = c.getDataValueFieldName(); // if (singleValueFieldName != null) { // //----------------------------------------------------------------------------- // // The target being inspected is a value node - create a link // // if there's any matching value in the row node. We don't // // currently care if it's from the same schema or not: identical // // field names currently always provide a match (sort of a weak auto-join) // //----------------------------------------------------------------------------- // final String fieldValue = c.getDataValue(singleValueFieldName); // // TODO: USE ASSOCIATIONS // if (rowNode.hasDataValue(singleValueFieldName, fieldValue)) { // links.add(makeLink(c, rowNode, singleValueFieldName, fieldValue, null)); // } // } else if (sourceSchema == targetSchema) { final MetaMap targetRow = target.getRawData(); if (Relation.isSameRow(targetSchema, targetRow, sourceRow)) { links.add(makeLink(rowNode, target, null, null, Color.orange)); targetsUsed.add(target); } } else { // if (sourceSchema != targetSchema) { final MetaMap targetRow = target.getRawData(); //Log.debug("looking for x-schema relation: " + sourceRow + "; " + targetRow); final Relation relation = Relation.getRelation(sourceRow, targetRow); if (relation != null) { links.add(makeLink(rowNode, target, relation)); targetsUsed.add(target); } //makeCrossSchemaRowNodeLinks(links, sourceSchema, targetSchema, rowNode, c); } } catch (Throwable t) { Log.warn("makeRowNodeLinks: processing target: " + target, t); } } return links; }
From source file:cn.InstFS.wkr.NetworkMining.UIs.TimeSeriesChart1.java
public static Color getcolor(int i) { switch (i) {//from www. ja va 2 s . c o m case 1: return Color.red; case 2: return Color.blue; case 3: return Color.cyan; case 4: return Color.gray; case 5: return Color.green; case 6: return Color.magenta; case 7: return Color.orange; case 8: return Color.yellow; case 9: return Color.white; case 0: return Color.pink; default: return Color.black; } }
From source file:mil.tatrc.physiology.utilities.csv.plots.ActionEventPlotter.java
public void createGraph(PlotJob job, List<List<Double>> timeData, List<List<Double>> data, List<LogEvent> events, List<SEAction> actions) { CSVPlotTool plotTool = new CSVPlotTool(); //to leverage existing functions String title = job.name + "_"; XYSeriesCollection dataSet = new XYSeriesCollection(); double maxY = 0; double minY = Double.MAX_VALUE; for (int i = 0; i < timeData.size(); i++) { if (timeData.get(i) == null || data.get(i) == null) { job.bgColor = Color.white; //This hits when we have Expected data but NOT computed data continue; }//from ww w. j a v a 2 s . c o m title = title + job.headers.get(i) + "_"; XYSeries dataSeries; if (job.isComparePlot) { if (timeData.size() > 1) dataSeries = plotTool.createXYSeries(i == 0 ? "Expected" : "Computed", timeData.get(i), data.get(i)); else //If we're comparing but only have one data list, expected is missing, so rename to computed { dataSeries = plotTool.createXYSeries("Computed", timeData.get(i), data.get(i)); } } else dataSeries = plotTool.createXYSeries(job.headers.get(i), timeData.get(i), data.get(i)); dataSet.addSeries(dataSeries); maxY = maxY < dataSeries.getMaxY() ? dataSeries.getMaxY() : maxY; minY = minY > dataSeries.getMinY() ? dataSeries.getMinY() : minY; } title = title + "vs_Time_Action_Event_Plot"; //Override the constructed title if desired (usually for compare plots) if (job.titleOverride != null && !job.titleOverride.isEmpty() && !job.titleOverride.equalsIgnoreCase("None")) title = job.titleOverride; double rangeLength = maxY - minY; if (Math.abs(rangeLength) < 1e-6) { rangeLength = .01; } class AEEntry implements Comparable<AEEntry> { public String name; public List<Double> times = new ArrayList<Double>(); public List<Double> YVals = new ArrayList<Double>(); public String type = ""; public int compareTo(AEEntry entry) { return times.get(0) < entry.times.get(0) ? -1 : times.get(0) > entry.times.get(0) ? 1 : 0; } } List<AEEntry> allActionsAndEvents = new ArrayList<AEEntry>(); if (!job.skipAllEvents) { //Make points for each event //Treat each event like two points on the same vertical line for (LogEvent event : events) { boolean skip = false; for (String eventToSkip : job.eventOmissions) { if (event.text.contains(eventToSkip)) skip = true; } if (skip) continue; AEEntry entry = new AEEntry(); entry.times.add(event.time.getValue()); if (job.logAxis) entry.YVals.add(maxY); else if (job.forceZeroYAxisBound && maxY < 0) entry.YVals.add(-.01); else entry.YVals.add(maxY + 0.15 * rangeLength); entry.times.add(event.time.getValue()); if (job.logAxis) entry.YVals.add(minY); else if (job.forceZeroYAxisBound && minY > 0) entry.YVals.add(-.01); else entry.YVals.add(minY - 0.15 * rangeLength); entry.name = event.text + "\r\nt=" + event.time.getValue(); entry.type = "EVENT:"; allActionsAndEvents.add(entry); } } if (!job.skipAllActions) { //Make similar entries for actions for (SEAction action : actions) { boolean skip = false; for (String actionToSkip : job.actionOmissions) { if (action.toString().contains(actionToSkip)) skip = true; } if (skip) continue; if (action.toString().contains("Advance Time")) continue; AEEntry entry = new AEEntry(); entry.times.add(action.getScenarioTime().getValue()); if (job.logAxis) entry.YVals.add(maxY); else if (job.forceZeroYAxisBound && maxY < 0) entry.YVals.add(-.01); else entry.YVals.add(maxY + 0.15 * rangeLength); entry.times.add(action.getScenarioTime().getValue()); if (job.logAxis) entry.YVals.add(minY); else if (job.forceZeroYAxisBound && minY > 0) entry.YVals.add(-.01); else entry.YVals.add(minY - 0.15 * rangeLength); entry.name = action.toString() + "\r\nt=" + action.getScenarioTime().getValue(); entry.type = "ACTION:"; allActionsAndEvents.add(entry); } } //Sort the list Collections.sort(allActionsAndEvents); //Add a series for each entry for (AEEntry entry : allActionsAndEvents) { dataSet.addSeries(plotTool.createXYSeries(entry.type + entry.name, entry.times, entry.YVals)); } //If we have experimental data, try to load it and create a dataset for it XYSeriesCollection expDataSet = new XYSeriesCollection(); if (job.experimentalData != null && !job.experimentalData.isEmpty()) { Map<String, List<Double>> expData = new HashMap<String, List<Double>>(); List<String> expHeaders = new ArrayList<String>(); try { CSVContents csv = new CSVContents(job.experimentalData); csv.abbreviateContents = 0; csv.readAll(expData); expHeaders = csv.getHeaders(); } catch (Exception e) { Log.error("Unable to read experimental data"); } if (!expData.isEmpty() && !expHeaders.isEmpty()) { List<Double> expTimeData = new ArrayList<Double>(); expTimeData = expData.get("Time(s)"); for (String h : expHeaders) //Will assume all headers from exp file will be on same Y axis vs time { if (h.equalsIgnoreCase("Time(s)")) continue; expDataSet.addSeries(plotTool.createXYSeries("Experimental " + h, expTimeData, expData.get(h))); } } } //set labels String XAxisLabel = "Time(s)"; String YAxisLabel = job.headers.get(0); JFreeChart chart = ChartFactory.createXYLineChart( job.titleOverride != null && job.titleOverride.equalsIgnoreCase("None") ? "" : title, // chart title XAxisLabel, // x axis label YAxisLabel, // y axis label dataSet, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); Log.info("Creating Graph " + title); XYPlot plot = (XYPlot) chart.getPlot(); if (!job.logAxis) { // Determine Y range double resMax0 = maxY; double resMin0 = minY; if (Double.isNaN(resMax0) || Double.isNaN(resMin0)) plot.getDomainAxis().setLabel("Range is NaN"); if (DoubleUtils.isZero(resMin0)) resMin0 = -0.000001; if (DoubleUtils.isZero(resMax0)) resMax0 = 0.000001; if (job.forceZeroYAxisBound && resMin0 >= 0) resMin0 = -.000001; if (job.forceZeroYAxisBound && resMax0 <= 0) resMax0 = .000001; rangeLength = resMax0 - resMin0; ValueAxis yAxis = plot.getRangeAxis(); if (rangeLength != 0) yAxis.setRange(resMin0 - 0.15 * rangeLength, resMax0 + 0.15 * rangeLength);//15% buffer so we can see top and bottom clearly //Add another Y axis to the right side for easier reading ValueAxis rightYAxis = new NumberAxis(); rightYAxis.setRange(yAxis.getRange()); rightYAxis.setLabel(""); //Override the bounds if desired try { if (job.Y1LowerBound != null) { yAxis.setLowerBound(job.Y1LowerBound); rightYAxis.setLowerBound(job.Y1LowerBound); } if (job.Y1UpperBound != null) { yAxis.setUpperBound(job.Y1UpperBound); rightYAxis.setUpperBound(job.Y1UpperBound); } } catch (Exception e) { Log.error( "Couldn't set Y bounds. You probably tried to set a bound on an axis that doesn't exist."); } plot.setRangeAxis(0, yAxis); plot.setRangeAxis(1, rightYAxis); } else { double resMin = minY; double resMax = maxY; if (resMin <= 0.0) resMin = .00001; LogarithmicAxis yAxis = new LogarithmicAxis("Log(" + YAxisLabel + ")"); LogarithmicAxis rightYAxis = new LogarithmicAxis(""); yAxis.setLowerBound(resMin); rightYAxis.setLowerBound(resMin); yAxis.setUpperBound(resMax); rightYAxis.setUpperBound(resMax); //Override the bounds if desired try { if (job.Y1LowerBound != null) { yAxis.setLowerBound(job.Y1LowerBound); rightYAxis.setLowerBound(job.Y1LowerBound); } if (job.Y1UpperBound != null) { yAxis.setUpperBound(job.Y1UpperBound); rightYAxis.setUpperBound(job.Y1UpperBound); } } catch (Exception e) { Log.error( "Couldn't set Y bounds. You probably tried to set a bound on an axis that doesn't exist."); } plot.setRangeAxis(0, yAxis); plot.setRangeAxis(1, rightYAxis); } //Override X bounds if desired try { if (job.X1LowerBound != null) plot.getDomainAxis(0).setLowerBound(job.X1LowerBound); if (job.X1UpperBound != null) plot.getDomainAxis(0).setUpperBound(job.X1UpperBound); } catch (Exception e) { Log.error("Couldn't set X bounds. You probably tried to set a bound on an axis that doesn't exist."); } //Override labels if desired if (job.X1Label != null && !plot.getDomainAxis(0).getLabel().contains("NaN")) plot.getDomainAxis(0).setLabel(job.X1Label.equalsIgnoreCase("None") ? "" : job.X1Label); if (job.Y1Label != null) plot.getRangeAxis(0).setLabel(job.Y1Label.equalsIgnoreCase("None") ? "" : job.Y1Label); //If we have experimental data, set up the renderer for it and add to plot if (expDataSet.getSeriesCount() != 0) { XYItemRenderer renderer1 = new XYLineAndShapeRenderer(false, true); // Shapes only renderer1.setSeriesShape(0, ShapeUtilities.createDiamond(8)); plot.setDataset(1, expDataSet); plot.setRenderer(1, renderer1); plot.mapDatasetToDomainAxis(1, 0); plot.mapDatasetToRangeAxis(1, 0); } formatAEPlot(job, chart); plot.setDomainGridlinesVisible(job.showGridLines); plot.setRangeGridlinesVisible(job.showGridLines); //Changing line widths and colors XYItemRenderer r = plot.getRenderer(); BasicStroke wideLine = new BasicStroke(2.0f); Color[] AEcolors = { Color.red, Color.green, Color.black, Color.magenta, Color.orange }; Color[] dataColors = { Color.blue, Color.cyan, Color.gray, Color.black, Color.red }; for (int i = 0, cIndex = 0; i < dataSet.getSeriesCount(); i++, cIndex++) { r.setSeriesStroke(i, wideLine); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setBaseShapesVisible(false); if (cIndex > 4) cIndex = 0; if (i < job.headers.size()) //Our actual data { renderer.setSeriesFillPaint(i, dataColors[cIndex]); renderer.setSeriesPaint(i, dataColors[cIndex]); } else //actions and events in procession of other colors { renderer.setSeriesFillPaint(i, AEcolors[cIndex]); renderer.setSeriesPaint(i, AEcolors[cIndex]); } } //Special color and format changes for compare plots if (job.isComparePlot) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); for (int i = 0; i < dataSet.getSeriesCount(); i++) { if (dataSet.getSeries(i).getKey().toString().equalsIgnoreCase("Expected")) { renderer.setSeriesStroke(//makes a dashed line i, //argument below float[]{I,K} -> alternates between solid and opaque (solid for I, opaque for K) new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 15.0f, 30.0f }, 0.0f)); renderer.setDrawSeriesLineAsPath(true); renderer.setUseFillPaint(true); renderer.setBaseShapesVisible(false); renderer.setSeriesFillPaint(i, Color.black); renderer.setSeriesPaint(i, Color.black); } if (dataSet.getSeries(i).getKey().toString().equalsIgnoreCase("Computed")) { renderer.setSeriesFillPaint(i, Color.red); renderer.setSeriesPaint(i, Color.red); } if (dataSet.getSeries(i).getKey().toString().startsWith("ACTION")) { renderer.setSeriesFillPaint(i, Color.green); renderer.setSeriesPaint(i, Color.green); } if (dataSet.getSeries(i).getKey().toString().startsWith("EVENT")) { renderer.setSeriesFillPaint(i, Color.blue); renderer.setSeriesPaint(i, Color.blue); } } } //Split the auto-generated legend into two legends, one for data and one for actions and events LegendItemCollection originalLegendCollection = plot.getLegendItems(); final LegendItemCollection dataLegendCollection = new LegendItemCollection(); int i; for (i = 0; i < job.headers.size() && i < originalLegendCollection.getItemCount(); i++) { if (originalLegendCollection.get(i).getLabel().startsWith("ACTION") || originalLegendCollection.get(i).getLabel().startsWith("EVENT")) break; dataLegendCollection.add(originalLegendCollection.get(i)); } final LegendItemCollection remainingLegendCollection = new LegendItemCollection(); for (; i < originalLegendCollection.getItemCount(); i++) { remainingLegendCollection.add(originalLegendCollection.get(i)); } chart.removeLegend(); LegendItemSource source = new LegendItemSource() { LegendItemCollection lic = new LegendItemCollection(); { lic.addAll(dataLegendCollection); } public LegendItemCollection getLegendItems() { return lic; } }; LegendTitle dataLegend = new LegendTitle(source); dataLegend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0)); dataLegend.setBorder(2, 2, 2, 2); dataLegend.setBackgroundPaint(Color.white); dataLegend.setPosition(RectangleEdge.TOP); dataLegend.setItemFont(new Font("SansSerif", Font.PLAIN, 22)); chart.addLegend(dataLegend); source = new LegendItemSource() { LegendItemCollection lic = new LegendItemCollection(); { lic.addAll(remainingLegendCollection); } public LegendItemCollection getLegendItems() { return lic; } }; LegendTitle actionEventsLegend = new LegendTitle(source); actionEventsLegend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0)); actionEventsLegend.setBorder(2, 2, 2, 2); actionEventsLegend.setBackgroundPaint(Color.white); actionEventsLegend.setPosition(RectangleEdge.BOTTOM); actionEventsLegend.setItemFont(new Font("SansSerif", Font.PLAIN, 22)); if (!job.hideAELegend && !job.removeAllLegends) chart.addLegend(actionEventsLegend); if (job.removeAllLegends) chart.removeLegend(); int verticalPixels = 800 + 170 * (allActionsAndEvents.size() / 5); //This is a little hacky, but if we want only the legend, just extend Plot() and remove the draw functionality so it makes a blank plot class legendPlot extends Plot { public void draw(Graphics2D arg0, Rectangle2D arg1, Point2D arg2, PlotState arg3, PlotRenderingInfo arg4) { } public String getPlotType() { return null; } } //Then add the legend to that and throw away the original plot if (job.legendOnly) { chart = new JFreeChart("", null, new legendPlot(), false); chart.addLegend(actionEventsLegend); } try { FileUtils.createDirectory(job.outputDir); String filename = job.outputFilename == null ? job.outputDir + "/" + plotTool.MakeFileName(title) + ".jpg" : job.outputDir + "/" + job.outputFilename; if (!filename.endsWith(".jpg")) filename = filename + ".jpg"; File JPGFile = new File(filename); if (job.imageHeight != null && job.imageWidth != null) ChartUtilities.saveChartAsJPEG(JPGFile, chart, job.imageWidth, job.imageHeight); else if (!job.hideAELegend && !job.removeAllLegends) ChartUtilities.saveChartAsJPEG(JPGFile, chart, 1600, verticalPixels); else ChartUtilities.saveChartAsJPEG(JPGFile, chart, 1600, 800); } catch (IOException e) { Log.error(e.getMessage()); } }