разделение данных на группы для уменьшения масштаба
This commit is contained in:
parent
2b41fb4181
commit
6e9eabae56
|
@ -1,21 +0,0 @@
|
|||
# Generated by Django 5.0.4 on 2024-04-26 10:33
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Task',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(max_length=100)),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -1,17 +0,0 @@
|
|||
# Generated by Django 5.0.4 on 2024-04-26 11:26
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('api', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameModel(
|
||||
old_name='Task',
|
||||
new_name='Product',
|
||||
),
|
||||
]
|
|
@ -1,18 +0,0 @@
|
|||
# Generated by Django 5.0.4 on 2024-04-26 12:45
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('api', '0002_rename_task_product'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='product',
|
||||
name='model3d',
|
||||
field=models.FileField(default=None, null=True, upload_to=''),
|
||||
),
|
||||
]
|
|
@ -1,18 +0,0 @@
|
|||
# Generated by Django 5.0.4 on 2024-04-26 12:57
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('api', '0003_product_model3d'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='product',
|
||||
name='description',
|
||||
field=models.TextField(default=None, null=True),
|
||||
),
|
||||
]
|
|
@ -1,23 +0,0 @@
|
|||
# Generated by Django 5.0.4 on 2024-04-27 06:33
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('api', '0004_product_description'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='product',
|
||||
name='image1',
|
||||
field=models.ImageField(blank=True, default=None, null=True, upload_to='back/files'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='product',
|
||||
name='model3d',
|
||||
field=models.FileField(blank=True, default=None, null=True, upload_to='back/files'),
|
||||
),
|
||||
]
|
|
@ -1,23 +0,0 @@
|
|||
# Generated by Django 5.0.4 on 2024-04-27 06:35
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('api', '0005_product_image1_alter_product_model3d'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='product',
|
||||
name='image2',
|
||||
field=models.ImageField(blank=True, default=None, null=True, upload_to='back/files'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='product',
|
||||
name='image3',
|
||||
field=models.ImageField(blank=True, default=None, null=True, upload_to='back/files'),
|
||||
),
|
||||
]
|
|
@ -87,6 +87,7 @@ onMounted(async () => {
|
|||
</script>
|
||||
<template>
|
||||
<div class="container" style="display: flex; justify-content: center; align-items: center;">
|
||||
<canvas ref="canvasElement" width="1200" height="600" @click="setPoint"></canvas>
|
||||
<canvas ref="canvasElement" width="1200" height="600"></canvas>
|
||||
|
||||
</div>
|
||||
</template>
|
|
@ -25,3 +25,8 @@ export const random_сolor = () => {
|
|||
|
||||
return `rgb(${r()}, ${r()}, ${r()})`;
|
||||
}
|
||||
export function* chunks<T>(arr: T[], n: number): Generator<T[], void> {
|
||||
for (let i = 0; i < arr.length; i += n) {
|
||||
yield arr.slice(i, i + n);
|
||||
}
|
||||
}
|
|
@ -1,11 +1,13 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import { SERVER_URL } from '../constants'
|
||||
import { chunks } from '../helpers'
|
||||
|
||||
export const useFloorplanStore = defineStore('floorplan', {
|
||||
state: () => {
|
||||
return {
|
||||
title: undefined,
|
||||
np_array: [] as number[][]
|
||||
np_array: [] as number[][],
|
||||
prepared_array: [] as number[][]
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
@ -15,6 +17,17 @@ export const useFloorplanStore = defineStore('floorplan', {
|
|||
const data = await res.json()
|
||||
this.title = data.title
|
||||
this.np_array = data.np_field
|
||||
const chunkSize = 5
|
||||
this.prepared_array = [...chunks(data.np_field, chunkSize)].map(line => {
|
||||
const line_data = [] as any[][]
|
||||
line.map((item: any) => [...chunks(item, chunkSize)]).map((item) => {
|
||||
item.map((one_line, k) => {
|
||||
if (!line_data[k]) line_data[k] = []
|
||||
line_data[k].push(...one_line)
|
||||
})
|
||||
})
|
||||
return line_data.map(el=> el.some(deep => deep > 0) ? 1 : 0)
|
||||
});
|
||||
} catch (error) {
|
||||
// this.list = []
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue