当前位置: 首页>>代码示例>>Java>>正文


Java HandleGesture类代码示例

本文整理汇总了Java中com.cburch.draw.model.HandleGesture的典型用法代码示例。如果您正苦于以下问题:Java HandleGesture类的具体用法?Java HandleGesture怎么用?Java HandleGesture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HandleGesture类属于com.cburch.draw.model包,在下文中一共展示了HandleGesture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: paint

import com.cburch.draw.model.HandleGesture; //导入依赖的package包/类
@Override
public void paint(Graphics g, HandleGesture gesture) {
	if (setForStroke(g)) {
		int x0 = this.x0;
		int y0 = this.y0;
		int x1 = this.x1;
		int y1 = this.y1;
		Handle h = gesture.getHandle();
		if (h.isAt(x0, y0)) {
			x0 += gesture.getDeltaX();
			y0 += gesture.getDeltaY();
		}
		if (h.isAt(x1, y1)) {
			x1 += gesture.getDeltaX();
			y1 += gesture.getDeltaY();
		}
		g.drawLine(x0, y0, x1, y1);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:20,代码来源:Line.java

示例2: moveHandle

import com.cburch.draw.model.HandleGesture; //导入依赖的package包/类
@SuppressWarnings("unlikely-arg-type")
@Override
public Handle moveHandle(HandleGesture gesture) {
	Handle[] hs = getHandleArray(gesture);
	Handle ret = null;
	if (!hs[0].equals(p0)) {
		p0 = hs[0].getLocation();
		ret = hs[0];
	}
	if (!hs[1].equals(p1)) {
		p1 = hs[1].getLocation();
		ret = hs[1];
	}
	if (!hs[2].equals(p2)) {
		p2 = hs[2].getLocation();
		ret = hs[2];
	}
	bounds = CurveUtil.getBounds(toArray(p0), toArray(p1), toArray(p2));
	return ret;
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:21,代码来源:Curve.java

示例3: paint

import com.cburch.draw.model.HandleGesture; //导入依赖的package包/类
@Override
public void paint(Graphics g, HandleGesture gesture) {
	List<Handle> hs = getHandles(gesture);
	int[] xs = new int[hs.size()];
	int[] ys = new int[hs.size()];
	int i = -1;
	for (Handle h : hs) {
		i++;
		xs[i] = h.getX();
		ys[i] = h.getY();
	}

	if (setForFill(g)) {
		g.fillPolygon(xs, ys, xs.length);
	}
	if (setForStroke(g)) {
		if (closed)
			g.drawPolygon(xs, ys, xs.length);
		else
			g.drawPolyline(xs, ys, xs.length);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:23,代码来源:Poly.java

示例4: modelChanged

import com.cburch.draw.model.HandleGesture; //导入依赖的package包/类
void modelChanged(CanvasModelEvent event) {
	int action = event.getAction();
	switch (action) {
	case CanvasModelEvent.ACTION_REMOVED:
		Collection<? extends CanvasObject> affected = event.getAffected();
		if (affected != null) {
			selected.removeAll(affected);
			suppressed.keySet().removeAll(affected);
			Handle h = selectedHandle;
			if (h != null && affected.contains(h.getObject())) {
				setHandleSelected(null);
			}
		}
		break;
	case CanvasModelEvent.ACTION_HANDLE_DELETED:
		if (event.getHandle().equals(selectedHandle)) {
			setHandleSelected(null);
		}
		break;
	case CanvasModelEvent.ACTION_HANDLE_MOVED:
		HandleGesture gesture = event.getHandleGesture();
		if (gesture.getHandle().equals(selectedHandle)) {
			setHandleSelected(gesture.getResultingHandle());
		}
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:27,代码来源:Selection.java

示例5: getHandles

import com.cburch.draw.model.HandleGesture; //导入依赖的package包/类
@Override
public List<Handle> getHandles(HandleGesture gesture) {
	if (gesture == null) {
		return UnmodifiableList.create(new Handle[] {
				new Handle(this, x0, y0), new Handle(this, x1, y1) });
	} else {
		Handle h = gesture.getHandle();
		int dx = gesture.getDeltaX();
		int dy = gesture.getDeltaY();
		Handle[] ret = new Handle[2];
		ret[0] = new Handle(this, h.isAt(x0, y0) ? Location.create(x0 + dx,
				y0 + dy) : Location.create(x0, y0));
		ret[1] = new Handle(this, h.isAt(x1, y1) ? Location.create(x1 + dx,
				y1 + dy) : Location.create(x1, y1));
		return UnmodifiableList.create(ret);
	}
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:18,代码来源:Line.java

示例6: moveHandle

import com.cburch.draw.model.HandleGesture; //导入依赖的package包/类
@Override
public Handle moveHandle(HandleGesture gesture) {
	Handle[] hs = getHandleArray(gesture);
	Handle ret = null;
	if (!hs[0].equals(p0)) {
		p0 = hs[0].getLocation();
		ret = hs[0];
	}
	if (!hs[1].equals(p1)) {
		p1 = hs[1].getLocation();
		ret = hs[1];
	}
	if (!hs[2].equals(p2)) {
		p2 = hs[2].getLocation();
		ret = hs[2];
	}
	bounds = CurveUtil.getBounds(toArray(p0), toArray(p1), toArray(p2));
	return ret;
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:20,代码来源:Curve.java

示例7: moveHandle

import com.cburch.draw.model.HandleGesture; //导入依赖的package包/类
@Override
public Handle moveHandle(HandleGesture gesture) {
	Handle[] oldHandles = getHandleArray(null);
	Handle[] newHandles = getHandleArray(gesture);
	Handle moved = gesture == null ? null : gesture.getHandle();
	Handle result = null;
	int x0 = Integer.MAX_VALUE;
	int x1 = Integer.MIN_VALUE;
	int y0 = Integer.MAX_VALUE;
	int y1 = Integer.MIN_VALUE;
	int i = -1;
	for (Handle h : newHandles) {
		i++;
		if (oldHandles[i].equals(moved)) {
			result = h;
		}
		int hx = h.getX();
		int hy = h.getY();
		if (hx < x0) x0 = hx;
		if (hx > x1) x1 = hx;
		if (hy < y0) y0 = hy;
		if (hy > y1) y1 = hy;
	}
	bounds = Bounds.create(x0, y0, x1 - x0, y1 - y0);
	return result;
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:27,代码来源:Rectangular.java

示例8: getHandles

import com.cburch.draw.model.HandleGesture; //导入依赖的package包/类
@Override
public List<Handle> getHandles(HandleGesture gesture) {
	if (gesture == null) {
		return UnmodifiableList.create(new Handle[] {
				new Handle(this, x0, y0), new Handle(this, x1, y1) });
	} else {
		Handle h = gesture.getHandle();
		int dx = gesture.getDeltaX();
		int dy = gesture.getDeltaY();
		Handle[] ret = new Handle[2];
		ret[0] = new Handle(this, h.isAt(x0, y0)
				? Location.create(x0 + dx, y0 + dy) : Location.create(x0, y0));
		ret[1] = new Handle(this, h.isAt(x1, y1)
				? Location.create(x1 + dx, y1 + dy) : Location.create(x1, y1));
		return UnmodifiableList.create(ret);
	}
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:18,代码来源:Line.java

示例9: paint

import com.cburch.draw.model.HandleGesture; //导入依赖的package包/类
@Override
public void paint(Graphics g, HandleGesture gesture) {
	List<Handle> hs = getHandles(gesture);
	int[] xs = new int[hs.size()];
	int[] ys = new int[hs.size()];
	int i = -1;
	for (Handle h : hs) {
		i++;
		xs[i] = h.getX();
		ys[i] = h.getY();
	}

	if (setForFill(g)) {
		g.fillPolygon(xs, ys, xs.length);
	}
	if (setForStroke(g)) {
		if (closed) g.drawPolygon(xs, ys, xs.length);
		else g.drawPolyline(xs, ys, xs.length);
	}
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:21,代码来源:Poly.java

示例10: moveHandle

import com.cburch.draw.model.HandleGesture; //导入依赖的package包/类
@Override
public Handle moveHandle(HandleGesture gesture) {
	Handle[] oldHandles = getHandleArray(null);
	Handle[] newHandles = getHandleArray(gesture);
	Handle moved = gesture == null ? null : gesture.getHandle();
	Handle result = null;
	int x0 = Integer.MAX_VALUE;
	int x1 = Integer.MIN_VALUE;
	int y0 = Integer.MAX_VALUE;
	int y1 = Integer.MIN_VALUE;
	int i = -1;
	for (Handle h : newHandles) {
		i++;
		if (oldHandles[i].equals(moved)) {
			result = h;
		}
		int hx = h.getX();
		int hy = h.getY();
		if (hx < x0)
			x0 = hx;
		if (hx > x1)
			x1 = hx;
		if (hy < y0)
			y0 = hy;
		if (hy > y1)
			y1 = hy;
	}
	bounds = Bounds.create(x0, y0, x1 - x0, y1 - y0);
	return result;
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:31,代码来源:Rectangular.java

示例11: getHandles

import com.cburch.draw.model.HandleGesture; //导入依赖的package包/类
@Override
public List<Handle> getHandles(HandleGesture gesture) {
	if (gesture == null) {
		return UnmodifiableList.create(new Handle[] { new Handle(this, x0, y0), new Handle(this, x1, y1) });
	} else {
		Handle h = gesture.getHandle();
		int dx = gesture.getDeltaX();
		int dy = gesture.getDeltaY();
		Handle[] ret = new Handle[2];
		ret[0] = new Handle(this, h.isAt(x0, y0) ? Location.create(x0 + dx, y0 + dy) : Location.create(x0, y0));
		ret[1] = new Handle(this, h.isAt(x1, y1) ? Location.create(x1 + dx, y1 + dy) : Location.create(x1, y1));
		return UnmodifiableList.create(ret);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:15,代码来源:Line.java

示例12: paint

import com.cburch.draw.model.HandleGesture; //导入依赖的package包/类
@Override
public void paint(Graphics g, HandleGesture gesture) {
	QuadCurve2D curve = getCurve(gesture);
	if (setForFill(g)) {
		((Graphics2D) g).fill(curve);
	}
	if (setForStroke(g)) {
		((Graphics2D) g).draw(curve);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:11,代码来源:Curve.java

示例13: moveHandle

import com.cburch.draw.model.HandleGesture; //导入依赖的package包/类
@Override
public Handle moveHandle(HandleGesture gesture) {
	List<Handle> hs = getHandles(gesture);
	Handle[] is = new Handle[hs.size()];
	Handle ret = null;
	int i = -1;
	for (Handle h : hs) {
		i++;
		is[i] = h;
	}
	setHandles(is);
	return ret;
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:14,代码来源:Poly.java

示例14: undoSub

import com.cburch.draw.model.HandleGesture; //导入依赖的package包/类
@Override
void undoSub(CanvasModel model) {
	Handle oldHandle = gesture.getHandle();
	int dx = oldHandle.getX() - newHandle.getX();
	int dy = oldHandle.getY() - newHandle.getY();
	HandleGesture reverse = new HandleGesture(newHandle, dx, dy, 0);
	model.moveHandle(reverse);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:9,代码来源:ModelMoveHandleAction.java

示例15: setHandleGesture

import com.cburch.draw.model.HandleGesture; //导入依赖的package包/类
public void setHandleGesture(HandleGesture gesture) {
	HandleGesture g = curHandleGesture;
	if (g != null)
		suppressed.remove(g.getHandle().getObject());

	Handle h = gesture.getHandle();
	suppressed.put(h.getObject(), MOVING_HANDLE);
	curHandleGesture = gesture;
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:10,代码来源:Selection.java


注:本文中的com.cburch.draw.model.HandleGesture类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。