Skip to content

Commit

Permalink
feat(connect): Adiciona lógica de conexão personalizada da bomba cent…
Browse files Browse the repository at this point in the history
…rífuga
  • Loading branch information
giovaneneves7 committed Oct 26, 2024
1 parent 85a1334 commit 720d90c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ public void connectEquipament(Label movedLabel, Label target){

} else if (target.getEquipamento().getAxios().equals(Constantes.HORIZONTAL) && movedLabel.getEquipamento().getAxios().equals(Constantes.VERTICAL)) {

System.out.println("Horizontal e vertical");
int diferencaX = movedLabel.getX() - target.getX();
int diferencaY = movedLabel.getY() - target.getY();
int xOrigem = 0;
Expand Down Expand Up @@ -429,14 +428,19 @@ public void connectEquipament(Label movedLabel, Label target){

} else{ // O alvo está na vertical e o equipamento a se conectar está na horizontal

if(!target.getEquipamento().isCanLeftConnect() && !target.getEquipamento().isCanRightConnect()) return;
if(!target.getEquipamento().isCanLeftConnect() && !target.getEquipamento().isCanRightConnect()){

WarningModal.createWarningModal(tr("this_connection_is_invalid"), tr("invalid_connection"));
return;

}

int diferencaX = movedLabel.getX() - target.getX();
int xOrigem = 0;
int yOrigem = 0;

if(diferencaX <= 0) { // movedLabel está à direita do alvo

System.out.println("direita");
if(!target.getEquipamento().isCanRightConnect()){

WarningModal.createWarningModal(tr("this_connection_is_invalid"), tr("invalid_connection"));
Expand Down Expand Up @@ -513,7 +517,12 @@ public void connectEquipament(Label movedLabel, Label target){
yOrigem = target.getY() - movedLabel.getHeight() + GapHelper.CONEXAO_3_Y_GAP;


} else{
} else if(target.getEquipamento().getType() == EquipamentType.BOMBA_CENTRIFUGA){

xOrigem = target.getX() + (target.getWidth() / 2) - (movedLabel.getWidth() / 2) + GapHelper.TUBULACAO_BOMBA_CENTRIFUGA_X_GAP;
yOrigem = target.getY() - movedLabel.getHeight() + GapHelper.TUBULACAO_BOMBA_CENTRIFUGA_Y_GAP;

}else{

xOrigem = target.getX() + (target.getWidth() / 2) - (movedLabel.getWidth() / 2);
yOrigem = target.getY() - movedLabel.getHeight();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/br/com/ifba/ipss/helper/GapHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class GapHelper {
// INFO: Valores em px.

public static final int BOMBA_CENTRIFUGA_TUBULACAO_X_GAP = 17;

public static final int CONEXAO_1_BOTTOM_X_GAP = 9;
public static final int CONEXAO_1_TOP_X_GAP = 9;

Expand Down Expand Up @@ -54,6 +55,8 @@ public class GapHelper {
public static final int TROCADOR_CALOR_TOP_X_GAP = 26;
public static final int TROCADOR_CALOR_Y_GAP = 18;

public static final int TUBULACAO_BOMBA_CENTRIFUGA_X_GAP = 57;
public static final int TUBULACAO_BOMBA_CENTRIFUGA_Y_GAP = 52;
public static final int TUBULACAO_CONEXAO_3_X_GAP = 16;

public static final int VALVULA_ESFERA_X_GAP = 16;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/files/ferramentas.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
"axios" : "vertical",
"can_bottom_connect": 0,
"can_horizontal_connect" : 1,
"can_left_connect" : 1,
"can_right_connect" : 0,
"can_top_connect" : 1,
"type" : "bomba_centrifuga",
Expand Down

0 comments on commit 720d90c

Please sign in to comment.