/** * Overrides TPoint setXY method. * * @param x the x coordinate * @param y the y coordinate */ public void setXY(double x, double y) { if (track.isLocked()) return; super.setXY(x, y); repaint(); ((PointMass) track).updateDerivatives(n); track.support.firePropertyChange("step", null, new Integer(n)); // $NON-NLS-1$ }
/** * Draws this without refreshing steps. * * @param panel the drawing panel requesting the drawing * @param _g the graphics context on which to draw */ public void drawMe(DrawingPanel panel, Graphics _g) { // position and show inspector if requested during loading if (inspectorX != Integer.MIN_VALUE && trackerPanel != null && trackerPanel.getTFrame() != null) { positionInspector(); Runnable runner = new Runnable() { public void run() { showInspector = false; inspector.setVisible(true); } }; if (showInspector) SwingUtilities.invokeLater(runner); } if (isVisible() && isTraceVisible()) { // draw trace only if fixed coords & (non-worldview or no ref frame) TrackerPanel tPanel = (TrackerPanel) panel; ImageCoordSystem coords = tPanel.getCoords(); // get active coords boolean isRefFrame = coords instanceof ReferenceFrame; if (isRefFrame) { coords = ((ReferenceFrame) coords).getCoords(); } boolean fixed = coords.isFixedAngle() && coords.isFixedOrigin() && coords.isFixedScale(); if (fixed && (!(tPanel instanceof WorldTView) || !isRefFrame)) { trace.reset(); for (int i = 0; i < traceX.length; i++) { if (Double.isNaN(traceX[i])) continue; tracePt.setLocation(traceX[i], traceY[i]); java.awt.Point p = tracePt.getScreenPosition(tPanel); if (trace.getCurrentPoint() == null) trace.moveTo((float) p.getX(), (float) p.getY()); else trace.lineTo((float) p.getX(), (float) p.getY()); } Graphics2D g2 = (Graphics2D) _g; Color color = g2.getColor(); Stroke stroke = g2.getStroke(); g2.setColor(getFootprint().getColor()); g2.setStroke(traceStroke); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2.draw(trace); // restore original color and stroke g2.setColor(color); g2.setStroke(stroke); } } super.draw(panel, _g); }
/** * Overrides TPoint showCoordinates method. * * @param vidPanel the video panel */ public void showCoordinates(VideoPanel vidPanel) { // put values into pointmass x and y fields Point2D p = getWorldPosition(vidPanel); track.xField.setValue(p.getX()); track.yField.setValue(p.getY()); track.magField.setValue(p.distance(0, 0)); double theta = Math.atan2(p.getY(), p.getX()); track.angleField.setValue(theta); super.showCoordinates(vidPanel); }
/** * Sets the adjusting flag. * * @param adjusting true if being dragged */ @Override public void setAdjusting(boolean adjusting) { super.setAdjusting(adjusting); track.support.firePropertyChange("adjusting", null, adjusting); // $NON-NLS-1$ }