FunctionArea may now plot circles easily. The FLensProblemViewer seems to be cured.

This commit is contained in:
Marcel Kronfeld
2008-06-19 11:03:38 +00:00
parent 113f119b29
commit 5acff4aec6
14 changed files with 472 additions and 377 deletions

View File

@@ -57,7 +57,11 @@ public class DLine extends DComponent
if( color != null ) g.setColor( color );
Point p1 = m.getPoint( start ),
p2 = m.getPoint( end ) ;
g.drawLine( p1.x, p1.y, p2.x, p2.y );
if ((p1!=null) && (p2!=null)) {
g.drawLine( p1.x, p1.y, p2.x, p2.y );
} else {
System.err.println("Couldnt paint rect!");
}
}
public String toString(){

View File

@@ -87,6 +87,9 @@ private boolean under_construction = false;
*/
public Point getPoint( double x, double y ){
DRectangle rect = getSourceOf( getDRectangle() );
if (rect == null) {
return null;
}
try{
if( x_scale != null ) x = x_scale.getSourceOf( x );
if( y_scale != null ) y = y_scale.getSourceOf( y );
@@ -214,8 +217,11 @@ private boolean under_construction = false;
*/
DRectangle getSourceOf( DRectangle rect ){
if( under_construction ) System.out.println("DMeasures.getSourceOf: "+rect);
if( !getDRectangle().contains( rect ) ) throw
new IllegalArgumentException("The rectangle lies not in the currently painted rectangle");
if( !getDRectangle().contains( rect ) ) {
return null;
//throw new IllegalArgumentException("The rectangle lies not in the currently painted rectangle");
}
if( x_scale == null && y_scale == null ) return rect;
if( rect.isEmpty() ) return (DRectangle)rect.clone();
DPoint p1 = new DPoint( rect.x, rect.y ),