本文整理汇总了Java中javafx.geometry.Point2D.getY方法的典型用法代码示例。如果您正苦于以下问题:Java Point2D.getY方法的具体用法?Java Point2D.getY怎么用?Java Point2D.getY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.geometry.Point2D
的用法示例。
在下文中一共展示了Point2D.getY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: touchRotate
import javafx.geometry.Point2D; //导入方法依赖的package包/类
private void touchRotate( final double X, final double Y ) {
Point2D p = sceneToLocal(X, Y);
double deltaX = p.getX() - ( pane.getLayoutX() + size * 0.5 );
double deltaY = p.getY() - ( pane.getLayoutY() + size * 0.5 );
double radius = Math.sqrt(( deltaX * deltaX ) + ( deltaY * deltaY ));
double nx = deltaX / radius;
double ny = deltaY / radius;
double theta = Math.atan2(ny, nx);
theta = Double.compare(theta, 0.0) >= 0 ? Math.toDegrees(theta) : Math.toDegrees(( theta )) + 360.0;
double angle = ( theta + 230 ) % 360;
if ( angle > 320 && angle < 360 ) {
angle = 0;
} else if ( angle <= 320 && angle > ANGLE_RANGE ) {
angle = ANGLE_RANGE;
}
setTargetValue(angle / getAngleStep() + getMinValue());
}
示例2: getControlPoint
import javafx.geometry.Point2D; //导入方法依赖的package包/类
private Point2D getControlPoint(Point2D prevPoint, Point2D point, Point2D nextPoint, boolean reverse){
if(point == null)
point = prevPoint;
if(prevPoint == null)
prevPoint = point;
if(nextPoint == null)
nextPoint = point;
double[] opposedLine = line(prevPoint, nextPoint);
double length = opposedLine[0] * smoothing;
double angle = reverse? opposedLine[1]+ PI: opposedLine[1];
double x = point.getX() + sin(angle)*length;
double y = point.getY() + cos(angle)*length;
return new Point2D(x,y);
}
示例3: buttondown
import javafx.geometry.Point2D; //导入方法依赖的package包/类
public void buttondown(JSONObject query, JSONObject uriParams, Session session) {
int button = 0;
if (query != null && query.has("button")) {
button = query.getInt("button");
}
IJavaFXElement element = null;
double xoffset;
double yoffset;
if (lastComponenet.element != null) {
element = lastComponenet.element;
xoffset = lastComponenet.x;
yoffset = lastComponenet.y;
} else {
element = session.getActiveElement();
Point2D p = element.getMidpoint();
xoffset = p.getX();
yoffset = p.getY();
}
element.buttonDown(button, xoffset, yoffset);
}
示例4: click
import javafx.geometry.Point2D; //导入方法依赖的package包/类
private void click(Session session, int button, int clickCount) {
IJavaFXElement element = null;
double xoffset;
double yoffset;
if (lastComponenet.element != null) {
element = lastComponenet.element;
xoffset = lastComponenet.x;
yoffset = lastComponenet.y;
} else {
element = session.getActiveElement();
Point2D p = element.getMidpoint();
xoffset = p.getX();
yoffset = p.getY();
}
element.click(button, null, null, clickCount, xoffset, yoffset);
}
示例5: targetSetOnDragDropped
import javafx.geometry.Point2D; //导入方法依赖的package包/类
private void targetSetOnDragDropped(ScreenMap target, DragEvent e) {
Dragboard db = e.getDragboard();
boolean success = false;
if (e.getDragboard().hasImage()) {
String imageName = db.getString();
Point2D point = target.sceneToLocal(e.getSceneX(), e.getSceneY());
GamePoint gameCoords = new GamePoint(point.getX()/target.getScreenWidth(), point.getY()/target.getScreenHeight());
for (Pair<String, Image> p : myScreenObjects.keySet()) {
String iName = p.getKey();
if (imageName.equals(iName)) {
XStreamHandler xstream = new XStreamHandler();
File tempSpriteFile = new File("data/tempSprites/tempSprite.xml");
xstream.saveToFile(myScreenObjects.get(p), tempSpriteFile);
SpriteMakerModel xmlSprite = (SpriteMakerModel) xstream.getAttributeFromFile(tempSpriteFile);
xmlSprite.addComponent(new Position(gameCoords, 0)); //heading 0 because all sprites default to this
myModel.addBackgroundTile(xmlSprite);
break;
}
}
success = true;
}
e.setDropCompleted(success);
e.consume();
}
示例6: latLongToPixel
import javafx.geometry.Point2D; //导入方法依赖的package包/类
public static Point2D latLongToPixel(final Dimension2D MAP_DIMENSION,
final Point2D UPPER_LEFT,
final Point2D LOWER_RIGHT,
final Point2D LOCATION) {
final double LATITUDE = LOCATION.getX();
final double LONGITUDE = LOCATION.getY();
final double MAP_WIDTH = MAP_DIMENSION.getWidth();
final double MAP_HEIGHT = MAP_DIMENSION.getHeight();
final double WORLD_MAP_WIDTH = ((MAP_WIDTH / (LOWER_RIGHT.getY() - UPPER_LEFT.getY())) * 360) / (2 * Math.PI);
final double MAP_OFFSET_Y = (WORLD_MAP_WIDTH / 2 * Math.log10((1 + Math.sin(Math.toRadians(LOWER_RIGHT.getX()))) / (1 - Math.sin(Math.toRadians(LOWER_RIGHT.getX())))));
final double X = (LONGITUDE - UPPER_LEFT.getY()) * (MAP_WIDTH / (LOWER_RIGHT.getY() - UPPER_LEFT.getY()));
final double Y = MAP_HEIGHT - ((WORLD_MAP_WIDTH / 2 * Math.log10((1 + Math.sin(Math.toRadians(LATITUDE))) / (1 - Math.sin(Math.toRadians(LATITUDE))))) - MAP_OFFSET_Y);
return new Point2D(X, Y);
}
示例7: addPointLocal
import javafx.geometry.Point2D; //导入方法依赖的package包/类
private void addPointLocal(Point2D point){
if(point.getX() == Double.NaN)
throw new RuntimeException("X value must be a number.");
if(point.getY() == Double.NaN)
throw new RuntimeException("Y value must be a number.");
points.add(point);
isNormalized = false;
}
示例8: line
import javafx.geometry.Point2D; //导入方法依赖的package包/类
private double[] line(Point2D prevPoint, Point2D point){
double lengthX = point.getX() - prevPoint.getX();
double lengthY = point.getY() - prevPoint.getY();
double length = sqrt(pow(lengthX,2) + pow(lengthY,2));
double angle = atan2(lengthX, lengthY);
return new double[]{length, angle};
}
示例9: getInsertData
import javafx.geometry.Point2D; //导入方法依赖的package包/类
private InsertData getInsertData(Point2D screenPoint) {
for(TabPane tabPane : tabPanes) {
Rectangle2D tabAbsolute = getAbsoluteRect(tabPane);
if(tabAbsolute.contains(screenPoint)) {
int tabInsertIndex = 0;
if(!tabPane.getTabs().isEmpty()) {
Rectangle2D firstTabRect = getAbsoluteRect(tabPane.getTabs().get(0));
if(firstTabRect.getMaxY()+60 < screenPoint.getY() || firstTabRect.getMinY() > screenPoint.getY()) {
return null;
}
Rectangle2D lastTabRect = getAbsoluteRect(tabPane.getTabs().get(tabPane.getTabs().size() - 1));
if(screenPoint.getX() < (firstTabRect.getMinX() + firstTabRect.getWidth() / 2)) {
tabInsertIndex = 0;
}
else if(screenPoint.getX() > (lastTabRect.getMaxX() - lastTabRect.getWidth() / 2)) {
tabInsertIndex = tabPane.getTabs().size();
}
else {
for(int i = 0; i < tabPane.getTabs().size() - 1; i++) {
Tab leftTab = tabPane.getTabs().get(i);
Tab rightTab = tabPane.getTabs().get(i + 1);
if(leftTab instanceof DraggableTab && rightTab instanceof DraggableTab) {
Rectangle2D leftTabRect = getAbsoluteRect(leftTab);
Rectangle2D rightTabRect = getAbsoluteRect(rightTab);
if(betweenX(leftTabRect, rightTabRect, screenPoint.getX())) {
tabInsertIndex = i + 1;
break;
}
}
}
}
}
return new InsertData(tabInsertIndex, tabPane);
}
}
return null;
}
示例10: moveto
import javafx.geometry.Point2D; //导入方法依赖的package包/类
public void moveto(JSONObject query, JSONObject uriParams, Session session) {
IJavaFXElement element = null;
if (query.has("element")) {
element = session.findElement(query.getString("element"));
}
boolean hasOffset = query.has("xoffset");
if (hasOffset != query.has("yoffset")) {
throw new MissingCommandParametersException("Missing x-offset or y-offset. Provide both x and y offsets.", null);
}
if (element == null && !hasOffset) {
throw new MissingCommandParametersException("One of the element or offset is expected.", null);
}
double xoffset;
double yoffset;
if (hasOffset) {
xoffset = query.getInt("xoffset");
yoffset = query.getInt("yoffset");
} else {
Point2D p = element.getMidpoint();
xoffset = p.getX();
yoffset = p.getY();
}
if (element == null) {
if (hasOffset && lastComponenet.element != null) {
element = lastComponenet.element;
xoffset += lastComponenet.x;
yoffset += lastComponenet.y;
} else {
element = session.getActiveElement();
}
}
element.moveto(xoffset, yoffset);
lastComponenet.x = xoffset;
lastComponenet.y = yoffset;
lastComponenet.element = element;
}
示例11: clickElement
import javafx.geometry.Point2D; //导入方法依赖的package包/类
public void clickElement(JSONObject query, JSONObject uriParams, Session session, IJavaFXElement element) {
if (lastComponenet.element != null && lastComponenet.element.equals(element)) {
element.click(0, null, null, 1, lastComponenet.x, lastComponenet.y);
} else {
Point2D p = element.getMidpoint();
element.click(0, null, null, 1, p.getX(), p.getY());
lastComponenet.element = element;
lastComponenet.x = p.getX();
lastComponenet.y = p.getY();
}
}
示例12: compare
import javafx.geometry.Point2D; //导入方法依赖的package包/类
private int compare(Point2D point1, Point2D point2) {
if(Math.round(point1.getX() - point2.getX())== 0){
return (int) (point1.getY() - point2.getY());
}else{
return (int)(point1.getX() - point2.getX());
}
}
示例13: isHullPoint
import javafx.geometry.Point2D; //导入方法依赖的package包/类
private boolean isHullPoint(Point2D point, Collection<Point2D> pointSet){
Point2D left = new Point2D(point.getX() - 1, point.getY());
Point2D top = new Point2D(point.getX(), point.getY() - 1);
Point2D right = new Point2D(point.getX() + 1, point.getY());
Point2D bottom = new Point2D(point.getX(), point.getY() + 1);
//check whether the point is an interior point
return !(pointSet.contains(left) && pointSet.contains(top) &&
pointSet.contains(right) && pointSet.contains(bottom));
}
示例14: panIfOutsideAxisBounds
import javafx.geometry.Point2D; //导入方法依赖的package包/类
private void panIfOutsideAxisBounds(MouseEvent event) {
Point2D rootOriginInScreen = panningComponent.getRoot().localToScreen(0, 0);
double mouseXRelativeToComponent = event.getScreenX() - rootOriginInScreen.getX();
double mouseYRelativeToComponent = event.getScreenY() - rootOriginInScreen.getY();
if (mouseXRelativeToComponent <= 0) {
if (!isRunning(timelineX)) {
startPanAnimation(-getAnimationSpeed(), timelineX, animatedPanX, panningComponent.panXProperty());
}
} else if (mouseXRelativeToComponent >= panningComponent.getRoot().getWidth()) {
if (!isRunning(timelineX)) {
startPanAnimation(getAnimationSpeed(), timelineX, animatedPanX, panningComponent.panXProperty());
}
} else {
timelineX.stop();
}
if (mouseYRelativeToComponent <= 0) {
if (!isRunning(timelineY)) {
startPanAnimation(-getAnimationSpeed(), timelineY, animatedPanY, panningComponent.panYProperty());
}
} else if (mouseYRelativeToComponent >= panningComponent.getRoot().getHeight()) {
if (!isRunning(timelineY)) {
startPanAnimation(getAnimationSpeed(), timelineY, animatedPanY, panningComponent.panYProperty());
}
} else {
timelineY.stop();
}
}
示例15: findNode
import javafx.geometry.Point2D; //导入方法依赖的package包/类
/**
* Finds a node in this package from a Point2D.
* @param point
* @return the node if found, otherwise null.
*/
public AbstractNode findNode(Point2D point) {
for (AbstractNode node : childNodes) {
if (point.getX() >= node.getX() && point.getX() <= node.getX()+ node.getWidth()
&& point.getY() >= node.getY() && point.getY() <= node.getY() + node.getHeight()) {
return node;
}
}
return null;
}