private static void renderHull(PtEntry pt) { Inf inf = Inf.create(); int count = 30; PtEntry ptStart = pt; do { inf.update(); if (pt.prev(true) != null) { boolean valley = false; valley = (pt.prev(true).source() == pt.source() && pt.prev(true).orig().next(true) != pt.orig()); V.pushColor(MyColor.cBLUE); V.pushStroke(valley ? STRK_RUBBERBAND : STRK_THICK); V.drawLine(pt.prev(true), pt); V.pop(2); } V.pushColor(MyColor.cDARKGREEN); V.mark(pt, MARK_DISC, .6); V.pop(); if (Editor.withLabels(true)) { StringBuilder sb = new StringBuilder(); sb.append(" #" + pt.id()); if (pt.source() != null) sb.append(" <" + pt.source() + ">"); V.pushScale(.6); V.draw(sb.toString(), MyMath.ptOnCircle(pt, MyMath.radians(30), 3), TX_FRAME | TX_BGND); V.pop(); } pt = pt.next(true); if (count-- == 0) V.draw("too many points rendering!", 50, 50, TX_CLAMP); } while (pt != ptStart && count > 0); }
public void paintView() { if (simple != null) simple.fill(MyColor.cLIGHTGRAY); Editor.render(); // T.show(traceHull); COper3.dbPaint(); if (traceHullPt != null) { renderHull(traceHullPt); } T.show(possHull, MyColor.cDARKGREEN, STRK_THICK, -1); T.show(valleyTri, MyColor.cDARKGREEN, STRK_RUBBERBAND, -1); T.show(traceValley, null, -1, -1); T.show(focusPt, MyColor.cRED, -1, MARK_DISC); }
public void mousePressed(MouseEvent e) { final int x = e.getX(); final int y = e.getY(); int sel = findSelection(x, y); /// if (sel == -1) return false; if (sel == -1) return; currentRollover = -1; // int currentSelection = sel; // if (!(disableRun && ((sel == RUN) || (sel == STOP)))) { // moving the handling of this over into the editor // setState(sel, ACTIVE, true); // } // if (currentSelection == OPEN) { // switch (currentSelection) { switch (sel) { case RUN: // if (!disableRun) { editor.handleRun(e.isShiftDown()); // } break; case STOP: // if (!disableRun) { // setState(RUN, INACTIVE, true); // setInactive(); editor.handleStop(); // } break; case OPEN: if (popup == null) { // popup = new JPopupMenu(); popup = editor.sketchbook.getPopupMenu(); // no events properly being fired, so nevermind /* popup.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("action " + e); } }); popup.addComponentListener(new ComponentAdapter() { public void componentHidden(ComponentEvent e) { System.out.println("hidden " + e); } }); */ add(popup); } // activate(OPEN); // SwingUtilities.invokeLater(new Runnable() { // public void run() { popup.show(EditorButtons.this, x, y); // }}); break; case NEW: editor.handleNew(e.isShiftDown()); break; case SAVE: editor.handleSave(false); break; case EXPORT: editor.handleExport(); break; case SERIAL: editor.handleSerial(); break; } }