本文整理了Java中java.awt.Polygon.reset()
方法的一些代码示例,展示了Polygon.reset()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Polygon.reset()
方法的具体详情如下:
包路径:java.awt.Polygon
类名称:Polygon
方法名:reset
[英]Resets this Polygon
object to an empty polygon. The coordinate arrays and the data in them are left untouched but the number of points is reset to zero to mark the old vertex data as invalid and to start accumulating new vertex data at the beginning. All internally-cached data relating to the old vertices are discarded. Note that since the coordinate arrays from before the reset are reused, creating a new empty Polygon
might be more memory efficient than resetting the current one if the number of vertices in the new polygon data is significantly smaller than the number of vertices in the data from before the reset.
[中]将此Polygon
对象重置为空多边形。坐标阵列和其中的数据保持不变,但点数重置为零,以将旧顶点数据标记为无效,并从一开始就开始累积新顶点数据。所有与旧顶点相关的内部缓存数据都将被丢弃。请注意,由于重新使用重置之前的坐标数组,如果新多边形数据中的顶点数明显小于重置之前的数据中的顶点数,则创建新的空Polygon
可能比重置当前的更节省内存。
代码示例来源:origin: geotools/geotools
awtPolygon.reset();
awtPolygon.addPoint(x, y);
代码示例来源:origin: com.harium/etyl
protected void initPolygon(int x, int y){
polygon.reset();
polygon.addPoint(x, y);
polygon.addPoint((int)(x+size), (int)y);
polygon.addPoint((int)(x+size/2), (int)(y+size));
}
代码示例来源:origin: com.harium/etyl
protected void initPolygon(int x, int y) {
polygon.reset();
polygon.addPoint((int)(x+size/2), (int)y);
polygon.addPoint((int)x, (int)(y+size));
polygon.addPoint((int)(x+size), (int)(y+size));
}
代码示例来源:origin: AliView/AliView
@Override
public void mouseDragged(MouseEvent e) {
JList list = (JList) e.getComponent();
if (list.getDragEnabled()) {
return;
}
if (srcPoint == null) {
srcPoint = e.getPoint();
}
Point destPoint = e.getPoint();
polygon.reset();
polygon.addPoint(srcPoint.x, srcPoint.y);
polygon.addPoint(destPoint.x, srcPoint.y);
polygon.addPoint(destPoint.x, destPoint.y);
polygon.addPoint(srcPoint.x, destPoint.y);
//list.setSelectedIndices(list.getIntersectsIcons(polygon));
list.repaint();
}
@Override
代码示例来源:origin: de.sciss/prefuse-core
/**
* Update the dimensions of the arrow head, creating a new
* arrow head if necessary. The return value is also set
* as the member variable <code>m_arrowHead</code>
* @param w the width of the untransformed arrow head base, in pixels
* @param h the height of the untransformed arrow head, in pixels
* @return the untransformed arrow head shape
*/
protected Polygon updateArrowHead(int w, int h) {
if ( m_arrowHead == null ) {
m_arrowHead = new Polygon();
} else {
m_arrowHead.reset();
}
m_arrowHead.addPoint(0, 0);
m_arrowHead.addPoint(-w/2, -h);
m_arrowHead.addPoint( w/2, -h);
m_arrowHead.addPoint(0, 0);
return m_arrowHead;
}
代码示例来源:origin: edu.stanford.protege/org.coode.owlviz
protected void setupArrows() {
if (controller.getGraphLayoutEngine().getLayoutDirection() == GraphLayoutEngine.LAYOUT_LEFT_TO_RIGHT) {
leftArrow.reset();
leftArrow.addPoint(ARROW_SIZE, -ARROW_SIZE);
leftArrow.addPoint(0, 0);
leftArrow.addPoint(ARROW_SIZE, ARROW_SIZE);
rightArrow.reset();
rightArrow.addPoint(-ARROW_SIZE, -ARROW_SIZE);
rightArrow.addPoint(0, 0);
rightArrow.addPoint(-ARROW_SIZE, ARROW_SIZE);
} else {
leftArrow.reset();
// Up Arrow
leftArrow.addPoint(-ARROW_SIZE, ARROW_SIZE);
leftArrow.addPoint(0, 0);
leftArrow.addPoint(ARROW_SIZE, ARROW_SIZE);
rightArrow.reset();
// Down arrow
rightArrow.addPoint(-ARROW_SIZE, -ARROW_SIZE);
rightArrow.addPoint(0, 0);
rightArrow.addPoint(ARROW_SIZE, -ARROW_SIZE);
}
}
代码示例来源:origin: gurkenlabs/litiengine
shadowPolygon.reset();
shadowPolygon.addPoint((int) pointA.getX(), (int) pointA.getY());
shadowPolygon.addPoint((int) pointB.getX(), (int) pointB.getY());
代码示例来源:origin: edu.stanford.protege/org.coode.owlviz
leftArrow.reset();
leftArrow.addPoint(ARROW_SIZE, ARROW_SIZE);
rightArrow.reset();
leftArrow.reset();
leftArrow.addPoint(ARROW_SIZE, ARROW_SIZE);
rightArrow.reset();
代码示例来源:origin: edu.stanford.protege/org.coode.owlviz
/**
* Sets the <code>Node's</code> size.
* @param width The width of the <code>Node</code>.
* @param height The height of the <code>Node</code>.
*/
public void setSize(int width, int height)
{
int x = getPosition().x;
int y = getPosition().y;
triangle.reset();
triangle.addPoint(x - width / 2, y + height / 4);
triangle.addPoint(x + width / 2, y + height / 4);
triangle.addPoint(x, y - height / 2);
}
代码示例来源:origin: edu.stanford.protege/org.coode.owlviz
/**
* Sets the (x,y) position of the <code>Node</code>.
* @param x The horizontal location.
* @param y The vertical location.
*/
public void setPosition(int x, int y)
{
int w = getSize().width;
int h = getSize().height;
pos.x = x;
pos.y = y;
triangle.reset();
triangle.addPoint(x - w / 2, y + h / 4);
triangle.addPoint(x + w / 2, y + h / 4);
triangle.addPoint(x, y - h / 2);
}
代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui
private void calculatePositions() {
// Avoid instantiating a new polygon each time.
this.polygon.reset();
Point position = getPosition();
this.polygon.addPoint(position.x, position.y);
this.polygon.addPoint(position.x, position.y + this.dimension.height + this.headHeight / 2);
this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height + this.headHeight
/ 2);
this.polygon.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
DrawUtils.setupRoundedGeneralPath(polygon, generalPath);
}
}
代码示例来源:origin: stackoverflow.com
resizeCorner.reset();
resizeCorner.addPoint(getWidth() - 2, getHeight() - 2);
resizeCorner.addPoint(getWidth() - 40, getHeight() - 2);
代码示例来源:origin: jaltekruse/OpenNotebook
g.fillPolygon(p);
p.reset();
p.addPoint(gridxToScreen(graph.X_MAX) + distBeyondAxis + OVERHANG, yGridOrigin);
p.addPoint(gridxToScreen(graph.X_MAX) - heightAboveAxis + OVERHANG, yGridOrigin + heightAboveAxis);
代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui
private void calculatePositions() {
this.polygon.reset();
Point position = getPosition();
this.polygon.addPoint(position.x, position.y);
this.polygon.addPoint(position.x, position.y + this.dimension.height + this.headHeight / 2);
this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height);
this.polygon.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
}
}
代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui
private void calculatePositions() {
this.polygon.reset();
Point position = getPosition();
this.polygon.addPoint(position.x, position.y);
this.polygon.addPoint(position.x, position.y + this.dimension.height + this.headHeight / 2);
this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height);
this.polygon.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
}
}
代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui
private void calculatePositions() {
this.polygon.reset();
Point position = getPosition();
this.polygon.addPoint(position.x, position.y);
this.polygon.addPoint(position.x, position.y + this.dimension.height
+ this.headHeight / 2);
this.polygon.addPoint(position.x + this.dimension.width, position.y
+ this.dimension.height);
this.polygon.addPoint(position.x + this.dimension.width, position.y
+ this.headHeight / 2);
DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
}
代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui
private void calculatePositions() {
// Avoid instantiating a new polygon each time.
this.polygon.reset();
Point position = getPosition();
this.polygon.addPoint(position.x, position.y);
this.polygon.addPoint(position.x, position.y + this.dimension.height);
this.polygon.addPoint(position.x + this.dimension.width / 2, position.y + this.dimension.height
+ this.headHeight);
this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height);
this.polygon.addPoint(position.x + this.dimension.width, position.y);
DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
}
}
代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui
private void calculatePositions() {
// Avoid instantiating a new polygon each time.
this.polygon.reset();
Point position = getPosition();
this.polygon.addPoint(position.x, position.y + this.headHeight / 2);
this.polygon.addPoint(position.x, position.y + this.dimension.height);
this.polygon.addPoint(position.x + this.dimension.width / 2, position.y + this.dimension.height
+ this.headHeight / 2);
this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height);
this.polygon.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
this.polygon.addPoint(position.x + this.dimension.width / 2, position.y);
DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
}
代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui
private void calculatePositions() {
// Avoid instantiating a new polygon each time.
this.polygon.reset();
Point position = getPosition();
this.polygon.addPoint(position.x, position.y + this.headHeight / 2);
this.polygon.addPoint(position.x, position.y + this.dimension.height);
this.polygon.addPoint(position.x + this.dimension.width / 2, position.y + this.dimension.height
+ this.headHeight / 2);
this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height);
this.polygon.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
this.polygon.addPoint(position.x + this.dimension.width / 2, position.y);
DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
}
}
代码示例来源:origin: RPTools/maptool
line.reset();
line.addPoint(x, y + h);
line.addPoint(x + w, y);
内容来源于网络,如有侵权,请联系作者删除!