public static void updateIcons(JTree tree) { Font defaultFont = UIManager.getFont("Tree.font"); Font currentFont = tree.getFont(); double newScale = (double) currentFont.getSize2D() / defaultFont.getSize2D(); DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) tree.getCellRenderer(); renderer.setOpenIcon( scale(UIManager.getIcon("Tree.openIcon"), newScale, tree)); renderer.setClosedIcon( scale(UIManager.getIcon("Tree.closedIcon"), newScale, tree)); renderer.setLeafIcon( scale(UIManager.getIcon("Tree.leafIcon"), newScale, tree)); Collection<Integer> iconSizes = Arrays.asList( renderer.getOpenIcon().getIconHeight(), renderer.getClosedIcon().getIconHeight(), renderer.getLeafIcon().getIconHeight()); // Convert points to pixels Point2D p = new Point2D.Float(0, currentFont.getSize2D()); FontRenderContext context = tree.getFontMetrics(currentFont).getFontRenderContext(); context.getTransform().transform(p, p); int fontSizeInPixels = (int) Math.ceil(p.getY()); tree.setRowHeight( Math.max(fontSizeInPixels, Collections.max(iconSizes) + 2)); }
public static float temp( int yr, int day, Point2D point) { if(yr<79 || yr>98) return 999f; //Float.NaN; Point2D p = getMapXY(point); int x = (int)Math.floor(p.getX()); if(x<0 || x>=46) return 998f; //Float.NaN; int y = (int)Math.floor(p.getY()); if(y<0 || y>=40) return 997f; //Float.NaN; if(year!=yr) try { readGrids(yr); } catch (IOException ex) { return 996f; //Float.NaN; } if( t==null ) return 995f; //Float.NaN; double dx = p.getX()-x; double dy = p.getY()-y; double dxy = dx*dy; int d = day-1; float T = .01f * (float) ( (double)t[d][y][x]*(1d-dx-dy+dxy) + (double)t[d][y][x+1]*(dx-dxy) + (double)t[d][y+1][x]*(dy-dxy) + (double)t[d][y+1][x+1]*(dxy) ); return T; }
private void advancePositions() { double c = 0; int nodeCount = graph.getNodeCount(); for (int iter = 0; iter < updatesPerFrame; ++iter) { for (Node n : graph.getNodes()) { Point2D.Float f = getForceforNode(n); double log = Math.log10(nodeCount) == 0 ? 1 : Math .log10(nodeCount); double delta = graph.getDegree(n) > 1 ? (deltaT / log) / Math.pow(graph.getDegree(n), 0.4) : (deltaT / log); f.setLocation(f.getX() * delta, f.getY() * delta); n.getNodeData().setX( n.getNodeData().x() + (float) (f.getX() / sensitivity)); n.getNodeData().setY( n.getNodeData().y() + (float) (f.getY() / sensitivity)); c += Math.abs(f.getX()) + Math.abs(f.getY()); } } setChange(c); align(100, 100); }
/** * convert a state from workspace to c space */ private static Config asvConfigToCfg(ASVConfig initialState, Test tester) { List<Point2D> positions = initialState.asvPositions; //length double [] pts = new double [initialState.getASVCount()+1]; Point2D p0= positions.get(0); pts[0]=p0.getX(); pts[1]=p0.getY(); double prevAngle=0; for (int i=1;i<positions.size();i++){ Point2D p1 = positions.get(i); double currentAngle = Math.atan2(p1.getY() - p0.getY(), p1.getX() - p0.getX()); pts[i+1]=tester.normaliseAngle(PI+prevAngle-currentAngle); prevAngle=currentAngle; p0=p1; } Config cfg = new Config(pts); return cfg; }
/** * Handle the case where a plot implements the {@link Zoomable} interface. * * @param zoomable the zoomable plot. * @param e the mouse wheel event. */ private void handleZoomable(ChartCanvas canvas, Zoomable zoomable, ScrollEvent e) { // don't zoom unless the mouse pointer is in the plot's data area ChartRenderingInfo info = canvas.getRenderingInfo(); PlotRenderingInfo pinfo = info.getPlotInfo(); Point2D p = new Point2D.Double(e.getX(), e.getY()); if (pinfo.getDataArea().contains(p)) { Plot plot = (Plot) zoomable; // do not notify while zooming each axis boolean notifyState = plot.isNotify(); plot.setNotify(false); int clicks = (int) e.getDeltaY(); double zf = 1.0 + this.zoomFactor; if (clicks < 0) { zf = 1.0 / zf; } if (canvas.isDomainZoomable()) { zoomable.zoomDomainAxes(zf, pinfo, p, true); } if (canvas.isRangeZoomable()) { zoomable.zoomRangeAxes(zf, pinfo, p, true); } plot.setNotify(notifyState); // this generates the change event too } }
public void advancePositions() { for (int i = 0; i < updatesPerFrame; i++) { for (Vertex v : graph.getVertices()) { if (!isFixed(v)) { Point2D c = transform( v); if (c != null) { Point2D f = getForceforNode(v); double deltaIndividual = 0; try { double log = Math.log10(getGraph().getVertexCount()) == 0 ? 1 : Math.log10(getGraph().getVertexCount()); deltaIndividual = getGraph().degree(v) > 1 ? (deltaT/log) / Math.pow(getGraph().degree(v), 0.4) : (deltaT/log); } catch (java.lang.IllegalArgumentException ex) { this.reset(); } f.setLocation(f.getX() * deltaIndividual, f.getY() * deltaIndividual); c.setLocation(c.getX() + f.getX(), c.getY() + f.getY()); new_change += Math.abs(f.getX()) + Math.abs(f.getY()); } } } } change = new_change; new_change = 0; align(100, 100); }
private void loadTrackFromFile(File file) throws HeadlessException, IOException, ClassNotFoundException { Object old = extractedTrack; if (file == null) { throw new IOException("null filename, can't load track from file - track needs to be saved first"); } log.info("loading track data from " + file); extractedTrack = SlotcarTrack.loadFromFile(file); // extractPoints = (LinkedList<Point2D.Float>) ois.readObject(); // unchecked cast exception extractPoints = new LinkedList<Point2D.Float>(); for (Object o : extractedTrack.trackPoints) { extractPoints.add((Point2D.Float) o); } extractedTrack.getSupport().addPropertyChangeListener(this); extractedTrack.updateTrack(); // update other internal vars of track setTrackName(extractedTrack.getTrackName()); }
protected int getTriangle(final FloatPoint point) { int res = -1; FloatPoint l = getLocation(); for (int type = MovingPanel.RIGHT; type <= MovingPanel.TOP; type++) { GeneralPath gp = getTrianglePath(type); double y = point.getY() + l.getY(); double x = point.getX() + l.getX(); if (gp.contains(new Point2D.Double(x, y))) { res = type; break; } } return res; }
public Point2D intersectionPoint(Ruling other) { Ruling this_l = this.expand(PERPENDICULAR_PIXEL_EXPAND_AMOUNT); Ruling other_l = other.expand(PERPENDICULAR_PIXEL_EXPAND_AMOUNT); Ruling horizontal, vertical; if (!this_l.intersectsLine(other_l)) { return null; } if (this_l.horizontal() && other_l.vertical()) { horizontal = this_l; vertical = other_l; } else if (this_l.vertical() && other_l.horizontal()) { vertical = this_l; horizontal = other_l; } else { throw new IllegalArgumentException("lines must be orthogonal, vertical and horizontal"); } return new Point2D.Float(vertical.getLeft(), horizontal.getTop()); }
@Override protected void pickContainedVertices(VisualizationViewer<GraphNode, GraphEdge> vv, Point2D down,Point2D out, boolean clear) { super.pickContainedVertices(vv, down, out, clear); NetworkModelAdapter netAdapter = this.basicGraphGUI.getGraphEnvironmentController().getNetworkModelAdapter(); // --- Get the selected nodes ---------------- Set<GraphNode> nodesSelected = this.getVisViewer().getPickedVertexState().getPicked(); // --- Get the related NetworkComponent's ---- HashSet<NetworkComponent> components = netAdapter.getNetworkComponentsFullySelected(nodesSelected); if (components!=null) { // --- Run through NetworkComponents ----- for (NetworkComponent networkComponent : components) { Vector<GraphElement> elements = netAdapter.getGraphElementsFromNetworkComponent(networkComponent); for (GraphElement graphElement : elements) { if (graphElement instanceof GraphEdge) { this.getVisViewer().getPickedEdgeState().pick((GraphEdge) graphElement, true); } } } } }
/** * !!! not used currently, but might be by getPixelbounds? */ public void pixellate(FontRenderContext renderFRC, Point2D loc, Point pxResult) { if (renderFRC == null) { renderFRC = frc; } // it is a total pain that you have to copy the transform. AffineTransform at = renderFRC.getTransform(); at.transform(loc, loc); pxResult.x = (int)loc.getX(); // but must not behave oddly around zero pxResult.y = (int)loc.getY(); loc.setLocation(pxResult.x, pxResult.y); try { at.inverseTransform(loc, loc); } catch (NoninvertibleTransformException e) { throw new IllegalArgumentException("must be able to invert frc transform"); } }
/** * Ensure that the positions array exists and holds position data. * If the array is null, this allocates it and sets default positions. */ private void initPositions() { if (positions == null) { setFRCTX(); positions = new float[glyphs.length * 2 + 2]; Point2D.Float trackPt = null; float track = getTracking(font); if (track != 0) { track *= font.getSize2D(); trackPt = new Point2D.Float(track, 0); // advance delta } Point2D.Float pt = new Point2D.Float(0, 0); if (font.isTransformed()) { AffineTransform at = font.getTransform(); at.transform(pt, pt); positions[0] = pt.x; positions[1] = pt.y; if (trackPt != null) { at.deltaTransform(trackPt, trackPt); } } for (int i = 0, n = 2; i < glyphs.length; ++i, n += 2) { getGlyphStrike(i).addDefaultGlyphAdvance(glyphs[i], pt); if (trackPt != null) { pt.x += trackPt.x; pt.y += trackPt.y; } positions[n] = pt.x; positions[n+1] = pt.y; } } }
public Path findDirectPath(final Point2D start, final Point2D target) { final Path2D path2D = new GeneralPath(Path2D.WIND_NON_ZERO); path2D.moveTo(start.getX(), start.getY()); path2D.lineTo(target.getX(), target.getY()); final List<Point2D> points = new ArrayList<>(); points.add(start); points.add(target); return new Path(start, target, path2D, points); }
/** * Translates a Java2D point on the chart to a screen location. * * @param java2DPoint * the Java2D point. * * @return The screen location. */ @Override public Point translateJava2DToScreen(Point2D java2DPoint) { Insets insets = getInsets(); int x = (int) (java2DPoint.getX() * this.scaleX + insets.left); int y = (int) (java2DPoint.getY() * this.scaleY + insets.top); return new Point(x, y); }
@Override public void setLocation(V v, Point2D p) { // Update own storage. v.setCoordinateX(p.getX()); v.setCoordinateY(p.getY()); super.setLocation(v, p); }
protected void createBall(Point2D.Float location) { // getEnclosedFilterChain().reset(); // TODO somehow need to spawn an initial cluster at the starting location Cluster b = tracker.createCluster(new BasicEvent(lastTimestamp, (short) location.x, (short) location.y)); b.setMass(10000); // some big number tracker.getClusters().add(b); ball = b; }
/** * Returns ball location from event tracker if it has a value, otherwise * from the convolution based tracker * * @return */ public Point2D.Float getBallLocation() { if ((ball != null) && ball.isVisible()) { return ball.getLocation(); } else { return staticBallTracker.getBallLocation(); } }
public EarthquakeItem(Earthquake eq) { this.eq = eq; Point2D p = map.getProjection().getMapXY( eq.lon , eq.lat ); x = p.getX(); y = p.getY(); }
@Override protected void dumpShape(PPOutputStream os) { os.print("<p:grpSp>"); os.print("<p:nvGrpSpPr>"); os.print("<p:cNvPr id='" + getShapeId() + "' " + "name='" + getName() + "'/>"); os.print("<p:cNvGrpSpPr/>"); os.print("<p:nvPr/>"); os.print("</p:nvGrpSpPr>"); os.print("<p:grpSpPr>"); Point2D pt = getInitialLocation(); Rectangle2D bb = getGroupBounds(); String offsetTag = os.getOffsetTag(pt.getX() + bb.getX(), pt.getY() + bb.getY()); os.print("<a:xfrm>"); os.print("<a:off " + offsetTag + "/>"); os.print("<a:ext cx='" + PPUtil.pointsToUnits(bb.getWidth()) + "' " + "cy='" + PPUtil.pointsToUnits(bb.getHeight()) + "'/>"); os.print("<a:chOff " + offsetTag + "/>"); os.print("<a:chExt cx='" + PPUtil.pointsToUnits(bb.getWidth()) + "' " + "cy='" + PPUtil.pointsToUnits(bb.getHeight()) + "'/>"); os.print("</a:xfrm>"); os.print("</p:grpSpPr>"); Point2D start = getInitialLocation(); os.adjustOffset(start.getX(), start.getY()); for (PPShape shape : contents) { shape.dumpShape(os); } os.adjustOffset(-getX(), -getY()); os.print("</p:grpSp>"); }
/** * Changes the point with the given index to a new value */ public void setPoint(int idx, Point2D.Float newPoint) { if ((idx >= 0) && (idx < trackPoints.size())) { trackPoints.set(idx, newPoint); updateTrack(); } }
/** * scale visualisation to fill full visualization viewer space * * @author amusial */ protected void fillVV() { // scale // if layout was scaled, scale it to it original size if (vv.getRenderContext().getMultiLayerTransformer() .getTransformer(Layer.LAYOUT).getScaleX() > 1D) { (new LayoutScalingControl()).scale(vv, (1f / (float) vv .getRenderContext().getMultiLayerTransformer() .getTransformer(Layer.LAYOUT).getScaleX()), new Point2D.Double()); } // get view bounds Dimension vd = vv.getPreferredSize(); if (vv.isShowing()) { vd = vv.getSize(); } // get visualisation layout size Dimension ld = vv.getGraphLayout().getSize(); // finally scale it if view bounds are different than visualisation layer bounds if (vd.equals(ld) == false) { float heightRatio = (float) (vd.getWidth() / ld.getWidth()); float widthRatio = (float) (vd .getHeight() / ld.getHeight()); scaler.scale(vv, (heightRatio < widthRatio ? heightRatio : widthRatio), new Point2D.Double()); } }
protected void correctGraph(Collection<ViwnNode> toCorrect, ViwnNode anode) { // boundary coordinates int minx, maxx, miny, maxy; // initialize boundary coordinates minx = maxx = (int) locations.get(anode).getX(); miny = maxy = (int) locations.get(anode).getY(); // for all nodes already place, check their locations for (ViwnNode vn : toCorrect) { Point2D p = locations.get(vn); if (p.getX() > maxx) { maxx = (int) p.getX(); } else if (p.getX() < minx) { minx = (int) p.getX(); } if (p.getY() > maxy) { maxy = (int) p.getY(); } else if (p.getY() < miny) { miny = (int) p.getY(); } } // replace nodes correctNode2PointMapping(toCorrect, -minx + distX, -miny + distY); // set visualisation size size = new Dimension((maxx - minx) + 2 * distX, (maxy - miny) + 2 * distY); }
/** * Return the union of the visual bounds of all the components. * This incorporates the path. It does not include logical * bounds (used by carets). */ public Rectangle2D getVisualBounds() { Rectangle2D result = null; for (int i = 0, n = 0; i < fComponents.length; i++, n += 2) { TextLineComponent tlc = fComponents[getComponentLogicalIndex(i)]; Rectangle2D r = tlc.getVisualBounds(); Point2D.Float pt = new Point2D.Float(locs[n], locs[n+1]); if (lp == null) { r.setRect(r.getMinX() + pt.x, r.getMinY() + pt.y, r.getWidth(), r.getHeight()); } else { lp.pathToPoint(pt, false, pt); AffineTransform at = tlc.getBaselineTransform(); if (at != null) { AffineTransform tx = AffineTransform.getTranslateInstance (pt.x - at.getTranslateX(), pt.y - at.getTranslateY()); tx.concatenate(at); r = tx.createTransformedShape(r).getBounds2D(); } else { r.setRect(r.getMinX() + pt.x, r.getMinY() + pt.y, r.getWidth(), r.getHeight()); } } if (result == null) { result = r; } else { result.add(r); } } if (result == null) { result = new Rectangle2D.Float(Float.MAX_VALUE, Float.MAX_VALUE, Float.MIN_VALUE, Float.MIN_VALUE); } return result; }
@SuppressWarnings("unchecked") public void advancePositions() { try{ for (int i = 0; i < updatesPerFrame; i++) { for (Object o : graph.getVertices()) { Vertex v = (Vertex) o; if(!isFixed(v)){ Point2D c = transform((V) v); if(c != null){ Point2D f = getForceforNode(v); double deltaIndividual = getGraph().degree((V)v) > 1 ? deltaT / Math.pow(getGraph().degree((V)v), 0.4) : deltaT; f.setLocation(f.getX()*deltaIndividual, f.getY()*deltaIndividual); c.setLocation(c.getX() + f.getX(), c.getY() + f.getY()); } } } } }catch(Exception e){ System.err.println(e); e.printStackTrace(); } align(100,100); }
/** * Compares this object with the specified object for order, based on * the outlier's point. * * @param o the Object to be compared. * @return a negative integer, zero, or a positive integer as this object * is less than, equal to, or greater than the specified object. * */ public int compareTo(Object o) { Outlier outlier = (Outlier) o; Point2D p1 = getPoint(); Point2D p2 = outlier.getPoint(); if (p1.equals(p2)) { return 0; } else if ((p1.getX() < p2.getX()) || (p1.getY() < p2.getY())) { return -1; } else { return 1; } }
private Point2D getPlusPoint(final int type, double rotateWidth) { if (type == MovingPanel.RIGHT) return new Point2D.Double(rotateWidth, 0); else if (type == MovingPanel.LEFT) return new Point2D.Double(-rotateWidth, 0); else if (type == MovingPanel.TOP) return new Point2D.Double(0, -rotateWidth); else if (type == MovingPanel.BOTTOM) return new Point2D.Double(0, rotateWidth); else return new Point2D.Double(0, 0); }
/** Computes the current image point, that is in the center in the current view area. */ private Point2D.Double computeCenterPoint() { Point p = scrollPane.getViewport().getViewPosition(); Rectangle viewRect = scrollPane.getViewport().getViewRect(); p.x += viewRect.width/2; p.y += viewRect.height/2; return new Point2D.Double(p.x / scale, p.y / scale); }
/** * Find the cumulative distance between an array of points * @param pts * @return */ public static double cumulativeDistance(Point2D[] pts) { if( pts==null ) return 0.; try{ double d = 0.; for (int i=1; i<pts.length; i++) { Point2D[] points = {pts[i-1], pts[i]}; d += distance(points); } return d; } catch (Exception e) { return 0; } }
public void doPaint(Graphics2D g2d) { g2d.translate(DIM*0.2, DIM*0.2); Shape s = new Rectangle2D.Float(0, 0, DIM*2, DIM*2); // RadialGradientPaint Point2D centre = new Point2D.Float(DIM/2.0f, DIM/2.0f); float radius = DIM/2.0f; Point2D focus = new Point2D.Float(DIM/3.0f, DIM/3.0f); float stops[] = {0.0f, 1.0f}; Color colors[] = { Color.red, Color.white} ; RadialGradientPaint rgp = new RadialGradientPaint(centre, radius, focus, stops, colors, RadialGradientPaint.CycleMethod.NO_CYCLE); g2d.setPaint(rgp); g2d.fill(s); g2d.translate(DIM*2.2, 0); Color colors1[] = { Color.red, Color.blue, Color.green} ; float stops1[] = {0.0f, 0.5f, 1.0f}; RadialGradientPaint rgp1 = new RadialGradientPaint(centre, radius, focus, stops1, colors1, RadialGradientPaint.CycleMethod.REFLECT); g2d.setPaint(rgp1); g2d.fill(s); g2d.translate(-DIM*2.2, DIM*2.2); Color colors2[] = { Color.red, Color.blue, Color.green, Color.white} ; float stops2[] = {0.0f, 0.3f, 0.6f, 1.0f}; RadialGradientPaint rgp2 = new RadialGradientPaint(centre, radius, focus, stops2, colors2, RadialGradientPaint.CycleMethod.REPEAT); g2d.setPaint(rgp2); g2d.fill(s); }
private void setTemporalNoiseLinePointsFromMousePoints(Point2D.Float start, Point2D.Float end) { final float offset = .1f; final float x0 = chip.getSizeX() * offset, y0 = chip.getSizeY() * offset, x1 = chip.getSizeX() * (1 - offset), y1 = chip.getSizeY() * (1 - offset); msp = start; mep = end; dsp.x = (float) meanrange * (msp.x - x0) / (x1 - x0); dep.x = (float) meanrange * (mep.x - x0) / (x1 - x0); dsp.y = (float) varrange * (msp.y - y0) / (y1 - y0); dep.y = (float) varrange * (mep.y - y0) / (y1 - y0); }
/** * Multiplies the range on the range axis/axes by the specified factor. * * @param factor the zoom factor. * @param info the plot rendering info. * @param source the source point. */ public void zoomRangeAxes(double factor, PlotRenderingInfo info, Point2D source) { CategoryPlot subplot = findSubplot(info, source); if (subplot != null) { subplot.zoomRangeAxes(factor, info, source); } }
/** * Returns whether the given configuration has sufficient area. * * @param cfg * the configuration to test. * @return whether the given configuration has sufficient area. */ public boolean hasEnoughArea(ASVConfig cfg) { double total = 0; List<Point2D> points = cfg.getASVPositions(); points.add(points.get(0)); points.add(points.get(1)); for (int i = 1; i < points.size() - 1; i++) { total += points.get(i).getX() * (points.get(i + 1).getY() - points.get(i - 1).getY()); } double area = Math.abs(total) / 2; return (area >= getMinimumArea(cfg.getASVCount()) - maxError); }
private void renderParticles(final Graphics2D g, final ParticleRenderType renderType) { final Point2D origin = this.getLocation(); this.particles.forEach(particle -> { if (particle.getParticleRenderType() == renderType) { particle.render(g, origin); } }); }
public void layout(FontStrikeDesc desc, float[] mat, int gmask, int baseIndex, TextRecord tr, int typo_flags, Point2D.Float pt, GVData data) { Font2D font = key.font(); FontStrike strike = font.getStrike(desc); long layoutTables = 0; if (font instanceof TrueTypeFont) { layoutTables = ((TrueTypeFont) font).getLayoutTableCache(); } nativeLayout(font, strike, mat, gmask, baseIndex, tr.text, tr.start, tr.limit, tr.min, tr.max, key.script(), key.lang(), typo_flags, pt, data, font.getUnitsPerEm(), layoutTables); }
/** Sets the window length. Clears the accumulated data. @param length the number of points to fit @see #LENGTH_DEFAULT */ synchronized public void setLength(int length) { this.length = length; points=new LinkedList<Point2D.Float>(); sx=0; sy=0; sxx=0; sxy=0; }
private void massage_glyphs(GlyphVector gv, int start, int n, Line l) { Point2D pos0 = gv.getGlyphPosition(0); // There's one big assumption here that in a monospaced font all the // Y placements are identical. So we use the placement for the first // glyph only. newp.y = (int) pos0.getY(); int col = (int) pos0.getX(); for (int gx = 0; gx < n; gx++) { newp.x = col; gv.setGlyphPosition(gx, newp); col += l.width(metrics, start + gx) * metrics.width; } }
public void start() { frameRate(1000); for(int i = 0; i < 5; i++) { AddGameObject(new Organism(this, new Point2D.Float(ThreadLocalRandom.current().nextInt(200, 800), ThreadLocalRandom.current().nextInt(200, 800)))); } NextRound(); }
private void updateVelocity(final Point2D p0, final Point2D p1, final long t0, final long t1) { final double dt = t1 - t0; if ((dt < DT_MAX) && (dt > 0)){ dragVelocity.set(p1, p0); dragVelocity.scale(1./dt); // Vitesse en pixel par milliseconde if (dragVelocity.getLength() > MAX_VELOCITY) { // Limitation de vitesse ! dragVelocity.setLength(MAX_VELOCITY); } } else { dragVelocity.set(0,0); // Vitesse nulle } lastEventTime = t1; }
/** Sets the coordinates of mouse to be displayed. @param p mouse location. */ public void setXY( Point p ) { if( p==null ) { if( app instanceof MapApp ) { ((MapApp)app).tools.info.setText(""); } else if(app instanceof PolarMapApp ) { ((PolarMapApp)app).tools.info.setText(""); } return; } Point2D.Double pt = (Point2D.Double)proj.getRefXY( getScaledPoint(p)); setLonLat( pt ); }
@Override synchronized public void setFilterEnabled(boolean yes) { super.setFilterEnabled(yes); setCameraRotationEstimator(cameraRotationEstimator); // reflag enabled/disabled state of motion computation getEnclosedFilterChain().reset(); if (!yes) { setPanTiltEnabled(false); // turn off servos, close interface if (chip.getAeViewer() != null && chip.getCanvas() != null && chip.getCanvas().getDisplayMethod() instanceof ChipRendererDisplayMethodRGBA) { ChipRendererDisplayMethodRGBA displayMethod = (ChipRendererDisplayMethodRGBA) chip.getCanvas().getDisplayMethod(); // TODO not ideal (tobi) displayMethod.setImageTransform(new Point2D.Float(0, 0), 0); } } else { resetFilter(); // reset on enabled to prevent large timestep anomalies } }