不等比缩放
This commit is contained in:
@@ -586,7 +586,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designItemLayer.getLayers().forEach(layer -> {
|
||||
ArrayList<Long> imageSize = new ArrayList<>();
|
||||
for (int i = 0; i < layer.getImageSize().size(); i++) {
|
||||
imageSize.add((long) (layer.getImageSize().get(i) * layer.getScale()));
|
||||
// todo check这里的计算是否正确
|
||||
imageSize.add((long) (layer.getImageSize().get(i) * layer.getScale()[i]));
|
||||
}
|
||||
layer.setImageSize(imageSize);
|
||||
if (!StringUtil.isNullOrEmpty(layer.getImageUrl())) {
|
||||
|
||||
@@ -350,7 +350,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
list.add(1L);
|
||||
list.add(1L);
|
||||
item.setOffset(list);
|
||||
item.setResize_scale(1f);
|
||||
item.setResize_scale(new Float[]{1.0f,1.0f});
|
||||
String path = item.getPath();
|
||||
if (StringUtils.isEmpty(path)) {
|
||||
String bodyPath = item.getBody_path();
|
||||
@@ -434,7 +434,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
list.add(1L);
|
||||
list.add(1L);
|
||||
item.setOffset(list);
|
||||
item.setResize_scale(1f);
|
||||
item.setResize_scale(new Float[]{1.0f,1.0f});
|
||||
String path = item.getPath();
|
||||
if (StringUtils.isEmpty(path)) {
|
||||
String bodyPath = item.getBody_path();
|
||||
@@ -631,7 +631,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
print.setPath(designItemDetail.getPrintPath());
|
||||
print.setSingleOrOverall("overall");
|
||||
print.setPosition("[0.0,0.0]");
|
||||
print.setScale(1d);
|
||||
// print.setScale(1d);
|
||||
// todo mark 将print默认scale置为0.3
|
||||
print.setScale(0.3d);
|
||||
print.setAngle(0.0);
|
||||
print.setPriority(1);
|
||||
print.setCreateDate(LocalDateTime.now());
|
||||
|
||||
@@ -61,7 +61,8 @@ public class TDesignPythonOutfitDetailServiceImpl extends ServiceImpl<TDesignPyt
|
||||
designPythonOutfitVO.setImageMinioUrl(StringUtil.isNullOrEmpty(detail.getImageUrl()) ? null : detail.getImageUrl());
|
||||
designPythonOutfitVO.setMaskUrl(StringUtil.isNullOrEmpty(detail.getMaskUrl()) ? null : minIoUtil.getPresignedUrl(detail.getMaskUrl(), 24 * 60));
|
||||
designPythonOutfitVO.setMaskMinioUrl(StringUtil.isNullOrEmpty(detail.getMaskUrl()) ? null : detail.getMaskUrl());
|
||||
designPythonOutfitVO.setScale(Float.parseFloat(detail.getScale()));
|
||||
// designPythonOutfitVO.setScale(Float.parseFloat(detail.getScale()));
|
||||
designPythonOutfitVO.setScale(modifyScale(detail.getScale()));
|
||||
designPythonOutfitVO.setOffset(StringUtil.isNullOrEmpty(detail.getOffset()) ? Arrays.asList(0L, 0L) : (List<Long>) JSON.parse(detail.getOffset()));
|
||||
designPythonOutfitVO.setPriority(Math.abs(detail.getPriority()));
|
||||
// designPythonOutfitVO.setOffset(CollectionUtil.isEmpty(offset) ? Arrays.asList(0L, 0L) : offset);
|
||||
@@ -77,6 +78,33 @@ public class TDesignPythonOutfitDetailServiceImpl extends ServiceImpl<TDesignPyt
|
||||
return designPythonOutfitVO;
|
||||
}
|
||||
|
||||
private Float[] modifyScale(String scale){
|
||||
Float[] scaleFloat = new Float[2];
|
||||
if (!StringUtil.isNullOrEmpty(scale)){
|
||||
if (scale.startsWith("[")){
|
||||
// 去除中括号并去掉多余的空格
|
||||
scale = scale.trim().replaceAll("^\\[|\\]$", "");
|
||||
|
||||
// 根据逗号和可选的空格拆分字符串
|
||||
String[] parts = scale.split("\\s*,\\s*");
|
||||
// Float[] floatArray = new Float[parts.length];
|
||||
|
||||
// 转换每个字符串为 Float 并添加到数组中
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
try {
|
||||
scaleFloat[i] = Float.parseFloat(parts[i]);
|
||||
} catch (NumberFormatException e) {
|
||||
System.err.println("Invalid number format: " + parts[i]);
|
||||
return new Float[0]; // 返回一个空数组或者其他错误处理逻辑
|
||||
}
|
||||
}
|
||||
}else {
|
||||
scaleFloat = new Float[]{Float.parseFloat(scale),Float.parseFloat(scale)};
|
||||
}
|
||||
}
|
||||
return scaleFloat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByDesignPythonOutfitId(Long designPythonOutfitId) {
|
||||
// QueryWrapper<TDesignPythonOutfitDetail> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
Reference in New Issue
Block a user