本文整理汇总了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());
}