Skip to content

Commit

Permalink
feat(connect): Adidiciona lógica de conexão personalizada das válvulas
Browse files Browse the repository at this point in the history
  • Loading branch information
giovaneneves7 committed Oct 25, 2024
1 parent 9cc1a5c commit 0b56fdc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ public void connectEquipament(Label movedLabel, Label target){

if(target.getEquipamento().getAxios().equals(Constantes.HORIZONTAL) && movedLabel.getEquipamento().getAxios().equals(Constantes.HORIZONTAL)){ // Ambos os equipamentos estão na horizontal

System.out.println("Ambos na horizontal");
int diferencaX = movedLabel.getX() - target.getX();
int xOrigem = 0;
int yOrigem = 0;
Expand Down Expand Up @@ -218,7 +217,6 @@ public void connectEquipament(Label movedLabel, Label target){

} else if(target.getEquipamento().getAxios().equals(Constantes.VERTICAL) && movedLabel.getEquipamento().getAxios().equals(Constantes.VERTICAL)){ // Ambos os equipamentos na vertical

System.out.println("Ambos na vertical");
int diferencaY = movedLabel.getY() - target.getY();

if (diferencaY <= 0) { // lblMovido está acima do alvo
Expand All @@ -235,7 +233,7 @@ public void connectEquipament(Label movedLabel, Label target){
if(target.getEquipamento().getType() == EquipamentType.BOMBA_CENTRIFUGA){

xOrigem = target.getX();
yOrigem = target.getY() - movedLabel.getHeight();
yOrigem = (target.getY() - movedLabel.getHeight());

} else if(target.getEquipamento().getId().equals(Constantes.CONEXAO_1_ID)){

Expand Down Expand Up @@ -290,9 +288,18 @@ public void connectEquipament(Label movedLabel, Label target){

xOrigem = (xOrigem - GapHelper.TUBULACAO_CONEXAO_3_X_GAP);

}else if(movedLabel.getEquipamento().getId().equals(Constantes.VALVULA_GAVETA_ID)){
}else if(movedLabel.getEquipamento().getId().equals(Constantes.VALVULA_ESFERA_ID)){

xOrigem = (xOrigem + GapHelper.VALVULA_ESFERA_X_GAP);

} else if(movedLabel.getEquipamento().getId().equals(Constantes.VALVULA_GAVETA_ID)){

xOrigem = (xOrigem + GapHelper.VALVULA_GAVETA_X_GAP);

} else if(movedLabel.getEquipamento().getId().equals(Constantes.VALVULA_GLOBO_ID)){

xOrigem = (xOrigem + GapHelper.VALVULA_GLOBO_X_GAP);

}

movedLabel.setLocation(xOrigem, yOrigem);
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 @@ -54,8 +54,11 @@ public class GapHelper {

public static final int TUBULACAO_CONEXAO_3_X_GAP = 16;

public static final int VALVULA_ESFERA_X_GAP = 16;

public static final int VALVULA_GAVETA_X_GAP = 16;

public static final int VALVULA_GLOBO_X_GAP = 18;
public static final int VALVULA_GLOBO_Y_GAP = 40;

public static final int VALVULA_RETENCAO_Y_GAP = 45;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/br/com/ifba/ipss/util/Constantes.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public class Constantes {
public static final String TUBULACAO_3_ID = "tb03";
public static final String TUBULACAO_4_ID = "tb04";
public static final String TUBULACAO_5_ID = "tb05";
public static final String VALVULA_ESFERA_ID = "esf_valv";
public static final String VALVULA_GAVETA_ID = "galv_valv";
public static final String VALVULA_GLOBO_ID = "glob_valv";

Expand Down

0 comments on commit 0b56fdc

Please sign in to comment.