import java.awt.Graphics2D; //导入方法依赖的package包/类
public void draw(Graphics2D g) {
//if(!display) return;
int yr1 = 1900;
int yr2 = 2005;
try {
long[] interval = timeInterval();
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
if( db.before.isSelected() ) {
cal.setTimeInMillis(interval[0]);
yr1 = cal.get(cal.YEAR);
}
if( db.after.isSelected() ) {
cal.setTimeInMillis(interval[1]);
yr2 = cal.get(cal.YEAR);
}
} catch(Exception e) {
}
//System.out.println( yr1 +"\t"+ yr2);
float size = 2.0f + 6f/(float)map.getZoom();
Arc2D.Float dot = new Arc2D.Float(-size/2f, -size/2f, size, size, 0f, 360f, Arc2D.CHORD);
float size1 = 2.0f + 7f/(float)map.getZoom();
GeneralPath triangle = new GeneralPath();
triangle.moveTo(0f, size1/2f );
triangle.lineTo(size1/2f, -size1/2f );
triangle.lineTo(-size1/2f, -size1/2f );
triangle.closePath();
//Rectangle2D.Float square = new Rectangle2D.Float(-size1/2f, -size1/2f, size1, size1);
AffineTransform at = g.getTransform();
g.setStroke( new BasicStroke( .5f/(float)map.getZoom() ) );
RenderingHints hints = g.getRenderingHints();
g.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g.setRenderingHint( RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
Shape shape = dot;
for(int k=0 ; k
//Shape shape = triangle;
//if( xyd[k][5]<=1991f ) shape = dot;
if( xyd[k][5]>yr2 )continue;
if( xyd[k][5]
g.translate( (double)xyd[k][0], (double)xyd[k][1] );
//g.setColor( Color.black );
//g.draw(shape);
g.setColor( color[k] );
g.fill(shape);
g.setColor( Color.black );
g.draw(shape);
g.setTransform( at );
}
g.setFont( (new Font("Serif", Font.BOLD, 1)).deriveFont( size1*1.5f));
Rectangle2D rect = map.getClipRect2D();
double s = (double) size1;
double x = rect.getX() + s;
double y = rect.getY() + 2.*s;
//g.translate( x, y );
//g.setColor( Color.white );
//g.fill( dot );
//g.setColor( Color.black );
//g.draw( dot );
//g.translate( s, s/2.);
//String year = db.startF.getText();
//String dateString = db.before.isSelected()
//? "before 1/1/"+year
//: "after 1/1/"+year;
//g.drawString( dateString, 0, 0);
//g.drawString( "before 1/1/1991", 0, 0);
//g.setTransform(at);
//g.translate( x, y+s*2.0 );
//g.setColor( Color.white );
//g.fill( triangle );
//g.setColor( Color.black );
//g.draw( triangle );
//g.translate( s, s/2.);
//g.drawString( "after 1/1/1991", 0, 0);
g.setTransform(at);
g.setRenderingHints( hints);
}