List of usage examples for java.awt BasicStroke JOIN_BEVEL
int JOIN_BEVEL
To view the source code for java.awt BasicStroke JOIN_BEVEL.
Click Source Link
From source file:edu.ucla.stat.SOCR.motionchart.MotionBubbleRenderer.java
/** * Returns the stroke used to outline data items. The default * implementation passes control to the//w w w .jav a2s . c o m * {@link #lookupSeriesOutlineStroke(int)} method. You can override this * method if you require different behaviour. * * @param row the row (or series) index (zero-based). * @param column the column (or category) index (zero-based). * @return The stroke (never <code>null</code>). */ @Override public Stroke getItemOutlineStroke(int row, int column) { Number z = dataset.getZ(row, column); BasicStroke stroke = DEFAULT_OUTLINE_STROKE; if (shouldHighlight(row, column)) { stroke = new BasicStroke(2.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL); } if (z == null) { stroke = new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(), stroke.getLineJoin(), stroke.getMiterLimit(), new float[] { 5.0f, 5.0f }, 0.0f); } return stroke; }
From source file:org.tsho.dmc2.core.chart.LyapunovRenderer.java
public LegendItemCollection getLegendItems() { if (type != TYPE_AREA) return null; LegendItemCollection legendItems = new LegendItemCollection(); Stroke stroke = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL); Shape shape = new Rectangle2D.Double(-3, -3, 6, 6); Iterator i = signsSet.iterator(); while (i.hasNext()) { ExpsSigns es = (ExpsSigns) i.next(); Color color = lyapunovColors.getColor(es.zer, es.pos, es.neg, es.nan); legendItems.add(new LegendItem(es.toString(), "", shape, true, color, stroke, Color.yellow, stroke)); }//from w ww . jav a 2 s . c o m if (pass == 0) { signsSet.clear(); } return legendItems; }
From source file:lucee.runtime.img.Image.java
public void setDrawingStroke(Struct attr) throws PageException { // empty /*from ww w .j a va 2s . c o m*/ if (attr == null || attr.size() == 0) { setDrawingStroke(new BasicStroke()); return; } // width float width = Caster.toFloatValue(attr.get("width", new Float(1F))); if (width < 0) throw new ExpressionException("key [width] should be a none negativ number"); // endcaps String strEndcaps = Caster.toString(attr.get("endcaps", "square")); strEndcaps = strEndcaps.trim().toLowerCase(); int endcaps; if ("square".equals(strEndcaps)) endcaps = BasicStroke.CAP_SQUARE; else if ("butt".equals(strEndcaps)) endcaps = BasicStroke.CAP_BUTT; else if ("round".equals(strEndcaps)) endcaps = BasicStroke.CAP_ROUND; else throw new ExpressionException("key [endcaps] has an invalid value [" + strEndcaps + "], valid values are [square,round,butt]"); // linejoins String strLinejoins = Caster.toString(attr.get("linejoins", "miter")); strLinejoins = strLinejoins.trim().toLowerCase(); int linejoins; if ("bevel".equals(strLinejoins)) linejoins = BasicStroke.JOIN_BEVEL; else if ("miter".equals(strLinejoins)) linejoins = BasicStroke.JOIN_MITER; else if ("round".equals(strLinejoins)) linejoins = BasicStroke.JOIN_ROUND; else throw new ExpressionException("key [linejoins] has an invalid value [" + strLinejoins + "], valid values are [bevel,miter,round]"); // miterlimit float miterlimit = 10.0F; if (linejoins == BasicStroke.JOIN_MITER) { miterlimit = Caster.toFloatValue(attr.get("miterlimit", new Float(10F))); if (miterlimit < 1F) throw new ExpressionException("key [miterlimit] should be greater or equal to 1"); } // dashArray Object oDashArray = attr.get("dashArray", null); float[] dashArray = null; if (oDashArray != null) { dashArray = ArrayUtil.toFloatArray(oDashArray); } // dash_phase float dash_phase = Caster.toFloatValue(attr.get("dash_phase", new Float(0F))); setDrawingStroke(width, endcaps, linejoins, miterlimit, dashArray, dash_phase); }
From source file:com.diversityarrays.kdxplore.scatterplot.ScatterPlotPanel.java
@SuppressWarnings("unchecked") public void redrawSelectedPlots() { if (syncedOption.getSyncWhat().isSync() && !getSelectionChanging()) { XYPlot xyplot = getChart().getXYPlot(); // curationControls.setSyncedState(true); Double yscale = (xyplot.getRangeAxis().getUpperBound() - xyplot.getRangeAxis().getLowerBound()) / 50; Double xscale = (xyplot.getDomainAxis().getUpperBound() - xyplot.getDomainAxis().getLowerBound()) / 50; Stroke stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 3 }, 0);// w w w . j ava 2 s . c o m Paint paint = Color.RED; for (Annotation anno : (List<Annotation>) xyplot.getAnnotations()) { if (anno != intervalAnnotation && anno instanceof XYShapeAnnotation) { xyplot.removeAnnotation((XYShapeAnnotation) anno); } } for (Point2D point : selectedPoints) { double x = point.getX(); double y = point.getY(); double y1 = y - yscale; double y2 = y + yscale; double x1 = x - xscale; double x2 = x + xscale; Ellipse2D oval = new Ellipse2D.Double(x1, y1, x2 - x1, y2 - y1); XYShapeAnnotation lineanno0 = new XYShapeAnnotation(oval, stroke, paint); addRangeMarker(lineanno0); } } curationControls.updateButtons(); }
From source file:windows.sensorWindow.java
/** * updates the width of the template plot * // www.j av a2 s .c o m * @param UID */ public static void updateTmplPlotWidth(String UID, int index) { Brick tmpBrick = Brick.getBrick(connectionData.BrickList, UID); if (index == 0) { if (rendererMap3.containsKey(UID)) { XYItemRenderer rendererTmp = rendererMap3.get(UID); int width = computeTmplPlotWidth(tmpBrick.tmpl1Width); BasicStroke stroke = new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);// , // 10.0f, // dash, // 0.0f); rendererTmp.setSeriesPaint(0, Color.GREEN); // renderer3.setSeriesStroke( 0, new BasicStroke( 1 ) ); rendererTmp.setSeriesStroke(0, stroke); rendererMap3.put(UID, rendererTmp); // tmplPlot1Width.put(UID, // computeTmplPlotWidth(tmpBrick.tmpl1Width)); } } if (index == 1) { if (rendererMap4.containsKey(UID)) { // TODO } } }
From source file:com.diversityarrays.kdxplore.scatterplot.ScatterPlotPanel.java
@Override public void updateSelectedSamples() { PlotsByTraitInstance plotsByTraitInstance = selectedValueStore.getSyncedPlotsByTrait(); intervalAnnotation = null;//from www . ja v a 2s .com selectedPoints.clear(); XYPlot xyplot = getChart().getXYPlot(); Double yscale = (xyplot.getRangeAxis().getUpperBound() - xyplot.getRangeAxis().getLowerBound()) / 50; Double xscale = (xyplot.getDomainAxis().getUpperBound() - xyplot.getDomainAxis().getLowerBound()) / 50; removeAnnotations(); Stroke stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 3 }, 0); Paint paint = Color.RED; xyplot.clearRangeMarkers(); TraitInstanceValueRetriever<?> x_tivr = tivrByTi.get(xInstance); double[] xy = new double[2]; for (TraitInstance ti : plotsByTraitInstance.getTraitInstances()) { if (traitInstances.contains(ti) && !xInstance.equals(ti)) { TraitInstanceValueRetriever<?> tivr = tivrByTi.get(ti); for (PlotOrSpecimen pos : plotsByTraitInstance.getPlotSpecimens((ti))) { if (usedPlotSpecimens.isEmpty() || usedPlotSpecimens.contains(pos)) { xy = getXY(x_tivr, tivr, pos, xy); if (xy != null) { double x = xy[0]; double y = xy[1]; double y1 = y - yscale; double y2 = y + yscale; double x1 = x - xscale; double x2 = x + xscale; selectedPoints.add(new Point2D.Double(x, y)); Ellipse2D oval = new Ellipse2D.Double(x1, y1, x2 - x1, y2 - y1); // Line2D line0 = new Line2D.Double(x1, y2, x2, y1); // Line2D line1 = new Line2D.Double(x1, y1, x2, y2); // XYShapeAnnotation lineanno0 = new XYShapeAnnotation(oval, stroke, paint); // // XYShapeAnnotation lineanno0 = new XYShapeAnnotation(line0, stroke, paint); // XYShapeAnnotation lineanno1 = new XYShapeAnnotation(line1, stroke, paint); addRangeMarker(lineanno0); // plotPanel.addRangeMarker(lineanno1); } } } } getChartPanel().repaint(); } curationControls.updateButtons(false); }
From source file:org.sakaiproject.sitestats.impl.ServerWideReportManagerImpl.java
private byte[] createMonthlyLoginChart(int width, int height) { IntervalXYDataset dataset1 = getMonthlyLoginsDataSet(); IntervalXYDataset dataset3 = getMonthlySiteUserDataSet(); if ((dataset1 == null) || (dataset3 == null)) { return generateNoDataChart(width, height); }//ww w. j a v a 2s . c o m // create plot ... XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false); renderer1.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); renderer1.setSeriesPaint(0, Color.RED); DateAxis domainAxis = new DateAxis(""); domainAxis.setTickUnit(new DateTickUnit(DateTickUnit.MONTH, 1, new SimpleDateFormat("yyyy-MM"))); domainAxis.setTickMarkPosition(DateTickMarkPosition.START); domainAxis.setVerticalTickLabels(true); domainAxis.setLowerMargin(0.01); domainAxis.setUpperMargin(0.01); NumberAxis axis1 = new NumberAxis("Total Logins"); axis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); axis1.setLabelPaint(Color.RED); axis1.setTickLabelPaint(Color.RED); XYPlot plot1 = new XYPlot(dataset1, null, axis1, renderer1); plot1.setBackgroundPaint(Color.lightGray); plot1.setDomainGridlinePaint(Color.white); plot1.setRangeGridlinePaint(Color.white); // AXIS 2 /* NumberAxis axis2 = new NumberAxis("Total Unique Users"); axis2.setStandardTickUnits (NumberAxis.createIntegerTickUnits ()); axis2.setLabelPaint(Color.BLUE); axis2.setTickLabelPaint(Color.BLUE); plot1.setRangeAxis(1, axis2); plot1.setDataset(1, dataset2); plot1.mapDatasetToRangeAxis(1, 1); XYItemRenderer renderer2 = new XYLineAndShapeRenderer(true, false); renderer2.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); renderer2.setSeriesPaint (0, Color.BLUE); plot1.setRenderer(1, renderer2); */ // add a third dataset and renderer... XYItemRenderer renderer3 = new XYLineAndShapeRenderer(true, false); renderer3.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); renderer3.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); renderer3.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); renderer3.setSeriesPaint(0, Color.GREEN); renderer3.setSeriesPaint(1, Color.BLACK); renderer3.setSeriesPaint(2, Color.CYAN); axis1 = new NumberAxis("count"); axis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); XYPlot plot2 = new XYPlot(dataset3, null, axis1, renderer3); plot2.setBackgroundPaint(Color.lightGray); plot2.setDomainGridlinePaint(Color.white); plot2.setRangeGridlinePaint(Color.white); CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(domainAxis); cplot.add(plot1, 3); cplot.add(plot2, 2); cplot.setGap(8.0); cplot.setDomainGridlinePaint(Color.white); cplot.setDomainGridlinesVisible(true); // return a new chart containing the overlaid plot... JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, cplot, false); LegendTitle legend = new LegendTitle(cplot); chart.addSubtitle(legend); // set background chart.setBackgroundPaint(parseColor(statsManager.getChartBackgroundColor())); // set chart border chart.setPadding(new RectangleInsets(10, 5, 5, 5)); chart.setBorderVisible(true); chart.setBorderPaint(parseColor("#cccccc")); // set anti alias chart.setAntiAlias(true); BufferedImage img = chart.createBufferedImage(width, height); final ByteArrayOutputStream out = new ByteArrayOutputStream(); try { ImageIO.write(img, "png", out); } catch (IOException e) { log.warn("Error occurred while generating SiteStats chart image data", e); } return out.toByteArray(); }
From source file:org.sakaiproject.sitestats.impl.ServerWideReportManagerImpl.java
private byte[] createWeeklyLoginChart(int width, int height) { IntervalXYDataset dataset1 = getWeeklyLoginsDataSet(); IntervalXYDataset dataset2 = getWeeklySiteUserDataSet(); if ((dataset1 == null) || (dataset2 == null)) { return generateNoDataChart(width, height); }// w ww. j a v a 2 s . c om // create plot ... XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false); renderer1.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); renderer1.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); renderer1.setSeriesPaint(0, Color.RED); renderer1.setSeriesPaint(0, Color.BLUE); DateAxis domainAxis = new DateAxis(""); domainAxis.setTickUnit(new DateTickUnit(DateTickUnit.DAY, 7, new SimpleDateFormat("yyyy-MM-dd"))); domainAxis.setTickMarkPosition(DateTickMarkPosition.START); domainAxis.setVerticalTickLabels(true); domainAxis.setLowerMargin(0.01); domainAxis.setUpperMargin(0.01); NumberAxis rangeAxis = new NumberAxis("count"); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); XYPlot plot1 = new XYPlot(dataset1, null, rangeAxis, renderer1); plot1.setBackgroundPaint(Color.lightGray); plot1.setDomainGridlinePaint(Color.white); plot1.setRangeGridlinePaint(Color.white); // add a second dataset and renderer... XYItemRenderer renderer2 = new XYLineAndShapeRenderer(true, false); renderer2.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); renderer2.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); renderer2.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); renderer2.setSeriesPaint(0, Color.GREEN); renderer2.setSeriesPaint(1, Color.BLACK); renderer2.setSeriesPaint(2, Color.CYAN); rangeAxis = new NumberAxis("count"); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); XYPlot plot2 = new XYPlot(dataset2, null, rangeAxis, renderer2); plot2.setBackgroundPaint(Color.lightGray); plot2.setDomainGridlinePaint(Color.white); plot2.setRangeGridlinePaint(Color.white); CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(domainAxis); cplot.add(plot1, 3); cplot.add(plot2, 2); cplot.setGap(8.0); cplot.setDomainGridlinePaint(Color.white); cplot.setDomainGridlinesVisible(true); // return a new chart containing the overlaid plot... JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, cplot, false); LegendTitle legend = new LegendTitle(cplot); chart.addSubtitle(legend); // set background chart.setBackgroundPaint(parseColor(statsManager.getChartBackgroundColor())); // set chart border chart.setPadding(new RectangleInsets(10, 5, 5, 5)); chart.setBorderVisible(true); chart.setBorderPaint(parseColor("#cccccc")); // set anti alias chart.setAntiAlias(true); BufferedImage img = chart.createBufferedImage(width, height); final ByteArrayOutputStream out = new ByteArrayOutputStream(); try { ImageIO.write(img, "png", out); } catch (IOException e) { log.warn("Error occurred while generating SiteStats chart image data", e); } return out.toByteArray(); }
From source file:org.jfree.experimental.swt.SWTGraphics2D.java
/** * Returns the AWT line join corresponding to the specified SWT line join. * * @param swtLineJoin the SWT line join. * * @return The AWT line join.//from ww w. ja v a 2s. c o m */ private int toAwtLineJoin(int swtLineJoin) { if (swtLineJoin == SWT.JOIN_BEVEL) { return BasicStroke.JOIN_BEVEL; } else if (swtLineJoin == SWT.JOIN_MITER) { return BasicStroke.JOIN_MITER; } else if (swtLineJoin == SWT.JOIN_ROUND) { return BasicStroke.JOIN_ROUND; } else { throw new IllegalArgumentException("SWT LineJoin " + swtLineJoin + " not recognised"); } }
From source file:org.jfree.experimental.swt.SWTGraphics2D.java
/** * Returns the SWT line join corresponding to the specified AWT line join. * * @param awtLineJoin the AWT line join. * * @return The SWT line join.//from w ww .jav a2s .c o m */ private int toSwtLineJoin(int awtLineJoin) { if (awtLineJoin == BasicStroke.JOIN_BEVEL) { return SWT.JOIN_BEVEL; } else if (awtLineJoin == BasicStroke.JOIN_MITER) { return SWT.JOIN_MITER; } else if (awtLineJoin == BasicStroke.JOIN_ROUND) { return SWT.JOIN_ROUND; } else { throw new IllegalArgumentException("AWT LineJoin " + awtLineJoin + " not recognised"); } }