修改protoc

This commit is contained in:
joylink_zhaoerwei 2024-09-19 10:42:56 +08:00
parent 2d73321e06
commit 0709b1392d
9 changed files with 858 additions and 847 deletions

View File

@ -19,6 +19,7 @@ import { useDrawStore } from 'src/stores/draw-store';
import { Rect, RectTemplate } from 'src/graphics/rect/Rect';
import { RectDraw } from 'src/graphics/rect/RectDrawAssistant';
import { RectData } from './graphics/RectInteraction';
import { common } from 'src/protos/common';
const UndoOptions: MenuItemOptions = {
name: '撤销',
@ -69,7 +70,7 @@ export function initCommonDrawApp(app: IDrawApp) {
}
interface ICommonStorage {
canvas: iscsGraphicData.Canvas;
canvas: common.Canvas;
arrows: iscsGraphicData.Arrow[];
iscsTexts: iscsGraphicData.IscsText[];
rects: iscsGraphicData.Rect[];
@ -91,7 +92,7 @@ export function loadCommonDrawDatas(storage: ICommonStorage): GraphicData[] {
export function saveCommonDrawDatas(app: IDrawApp, storage: ICommonStorage) {
const canvasData = app.canvas.saveData();
storage.canvas = new iscsGraphicData.Canvas({
storage.canvas = new common.Canvas({
width: canvasData.width,
height: canvasData.height,
backgroundColor: canvasData.backgroundColor,

View File

@ -4,6 +4,7 @@ import { iscsGraphicData } from 'src/protos/iscs_graphic_data';
import { IArrowData, Arrow } from 'src/graphics/arrow/Arrow';
import { GraphicDataBase } from './GraphicDataBase';
import { IPointData } from 'pixi.js';
import { common } from 'src/protos/common';
export class ArrowData extends GraphicDataBase implements IArrowData {
constructor(data?: iscsGraphicData.Arrow) {
@ -33,7 +34,7 @@ export class ArrowData extends GraphicDataBase implements IArrowData {
}
set points(points: IPointData[]) {
this.data.points = points.map(
(p) => new iscsGraphicData.Point({ x: p.x, y: p.y })
(p) => new common.Point({ x: p.x, y: p.y })
);
}
clone(): ArrowData {

View File

@ -8,8 +8,8 @@ import {
IGraphicTransform,
} from 'jl-graphic';
// import { toStorageTransform } from '..';
import { iscsGraphicData } from 'src/protos/iscs_graphic_data';
import { IPointData, Point } from 'pixi.js';
import { common } from 'src/protos/common';
export interface ICommonInfo {
id: number;
@ -17,15 +17,15 @@ export interface ICommonInfo {
transform: IGraphicTransform;
childTransforms: IChildTransform[];
}
export function fromStoragePoint(p: iscsGraphicData.Point): Point {
export function fromStoragePoint(p: common.Point): Point {
return new Point(p.x, p.y);
}
export function toStoragePoint(p: IPointData): iscsGraphicData.Point {
return new iscsGraphicData.Point({ x: p.x, y: p.y });
export function toStoragePoint(p: IPointData): common.Point {
return new common.Point({ x: p.x, y: p.y });
}
export function fromStorageTransfrom(
transfrom: iscsGraphicData.Transform
transfrom: common.Transform
): GraphicTransform {
return new GraphicTransform(
fromStoragePoint(transfrom.position),
@ -37,8 +37,8 @@ export function fromStorageTransfrom(
export function toStorageTransform(
transform: GraphicTransform
): iscsGraphicData.Transform {
return new iscsGraphicData.Transform({
): common.Transform {
return new common.Transform({
position: toStoragePoint(transform.position),
scale: toStoragePoint(transform.scale),
rotation: transform.rotation,
@ -57,15 +57,15 @@ export abstract class GraphicDataBase implements GraphicData {
this._data = data;
}
static defaultCommonInfo(graphicType: string): iscsGraphicData.CommonInfo {
return new iscsGraphicData.CommonInfo({
static defaultCommonInfo(graphicType: string): common.CommonInfo {
return new common.CommonInfo({
id: 0,
graphicType: graphicType,
transform: new iscsGraphicData.Transform({
position: new iscsGraphicData.Point({ x: 0, y: 0 }),
scale: new iscsGraphicData.Point({ x: 1, y: 1 }),
transform: new common.Transform({
position: new common.Point({ x: 0, y: 0 }),
scale: new common.Point({ x: 1, y: 1 }),
rotation: 0,
skew: new iscsGraphicData.Point({ x: 0, y: 0 }),
skew: new common.Point({ x: 0, y: 0 }),
}),
childTransforms: [],
});
@ -104,10 +104,10 @@ export abstract class GraphicDataBase implements GraphicData {
}
set childTransforms(v: ChildTransform[] | undefined) {
if (v) {
const cts: iscsGraphicData.ChildTransform[] = [];
const cts: common.ChildTransform[] = [];
v.forEach((ct) =>
cts.push(
new iscsGraphicData.ChildTransform({
new common.ChildTransform({
...ct,
transform: toStorageTransform(ct.transform),
})

View File

@ -3,6 +3,7 @@ import { IPointData } from 'pixi.js';
import { IRectData, Rect } from 'src/graphics/rect/Rect';
import { iscsGraphicData } from 'src/protos/iscs_graphic_data';
import { GraphicDataBase } from './GraphicDataBase';
import { common } from 'src/protos/common';
export class RectData extends GraphicDataBase implements IRectData {
constructor(data?: iscsGraphicData.Rect) {
@ -43,7 +44,7 @@ export class RectData extends GraphicDataBase implements IRectData {
return this.data.point;
}
set point(point: IPointData) {
this.data.point = new iscsGraphicData.Point({ x: point.x, y: point.y });
this.data.point = new common.Point({ x: point.x, y: point.y });
}
get width(): number {
return this.data.width;

View File

@ -139,9 +139,10 @@ import {
IscsStyle,
} from '../api/DraftApi';
import { ApiError } from 'src/boot/axios';
import { useRouter } from 'vue-router';
const $q = useQuasar();
const router = useRouter();
const props = withDefaults(
defineProps<{
sizeHeight: number;
@ -310,4 +311,9 @@ async function deleteData(row: DraftItem) {
operateDisabled.value = false;
});
}
function goToPath(row: DraftItem) {
let path = `/iscsPainting/${row.id}`;
router.push({ path: path });
}
</script>

View File

@ -12,6 +12,10 @@ export namespace common {
DataType_Psl = 3,
DataType_Iscs = 4
}
export enum IscsStyle {
IscsStyle_Unknown = 0,
DaShiZhiNeng = 1
}
export enum FeatureType {
FeatureType_Unknown = 0,
FeatureType_Simulation = 1,
@ -22,9 +26,9 @@ export namespace common {
constructor(data?: any[] | {
width?: number;
height?: number;
background_color?: string;
viewport_transform?: Transform;
grid_background?: Grid;
backgroundColor?: string;
viewportTransform?: Transform;
gridBackground?: Grid;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -35,14 +39,14 @@ export namespace common {
if ("height" in data && data.height != undefined) {
this.height = data.height;
}
if ("background_color" in data && data.background_color != undefined) {
this.background_color = data.background_color;
if ("backgroundColor" in data && data.backgroundColor != undefined) {
this.backgroundColor = data.backgroundColor;
}
if ("viewport_transform" in data && data.viewport_transform != undefined) {
this.viewport_transform = data.viewport_transform;
if ("viewportTransform" in data && data.viewportTransform != undefined) {
this.viewportTransform = data.viewportTransform;
}
if ("grid_background" in data && data.grid_background != undefined) {
this.grid_background = data.grid_background;
if ("gridBackground" in data && data.gridBackground != undefined) {
this.gridBackground = data.gridBackground;
}
}
}
@ -58,36 +62,36 @@ export namespace common {
set height(value: number) {
pb_1.Message.setField(this, 2, value);
}
get background_color() {
get backgroundColor() {
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
}
set background_color(value: string) {
set backgroundColor(value: string) {
pb_1.Message.setField(this, 3, value);
}
get viewport_transform() {
get viewportTransform() {
return pb_1.Message.getWrapperField(this, Transform, 4) as Transform;
}
set viewport_transform(value: Transform) {
set viewportTransform(value: Transform) {
pb_1.Message.setWrapperField(this, 4, value);
}
get has_viewport_transform() {
get has_viewportTransform() {
return pb_1.Message.getField(this, 4) != null;
}
get grid_background() {
get gridBackground() {
return pb_1.Message.getWrapperField(this, Grid, 5) as Grid;
}
set grid_background(value: Grid) {
set gridBackground(value: Grid) {
pb_1.Message.setWrapperField(this, 5, value);
}
get has_grid_background() {
get has_gridBackground() {
return pb_1.Message.getField(this, 5) != null;
}
static fromObject(data: {
width?: number;
height?: number;
background_color?: string;
viewport_transform?: ReturnType<typeof Transform.prototype.toObject>;
grid_background?: ReturnType<typeof Grid.prototype.toObject>;
backgroundColor?: string;
viewportTransform?: ReturnType<typeof Transform.prototype.toObject>;
gridBackground?: ReturnType<typeof Grid.prototype.toObject>;
}): Canvas {
const message = new Canvas({});
if (data.width != null) {
@ -96,14 +100,14 @@ export namespace common {
if (data.height != null) {
message.height = data.height;
}
if (data.background_color != null) {
message.background_color = data.background_color;
if (data.backgroundColor != null) {
message.backgroundColor = data.backgroundColor;
}
if (data.viewport_transform != null) {
message.viewport_transform = Transform.fromObject(data.viewport_transform);
if (data.viewportTransform != null) {
message.viewportTransform = Transform.fromObject(data.viewportTransform);
}
if (data.grid_background != null) {
message.grid_background = Grid.fromObject(data.grid_background);
if (data.gridBackground != null) {
message.gridBackground = Grid.fromObject(data.gridBackground);
}
return message;
}
@ -111,9 +115,9 @@ export namespace common {
const data: {
width?: number;
height?: number;
background_color?: string;
viewport_transform?: ReturnType<typeof Transform.prototype.toObject>;
grid_background?: ReturnType<typeof Grid.prototype.toObject>;
backgroundColor?: string;
viewportTransform?: ReturnType<typeof Transform.prototype.toObject>;
gridBackground?: ReturnType<typeof Grid.prototype.toObject>;
} = {};
if (this.width != null) {
data.width = this.width;
@ -121,14 +125,14 @@ export namespace common {
if (this.height != null) {
data.height = this.height;
}
if (this.background_color != null) {
data.background_color = this.background_color;
if (this.backgroundColor != null) {
data.backgroundColor = this.backgroundColor;
}
if (this.viewport_transform != null) {
data.viewport_transform = this.viewport_transform.toObject();
if (this.viewportTransform != null) {
data.viewportTransform = this.viewportTransform.toObject();
}
if (this.grid_background != null) {
data.grid_background = this.grid_background.toObject();
if (this.gridBackground != null) {
data.gridBackground = this.gridBackground.toObject();
}
return data;
}
@ -140,12 +144,12 @@ export namespace common {
writer.writeInt32(1, this.width);
if (this.height != 0)
writer.writeInt32(2, this.height);
if (this.background_color.length)
writer.writeString(3, this.background_color);
if (this.has_viewport_transform)
writer.writeMessage(4, this.viewport_transform, () => this.viewport_transform.serialize(writer));
if (this.has_grid_background)
writer.writeMessage(5, this.grid_background, () => this.grid_background.serialize(writer));
if (this.backgroundColor.length)
writer.writeString(3, this.backgroundColor);
if (this.has_viewportTransform)
writer.writeMessage(4, this.viewportTransform, () => this.viewportTransform.serialize(writer));
if (this.has_gridBackground)
writer.writeMessage(5, this.gridBackground, () => this.gridBackground.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -162,13 +166,13 @@ export namespace common {
message.height = reader.readInt32();
break;
case 3:
message.background_color = reader.readString();
message.backgroundColor = reader.readString();
break;
case 4:
reader.readMessage(message.viewport_transform, () => message.viewport_transform = Transform.deserialize(reader));
reader.readMessage(message.viewportTransform, () => message.viewportTransform = Transform.deserialize(reader));
break;
case 5:
reader.readMessage(message.grid_background, () => message.grid_background = Grid.deserialize(reader));
reader.readMessage(message.gridBackground, () => message.gridBackground = Grid.deserialize(reader));
break;
default: reader.skipField();
}
@ -185,34 +189,34 @@ export namespace common {
export class Grid extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
has_grid?: boolean;
line_color?: string;
hasGrid?: boolean;
lineColor?: string;
space?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("has_grid" in data && data.has_grid != undefined) {
this.has_grid = data.has_grid;
if ("hasGrid" in data && data.hasGrid != undefined) {
this.hasGrid = data.hasGrid;
}
if ("line_color" in data && data.line_color != undefined) {
this.line_color = data.line_color;
if ("lineColor" in data && data.lineColor != undefined) {
this.lineColor = data.lineColor;
}
if ("space" in data && data.space != undefined) {
this.space = data.space;
}
}
}
get has_grid() {
get hasGrid() {
return pb_1.Message.getFieldWithDefault(this, 1, false) as boolean;
}
set has_grid(value: boolean) {
set hasGrid(value: boolean) {
pb_1.Message.setField(this, 1, value);
}
get line_color() {
get lineColor() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set line_color(value: string) {
set lineColor(value: string) {
pb_1.Message.setField(this, 2, value);
}
get space() {
@ -222,16 +226,16 @@ export namespace common {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
has_grid?: boolean;
line_color?: string;
hasGrid?: boolean;
lineColor?: string;
space?: number;
}): Grid {
const message = new Grid({});
if (data.has_grid != null) {
message.has_grid = data.has_grid;
if (data.hasGrid != null) {
message.hasGrid = data.hasGrid;
}
if (data.line_color != null) {
message.line_color = data.line_color;
if (data.lineColor != null) {
message.lineColor = data.lineColor;
}
if (data.space != null) {
message.space = data.space;
@ -240,15 +244,15 @@ export namespace common {
}
toObject() {
const data: {
has_grid?: boolean;
line_color?: string;
hasGrid?: boolean;
lineColor?: string;
space?: number;
} = {};
if (this.has_grid != null) {
data.has_grid = this.has_grid;
if (this.hasGrid != null) {
data.hasGrid = this.hasGrid;
}
if (this.line_color != null) {
data.line_color = this.line_color;
if (this.lineColor != null) {
data.lineColor = this.lineColor;
}
if (this.space != null) {
data.space = this.space;
@ -259,10 +263,10 @@ export namespace common {
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.has_grid != false)
writer.writeBool(1, this.has_grid);
if (this.line_color.length)
writer.writeString(2, this.line_color);
if (this.hasGrid != false)
writer.writeBool(1, this.hasGrid);
if (this.lineColor.length)
writer.writeString(2, this.lineColor);
if (this.space != 0)
writer.writeInt32(3, this.space);
if (!w)
@ -275,10 +279,10 @@ export namespace common {
break;
switch (reader.getFieldNumber()) {
case 1:
message.has_grid = reader.readBool();
message.hasGrid = reader.readBool();
break;
case 2:
message.line_color = reader.readString();
message.lineColor = reader.readString();
break;
case 3:
message.space = reader.readInt32();
@ -627,9 +631,9 @@ export namespace common {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
id?: number;
graphic_type?: string;
graphicType?: string;
transform?: Transform;
children_transform?: ChildTransform[];
childTransforms?: ChildTransform[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4], this.#one_of_decls);
@ -637,14 +641,14 @@ export namespace common {
if ("id" in data && data.id != undefined) {
this.id = data.id;
}
if ("graphic_type" in data && data.graphic_type != undefined) {
this.graphic_type = data.graphic_type;
if ("graphicType" in data && data.graphicType != undefined) {
this.graphicType = data.graphicType;
}
if ("transform" in data && data.transform != undefined) {
this.transform = data.transform;
}
if ("children_transform" in data && data.children_transform != undefined) {
this.children_transform = data.children_transform;
if ("childTransforms" in data && data.childTransforms != undefined) {
this.childTransforms = data.childTransforms;
}
}
}
@ -654,10 +658,10 @@ export namespace common {
set id(value: number) {
pb_1.Message.setField(this, 1, value);
}
get graphic_type() {
get graphicType() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set graphic_type(value: string) {
set graphicType(value: string) {
pb_1.Message.setField(this, 2, value);
}
get transform() {
@ -669,51 +673,51 @@ export namespace common {
get has_transform() {
return pb_1.Message.getField(this, 3) != null;
}
get children_transform() {
get childTransforms() {
return pb_1.Message.getRepeatedWrapperField(this, ChildTransform, 4) as ChildTransform[];
}
set children_transform(value: ChildTransform[]) {
set childTransforms(value: ChildTransform[]) {
pb_1.Message.setRepeatedWrapperField(this, 4, value);
}
static fromObject(data: {
id?: number;
graphic_type?: string;
graphicType?: string;
transform?: ReturnType<typeof Transform.prototype.toObject>;
children_transform?: ReturnType<typeof ChildTransform.prototype.toObject>[];
childTransforms?: ReturnType<typeof ChildTransform.prototype.toObject>[];
}): CommonInfo {
const message = new CommonInfo({});
if (data.id != null) {
message.id = data.id;
}
if (data.graphic_type != null) {
message.graphic_type = data.graphic_type;
if (data.graphicType != null) {
message.graphicType = data.graphicType;
}
if (data.transform != null) {
message.transform = Transform.fromObject(data.transform);
}
if (data.children_transform != null) {
message.children_transform = data.children_transform.map(item => ChildTransform.fromObject(item));
if (data.childTransforms != null) {
message.childTransforms = data.childTransforms.map(item => ChildTransform.fromObject(item));
}
return message;
}
toObject() {
const data: {
id?: number;
graphic_type?: string;
graphicType?: string;
transform?: ReturnType<typeof Transform.prototype.toObject>;
children_transform?: ReturnType<typeof ChildTransform.prototype.toObject>[];
childTransforms?: ReturnType<typeof ChildTransform.prototype.toObject>[];
} = {};
if (this.id != null) {
data.id = this.id;
}
if (this.graphic_type != null) {
data.graphic_type = this.graphic_type;
if (this.graphicType != null) {
data.graphicType = this.graphicType;
}
if (this.transform != null) {
data.transform = this.transform.toObject();
}
if (this.children_transform != null) {
data.children_transform = this.children_transform.map((item: ChildTransform) => item.toObject());
if (this.childTransforms != null) {
data.childTransforms = this.childTransforms.map((item: ChildTransform) => item.toObject());
}
return data;
}
@ -723,12 +727,12 @@ export namespace common {
const writer = w || new pb_1.BinaryWriter();
if (this.id != 0)
writer.writeUint32(1, this.id);
if (this.graphic_type.length)
writer.writeString(2, this.graphic_type);
if (this.graphicType.length)
writer.writeString(2, this.graphicType);
if (this.has_transform)
writer.writeMessage(3, this.transform, () => this.transform.serialize(writer));
if (this.children_transform.length)
writer.writeRepeatedMessage(4, this.children_transform, (item: ChildTransform) => item.serialize(writer));
if (this.childTransforms.length)
writer.writeRepeatedMessage(4, this.childTransforms, (item: ChildTransform) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -742,13 +746,13 @@ export namespace common {
message.id = reader.readUint32();
break;
case 2:
message.graphic_type = reader.readString();
message.graphicType = reader.readString();
break;
case 3:
reader.readMessage(message.transform, () => message.transform = Transform.deserialize(reader));
break;
case 4:
reader.readMessage(message.children_transform, () => pb_1.Message.addToRepeatedWrapperField(message, 4, ChildTransform.deserialize(reader), ChildTransform));
reader.readMessage(message.childTransforms, () => pb_1.Message.addToRepeatedWrapperField(message, 4, ChildTransform.deserialize(reader), ChildTransform));
break;
default: reader.skipField();
}

File diff suppressed because it is too large Load Diff

View File

@ -46,6 +46,14 @@ const routes: RouteRecordRaw[] = [
},
],
},
{
path: '/iscsPainting/:id',
name: 'iscsPainting',
component: () => import('layouts/IscsDrawLayout.vue'),
meta: {
hidden: true,
},
},
{
path: '/:catchAll(.*)*',
meta: {
@ -53,22 +61,6 @@ const routes: RouteRecordRaw[] = [
},
component: () => import('pages/ErrorNotFound.vue'),
},
{
path: '/cctvPainting',
name: 'cctvPainting',
meta: {
label: 'CCTV绘制',
},
component: () => import('layouts/CCTVDrawLayout.vue'),
},
{
path: '/fasPaint',
name: 'fasPaint',
meta: {
label: '火灾报警绘制',
},
component: () => import('layouts/FASDrawLayout.vue'),
},
];
export default routes;