Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private BoundingBox getBoundsDebug() {
- Bounds localBounds = this.getBoundsInLocal();
- double minX = localBounds.getMinX() + 200;
- double maxX = localBounds.getMaxX() - 200;
- double minY = localBounds.getMinY() + 200;
- double maxY = localBounds.getMaxY() - 200;
- //Flip the boundingbox' y-coords, as the rendering is flipped, but the model isn't.
- Point2D minPoint = getModelCoords(minX, maxY);
- Point2D maxPoint = getModelCoords(maxX, minY);
- gc.setStroke(Color.RED);
- gc.beginPath();
- gc.lineTo(minPoint.getX(), minPoint.getY());
- gc.lineTo(minPoint.getX(), maxPoint.getY());
- gc.lineTo(maxPoint.getX(), maxPoint.getY());
- gc.lineTo(maxPoint.getX(), minPoint.getY());
- gc.lineTo(minPoint.getX(), minPoint.getY());
- gc.stroke();
- return new BoundingBox(minPoint.getX(), minPoint.getY(),
- maxPoint.getX()-minPoint.getX(), maxPoint.getY()-minPoint.getY());
- }
- public double getCenterX(){
- Bounds localBounds = this.getBoundsInLocal();
- double minX = localBounds.getMinX() + 200;
- double maxX = localBounds.getMaxX() - 200;
- double minY = localBounds.getMinY() + 200;
- double maxY = localBounds.getMaxY() - 200;
- //Flip the boundingbox' y-coords, as the rendering is flipped, but the model isn't.
- Point2D minPoint = getModelCoords(minX, maxY);
- Point2D maxPoint = getModelCoords(maxX, minY);
- return (minPoint.getX() + (maxPoint.getX()-minPoint.getX())/2)/model.getLonfactor();
- }
- public double getCenterY(){
- Bounds localBounds = this.getBoundsInLocal();
- double minX = localBounds.getMinX() + 200;
- double maxX = localBounds.getMaxX() - 200;
- double minY = localBounds.getMinY() + 200;
- double maxY = localBounds.getMaxY() - 200;
- //Flip the boundingbox' y-coords, as the rendering is flipped, but the model isn't.
- Point2D minPoint = getModelCoords(minX, maxY);
- Point2D maxPoint = getModelCoords(maxX, minY);
- return (minPoint.getY() + (maxPoint.getY()-minPoint.getY())/2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement