Here you can find the source of paintPointLineList(Graphics2D g2d, double zoom, Vector
Parameter | Description |
---|---|
g2d | a parameter |
zoom | a parameter |
points | a parameter |
paintSSRange | a parameter |
sRange | a parameter |
public static void paintPointLineList(Graphics2D g2d, double zoom, Vector<double[]> points, boolean paintSSRange, double sRange)
//package com.java2s; /*// w w w.j ava 2 s. c o m * Copyright (c) 2004-2013 Universidade do Porto - Faculdade de Engenharia * Laborat?rio de Sistemas e Tecnologia Subaqu?tica (LSTS) * All rights reserved. * Rua Dr. Roberto Frias s/n, sala I203, 4200-465 Porto, Portugal * * This file is part of Neptus, Command and Control Framework. * * Commercial Licence Usage * Licencees holding valid commercial Neptus licences may use this file * in accordance with the commercial licence agreement provided with the * Software or, alternatively, in accordance with the terms contained in a * written agreement between you and Universidade do Porto. For licensing * terms, conditions, and further information contact lsts@fe.up.pt. * * European Union Public Licence - EUPL v.1.1 Usage * Alternatively, this file may be used under the terms of the EUPL, * Version 1.1 only (the "Licence"), appearing in the file LICENCE.md * included in the packaging of this file. You may not use this work * except in compliance with the Licence. Unless required by applicable * law or agreed to in writing, software distributed under the Licence is * distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF * ANY KIND, either express or implied. See the Licence for the specific * language governing permissions and limitations at * https://www.lsts.pt/neptus/licence. * * For more information please see <http://lsts.fe.up.pt/neptus>. * * Author: Paulo Dias * 11/09/2011 */ import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Stroke; import java.awt.geom.Ellipse2D; import java.awt.geom.Line2D; import java.util.Vector; public class Main { protected static final int X = 0, Y = 1, Z = 2, T = 3; /** * @param g2d * @param zoom * @param points * @param paintSSRange * @param sRange */ public static void paintPointLineList(Graphics2D g2d, double zoom, Vector<double[]> points, boolean paintSSRange, double sRange) { paintPointLineList(g2d, zoom, points, paintSSRange, sRange, false); } /** * @param g2d * @param zoom * @param points * @param paintSSRange * @param sRange * @param editMode */ public static void paintPointLineList(Graphics2D g2d, double zoom, Vector<double[]> points, boolean paintSSRange, double sRange, boolean editMode) { double[] pointI, pointF, pointN; Color oColor = g2d.getColor(); Stroke sO = g2d.getStroke(); Stroke s1 = new BasicStroke(1); Stroke s2 = new BasicStroke(2); Stroke s3 = new BasicStroke(3); Stroke sR = new BasicStroke((float) (2 * sRange * zoom), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); for (int i = 0; i < points.size(); i += 2) { pointI = points.get(i); //NeptusLog.pub().info("<###>[" + pointI[X] + ", " + pointI[Y] + "]"); try { pointF = points.get(i + 1); } catch (Exception e1) { pointF = null; } try { pointN = points.get(i + 2); } catch (Exception e) { pointN = null; } int ellisRadius = !editMode ? 3 : 4; Ellipse2D el = new Ellipse2D.Double(-ellisRadius, -ellisRadius, ellisRadius * 2, ellisRadius * 2); if (i == 0) { g2d.translate(pointI[X] * zoom, pointI[Y] * zoom); g2d.setColor(new Color(0, 255, 0)); g2d.fill(el); g2d.translate(-pointI[X] * zoom, -pointI[Y] * zoom); } if (pointF != null) { Line2D.Double l = new Line2D.Double(pointI[X] * zoom, pointI[Y] * zoom, pointF[X] * zoom, pointF[Y] * zoom); if (paintSSRange) { g2d.setColor(new Color(0, 0, 0, 30)); g2d.setStroke(sR); g2d.draw(l); } g2d.setColor(!editMode ? Color.yellow : Color.orange); g2d.setStroke(!editMode ? s2 : s3); g2d.draw(l); g2d.setColor(Color.black); g2d.setStroke(s1); if (!editMode) g2d.draw(l); g2d.setStroke(sO); g2d.translate(pointF[X] * zoom, pointF[Y] * zoom); g2d.setColor(new Color(255, 0, 0)); g2d.fill(el); g2d.translate(-pointF[X] * zoom, -pointF[Y] * zoom); if (pointN != null) { l = new Line2D.Double(pointF[X] * zoom, pointF[Y] * zoom, pointN[X] * zoom, pointN[Y] * zoom); g2d.setColor(!editMode ? Color.yellow : Color.orange); g2d.setStroke(!editMode ? s2 : s3); g2d.draw(l); g2d.setColor(Color.black); g2d.setStroke(s1); if (!editMode) g2d.draw(l); g2d.setStroke(sO); g2d.translate(pointN[X] * zoom, pointN[Y] * zoom); g2d.setColor(new Color(0, 255, 0)); g2d.fill(el); g2d.translate(-pointN[X] * zoom, -pointN[Y] * zoom); } } } g2d.setColor(oColor); } }