本文整理匯總了Java中java.awt.geom.GeneralPath.getBounds方法的典型用法代碼示例。如果您正苦於以下問題:Java GeneralPath.getBounds方法的具體用法?Java GeneralPath.getBounds怎麽用?Java GeneralPath.getBounds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.geom.GeneralPath
的用法示例。
在下文中一共展示了GeneralPath.getBounds方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: selectLasso
import java.awt.geom.GeneralPath; //導入方法依賴的package包/類
/**
Selects the area represented by poly
*/
void selectLasso(XYGraph xyg) {
GeneralPath path = new GeneralPath();
for (int i=0; i<poly.npoints; i++){
Point2D p2 = new Point2D.Float (poly.xpoints[i], poly.ypoints[i]);
Point2D point = new Point2D.Double (xyg.getXAt(p2), xyg.getYAt(p2));
if (i==0) path.moveTo((float)point.getX(), (float) point.getY());
else path.lineTo((float)point.getX(), (float) point.getY());
}
path.closePath();
Rectangle2D r = path.getBounds();
int n = 0;
while (n<x.length&&(Float.isNaN(x[n])||Float.isNaN(y[n]))) {
n++;
}
if (n>=x.length) return;
table.getSelectionModel().setValueIsAdjusting(true);
table.clearSelection();
for (int i = n; i < x.length; i++) {
if (Float.isNaN(x[i])||Float.isNaN(y[i])) continue;
if (r.contains(x[i], y[i]) && path.contains(x[i], y[i])) {
table.getSelectionModel().addSelectionInterval(i, i);
}
}
table.getSelectionModel().setValueIsAdjusting(false);
unDrawLasso(xyg);
if (table.getSelectedRow() != -1)
table.ensureIndexIsVisible(table.getSelectedRow());
}
示例2: selectLasso
import java.awt.geom.GeneralPath; //導入方法依賴的package包/類
/**
Selects the area represented by poly
*/
void selectLasso(XYGraph xyg) {
GeneralPath path = new GeneralPath();
for (int i=0; i<poly.npoints; i++){
Point2D p2 = new Point2D.Float (poly.xpoints[i], poly.ypoints[i]);
Point2D point = new Point2D.Double (xyg.getXAt(p2), xyg.getYAt(p2));
if (i==0) path.moveTo((float)point.getX(), (float) point.getY());
else path.lineTo((float)point.getX(), (float) point.getY());
}
path.closePath();
Rectangle2D r = path.getBounds();
ds.dataT.getSelectionModel().setValueIsAdjusting(true);
if (scatter) {
int n = 0;
while (n<x.length&&(Float.isNaN(x[n])||Float.isNaN(y[n]))) {
n++;
}
if (n>=x.length) return;
for (int i = n; i < x.length; i++) {
if (Float.isNaN(x[i])||Float.isNaN(y[i])) continue;
if (r.contains(x[i], y[i]) && path.contains(x[i], y[i])) {
ds.dataT.getSelectionModel().addSelectionInterval(i, i);
}
}
}
unDrawLasso(xyg);
// selectionChangedRedraw(ds.selected);
ds.dataT.getSelectionModel().setValueIsAdjusting(false);
if (ds.dataT.getSelectedRow() != -1)
ds.dataT.ensureIndexIsVisible(ds.dataT.getSelectedRow());
}
示例3: selectLasso
import java.awt.geom.GeneralPath; //導入方法依賴的package包/類
public void selectLasso() {
GeneralPath path = new GeneralPath();
for (int i=0; i<poly.npoints; i++){
Point2D point = map.getScaledPoint(new Point(poly.xpoints[i],poly.ypoints[i]));
if (i==0) path.moveTo((float)point.getX(), (float) point.getY());
else path.lineTo((float)point.getX(), (float) point.getY());
}
path.closePath();
r=path.getBounds();
Rectangle2D rect = map.getClipRect2D();
float yMin = (float)rect.getY();
float yMax = (float)(rect.getY() + rect.getHeight());
float xMin = (float)rect.getX();
float xMax = (float)(rect.getX() + rect.getWidth());
float wrap = (float)map.getWrap();
table.getSelectionModel().setValueIsAdjusting(true);
table.clearSelection();
for( int k=0 ; k<model.current.length ; k++) {
PDBStation stat = PDBStation.get(model.current[k]);
double x = stat.getX();
double y = stat.getY();
if( y<yMin || y>yMax ) continue;
if( wrap>0f ) {
while( x>xMin+wrap ) x -= wrap;
while( x<xMin ) x += wrap;
while( x<xMax ) {
if (r.contains(x, y)&&path.contains(x, y))
table.addRowSelectionInterval(k, k);
x += wrap;
}
} else {
if( x>xMin && x<xMax ) {
if (r.contains(x, y)&&path.contains(x, y))
table.addRowSelectionInterval(k, k);
}
}
}
table.getSelectionModel().setValueIsAdjusting(false);
int selected = table.getSelectedRow();
if (selected != -1)
table.ensureIndexIsVisible(selected);
unDrawLasso();
table.getRowHeader().setSelectedIndices(table.getSelectedRows());
table.getRowHeader().repaint();
}
示例4: selectLasso
import java.awt.geom.GeneralPath; //導入方法依賴的package包/類
public void selectLasso() {
GeneralPath path = new GeneralPath();
for (int i=0; i<poly.npoints; i++){
Point2D point = map.getScaledPoint(new Point(poly.xpoints[i],poly.ypoints[i]));
if (i==0) path.moveTo((float)point.getX(), (float) point.getY());
else path.lineTo((float)point.getX(), (float) point.getY());
}
path.closePath();
r=path.getBounds();
// Point2D p = map.getScaledPoint(new Point(r.x,r.y));
// Rectangle2D.Double r = new Rectangle2D.Double(p.getX(),p.getY(),
// this.r.width/map.getZoom(),this.r.height/map.getZoom());
Rectangle2D rect = map.getClipRect2D();
float yMin = (float)rect.getY();
float yMax = (float)(rect.getY() + rect.getHeight());
float xMin = (float)rect.getX();
float xMax = (float)(rect.getX() + rect.getWidth());
float wrap = (float)map.getWrap();
//System.out.println(xMin+"\t"+xMax+"\t"+yMin+"\t"+yMax);
dataT.getSelectionModel().setValueIsAdjusting(true);
if (station){
for( int k=0 ; k<tm.displayToDataIndex.size() ; k++) {
int z = tm.displayToDataIndex.get(k);
UnknownData d = data.get(z);
if (f!=null&&k<f.length&&Float.isNaN(f[k])) continue;
if (f2!=null&&k<f2.length&&Float.isNaN(f2[k])) continue;
if (dataT.isRowSelected(k)){ continue; }
//Symbol s = new Symbol(Symbol.CIRCLE, (float) (3./zoom), b, a);
float x = d.x;
float y = d.y;
//System.out.println(d+"\t"+yMin+"\t"+yMax);
if( y<yMin || y>yMax ) continue;
if (Float.isNaN(d.x) || Float.isNaN(d.y)) continue;
if( wrap>0f ) {
while( x>xMin+wrap ) x -= wrap;
while( x<xMin ) x += wrap;
while( x<xMax ) {
if (r.contains(x, y)&&path.contains(x, y))
dataT.getSelectionModel().addSelectionInterval(k, k);
x += wrap;
}
} else {
if( x>xMin && x<xMax ) {
if (r.contains(x, y)&&path.contains(x, y))
dataT.getSelectionModel().addSelectionInterval(k, k);
}
}
}
}
dataT.getSelectionModel().setValueIsAdjusting(false);
unDrawLasso();
// selectionChangedRedraw(os);
if (dataT.getSelectedRow() != -1)
dataT.ensureIndexIsVisible(dataT.getSelectedRow());
}