本文整理汇总了Java中com.leapmotion.leap.CircleGesture.state方法的典型用法代码示例。如果您正苦于以下问题:Java CircleGesture.state方法的具体用法?Java CircleGesture.state怎么用?Java CircleGesture.state使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.leapmotion.leap.CircleGesture
的用法示例。
在下文中一共展示了CircleGesture.state方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: circleGestureListener
import com.leapmotion.leap.CircleGesture; //导入方法依赖的package包/类
@Override
public void circleGestureListener(CircleGesture circle) {
if(mouseOn){
String clockwiseness;
if (circle.state() == Gesture.State.STATE_STOP && circle.radius() < 10){
if (circle.pointable().direction().angleTo(circle.normal()) <= Math.PI/4) {
// Clockwise if angle is less than 90 degrees
clockwiseness = "clockwise";
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
Debug.getInstance().mouse("raduis:" + circle.radius());
} else {
clockwiseness = "counterclockwise";
robot.mousePress(InputEvent.BUTTON3_MASK);
robot.mouseRelease(InputEvent.BUTTON3_MASK);
}
Debug.getInstance().mouse("end of swipe "+ clockwiseness);
}
}
}
示例2: circleGestureRecognized
import com.leapmotion.leap.CircleGesture; //导入方法依赖的package包/类
@Override
public void circleGestureRecognized(CircleGesture detectedGesture) {
if (detectedGesture.state() == Gesture.State.STATE_STOP) {
//This may have been already consumed, we are not sure.
if (!consumedCircleGestureBuffer.contains(detectedGesture.id()))
circleGestureBuffer.put(detectedGesture.id(), detectedGesture);
logger.debug("//////////////////////////////////////");
logger.debug("Gesture type: " + detectedGesture.type().toString());
logger.debug("ID: " + detectedGesture.id());
logger.debug("Radius: " + detectedGesture.radius());
logger.debug("Normal: " + detectedGesture.normal());
logger.debug("Clockwise: " + JitterSystem.isClockwise(detectedGesture));
logger.debug("Turns: " + detectedGesture.progress());
logger.debug("Center: " + detectedGesture.center());
logger.debug("Duration: " + detectedGesture.durationSeconds() + "s");
logger.debug("//////////////////////////////////////");
} else if (detectedGesture.state() == Gesture.State.STATE_START) {
circleGestureBuffer.put(detectedGesture.id(), detectedGesture);
} else if (detectedGesture.state() == Gesture.State.STATE_UPDATE) {
if (!consumedCircleGestureBuffer.contains(detectedGesture.id()))
circleGestureBuffer.put(detectedGesture.id(), detectedGesture);
}
}
示例3: removeStoppedCircles
import com.leapmotion.leap.CircleGesture; //导入方法依赖的package包/类
private void removeStoppedCircles(CircleGesture circleGesture) {
if (circleGesture.state() == Gesture.State.STATE_STOP) {
circleGestureBuffer.remove(circleGesture.id());
if (consumptionEnabled) {
consumedCircleGestureBuffer.remove(circleGesture.id());
logger.debug("Just removed gesture with id " + circleGesture.id() + " from the 'consumed' list");
}
}
}
示例4: printGestureDetails
import com.leapmotion.leap.CircleGesture; //导入方法依赖的package包/类
private void printGestureDetails(Gesture gesture, Controller controller) {
switch (gesture.type()) {
case TYPE_CIRCLE:
CircleGesture circle = new CircleGesture(gesture);
// Calculate clock direction using the angle between circle normal and pointable
String clockwise;
if (circle.pointable().direction().angleTo(circle.normal()) <= Math.PI / 4) {
// Clockwise if angle is less than 90 degrees
clockwise = "clockwise";
} else {
clockwise = "counterclockwise";
}
// Calculate angle swept since last frame
double sweptAngle = 0;
if (circle.state() != State.STATE_START) {
CircleGesture previousUpdate =
new CircleGesture(controller.frame(1).gesture(circle.id()));
sweptAngle = (circle.progress() - previousUpdate.progress()) * 2 * Math.PI;
}
logger.debug("Circle id: " + circle.id() + ", " + circle.state() + ", progress: "
+ circle.progress() + ", radius: " + circle.radius() + ", angle: "
+ Math.toDegrees(sweptAngle) + ", " + clockwise);
break;
case TYPE_SWIPE:
SwipeGesture swipe = new SwipeGesture(gesture);
logger.debug("Swipe id: " + swipe.id() + ", " + swipe.state() + ", position: "
+ swipe.position() + ", direction: " + swipe.direction() + ", speed: " + swipe.speed());
break;
case TYPE_SCREEN_TAP:
ScreenTapGesture screenTap = new ScreenTapGesture(gesture);
logger.debug("Screen Tap id: " + screenTap.id() + ", " + screenTap.state()
+ ", position: " + screenTap.position() + ", direction: " + screenTap.direction());
break;
case TYPE_KEY_TAP:
KeyTapGesture keyTap = new KeyTapGesture(gesture);
logger.debug("Key Tap id: " + keyTap.id() + ", " + keyTap.state() + ", position: "
+ keyTap.position() + ", direction: " + keyTap.direction());
break;
default:
logger.debug("Unknown gesture type.");
break;
}
}