public Polygon getInteriorPolygon(Component c) { NimbusEditorTabCellRenderer ren = (NimbusEditorTabCellRenderer) c; Insets ins = getBorderInsets(c); Polygon p = new Polygon(); int x = ren.isLeftmost() ? 3 : 0; int y = 0; int width = ren.isLeftmost() ? c.getWidth() - 3 : c.getWidth(); int height = c.getHeight() - 4; //Modified to return rectangle p.addPoint(x, y); p.addPoint(x + width, y); p.addPoint(x + width, y + height); p.addPoint(x, y + height); return p; }
private static long test(Image bi, Image vi, AffineTransform atfm) { final Polygon p = new Polygon(); p.addPoint(0, 0); p.addPoint(SIZE, 0); p.addPoint(0, SIZE); p.addPoint(SIZE, SIZE); p.addPoint(0, 0); Graphics2D g2d = (Graphics2D) vi.getGraphics(); g2d.clip(p); g2d.transform(atfm); g2d.setComposite(AlphaComposite.SrcOver); final long start = System.nanoTime(); g2d.drawImage(bi, 0, 0, null); final long time = System.nanoTime() - start; g2d.dispose(); return time; }
public Polygon getInteriorPolygon(Component c) { NimbusEditorTabCellRenderer ren = (NimbusEditorTabCellRenderer) c; Insets ins = getBorderInsets(c); Polygon p = new Polygon(); int x = 0; int y = 0; int width = c.getWidth() + 10; int height = c.getHeight() - 4; //Modified to return rectangle p.addPoint(x, y); p.addPoint(x + width, y); p.addPoint(x + width, y + height); p.addPoint(x, y + height); return p; }
public Shape getRegiaoComentario() { if (Regiao == null) { GeneralPath pa = new GeneralPath(); pa.setWindingRule(GeneralPath.WIND_NON_ZERO); Rectangle rec = getBounds(); int tam = Math.min(rec.width / 6, rec.height / 6); int curv = tam / 4; int lw = rec.x + rec.width; int[] px = new int[]{rec.x, lw - tam, lw, lw, rec.x}; int[] py = new int[]{rec.y, rec.y, rec.y + tam, rec.y + rec.height, rec.y + rec.height}; Polygon po = new Polygon(px, py, 5); pa.append(po, true); pa.moveTo(lw - tam, rec.y); pa.curveTo(lw - tam, rec.y, lw - tam + curv, rec.y + curv, lw - tam, rec.y + tam - (1)); pa.moveTo(lw - tam, rec.y + tam - (1)); pa.lineTo(lw, rec.y + tam); pa.closePath(); Regiao = pa; } return Regiao; }
/** * Draw a semi-trasparet area * @param g The graphic object * @param dragPoint The first point * @param beginPoint The second point * @param c The color of the area */ public void drawDragArea(Graphics2D g, Point dragPoint, Point beginPoint, Color c) { g.setColor(c); Polygon poly = new Polygon(); poly.addPoint((int) beginPoint.getX(), (int) beginPoint.getY()); poly.addPoint((int) beginPoint.getX(), (int) dragPoint.getY()); poly.addPoint((int) dragPoint.getX(), (int) dragPoint.getY()); poly.addPoint((int) dragPoint.getX(), (int) beginPoint.getY()); //Set the widths of the shape's outline Stroke oldStro = g.getStroke(); Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); g.setStroke(stroke); g.drawPolygon(poly); g.setStroke(oldStro); //Set the trasparency of the iside of the rectangle Composite oldComp = g.getComposite(); Composite alphaComp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f); g.setComposite(alphaComp); g.fillPolygon(poly); g.setComposite(oldComp); }
/** * */ public Shape createShape(mxGraphics2DCanvas canvas, mxCellState state) { Rectangle temp = state.getRectangle(); int x = temp.x; int y = temp.y; int w = temp.width; int h = temp.height; int halfWidth = w / 2; int halfHeight = h / 2; Polygon rhombus = new Polygon(); rhombus.addPoint(x + halfWidth, y); rhombus.addPoint(x + w, y + halfHeight); rhombus.addPoint(x + halfWidth, y + h); rhombus.addPoint(x, y + halfHeight); return rhombus; }
/** * Test of resizedToOriginal for polygon method, of class Resize. * * No further tests are done because the resize of the polygon points is * done based on resizedToOriginal for values methods. */ @Test public void testResizedToOriginal_Polygon_01() { final String testDescription = "----------resizedToOriginalPolygon_01----------\n" + " Summary: Test of resizedToOriginal(Polygon) method, of class Resize\n" + " Description: Check there is no exception when processing null input. Input value null, the resize is set to (1.0, 1.0).\n" + " Pre-conditions: none\n" + " Conditions: none\n" + " Expected result: It shall output null; no errors or exceptions shall occur.\n"; System.out.println(testDescription); Polygon polyResized = null; Resize instance = new Resize(1.0, 1.0); Polygon expResult = null; Polygon result = instance.resizedToOriginal(polyResized); assertEquals(expResult, result); }
public void mousePressed(MouseEvent e) { if (station){ //This will detect if the mouse clicks on a datapoint //and will set the selectedRow value. Used for dragging. selectedRow = -1; selectPoint(e); } if (e.isControlDown()) return; if (e.isConsumed()||!map.isSelectable()) return; if (db.panTB.isSelected()) return; if (e.isShiftDown()) { p1=e.getPoint(); p2=new Point(p1.x+1,p1.y+1); drawSelectionBox(); } else { poly = new Polygon(); poly.addPoint(e.getPoint().x, e.getPoint().y); } }
/** * Creates a polygon MapArea */ public MapArea(Polygon polygon) { int[] coords = null; if ((polygon != null) && (polygon.npoints != 0)) { coords = new int[polygon.npoints * 2]; for (int i = 0; i < polygon.npoints; i++) { coords[i*2] = polygon.xpoints[i]; coords[i*2+1] = polygon.ypoints[i]; } } _init(POLYGON_SHAPE, coords); }
private void registerMultipleServices() { area = new Area(); rectangle = new Rectangle(); polygon = new Polygon(); Dictionary polygonProp = new Properties(); polygonProp.put(Constants.SERVICE_RANKING, new Integer(1)); // first register polygon polygonReg = bundleContext.registerService(Shape.class.getName(), polygon, polygonProp); // then rectangle Dictionary rectangleProp = new Properties(); rectangleProp.put(Constants.SERVICE_RANKING, new Integer(10)); rectangleReg = bundleContext.registerService(Shape.class.getName(), rectangle, rectangleProp); // then area Dictionary areaProp = new Properties(); areaProp.put(Constants.SERVICE_RANKING, new Integer(100)); areaReg = bundleContext.registerService(Shape.class.getName(), area, areaProp); }
public void testMultipleInterceptorEquality() throws Exception { target = new Polygon(); Advice interceptorA1 = createInterceptorWOServiceRequired(); Advice interceptorA2 = new LocalBundleContextAdvice(bundleContext); Advice interceptorA3 = new ServiceTCCLInterceptor(null); Advice interceptorB1 = createInterceptorWOServiceRequired(); Advice interceptorB2 = new LocalBundleContextAdvice(bundleContext); Advice interceptorB3 = new ServiceTCCLInterceptor(null); Object proxyA = createProxy(target, Shape.class, new Advice[] { interceptorA1, interceptorA2, interceptorA3 }); Object proxyB = createProxy(target, Shape.class, new Advice[] { interceptorB1, interceptorB2, interceptorB3 }); assertFalse(proxyA == proxyB); assertEquals(interceptorA1, interceptorB1); assertEquals(interceptorA2, interceptorB2); assertEquals(interceptorA3, interceptorB3); assertEquals(proxyA, proxyB); }
public mxPoint paintMarker(mxGraphics2DCanvas canvas, mxCellState state, String type, mxPoint pe, double nx, double ny, double size, boolean source) { Polygon poly = new Polygon(); poly.addPoint((int) Math.round(pe.getX()), (int) Math.round(pe.getY())); poly.addPoint((int) Math.round(pe.getX() - nx - ny / 2), (int) Math.round(pe.getY() - ny + nx / 2)); if (type.equals(mxConstants.ARROW_CLASSIC)) { poly.addPoint((int) Math.round(pe.getX() - nx * 3 / 4), (int) Math.round(pe.getY() - ny * 3 / 4)); } poly.addPoint((int) Math.round(pe.getX() + ny / 2 - nx), (int) Math.round(pe.getY() - ny - nx / 2)); if (mxUtils.isTrue(state.getStyle(), (source) ? "startFill" : "endFill", true)) { canvas.fillShape(poly); } canvas.getGraphics().draw(poly); return new mxPoint(-nx, -ny); }
public L2Territory(/*String string*/) { poly = new Polygon(); _points = new Point[0]; // _terr = string; _xMin = 999999; _xMax = -999999; _yMin = 999999; _yMax = -999999; _zMin = 999999; _zMax = -999999; _procMax = 0; }
public Polygon getExactTabIndication(int idx) { Polygon result = tabDisplayer.getUI().getExactTabIndication(idx); scratchPoint.setLocation(0,0); Point p = SwingUtilities.convertPoint(tabDisplayer, scratchPoint, container); result.translate (-p.x, -p.y); return appendContentBoundsTo(result); }
public Polygon getInsertTabIndication(int idx) { Polygon result = tabDisplayer.getUI().getInsertTabIndication(idx); scratchPoint.setLocation(0,0); Point p = SwingUtilities.convertPoint(tabDisplayer, scratchPoint, container); result.translate (-p.x, -p.y); return appendContentBoundsTo(result); }
public void paintInterior(Graphics g, Component c) { NimbusEditorTabCellRenderer ren = (NimbusEditorTabCellRenderer) c; Polygon p = getInteriorPolygon(c); Rectangle bounds = p.getBounds(); int yDiff = getHeightDifference(ren); paintTabBackground(g, 0, c, bounds.x, bounds.y + yDiff, bounds.width, bounds.height - yDiff); if (!supportsCloseButton((JComponent)c)) { return; } paintCloseButton( g, (JComponent)c ); }
public void paintInterior(Graphics g, Component c) { NimbusEditorTabCellRenderer ren = (NimbusEditorTabCellRenderer) c; Polygon p = getInteriorPolygon(c); Rectangle bounds = p.getBounds(); int yDiff = getHeightDifference(ren); paintTabBackground(g, 0, c, bounds.x, bounds.y + yDiff, bounds.width, bounds.height - yDiff); }
@Override public Polygon getExactTabIndication(int index) { // TBD - the same code is copied in ScrollableTabsUI, should be shared // if will not differ // GeneralPath indication = new GeneralPath(); JComponent control = getDisplayer(); int height = control.getHeight(); TabLayoutModel tlm = getLayoutModel(); int tabXStart = tlm.getX(index); int tabXEnd = tabXStart + tlm.getW(index); int[] xpoints = new int[4]; int[] ypoints = new int[4]; xpoints[0] = tabXStart; ypoints[0] = 0; xpoints[1] = tabXEnd; ypoints[1] = 0; xpoints[2] = tabXEnd; ypoints[2] = height - 1; xpoints[3] = tabXStart; ypoints[3] = height - 1; return new EqualPolygon(xpoints, ypoints); }
@Override public Polygon getInsertTabIndication(int index) { EqualPolygon indication = new EqualPolygon(); JComponent control = getDisplayer(); int height = control.getHeight(); int width = control.getWidth(); TabLayoutModel tlm = getLayoutModel(); int tabXStart; int tabXEnd; if (index == 0) { tabXStart = 0; tabXEnd = tlm.getW(0) / 2; } else if (index >= getDataModel().size()) { tabXStart = tlm.getX(index - 1) + tlm.getW(index - 1) / 2; tabXEnd = tabXStart + tlm.getW(index - 1); if (tabXEnd > width) { tabXEnd = width; } } else { tabXStart = tlm.getX(index - 1) + tlm.getW(index - 1) / 2; tabXEnd = tlm.getX(index) + tlm.getW(index) / 2; } indication.moveTo(tabXStart, 0); indication.lineTo(tabXEnd, 0); indication.lineTo(tabXEnd, height - 1); indication.lineTo(tabXStart, height - 1); return indication; }
public void paintIcon(Component c, Graphics g, int x, int y) { Polygon p = new Polygon(); p.addPoint(x, y); p.addPoint(x+getIconWidth(), y+getIconHeight()/2); p.addPoint(x, y+getIconHeight()); g.fillPolygon(p); }
@Override public Shape createShape(double x, double y) { int[] xPoints = new int[] { (int) Math.ceil(x - POINTSIZE / 2.0d), (int) Math.ceil(x), (int) Math.ceil(x + POINTSIZE / 2.0d) }; int[] yPoints = new int[] { (int) Math.ceil(y + POINTSIZE / 2.0d), (int) Math.ceil(y - POINTSIZE / 2.0d), (int) Math.ceil(y + POINTSIZE / 2.0d) }; return new Polygon(xPoints, yPoints, xPoints.length); }
@Override public Shape createShape(double x, double y) { int[] xPoints = new int[] { (int) Math.ceil(x - POINTSIZE / 2.0d), (int) Math.ceil(x), (int) Math.ceil(x + POINTSIZE / 2.0d) }; int[] yPoints = new int[] { (int) Math.ceil(y - POINTSIZE / 2.0d), (int) Math.ceil(y + POINTSIZE / 2.0d), (int) Math.ceil(y - POINTSIZE / 2.0d) }; return new Polygon(xPoints, yPoints, xPoints.length); }
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 3, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = { color, null }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }
private static void paintSelectedRight(Graphics g, int x, int y, int w, int h) { g.setColor(RapidLookTools.getColors().getTabbedPaneColors()[2]); g.drawLine(x, y + 1, x + w - 11, y + 1); g.setColor(RapidLookTools.getColors().getTabbedPaneColors()[3]); g.drawLine(x, y, x + w - 15, y); ColorUIResource c1 = RapidLookTools.getColors().getTabbedPaneColors()[4]; g.setColor(c1); g.drawLine(w + x - 10, y + 1, w + x - 10, y + 2); g.drawLine(w + x - 9, y + 2, w + x - 9, y + 2); g.drawLine(w + x - 8, y + 2, w + x - 8, y + 3); g.drawLine(w + x - 7, y + 3, w + x - 7, y + 4); g.drawLine(w + x - 6, y + 4, w + x - 6, y + 5); g.setColor(RapidLookTools.getColors().getTabbedPaneColors()[5]); g.drawLine(x, y + 2, x + w - 11, y + 2); g.drawLine(x, y + 3, x + w - 9, y + 3); g.drawLine(x, y + 4, x + w - 8, y + 4); g.drawLine(x, y + 5, x + w - 7, y + 5); Graphics2D g2 = (Graphics2D) g; g2.setPaint(new GradientPaint(1, y + 6, RapidLookTools.getColors().getTabbedPaneColors()[6], 1, y + h, RapidLookTools.getColors().getTabbedPaneColors()[7])); int[] xArr = new int[] { x + 4, w + x - 5, w + x - 5, x + 4 }; int[] yArr = new int[] { y + 6, y + 6, y + h, y + h }; Polygon p1 = new Polygon(xArr, yArr, 4); g2.fillPolygon(p1); g.setColor(c1); g.drawLine(w + x - 5, y + 6, x + w - 5, y + h - 1); g.setColor(RapidLookTools.getColors().getTabbedPaneColors()[1]); g.drawLine(x + w - 14, y, x + w - 12, y); g.drawLine(w + x - 6, y + 6, x + w - 6, y + 6); }
protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) { Polygon shape = new Polygon(); shape.addPoint(x - (h / 4), y + h); shape.addPoint(x + (h / 4), y); shape.addPoint(x + w - (h / 4), y); if (isSelected || (tabIndex == (rects.length - 1))) { if (isSelected) { g.setColor(selectedColor); } else { g.setColor(unselectedColor); } shape.addPoint(x + w + (h / 4), y + h); } else { g.setColor(unselectedColor); shape.addPoint(x + w, y + (h / 2)); shape.addPoint(x + w - (h / 4), y + h); } g.fillPolygon(shape); }
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 2, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = ((side + 1) % 4 < 2) == (type == Value.GROOVE) ? new Color[] { getShadowColor(color), getLightColor(color) } : new Color[] { getLightColor(color), getShadowColor(color) }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }
public static Shape createTurnedTriangular() { double s = SHAPE_SIZE; int s_2 = (int) Math.round(s / 2.0); int[] xPoints = new int[] { -s_2, 0, s_2 }; int[] yPoints = new int[] { -s_2, s_2, -s_2 }; return new Polygon(xPoints, yPoints, xPoints.length); }
public void mouseMoved(MouseEvent ev) { ArrayList<DPoint>[] util; util = data.getResults().getUtilization(); for (int j = 0; j < data.getStationNames().length; j++) { DPoint test = this.adjustMousePoint(ev.getX(), ev.getY()); if (stationLabels[j] != null && stationLabels[j].contains(test)) { setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); return; } int i; for (i = 0; i < util[j].size(); i = i + 2) { if (!showStation[j]) continue; DPoint pointA = plane.getTruePoint(util[j].get(i)); DPoint pointB = plane.getTruePoint(util[j].get(i + 1)); Polygon rect = new Polygon(); rect.addPoint((int) pointA.getX(), (int) pointA.getY() - 16); rect.addPoint((int) pointA.getX(), (int) pointA.getY() + 16); rect.addPoint((int) pointB.getX(), (int) pointB.getY() - 16); rect.addPoint((int) pointB.getX(), (int) pointB.getY() + 16); if (rect.contains(test)) { tooltip = test; repaint(); return; } } } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); if (tooltip != null) { tooltip = null; repaint(); } }
public Shape getRegiaoLosanglo() { if (Regiao == null) { Rectangle r = new Rectangle(getLeft(), getTop(), getWidth(), getHeight()); //getBounds(); Polygon los = new Polygon(); los.addPoint(r.x, r.y + r.height / 2); los.addPoint(r.x + r.width / 2, r.y); los.addPoint(r.x + r.width, r.y + r.height / 2); los.addPoint(r.x + r.width / 2, r.y + r.height); Regiao = los; } return Regiao; }
/** * Plots the data for a given series. * * @param g2 the drawing surface. * @param dataArea the data area. * @param info collects plot rendering info. * @param plot the plot. * @param dataset the dataset. * @param seriesIndex the series index. */ public void drawSeries(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info, PolarPlot plot, XYDataset dataset, int seriesIndex) { Polygon poly = new Polygon(); int numPoints = dataset.getItemCount(seriesIndex); for (int i = 0; i < numPoints; i++) { double theta = dataset.getXValue(seriesIndex, i); double radius = dataset.getYValue(seriesIndex, i); Point p = plot.translateValueThetaRadiusToJava2D(theta, radius, dataArea); poly.addPoint(p.x, p.y); } g2.setPaint(getSeriesPaint(seriesIndex)); g2.setStroke(getSeriesStroke(seriesIndex)); if (isSeriesFilled(seriesIndex)) { Composite savedComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f)); g2.fill(poly); g2.setComposite(savedComposite); } else { g2.draw(poly); } }
/** Draws a shape. */ public OurPDFWriter drawShape(Shape shape, boolean fillOrNot) { if (shape instanceof Polygon) { Polygon obj = (Polygon)shape; for(int i = 0; i < obj.npoints; i++) buf.writes(obj.xpoints[i]).writes(obj.ypoints[i]).write(i==0 ? "m\n" : "l\n"); buf.write("h\n"); } else { double moveX = 0, moveY = 0, nowX = 0, nowY = 0, pt[] = new double[6]; for(PathIterator it = shape.getPathIterator(null); !it.isDone(); it.next()) switch(it.currentSegment(pt)) { case PathIterator.SEG_MOVETO: nowX = moveX = pt[0]; nowY = moveY = pt[1]; buf.writes(nowX).writes(nowY).write("m\n"); break; case PathIterator.SEG_CLOSE: nowX = moveX; nowY = moveY; buf.write("h\n"); break; case PathIterator.SEG_LINETO: nowX = pt[0]; nowY = pt[1]; buf.writes(nowX).writes(nowY).write("l\n"); break; case PathIterator.SEG_CUBICTO: nowX = pt[4]; nowY = pt[5]; buf.writes(pt[0]).writes(pt[1]).writes(pt[2]).writes(pt[3]).writes(nowX).writes(nowY).write("c\n"); break; case PathIterator.SEG_QUADTO: // Convert quadratic bezier into cubic bezier using de Casteljau algorithm double px = nowX + (pt[0] - nowX)*(2.0/3.0), qx = px + (pt[2] - nowX)/3.0; double py = nowY + (pt[1] - nowY)*(2.0/3.0), qy = py + (pt[3] - nowY)/3.0; nowX = pt[2]; nowY = pt[3]; buf.writes(px).writes(py).writes(qx).writes(qy).writes(nowX).writes(nowY).write("c\n"); break; } } buf.write(fillOrNot ? "f\n" : "S\n"); return this; }
/** * Create a Polygon that is a rectangle draw between two point * @param xP1 The x of the first point * @param yP1 The y of the first point * @param xP2 The x of the second point * @param yP2 The y of the second point * @return The rectangle in a polygon object */ public Polygon twoPointRectangle(int xP1, int yP1, int xP2, int yP2) { Polygon p = new Polygon(); p.addPoint(xP1, yP1); p.addPoint(xP1, yP2); p.addPoint(xP2, yP2); p.addPoint(xP2, yP1); return p; }
/** * Plots the data for a given series. * * @param g2 the drawing surface. * @param dataArea the data area. * @param info collects plot rendering info. * @param plot the plot. * @param dataset the dataset. * @param seriesIndex the series index. */ public void drawSeries(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info, PolarPlot plot, XYDataset dataset, int seriesIndex) { Polygon poly = new Polygon(); int numPoints = dataset.getItemCount(seriesIndex); for (int i = 0; i < numPoints; i++) { double theta = dataset.getXValue(seriesIndex, i); double radius = dataset.getYValue(seriesIndex, i); Point p = plot.translateValueThetaRadiusToJava2D(theta, radius, dataArea); poly.addPoint(p.x, p.y); } g2.setPaint(getSeriesPaint(seriesIndex)); g2.setStroke(getSeriesStroke(seriesIndex)); if (isSeriesFilled(seriesIndex)) { Composite savedComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance( AlphaComposite.SRC_OVER, 0.5f)); g2.fill(poly); g2.setComposite(savedComposite); } else { g2.draw(poly); } }
@Override public Shape getBounds() { tempShape = new Polygon(drawShape.xpoints, drawShape.ypoints, drawShape.xpoints.length); tempShape.translate(-1 * (tempShape.getBounds().x + tempShape.getBounds().width/2), -1 * (tempShape.getBounds().y + tempShape.getBounds().height/2)); return EZElement.boundHelper(tempShape, this); }
@Override public void mouseMoved(MouseEvent e) { final Point p = e.getPoint(); final Polygon polygon = getTriangle(); if(polygon.contains(p)){ inTheTriangleZone = true; this.setCursor(new Cursor(Cursor.SE_RESIZE_CURSOR)); this.repaint(); } else { inTheTriangleZone = false; this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); this.repaint(); } }
public static PolygonGraphics fromPositions(Color c, List<Position> points) { Polygon myPolygon = new Polygon(); for (Position p : points) { myPolygon.addPoint((int)p.getX(), (int)p.getY()); } Rectangle2D bounds = myPolygon.getBounds2D(); return new PolygonGraphics(c, myPolygon, bounds); }
public static String polygonToString(Polygon p) { final StringBuilder s = new StringBuilder(); for (int i = 0; i < p.npoints; i++) { s.append(Math.round(p.xpoints[i])).append(',').append(Math.round(p.ypoints[i])); if (i < (p.npoints - 1)) { s.append(';'); } } return s.toString(); }