You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.8 KiB
63 lines
1.8 KiB
package com.yvan.logisticsModel;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
import lombok.Data;
|
|
import org.clever.core.Conv;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* 物流单元基类
|
|
*/
|
|
@Data
|
|
public abstract class BaseItem {
|
|
public final String id;
|
|
public final String t;
|
|
|
|
/**
|
|
* 变换矩阵, 3x3矩阵, tf[0]=position,采用 X向右增长,Y轴向屏幕外增长,Z向下增长, tf[1]=rotation, tf[2]=scale
|
|
*/
|
|
public final float[][] tf;
|
|
|
|
/**
|
|
* 物品的自定义数据
|
|
*/
|
|
@JsonIgnore
|
|
public final Map<String, Object> dt;
|
|
|
|
@JsonIgnore
|
|
public final Map<String, Object> raw;
|
|
|
|
@JsonIgnore
|
|
public final LogisticsRuntime runtime;
|
|
|
|
@JsonIgnore
|
|
public boolean isInitialized = false;
|
|
|
|
public synchronized void initialize() {
|
|
this.isInitialized = true;
|
|
}
|
|
|
|
public BaseItem(LogisticsRuntime runtime, Map<String, Object> map) {
|
|
this.runtime = runtime;
|
|
this.raw = map;
|
|
this.id = Conv.asString(map.get("id"));
|
|
this.t = Conv.asString(map.get("t"));
|
|
|
|
List tfRaw = (List) map.get("tf");
|
|
|
|
this.tf = new float[3][3];
|
|
this.tf[0][0] = Conv.asFloat(((List) tfRaw.get(0)).get(0));
|
|
this.tf[0][1] = Conv.asFloat(((List) tfRaw.get(0)).get(1));
|
|
this.tf[0][2] = Conv.asFloat(((List) tfRaw.get(0)).get(2));
|
|
this.tf[1][0] = Conv.asFloat(((List) tfRaw.get(1)).get(0));
|
|
this.tf[1][1] = Conv.asFloat(((List) tfRaw.get(1)).get(1));
|
|
this.tf[1][2] = Conv.asFloat(((List) tfRaw.get(1)).get(2));
|
|
this.tf[2][0] = Conv.asFloat(((List) tfRaw.get(2)).get(0));
|
|
this.tf[2][1] = Conv.asFloat(((List) tfRaw.get(2)).get(1));
|
|
this.tf[2][2] = Conv.asFloat(((List) tfRaw.get(2)).get(2));
|
|
|
|
this.dt = (Map<String, Object>) map.get("dt");
|
|
}
|
|
}
|
|
|