自动化立体仓库 - WCS系统
1
zhangc
2025-04-12 4ec87f4d9d873487adda85686a1bfd7fa620f857
src/main/java/com/zy/common/model/NavigateNode.java
@@ -2,14 +2,17 @@
import lombok.Data;
import java.io.Serializable;
/**
 * A*寻路算法Node节点
 */
@Data
public class NavigateNode implements Comparable<NavigateNode>{
public class NavigateNode implements Comparable<NavigateNode>, Cloneable, Serializable {
    private int x;//坐标x
    private int y;//坐标y
    private int z;//坐标z(高度)
    private int F;//综合花费的步数
    private int G;//已经花费的步数
    private int H;//将要花费的步数
@@ -17,6 +20,7 @@
    private Boolean isInflectionPoint;//是否为拐点
    private String direction;//行走方向
    private Integer moveDistance;//行走距离
    private Integer nodeValue;//节点数据
    public NavigateNode(int x, int y) {
        this.x = x;
@@ -29,7 +33,7 @@
        this.Father = father;
        if (this.Father != null) {
            //走过的步数等于父节点走过的步数加一
            this.G = father.G + 1;
            this.G = father.G + this.G;
        } else { //父节点为空代表它是第一个结点
            this.G = 0;
        }
@@ -45,4 +49,14 @@
        return Integer.compare(this.F, o.F);
    }
    @Override
    public NavigateNode clone() {
        try {
            return (NavigateNode) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return null;
    }
}