本文整理了Java中ij.gui.Line.getStrokeWidth()
方法的一些代码示例,展示了Line.getStrokeWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Line.getStrokeWidth()
方法的具体详情如下:
包路径:ij.gui.Line
类名称:Line
方法名:getStrokeWidth
暂无
代码示例来源:origin: net.imagej/ij
/** Returns the number of points in this selection; equivalent to getPolygon().npoints. */
public int size() {
return getStrokeWidth()<=1?2:4;
}
代码示例来源:origin: imagej/ImageJA
/** Returns the number of points in this selection; equivalent to getPolygon().npoints. */
public int size() {
return getStrokeWidth()<=1?2:4;
}
代码示例来源:origin: net.imagej/ij
public boolean contains(int x, int y) {
if (getStrokeWidth()>1) {
if ((x==x1&&y==y1) || (x==x2&&y==y2))
return true;
else
return getPolygon().contains(x,y);
} else
return false;
}
代码示例来源:origin: net.imagej/ij
protected void mouseDownInHandle(int handle, int sx, int sy) {
state = MOVING_HANDLE;
activeHandle = handle;
if (getStrokeWidth()<=3)
ic.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
}
代码示例来源:origin: net.imagej/ij
@Override
public Iterator<Point> iterator() {
if (getStrokeWidth() <= 1.0)
return new PointIterator(this); // use the specific thin-line iterator
else
return super.iterator(); // fall back on Roi's iterator
}
代码示例来源:origin: imagej/ImageJA
public boolean contains(int x, int y) {
if (getStrokeWidth()>1) {
if ((x==x1&&y==y1) || (x==x2&&y==y2))
return true;
else
return getPolygon().contains(x,y);
} else
return false;
}
代码示例来源:origin: imagej/ImageJA
@Override
public Iterator<Point> iterator() {
if (getStrokeWidth() <= 1.0)
return new PointIterator(this); // use the specific thin-line iterator
else
return super.iterator(); // fall back on Roi's iterator
}
代码示例来源:origin: imagej/ImageJA
protected void mouseDownInHandle(int handle, int sx, int sy) {
state = MOVING_HANDLE;
activeHandle = handle;
if (getStrokeWidth()<=3)
ic.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
}
代码示例来源:origin: net.imagej/ij
/** Returns a handle number if the specified screen coordinates are
inside or near a handle, otherwise returns -1. */
public int isHandle(int sx, int sy) {
int size = HANDLE_SIZE+5;
if (getStrokeWidth()>1) size += (int)Math.log(getStrokeWidth());
int halfSize = size/2;
double offset = getOffset(0.5);
int sx1 = ic.screenXD(x+x1R+offset) - halfSize;
int sy1 = ic.screenYD(y+y1R+offset) - halfSize;
int sx2 = ic.screenXD(x+x2R+offset) - halfSize;
int sy2 = ic.screenYD(y+y2R+offset) - halfSize;
int sx3 = sx1 + (sx2-sx1)/2-1;
int sy3 = sy1 + (sy2-sy1)/2-1;
if (sx>=sx1&&sx<=sx1+size&&sy>=sy1&&sy<=sy1+size) return 0;
if (sx>=sx2&&sx<=sx2+size&&sy>=sy2&&sy<=sy2+size) return 1;
if (sx>=sx3&&sx<=sx3+size+2&&sy>=sy3&&sy<=sy3+size+2) return 2;
return -1;
}
代码示例来源:origin: imagej/ImageJA
/** Returns a handle number if the specified screen coordinates are
inside or near a handle, otherwise returns -1. */
public int isHandle(int sx, int sy) {
int size = HANDLE_SIZE+5;
if (getStrokeWidth()>1) size += (int)Math.log(getStrokeWidth());
int halfSize = size/2;
double offset = getOffset(0.5);
int sx1 = ic.screenXD(x+x1R+offset) - halfSize;
int sy1 = ic.screenYD(y+y1R+offset) - halfSize;
int sx2 = ic.screenXD(x+x2R+offset) - halfSize;
int sy2 = ic.screenYD(y+y2R+offset) - halfSize;
int sx3 = sx1 + (sx2-sx1)/2-1;
int sy3 = sy1 + (sy2-sy1)/2-1;
if (sx>=sx1&&sx<=sx1+size&&sy>=sy1&&sy<=sy1+size) return 0;
if (sx>=sx2&&sx<=sx2+size&&sy>=sy2&&sy<=sy2+size) return 1;
if (sx>=sx3&&sx<=sx3+size+2&&sy>=sy3&&sy<=sy3+size+2) return 2;
return -1;
}
代码示例来源:origin: net.imagej/ij
x1d=x+x1R; y1d=y+y1R; x2d=x+x2R; y2d=y+y2R;
FloatPolygon p = new FloatPolygon();
if (getStrokeWidth()<=1) {
p.addPoint((float)x1d, (float)y1d);
p.addPoint((float)x2d, (float)y2d);
} else {
double angle = Math.atan2(y1d-y2d, x2d-x1d);
double width2 = getStrokeWidth()/2.0;
double p1x = x1d + Math.cos(angle+Math.PI/2d)*width2;
double p1y = y1d - Math.sin(angle+Math.PI/2d)*width2;
代码示例来源:origin: imagej/ImageJA
x1d=x+x1R; y1d=y+y1R; x2d=x+x2R; y2d=y+y2R;
FloatPolygon p = new FloatPolygon();
if (getStrokeWidth()<=1) {
p.addPoint((float)x1d, (float)y1d);
p.addPoint((float)x2d, (float)y2d);
} else {
double angle = Math.atan2(y1d-y2d, x2d-x1d);
double width2 = getStrokeWidth()/2.0;
double p1x = x1d + Math.cos(angle+Math.PI/2d)*width2;
double p1y = y1d - Math.sin(angle+Math.PI/2d)*width2;
代码示例来源:origin: net.imagej/ij
dy = oy-(y1d+(y2d-y1d)/2);
x1d+=dx; y1d+=dy; x2d+=dx; y2d+=dy;
if (getStrokeWidth()>1) {
x1d+=xHandleOffset; y1d+=yHandleOffset;
x2d+=xHandleOffset; y2d+=yHandleOffset;
代码示例来源:origin: net.imagej/ij
/** Returns the pixel values along this line. */
public double[] getPixels() {
double[] profile;
if (getStrokeWidth()<=1) {
ImageProcessor ip = imp.getProcessor();
profile = ip.getLine(x1d, y1d, x2d, y2d);
} else {
ImageProcessor ip2 = (new Straightener()).rotateLine(imp,(int)getStrokeWidth());
if (ip2==null) return new double[0];
int width = ip2.getWidth();
int height = ip2.getHeight();
if (ip2 instanceof FloatProcessor)
return ProfilePlot.getColumnAverageProfile(new Rectangle(0,0,width,height),ip2);
profile = new double[width];
double[] aLine;
ip2.setInterpolate(false);
for (int y=0; y<height; y++) {
aLine = ip2.getLine(0, y, width-1, y);
for (int i=0; i<width; i++)
profile[i] += aLine[i];
}
for (int i=0; i<width; i++)
profile[i] /= height;
}
return profile;
}
代码示例来源:origin: imagej/ImageJA
/** Returns the pixel values along this line. */
public double[] getPixels() {
double[] profile;
if (getStrokeWidth()<=1) {
ImageProcessor ip = imp.getProcessor();
profile = ip.getLine(x1d, y1d, x2d, y2d);
} else {
ImageProcessor ip2 = (new Straightener()).rotateLine(imp,(int)getStrokeWidth());
if (ip2==null) return new double[0];
int width = ip2.getWidth();
int height = ip2.getHeight();
if (ip2 instanceof FloatProcessor)
return ProfilePlot.getColumnAverageProfile(new Rectangle(0,0,width,height),ip2);
profile = new double[width];
double[] aLine;
ip2.setInterpolate(false);
for (int y=0; y<height; y++) {
aLine = ip2.getLine(0, y, width-1, y);
for (int i=0; i<width; i++)
profile[i] += aLine[i];
}
for (int i=0; i<width; i++)
profile[i] /= height;
}
return profile;
}
代码示例来源:origin: stackoverflow.com
Line vLine = new Line();
GridPane.setMargin(vLine, vMargin);
System.out.println(vLine.getStrokeWidth());
vLine.endYProperty().bind(height);
gridPane.add(vLine, i, 0, 1, nextRow);
代码示例来源:origin: ome/bio-formats_plugins
if (roi.getStrokeWidth() > 0) {
store.setLineStrokeWidth(new Length((roi.getStrokeWidth()),
UNITS.PIXEL), roiNum, shape);
代码示例来源:origin: openmicroscopy/bioformats
if (roi.getStrokeWidth() > 0) {
store.setLineStrokeWidth(new Length((roi.getStrokeWidth()),
UNITS.PIXEL), roiNum, shape);
代码示例来源:origin: net.imagej/ij
public void drawPixels(ImageProcessor ip) {
ip.setLineWidth(1);
double x = getXBase();
double y = getYBase();
x1d=x+x1R; y1d=y+y1R; x2d=x+x2R; y2d=y+y2R;
double offset = getOffset(0.5);
if (getStrokeWidth()<=1) {
ip.moveTo((int)(x1d+offset), (int)(y1d+offset));
ip.lineTo((int)(x2d+offset), (int)(y2d+offset));
} else {
Polygon p = null;
if (offset>0.0) {
FloatPolygon fp = getFloatPolygon();
for (int i=0; i<fp.npoints; i++) {
fp.xpoints[i] += offset;
fp.ypoints[i] += offset;
}
p = new Polygon(toIntR(fp.xpoints), toIntR(fp.ypoints), fp.npoints);
} else
p = getPolygon();
ip.drawPolygon(p);
updateFullWindow = true;
}
}
代码示例来源:origin: imagej/ImageJA
public void drawPixels(ImageProcessor ip) {
ip.setLineWidth(1);
double x = getXBase();
double y = getYBase();
x1d=x+x1R; y1d=y+y1R; x2d=x+x2R; y2d=y+y2R;
double offset = getOffset(0.5);
if (getStrokeWidth()<=1) {
ip.moveTo((int)(x1d+offset), (int)(y1d+offset));
ip.lineTo((int)(x2d+offset), (int)(y2d+offset));
} else {
Polygon p = null;
if (offset>0.0) {
FloatPolygon fp = getFloatPolygon();
for (int i=0; i<fp.npoints; i++) {
fp.xpoints[i] += offset;
fp.ypoints[i] += offset;
}
p = new Polygon(toIntR(fp.xpoints), toIntR(fp.ypoints), fp.npoints);
} else
p = getPolygon();
ip.drawPolygon(p);
updateFullWindow = true;
}
}
内容来源于网络,如有侵权,请联系作者删除!