-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: generate and render thumbnail (#341)
* feat: render picture and rect on top of it when coordinates are chosen * feat: generating picture on model page, rendering it there and in coordinate diallogue * fix: Delete 2024-10-15.md * fix: removed unneccecary code and warnings
- Loading branch information
Showing
29 changed files
with
732 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import axios from 'axios'; | ||
import { OpenAPI } from '../generated'; | ||
|
||
export const getAnalogueModelImage = async ( | ||
analogueModelId: string, | ||
imageId: string, | ||
): Promise<string> => { | ||
const token = OpenAPI.TOKEN; // replace with your bearer token | ||
const base = OpenAPI.BASE; | ||
|
||
const response = await axios.get( | ||
`/api/analogue-models/${analogueModelId}/images/${imageId}`, | ||
{ | ||
headers: { Authorization: `Bearer ${token}` }, | ||
responseType: 'blob', // response type of blob to handle images | ||
baseURL: base, | ||
}, | ||
); | ||
|
||
// create an object URL for the image blob and return it | ||
return URL.createObjectURL(response.data); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* generated using openapi-typescript-codegen -- do no edit */ | ||
/* istanbul ignore file */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
|
||
import type { FileType } from './FileType'; | ||
|
||
export type AnalogueModelImageDto = { | ||
analogueModelImageId: string; | ||
fileName: string; | ||
type: FileType; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* generated using openapi-typescript-codegen -- do no edit */ | ||
/* istanbul ignore file */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
|
||
export enum FileType { | ||
JPG = 'JPG', | ||
PNG = 'PNG', | ||
CSV = 'CSV', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* generated using openapi-typescript-codegen -- do no edit */ | ||
/* istanbul ignore file */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
|
||
export type GenerateThumbnailCommand = { | ||
modelId: string; | ||
}; | ||
|
15 changes: 15 additions & 0 deletions
15
src/api/generated/models/GenerateThumbnailCommandResponse.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* generated using openapi-typescript-codegen -- do no edit */ | ||
/* istanbul ignore file */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
|
||
import type { GenerateThumbnailDto } from './GenerateThumbnailDto'; | ||
|
||
export type GenerateThumbnailCommandResponse = { | ||
success?: boolean; | ||
count?: number | null; | ||
message?: string | null; | ||
validationErrors?: Array<string> | null; | ||
data: GenerateThumbnailDto; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* generated using openapi-typescript-codegen -- do no edit */ | ||
/* istanbul ignore file */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
|
||
import type { JobStatus } from './JobStatus'; | ||
import type { JobType } from './JobType'; | ||
|
||
export type GenerateThumbnailDto = { | ||
jobId: string; | ||
name: string; | ||
jobStatus: JobStatus; | ||
jobType: JobType; | ||
}; | ||
|
15 changes: 15 additions & 0 deletions
15
src/api/generated/models/GetImageMetadataCommandResponse.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* generated using openapi-typescript-codegen -- do no edit */ | ||
/* istanbul ignore file */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
|
||
import type { ImageMetadataDto } from './ImageMetadataDto'; | ||
|
||
export type GetImageMetadataCommandResponse = { | ||
success?: boolean; | ||
count?: number | null; | ||
message?: string | null; | ||
validationErrors?: Array<string> | null; | ||
data: ImageMetadataDto; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* generated using openapi-typescript-codegen -- do no edit */ | ||
/* istanbul ignore file */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
|
||
import type { ThumbnailBoundingBoxDto } from './ThumbnailBoundingBoxDto'; | ||
|
||
export type ImageMetadataDto = { | ||
modelName: string; | ||
boundingBox: ThumbnailBoundingBoxDto; | ||
colorLegend: Record<string, string>; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* generated using openapi-typescript-codegen -- do no edit */ | ||
/* istanbul ignore file */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
|
||
export type ThumbnailBoundingBoxDto = { | ||
x0: number; | ||
y0: number; | ||
x1: number; | ||
y1: number; | ||
}; | ||
|
15 changes: 15 additions & 0 deletions
15
src/api/generated/models/UpdateThumbnailGenStatusCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* generated using openapi-typescript-codegen -- do no edit */ | ||
/* istanbul ignore file */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
|
||
import type { RadixJobDto } from './RadixJobDto'; | ||
|
||
export type UpdateThumbnailGenStatusCommand = { | ||
name: string; | ||
started?: string | null; | ||
ended?: string | null; | ||
status: string; | ||
jobStatuses?: Array<RadixJobDto> | null; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* generated using openapi-typescript-codegen -- do no edit */ | ||
/* istanbul ignore file */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
import type { File } from '../models/File'; | ||
import type { GetImageMetadataCommandResponse } from '../models/GetImageMetadataCommandResponse'; | ||
|
||
import type { CancelablePromise } from '../core/CancelablePromise'; | ||
import { OpenAPI } from '../core/OpenAPI'; | ||
import { request as __request } from '../core/request'; | ||
|
||
export class AnalogueModelImagesService { | ||
|
||
/** | ||
* @param analogueModelId | ||
* @param imageId | ||
* @returns File Success | ||
* @throws ApiError | ||
*/ | ||
public static getApiAnalogueModelsImages( | ||
analogueModelId: string, | ||
imageId: string, | ||
): CancelablePromise<File> { | ||
return __request(OpenAPI, { | ||
method: 'GET', | ||
url: '/api/analogue-models/{analogueModelId}/images/{imageId}', | ||
path: { | ||
'analogueModelId': analogueModelId, | ||
'imageId': imageId, | ||
}, | ||
errors: { | ||
403: `Forbidden`, | ||
404: `Not Found`, | ||
}, | ||
}); | ||
} | ||
|
||
/** | ||
* @param analogueModelId | ||
* @param imageId | ||
* @returns GetImageMetadataCommandResponse Success | ||
* @throws ApiError | ||
*/ | ||
public static getApiAnalogueModelsImagesMetadata( | ||
analogueModelId: string, | ||
imageId: string, | ||
): CancelablePromise<GetImageMetadataCommandResponse> { | ||
return __request(OpenAPI, { | ||
method: 'GET', | ||
url: '/api/analogue-models/{analogueModelId}/images/{imageId}/metadata', | ||
path: { | ||
'analogueModelId': analogueModelId, | ||
'imageId': imageId, | ||
}, | ||
errors: { | ||
403: `Forbidden`, | ||
404: `Not Found`, | ||
}, | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.