Java examples for java.lang:Math Geometry
Draw positive sensor intervals on a complex region
//package com.java2s; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.geom.Line2D; import java.awt.image.BufferedImage; public class Main { /**//from ww w. j a v a 2 s . c om * Draw positive sensor intervals on a complex region * * @param bi * @param il * @param lineC * @param subLineC * @param showNum */ public static void drawLine(BufferedImage bi, Line2D il, int lineC, int subLineC, boolean showNum) { Graphics2D g2d = (Graphics2D) bi.createGraphics(); if (showNum) { g2d.setFont(new Font("Helvetica", Font.PLAIN, 10)); g2d.setColor(Color.ORANGE); g2d.drawString("s" + String.valueOf(lineC), (int) il.getX1(), (int) il.getY1()); g2d.drawString(":" + String.valueOf(subLineC), (int) il.getX1() + 15, (int) il.getY1()); g2d.setColor(Color.PINK); g2d.drawString("e" + String.valueOf(lineC), (int) il.getX2(), (int) il.getY2()); g2d.drawString(":" + String.valueOf(subLineC), (int) il.getX2() + 15, (int) il.getY2()); } g2d.setColor(Color.BLACK); g2d.drawLine((int) il.getX1(), (int) il.getY1(), (int) il.getX2(), (int) il.getY2()); } }