/* * DotFill.java * * Created on 26 October 2001, 20:16 */ package uk.ac.leeds.ccg.geotools.misc; import java.awt.*; /** * * @author Ian Turton * @version */ public class DotFill { /** Creates new DotFill */ public DotFill() { } public static void fillPolygon(Graphics g,Polygon poly,int diameter,int distance){ int x[] = poly.xpoints; int y[] = poly.ypoints; int n = poly.npoints; double p;//cos/sine of angle offset of tmp polygon int k; double HI =-Double.MAX_VALUE; double LO =Double.MAX_VALUE; //rotate the polygon so that hatch lines are horezontal for(int i=0;iLO) p=p-distance; k = (int)((HI-p)/distance); if(k<=0 && distance<=0){ System.err.println("No hatching possible"); return; } double[] ord = new double[k]; //k is the number of hatches to draw for(int i=0;ip&&y[j]>p) continue; ord[m]=x[l]+(x[j]-x[l])*(p-y[l])/(y[j]-y[l]); m++; } if(m%2!=0){System.err.println("Rounding error in DotFill hatch");} if(m==0)continue; //sort ord for(int j=1;jord[l]){ double q = ord[l]; ord[l]=ord[l-1]; ord[l-1]=q; } } } int ns=0; int xh[] = new int[n]; for(int j=1;j