mirror of
http://124.126.16.154:8888/singularity/HyperfDevelopmentKit.git
synced 2026-01-15 00:35:08 +08:00
feat(studio.resource): 添加了线框模型的资源模型
Signed-off-by: 李东云 <dongyun.li@luxcreo.ai>
This commit is contained in:
60
src/Studio/Resource/Workspace/Tasks/Source/FrameDetail.php
Normal file
60
src/Studio/Resource/Workspace/Tasks/Source/FrameDetail.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Lattice.php@HDK
|
||||
*
|
||||
* @author 李东云<dongyun.li@luxcreo.cn>
|
||||
* Powered by PhpStorm
|
||||
* Created on 2022/5/13
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Singularity\HDK\Studio\Resource\Workspace\Tasks\Source;
|
||||
|
||||
use Hyperf\Resource\Json\JsonResource;
|
||||
use Singularity\HDK\Studio\Enums\TaskLatticeAction;
|
||||
use Singularity\HDK\Studio\Resource\Field;
|
||||
use Singularity\HDK\Studio\Resource\File;
|
||||
use Singularity\HDK\Studio\Resource\Lattice as LatticeResource;
|
||||
use Singularity\HDK\Utils\Resource\ClassicResponse;
|
||||
|
||||
/**
|
||||
* 晶格模型生成任务的 source 格式
|
||||
* Singularity\HDK\Studio\Resource\Workspace\Tasks\Source\Lattice@HDK
|
||||
*
|
||||
* @author 李东云<dongyun.li@luxcreo.cn>
|
||||
* Powered by PhpStorm
|
||||
* Created on 2022/5/13
|
||||
*
|
||||
* @property string $fileId 要处理的模型文件 ID
|
||||
* @property string $fileUrl 要处理的模型文件完整路径
|
||||
* @property TaskLatticeAction $action 模型精度
|
||||
* @property string $latticeId 晶格
|
||||
* @property float $scalingRatio 密度比,两位小数
|
||||
* @property float $size 晶格尺寸
|
||||
* @property float $wide 杆径粗细
|
||||
* @property int $surfaceNum 面数
|
||||
* @property int $fieldId
|
||||
* @property LatticeResource $lattice
|
||||
*/
|
||||
final class FrameDetail extends JsonResource
|
||||
{
|
||||
use ClassicResponse;
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
$action = $this->action ?? null;
|
||||
return [
|
||||
'modelName' => $this->modelName ?? $this?->source?->name,
|
||||
'field' => Field::make($this->field),
|
||||
'source' => File::make($this?->source),
|
||||
'action' => !isset($action) ? null : $action,
|
||||
'lattice' => LatticeResource::make($this->lattice),
|
||||
'scalingRatio' => $this->scalingRatio,
|
||||
'size' => $this->size,
|
||||
'wide' => $this->wide,
|
||||
'surfaceNum' => $this->surfaceNum,
|
||||
'output' => $this->when(isset($this->output), File::make($this?->output)),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -34,8 +34,11 @@ use Singularity\HDK\Utils\Resource\ClassicResponse;
|
||||
* @property float $size 晶格尺寸
|
||||
* @property float $wide 杆径粗细
|
||||
* @property int $surfaceNum 面数
|
||||
* @property int $fieldId
|
||||
* @property int $field
|
||||
* @property LatticeResource $lattice
|
||||
* @property-read File $source
|
||||
* @property-read File $output
|
||||
* @property-read File $outputSmall
|
||||
*/
|
||||
final class LatticeDetail extends JsonResource
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
namespace Singularity\HDK\Studio\Resource\Workspace;
|
||||
|
||||
use Hyperf\Resource\Json\JsonResource;
|
||||
use Singularity\HDK\Studio\Resource\Workspace\Tasks\Source\FrameDetail;
|
||||
use Singularity\HDK\Studio\Resource\Workspace\Tasks\Source\LatticeDetail;
|
||||
use Singularity\HDK\Utils\Resource\ClassicResponse;
|
||||
|
||||
@@ -21,10 +22,11 @@ use Singularity\HDK\Utils\Resource\ClassicResponse;
|
||||
* Powered by PhpStorm
|
||||
* Created on 2022/5/12
|
||||
*
|
||||
* @property string $wsId
|
||||
* @property string $userId 创建用户
|
||||
* @property int $status 状态,标记是否完结,晶格填充后就不能再操作了
|
||||
* @property-read ?array $latticeTask
|
||||
* @property string $wsId
|
||||
* @property string $userId 创建用户
|
||||
* @property int $status 状态,标记是否完结,晶格填充后就不能再操作了
|
||||
* @property-read array|null $latticeTask
|
||||
* @property-read array|null $frameTask
|
||||
* @property \Carbon\Carbon $createdAt
|
||||
*/
|
||||
class WorkspaceDetail extends JsonResource
|
||||
@@ -36,7 +38,14 @@ class WorkspaceDetail extends JsonResource
|
||||
return [
|
||||
'id' => $this->wsId,
|
||||
'status' => $this->status,
|
||||
// 'tasks'=>$this->tasks,
|
||||
$this->mergeWhen(
|
||||
!empty($this->frameTask),
|
||||
[
|
||||
'frameTask' => empty($this->frameTask) ? $this->frameTask : FrameDetail::make(
|
||||
$this->frameTask
|
||||
)->toArray(),
|
||||
]
|
||||
),
|
||||
$this->mergeWhen(
|
||||
!empty($this->latticeTask),
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user