package com.fdkankan.dxf.generate.model;

import com.fdkankan.dxf.generate.Vector3;
import com.fdkankan.dxf.generate.model.base.BaseDxfEntity;
import com.fdkankan.dxf.generate.util.DxfLineBuilder;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 点实体对象
 **/
@EqualsAndHashCode(callSuper = true)
@Data
public class DxfPoint extends BaseDxfEntity {
    private Vector3 point = new Vector3(0, 0, 0);

    public DxfPoint() {

    }

    public DxfPoint(double x, double y, double z) {
        this.point = new Vector3(x, y, z);
    }

    public DxfPoint(Vector3 point) {
        this.point = point;
    }

    @Override
    protected String getChildDxfStr() {
        return DxfLineBuilder.build()
                .append(10, String.format("%.6f", point.getX()))
                .append(20, String.format("%.6f", point.getY()))
                .append(30, String.format("%.6f", point.getZ())).toString();
    }

    @Override
    public String getEntityName() {
        return "POINT";
    }

    @Override
    public String getEntityClassName() {
        return "AcDbPoint";
    }
}
