/* * DisplayBilliardPath.java * * Created on March 10, 2006, 10:09 AM */ package Current.popups.BilliardPath; import Current.popups.Unfold.*; import Current.basic.*; import Current.manage.*; import java.awt.*; import java.awt.geom.AffineTransform; import java.awt.geom.GeneralPath; import java.awt.geom.Rectangle2D; import java.awt.geom.Point2D; import org.pat.graphics.arrows.*; import Current.gui.*; import Current.popups.ImageSave.ImageSaver; /** * * @author pat */ public class DisplayConeSurface extends DBCanvas implements ImageSaver, UnfoldingData.UnfoldingDataWatcher { ListenTriangle T[]=new ListenTriangle[2]; double pos=0.5; // position of path in strip. protected Manager M; public DisplayProperties properties; protected UnfoldingData UD; protected boolean popup; /** to be called as an independent popup */ public DisplayConeSurface(Manager M) { popup=true; UnfoldingData ud=new UnfoldingData(M); ud.setWatcher(this); init(M,ud,new DisplayProperties(M)); } /** to be called by a DisplayContainer */ public DisplayConeSurface(Manager M, UnfoldingData UD, DisplayProperties properties) { popup=false; init(M,UD,properties); } private void init(Manager M, UnfoldingData UD, DisplayProperties properties) { setFont(new Font("sanserif", Font.PLAIN, 20)); this.M=M; this.UD=UD; this.properties=properties; setSize(200,200); M.ISM.add("cone surface", this); M.addListener(this); } /** called when the color settings are changed */ public void mcbReceive(DisplayProperties.ColorSettings cs) { repaint(); } public void mcbCleanup() { M.ISM.remove(this); M.remove(this); } public void paint(Graphics gfx){ if (properties.colors.bgColor!=this.getBackground()) { setBackground(properties.colors.bgColor); gfx.setColor(properties.colors.bgColor); gfx.fillRect(0,0, getWidth(), getHeight()); } pos=properties.pos; Graphics2D g=(Graphics2D) gfx; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); T[0]=ListenTriangle.init(UD.Z); T[1]=T[0].reflect(2); GeneralPath[] triangle={T[0].getPath(),T[1].getPath()}; Rectangle2D rect=new Rectangle2D.Double(); Rectangle2D.union(triangle[0].getBounds2D(), triangle[1].getBounds2D(), rect); double s1=getWidth()/rect.getWidth(), s2=getHeight()/rect.getHeight(),s; if (s1