use of com.ramussoft.reportgef.model.Bounds in project ramus by Vitaliy-Yakovchuk.
the class GEFComponent method mouseMoved.
public void mouseMoved(Point point) {
synchronized (mouseLock) {
if (mousePressedPosition != null)
mouseDragPosition = point;
Bounds bounds = getSelected(point);
int cursorType;
if (bounds == null)
cursorType = Cursor.DEFAULT_CURSOR;
else {
cursorType = Cursor.MOVE_CURSOR;
}
if (selection.getBounds().length == 1) {
boolean resizableX = selection.isResizeableX(diagram);
boolean resizableY = selection.isResizeableY(diagram);
if ((resizableX) && (isRightMove(point)))
cursorType = Cursor.E_RESIZE_CURSOR;
else if ((resizableX) && (isLeftMove(point)))
cursorType = Cursor.W_RESIZE_CURSOR;
else if ((resizableY) && (isTopMove(point)))
cursorType = Cursor.N_RESIZE_CURSOR;
else if ((resizableY) && (isBottomMove(point)))
cursorType = Cursor.S_RESIZE_CURSOR;
else if ((resizableY) && (resizableX) && (isRightBottomMove(point)))
cursorType = Cursor.SE_RESIZE_CURSOR;
else if ((resizableY) && (resizableX) && (isLeftBottomMove(point)))
cursorType = Cursor.SW_RESIZE_CURSOR;
else if ((resizableY) && (resizableX) && (isTopRightMove(point)))
cursorType = Cursor.NE_RESIZE_CURSOR;
else if ((resizableY) && (resizableX) && (isTopLeftMove(point)))
cursorType = Cursor.NW_RESIZE_CURSOR;
}
if (this.cursorType != cursorType) {
this.cursorType = cursorType;
this.setCursor(new Cursor(cursorType));
}
}
repaint();
}
use of com.ramussoft.reportgef.model.Bounds in project ramus by Vitaliy-Yakovchuk.
the class Group method getRectangle.
public Rectangle2D getRectangle() {
double minX = bounds[0].getLeft();
double minY = bounds[0].getTop();
double maxX = bounds[0].getRight();
double maxY = bounds[0].getBottom();
for (int i = 1; i < bounds.length; i++) {
Bounds bounds = this.bounds[i];
if (bounds.getLeft() < minX)
minX = bounds.getLeft();
if (bounds.getTop() < minY)
minY = bounds.getTop();
if (bounds.getRight() > maxX)
maxX = bounds.getRight();
if (bounds.getBottom() > maxY)
maxY = bounds.getBottom();
}
return new Rectangle2D.Double(minX, minY, maxX - minX, maxY - minY);
}
use of com.ramussoft.reportgef.model.Bounds in project ramus by Vitaliy-Yakovchuk.
the class Group method getCenter.
public Point2D getCenter() {
if (center == null) {
if (bounds.length == 0)
center = new Point2D.Double();
else {
double minX = bounds[0].getLeft();
double minY = bounds[0].getTop();
double maxX = bounds[0].getRight();
double maxY = bounds[0].getBottom();
for (int i = 1; i < bounds.length; i++) {
Bounds bounds = this.bounds[i];
if (bounds.getLeft() < minX)
minX = bounds.getLeft();
if (bounds.getTop() < minY)
minY = bounds.getTop();
if (bounds.getRight() > maxX)
maxX = bounds.getRight();
if (bounds.getBottom() > maxY)
maxY = bounds.getBottom();
}
center = new Point2D.Double((minX + maxX) / 2d, (minY + maxY) / 2);
}
}
return center;
}
Aggregations