RED-6440 fixed point issue in manual redaction

This commit is contained in:
Timo Bejan 2023-03-22 14:16:20 +02:00
parent f476693409
commit 4c9ea27207

View File

@ -1,24 +1,68 @@
package com.iqser.red.service.persistence.service.v1.api.shared.model.annotations;
import com.iqser.red.service.persistence.service.v1.api.shared.model.redactionlog.Point;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Rectangle {
private float topLeftX;
private float topLeftY;
private Point topLeft = new Point();
private float width;
private float height;
private int page;
@Builder
public static Rectangle createRectangle(float topLeftX, float topLeftY, float width, float height, int page) {
return new Rectangle(topLeftX, topLeftY, width, height, page);
}
public Rectangle(float topLeftX, float topLeftY, float width, float height, int page) {
topLeft.setX(topLeftX);
topLeft.setY(topLeftY);
this.width = width;
this.height = height;
this.page = page;
}
public float getTopLeftX() {
return topLeft != null ? topLeft.getX() : 0f;
}
public float getTopLeftY() {
return topLeft != null ? topLeft.getY() : 0f;
}
public void setTopLeftX(float topLeftX) {
if (topLeft == null) {
topLeft = new Point();
}
topLeft.setX(topLeftX);
}
public void setTopLeftY(float topLeftY) {
if (topLeft == null) {
topLeft = new Point();
}
topLeft.setY(topLeftY);
}
}