开发:增加测试用例

pull/1477/MERGE
ChenX 2 years ago
parent 212443af75
commit 30d3bd9a94

@ -0,0 +1,34 @@
import { CADFiler } from "../../src/api";
import "../Utils/jest.util";
import { LoadEntityFromFileData } from "../Utils/LoadEntity.util";
LoadEntityFromFileData;
//如果不延迟导入,则导致循环依赖错误
import { inflateBase64 } from "../../src/Common/inflate";
import { Database } from "../../src/DatabaseServices/Database";
import { RoomWallBase } from "../../src/DatabaseServices/Room/Entity/Wall/RoomWallBase";
import { RoomWallLine } from "../../src/DatabaseServices/Room/Entity/Wall/RoomWallLine";
import { RoomWallParse } from "../../src/ueapi";
test('网洞绘制错误', () =>
{
let str = "WebCADSuperCopy:eJy9U7tOxEAM/JetncizL3v/gIIC0VCcrrgiSEgLkeAo+HucXAghdydFQpBkk1lr7MzI6x3IKZIjJXAkkLf1eKhvHbEh5yzg50Akd9/3zw+HWm+fXjpnjGCZlsM8kUBixB3sdbovov34Ob6+d5uo8EMIbPLE/hSDllYzRx9zQUhKWdBiedE5q1CDJNIyQ6BpeGTQOlq66Wt319ePOtnyky1ss7VFUeaNxhuIB7cIJUkKrDlSiqty39WQDA1ST10I1CjzXK/JfL1n/h97ZqLaopJTDJ4NbOvZZdZVQ+GvDfHvzJwdwKxDSZurrwnz4wo/9rC8EaY5zOMRzau9rCdXFwRPZUUHr/nAgsL7T0ws5zA=";
str = str.substr(16);
str = inflateBase64(str);
let f = new CADFiler(JSON.parse(str));
f.Read();
f.Read();
let db = new Database;
db.FileRead(f);
let walls = db.ModelSpace.Entitys.filter(e => e instanceof RoomWallBase) as RoomWallLine[];
new RoomWallParse(false, undefined, false).Parse(walls);
for (let w of walls)
{
expect(w.MeshGeometry.vertices.length).toMatchSnapshot();
}
});

@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`网洞绘制错误 1`] = `"8.00000"`;
exports[`网洞绘制错误 2`] = `"8.00000"`;
exports[`网洞绘制错误 3`] = `"8.00000"`;

@ -1,9 +1,9 @@
import pako from "pako";
import { app } from "../../ApplicationServices/Application";
import { FileHistoryFilesUrl, FileHistoryUrl } from "../../Common/HostUrl";
import { inflateBase64 } from "../../Common/inflate";
import { KeyWord } from "../../Common/InputState";
import { Log } from "../../Common/Log";
import { inflate } from "../../Common/SerializeMaterial";
import { StoreageKeys } from "../../Common/StoreageKeys";
import { CADFiler } from "../../DatabaseServices/CADFiler";
import { FileServer } from "../../DatabaseServices/FileServer";
@ -88,7 +88,7 @@ async function FetchFile1(url: string): Promise<CADFiler>
let res = await fetch(url);
let binaryData = await res.text();
let jsonString = inflate(binaryData);
let jsonString = inflateBase64(binaryData);
let jsonObject = JSON.parse(jsonString);
let cadfiler = new CADFiler(jsonObject);

@ -3,8 +3,8 @@ import pako from "pako";
import React from "react";
import { app } from "../../ApplicationServices/Application";
import { FileHistoryFilesUrl, FileHistoryUrl, SignUrl } from "../../Common/HostUrl";
import { inflateBase64 } from "../../Common/inflate";
import { PostJson, RequestStatus } from "../../Common/Request";
import { inflate } from "../../Common/SerializeMaterial";
import { StoreageKeys } from "../../Common/StoreageKeys";
import { CADFiler } from "../../DatabaseServices/CADFiler";
import { FileServer } from "../../DatabaseServices/FileServer";
@ -121,7 +121,7 @@ async function FetchFile1(url: string): Promise<CADFiler>
let res = await fetch(url);
let binaryData = await res.text();
let jsonString = inflate(binaryData);
let jsonString = inflateBase64(binaryData);
let jsonObject = JSON.parse(jsonString);
let cadfiler = new CADFiler(jsonObject);

@ -6,10 +6,11 @@ import { EBoardKeyList } from "../Common/BoardKeyList";
import { safeEval } from "../Common/eval";
import { FileSystem } from "../Common/FileSystem";
import { BuyZengZhiBao, MaterialUrls } from "../Common/HostUrl";
import { inflateBase64 } from "../Common/inflate";
import { JigMoveEntity } from "../Common/JigMove";
import { MakeMirrorMtx, NormalMatrix, RoundMatrix } from "../Common/Matrix4Utils";
import { PostJson, RequestStatus } from "../Common/Request";
import { inflate, MaterialIn } from "../Common/SerializeMaterial";
import { MaterialIn } from "../Common/SerializeMaterial";
import { DuplicateRecordCloning } from "../Common/Status";
import { FixIndex, ToFixed } from "../Common/Utils";
import { SweepSolid } from "../DatabaseServices/3DSolid/SweepSolid";
@ -650,7 +651,7 @@ async function handleGetMtlJson(material: KJL_Material)
if (data.err_code === RequestStatus.Ok)
{
let file = data.materials.file;
return inflate(file);
return inflateBase64(file);
}
};

@ -2,8 +2,8 @@ import { Intent } from "@blueprintjs/core";
import { Box3, Matrix4, Vector3 } from "three";
import { app } from "../ApplicationServices/Application";
import { arrayLast } from "../Common/ArrayExt";
import { inflateBase64 } from "../Common/inflate";
import { KeyWord } from "../Common/InputState";
import { inflate } from "../Common/SerializeMaterial";
import { UpdateDraw } from "../Common/Status";
import { readClipboardText } from "../Common/Utils";
import { CADFiler } from "../DatabaseServices/CADFiler";
@ -42,11 +42,11 @@ export class PasteClip
}
if (str.startsWith("zip:"))
str = inflate(str.slice(4));
str = inflateBase64(str.slice(4));
else if (str.startsWith("WebCADSuperCopy:"))
{
str = str.substr(16);
str = inflate(str);
str = inflateBase64(str);
let f = new CADFiler(JSON.parse(str));
f.Read();

@ -1,10 +1,14 @@
import { observable, toJS } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
import { Vector3 } from "three";
import { app } from "../ApplicationServices/Application";
import { CURRENT_HOST, TemplateUrls, ConfigUrls } from "../Common/HostUrl";
import { appCache } from '../Common/AppCache';
import { ConfigUrls, CURRENT_HOST, TemplateUrls } from "../Common/HostUrl";
import { inflateBase64 } from "../Common/inflate";
import { Log } from "../Common/Log";
import { PostJson, RequestStatus } from "../Common/Request";
import { inflate, TemplateIn } from "../Common/SerializeMaterial";
import { TemplateIn } from "../Common/SerializeMaterial";
import { DuplicateRecordCloning } from "../Common/Status";
import { EditorOnlineTemplate, GetOnlineTemplate } from "../DatabaseServices/Template/TempateUtils";
import { TemplateRecord } from "../DatabaseServices/Template/TemplateRecord";
@ -13,15 +17,12 @@ import { JigUtils } from "../Editor/JigUtils";
import { PromptStatus } from "../Editor/PromptResult";
import { userConfig } from "../Editor/UserConfig";
import { MoveMatrix } from "../Geometry/GeUtils";
import { CommonIframe } from './../UI/Components/Common/CommonIframe';
import { AutoCutCheckbox } from '../UI/Components/Board/BoardCommon';
import { ModalFooter } from '../UI/Components/Modal/ModalContainer';
import { observable, toJS } from 'mobx';
import { observer } from 'mobx-react';
import { IGetRoomInfo } from '../UI/Components/Template/GetRoomCabName';
import { IDrawBoardAutoCutOption } from '../UI/Store/BoardInterface';
import { AutoCutCheckbox } from '../UI/Components/Board/BoardCommon';
import { CommonIframe } from './../UI/Components/Common/CommonIframe';
import { AutoCutting } from './BoardCutting/AutoCuttingReactor';
import { appCache } from '../Common/AppCache';
import { IGetRoomInfo } from '../UI/Components/Template/GetRoomCabName';
export class Command_TemplateSearch implements Command
{
@ -60,7 +61,7 @@ export class TemplateSearchDialog extends React.Component<{ url: string; }, {}>{
app.Editor.MaskManage.Clear();
let file = JSON.parse(inflate(data.modules.file));
let file = JSON.parse(inflateBase64(data.modules.file));
let template = TemplateIn(file).Root;
let ens = template.Db.ModelSpace.Entitys;

@ -5,8 +5,9 @@ import { EBoardKeyList } from "../../Common/BoardKeyList";
import { ParseBoardList } from "../../Common/BoardUtil";
import { IRectInfo, IsRect } from "../../Common/CurveUtils";
import { ToplineUrls } from "../../Common/HostUrl";
import { inflateBase64 } from "../../Common/inflate";
import { PostJson, RequestStatus } from "../../Common/Request";
import { GroupFileIn, inflate } from "../../Common/SerializeMaterial";
import { GroupFileIn } from "../../Common/SerializeMaterial";
import { Sleep } from "../../Common/Sleep";
import { Hole } from "../../DatabaseServices/3DSolid/Hole";
import { SweepSolid } from "../../DatabaseServices/3DSolid/SweepSolid";
@ -128,7 +129,7 @@ export class OneKeyLayout implements Command
data = await PostJson(ToplineUrls.detail, { topline_id: data.toplines[i].topline_id });
if (data.err_code === RequestStatus.Ok)
{
file = inflate(data.toplines.file);
file = inflateBase64(data.toplines.file);
ens = GroupFileIn(JSON.parse(file));
handleEntitys(ens);
hasFrame = true;
@ -151,7 +152,7 @@ export class OneKeyLayout implements Command
app.Editor.ModalManage.RenderModal(FrameManage, { store });
let state = await app.Editor.ModalManage.Wait();
if (state.Status !== ModalState.Ok) return;
file = inflate(store._Data.toplines.file);
file = inflateBase64(store._Data.toplines.file);
ens = GroupFileIn(JSON.parse(file));
handleEntitys(ens);
break;

@ -108,13 +108,6 @@ export function deflate(data: string)
return base64;
}
export function inflate(base64: string)
{
let binaryString = atob(base64);
let data = pako.inflate(binaryString, { to: "string" });
return data;
}
export function dataURItoBlob(dataURI: string)
{
// convert base64 to raw binary data held in a string

@ -0,0 +1,9 @@
import pako from "pako";
//解压base64
export function inflateBase64(base64: string)
{
let binaryString = atob(base64);
let data = pako.inflate(binaryString, { to: "string" });
return data;
}

@ -80,6 +80,8 @@ export class CADFiler
if (this.database !== undefined && obj instanceof CADObject)
obj.SetDefaultDb(this.database);
}
if (!obj)
console.error("未注册类名:", className);
obj.ReadFile(this);
return obj;
}

@ -3,8 +3,9 @@ import { HistoryToaster, OperLogs } from "../Add-on/File/OperLog";
import { app } from "../ApplicationServices/Application";
import { FileSystem } from "../Common/FileSystem";
import { FileUrls } from "../Common/HostUrl";
import { inflateBase64 } from "../Common/inflate";
import { DirectoryId, PostJson, RequestStatus } from "../Common/Request";
import { deflate, inflate } from "../Common/SerializeMaterial";
import { deflate } from "../Common/SerializeMaterial";
import { Singleton } from "../Common/Singleton";
import { Sleep } from "../Common/Sleep";
import { StoreageKeys } from "../Common/StoreageKeys";
@ -225,7 +226,7 @@ export class FileServer extends Singleton
{
let f: IFileInfo = {
name: data.files.name,
file: inflate(data.files.file),
file: inflateBase64(data.files.file),
code: data.files.code
};
await this.CacheFileInfo(fid, f);
@ -262,7 +263,7 @@ export class FileServer extends Singleton
if (data.err_code === RequestStatus.Ok)
{
let finfo: IFileInfo = {
file: rawFile ?? inflate(info.file),
file: rawFile ?? inflateBase64(info.file),
name: info.name,
code: data.files.code
};
@ -283,7 +284,7 @@ export class FileServer extends Singleton
code: data.files.code
};
if (fileInfo.file)
finfo.file = rawFile ?? inflate(fileInfo.file);
finfo.file = rawFile ?? inflateBase64(fileInfo.file);
await this.CacheFileInfo(data.files.file_id, finfo);
}

@ -5,9 +5,10 @@ import { app } from "../../ApplicationServices/Application";
import { arrayRemoveOnce } from "../../Common/ArrayExt";
import { safeEval } from "../../Common/eval";
import { TemplateUrls } from "../../Common/HostUrl";
import { inflateBase64 } from "../../Common/inflate";
import { Log } from "../../Common/Log";
import { PostJson, RequestStatus } from "../../Common/Request";
import { deflate, GetEntitysLogo, inflate, TemplateIn, TemplateOut, TemplateParamsOut } from "../../Common/SerializeMaterial";
import { deflate, GetEntitysLogo, TemplateIn, TemplateOut, TemplateParamsOut } from "../../Common/SerializeMaterial";
import { DuplicateRecordCloning } from "../../Common/Status";
import { StretchParse } from "../../Common/StretchParse";
import { FixedNotZero } from "../../Common/Utils";
@ -1090,7 +1091,7 @@ export async function GetOnlineTemplate(tid: string, props?: ITemplateParam[]):
if (data.err_code === RequestStatus.Ok)
{
let file = JSON.parse(inflate(data.modules.file));
let file = JSON.parse(inflateBase64(data.modules.file));
let template = TemplateIn(file);
if (props)
for (let par of props)

@ -5,8 +5,8 @@ import { CADFiler } from "../../../api";
import { app } from "../../../ApplicationServices/Application";
import { CommandNames } from "../../../Common/CommandNames";
import { CoolDownTime } from "../../../Common/CoolDownTime";
import { inflateBase64 } from "../../../Common/inflate";
import { IResponseData } from "../../../Common/Request";
import { inflate } from "../../../Common/SerializeMaterial";
import { FileServer } from "../../../DatabaseServices/FileServer";
import { commandMachine } from "../../../Editor/CommandMachine";
import { CommandState } from "../../../Editor/CommandState";
@ -150,7 +150,7 @@ export default class GalleryStore
if (await this.fileServer.AddNewFile())
{
//inflate解码
app.OpenFile(new CADFiler(JSON.parse(inflate(gallery_detail.file))));
app.OpenFile(new CADFiler(JSON.parse(inflateBase64(gallery_detail.file))));
app.Editor.ModalManage.Destory();

@ -3,21 +3,22 @@ import { IObservableValue } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
import { app } from '../../../ApplicationServices/Application';
import { appCache } from '../../../Common/AppCache';
import { TemplateUrls } from '../../../Common/HostUrl';
import { inflateBase64 } from "../../../Common/inflate";
import { PostJson, RequestStatus } from '../../../Common/Request';
import { deflate, ExtrudeDrillFileIn, GetEntitysLogo, inflate } from '../../../Common/SerializeMaterial';
import { deflate, ExtrudeDrillFileIn, GetEntitysLogo } from '../../../Common/SerializeMaterial';
import { StoreageKeys } from '../../../Common/StoreageKeys';
import { ExtrudeHole } from '../../../DatabaseServices/3DSolid/ExtrudeHole';
import { CADFiler } from '../../../DatabaseServices/CADFiler';
import { ExtrudeSolid } from '../../../DatabaseServices/Entity/Extrude';
import { CommandWrap } from '../../../Editor/CommandMachine';
import { TempEditor } from '../../../Editor/TempEditor';
import { DataList } from '../Common/Datalist';
import { IDirectoryProps } from '../SourceManage/CommonPanel';
import { AppToaster } from '../Toaster';
import { DrillingTemplateManage } from './DrillingTemplateManage';
import { ModalPosition } from './ModalInterface';
import { ExtrudeHole } from '../../../DatabaseServices/3DSolid/ExtrudeHole';
import { appCache } from '../../../Common/AppCache';
import { StoreageKeys } from '../../../Common/StoreageKeys';
import { DataList } from '../Common/Datalist';
import { CommandWrap } from '../../../Editor/CommandMachine';
export interface IDrillTempListProps
{
@ -141,7 +142,7 @@ export class DrillingTemplateList extends React.Component<IDrillTempListProps, {
if (data.err_code === RequestStatus.Ok)
{
let files = JSON.parse(inflate(data.modules.file));
let files = JSON.parse(inflateBase64(data.modules.file));
let ens = files.map(ExtrudeDrillFileIn) as ExtrudeSolid[];
await CommandWrap(() =>

@ -4,17 +4,18 @@ import { observer } from 'mobx-react';
import * as React from 'react';
import { app } from '../../../ApplicationServices/Application';
import { TemplateUrls } from '../../../Common/HostUrl';
import { inflateBase64 } from "../../../Common/inflate";
import { DirectoryId, PostJson, RequestStatus } from '../../../Common/Request';
import { deflate, EntitysIn, EntitysOut, GetEntitysLogo, inflate } from '../../../Common/SerializeMaterial';
import { deflate, EntitysIn, EntitysOut, GetEntitysLogo } from '../../../Common/SerializeMaterial';
import { ExtrudeHole } from '../../../DatabaseServices/3DSolid/ExtrudeHole';
import { CommandWrap } from '../../../Editor/CommandMachine';
import { PromptStatus } from '../../../Editor/PromptResult';
import { MoveMatrix } from '../../../Geometry/GeUtils';
import { DrillStore } from '../../Store/DrillStore';
import { CommonPanel, IDirectoryProps } from '../SourceManage/CommonPanel';
import { HandleDirComponent } from '../SourceManage/HandleDirComponent';
import { AppToaster } from '../Toaster';
import { DrillingTemplateList } from './DrillingTemplateList';
import { ExtrudeHole } from '../../../DatabaseServices/3DSolid/ExtrudeHole';
import { DrillStore } from '../../Store/DrillStore';
@observer
export class DrillingTemplateManage extends React.Component<{ store?: DrillStore; }> {
@ -238,7 +239,7 @@ export class DrillingTemplateManage extends React.Component<{ store?: DrillStore
if (data.err_code === RequestStatus.Ok)
{
let modules = JSON.parse(inflate(data.modules.file));
let modules = JSON.parse(inflateBase64(data.modules.file));
CommandWrap(() =>
{
EntitysIn(modules).forEach(e => app.Database.ModelSpace.Append(e));

@ -6,8 +6,9 @@ import { Box3, Matrix4, Vector3 } from 'three';
import { OneKeyLayoutStore } from '../../../Add-on/Viewport/OneKeyLayoutStore';
import { app } from '../../../ApplicationServices/Application';
import { ToplineUrls } from '../../../Common/HostUrl';
import { inflateBase64 } from "../../../Common/inflate";
import { DirectoryId, PostJson, RequestStatus } from '../../../Common/Request';
import { deflate, GetEntitysLogo, GroupFileIn, GroupOut, inflate } from '../../../Common/SerializeMaterial';
import { deflate, GetEntitysLogo, GroupFileIn, GroupOut } from '../../../Common/SerializeMaterial';
import { Curve } from '../../../DatabaseServices/Entity/Curve';
import { Entity } from '../../../DatabaseServices/Entity/Entity';
import { Region } from '../../../DatabaseServices/Entity/Region';
@ -256,7 +257,7 @@ export class FrameManage extends React.Component<IFrameManageProps> {
if (data.err_code === RequestStatus.Ok)
{
let file = inflate(data.toplines.file);
let file = inflateBase64(data.toplines.file);
await CommandWrap(async () =>
{

@ -6,8 +6,9 @@ import { Vector3 } from 'three';
import { OneKeyLayoutStore } from '../../../../Add-on/Viewport/OneKeyLayoutStore';
import { app } from '../../../../ApplicationServices/Application';
import { ToplineUrls } from '../../../../Common/HostUrl';
import { inflateBase64 } from "../../../../Common/inflate";
import { PostJson, RequestStatus } from '../../../../Common/Request';
import { deflate, GetEntitysLogo, GroupFileIn, GroupOut, inflate } from '../../../../Common/SerializeMaterial';
import { deflate, GetEntitysLogo, GroupFileIn, GroupOut } from '../../../../Common/SerializeMaterial';
import { GetEntity } from '../../../../Common/Utils';
import { CADFiler } from '../../../../DatabaseServices/CADFiler';
import { Curve } from '../../../../DatabaseServices/Entity/Curve';
@ -116,7 +117,7 @@ export class FrameList extends React.Component<IToplineListProps, { isContextMen
TempEditor.Start();
let file = inflate(data.toplines.file);
let file = inflateBase64(data.toplines.file);
let ens = GroupFileIn(JSON.parse(file));
await CommandWrap(() =>
{

@ -3,23 +3,24 @@ import { IObservableValue, observable } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
import { app } from '../../../../ApplicationServices/Application';
import { DataAdapter } from '../../../../Common/DataAdapter';
import { ToplineUrls } from '../../../../Common/HostUrl';
import { inflateBase64 } from "../../../../Common/inflate";
import { MouseKey } from '../../../../Common/KeyEnum';
import { PostJson, RequestStatus } from '../../../../Common/Request';
import { deflate, getPolylineSVG, inflate, toplineFileIn } from '../../../../Common/SerializeMaterial';
import { deflate, getPolylineSVG, toplineFileIn } from '../../../../Common/SerializeMaterial';
import { CADFiler } from '../../../../DatabaseServices/CADFiler';
import { Polyline } from '../../../../DatabaseServices/Entity/Polyline';
import { commandMachine } from '../../../../Editor/CommandMachine';
import { TempEditor } from '../../../../Editor/TempEditor';
import { IKnifeProps, IUiOption } from '../../../Store/BoardInterface';
import { ZoomToEntity } from '../../../Store/RightPanelStore/BoardEdgesEditor';
import { DataList } from '../../Common/Datalist';
import { ModalPosition } from '../../Modal/ModalInterface';
import { IDirectoryProps } from '../../SourceManage/CommonPanel';
import { AppToaster } from '../../Toaster';
import { KnifeManage } from './KnifeManage';
import { DataList } from '../../Common/Datalist';
import KnifePropsModal from './knifePropsModal';
import { IKnifeProps, IUiOption } from '../../../Store/BoardInterface';
import { DataAdapter } from '../../../../Common/DataAdapter';
export interface IKnifeListProps
{
@ -115,7 +116,7 @@ export class KnifeList extends React.Component<IKnifeListProps, { isContextMenuO
if (data.err_code === RequestStatus.Ok)
{
let file = inflate(data.toplines.file);
let file = inflateBase64(data.toplines.file);
let pl = toplineFileIn(file);
app.Database.ModelSpace.Append(pl);
app.Database.hm.lockIndex++;//禁止初始化动作被撤销

@ -1,27 +1,26 @@
import { Button, Intent } from '@blueprintjs/core';
import { observable } from 'mobx';
import { observer } from 'mobx-react';
import React, { Component } from 'react';
import { CommonModal } from '../../Modal/ModalContainer';
import { Matrix4 } from 'three';
import { buildTopline as buildKnife } from '../../../../Add-on/DrawTopline';
import { GetCloseContour } from '../../../../Add-on/Sweep';
import { app } from '../../../../ApplicationServices/Application';
import { CommonPanel } from '../../SourceManage/CommonPanel';
import { DirectoryId, PostJson, RequestStatus } from '../../../../Common/Request';
import { ToplineUrls } from '../../../../Common/HostUrl';
import { KnifeList } from './KnifeList';
import { Button } from '@blueprintjs/core';
import { Intent } from '@blueprintjs/core';
import { observable } from 'mobx';
import { HandleDirComponent } from '../../SourceManage/HandleDirComponent';
import { AppToaster } from '../../Toaster';
import { IDirectoryProps } from '../../SourceManage/CommonPanel';
import { PromptStatus } from '../../../../Editor/PromptResult';
import { inflateBase64 } from "../../../../Common/inflate";
import { DirectoryId, PostJson, RequestStatus } from '../../../../Common/Request';
import { deflate, getPolylineSVG, toplineFileIn } from '../../../../Common/SerializeMaterial';
import { CADFiler } from '../../../../DatabaseServices/CADFiler';
import { Polyline } from '../../../../DatabaseServices/Entity/Polyline';
import { inflate, toplineFileIn, deflate, getPolylineSVG } from '../../../../Common/SerializeMaterial';
import { CommandWrap } from '../../../../Editor/CommandMachine';
import { buildTopline as buildKnife } from '../../../../Add-on/DrawTopline';
import { CADFiler } from '../../../../DatabaseServices/CADFiler';
import { observer } from 'mobx-react';
import { GetCloseContour } from '../../../../Add-on/Sweep';
import { PromptStatus } from '../../../../Editor/PromptResult';
import { MoveMatrix } from '../../../../Geometry/GeUtils';
import { Matrix4 } from 'three';
import { IKnifeInfo2 } from '../../../Store/RightPanelStore/Modeling2Store';
import { CommonModal } from '../../Modal/ModalContainer';
import { CommonPanel, IDirectoryProps } from '../../SourceManage/CommonPanel';
import { HandleDirComponent } from '../../SourceManage/HandleDirComponent';
import { AppToaster } from '../../Toaster';
import { KnifeList } from './KnifeList';
interface IKnifeManageProps
{
@ -263,7 +262,7 @@ export class KnifeManage extends Component<IKnifeManageProps, IKnifeManageState>
if (data.err_code === RequestStatus.Ok)
{
let file = inflate(data.toplines.file);
let file = inflateBase64(data.toplines.file);
let polyline = toplineFileIn(file);
CommandWrap(async () =>
{
@ -285,7 +284,7 @@ export class KnifeManage extends Component<IKnifeManageProps, IKnifeManageState>
if (data.err_code === RequestStatus.Ok)
{
let file = inflate(data.toplines.file);
let file = inflateBase64(data.toplines.file);
let polyline = toplineFileIn(file);
CommandWrap(() =>
{

@ -6,9 +6,10 @@ import { Curve, Vector3 } from 'three';
import { app } from '../../../ApplicationServices/Application';
import { CommandNames } from '../../../Common/CommandNames';
import { MaterialUrls, PublishMaterialUrl } from '../../../Common/HostUrl';
import { inflateBase64 } from "../../../Common/inflate";
import { IsMeshMaterialEntity } from '../../../Common/IsMeshMaterialEntity';
import { PostJson, RequestStatus } from '../../../Common/Request';
import { inflate, MaterialIn, MaterialInAndAppendAppData } from '../../../Common/SerializeMaterial';
import { MaterialIn, MaterialInAndAppendAppData } from '../../../Common/SerializeMaterial';
import { DuplicateRecordCloning } from '../../../Common/Status';
import { GetEntity, getFileSize } from '../../../Common/Utils';
import { Hole } from '../../../DatabaseServices/3DSolid/Hole';
@ -55,7 +56,7 @@ export class MaterialList extends React.Component<IImgListProps, {}> {
if (data.err_code === RequestStatus.Ok)
{
let file = data.materials.file;
return inflate(file);
return inflateBase64(file);
}
};
private editor = async (data: { material_id: string; }) =>

@ -7,9 +7,10 @@ import { app } from '../../../ApplicationServices/Application';
import { CommandNames } from '../../../Common/CommandNames';
import { FileSystem } from '../../../Common/FileSystem';
import { PublishTemplateUrl, TemplateUrls } from '../../../Common/HostUrl';
import { inflateBase64 } from "../../../Common/inflate";
import { MouseKey } from '../../../Common/KeyEnum';
import { DirectoryId, Post, PostJson, RequestStatus } from '../../../Common/Request';
import { GetEntitysLogo, inflate, TemplateParamsIn } from '../../../Common/SerializeMaterial';
import { GetEntitysLogo, TemplateParamsIn } from '../../../Common/SerializeMaterial';
import { copyTextToClipboard } from '../../../Common/Utils';
import { TemplateParam } from '../../../DatabaseServices/Template/Param/TemplateParam';
import { GetOnlineTemplate } from '../../../DatabaseServices/Template/TempateUtils';
@ -125,7 +126,7 @@ export class TemplateList extends React.Component<ITemplateListProps> {
this.props.currentInfo.isHandle = this.props.currentDir.path.includes("拉手");
this.props.currentInfo.isHinge = this.props.currentDir.path.includes("铰链");
this.props.currentInfo.isKuGan = this.props.currentDir.path.includes("裤杆");
let pars = TemplateParamsIn(JSON.parse(inflate(temp.props)));
let pars = TemplateParamsIn(JSON.parse(inflateBase64(temp.props)));
this._params = pars;
observable(this.props.currentProps).replace(pars.map(p =>
{

@ -4,9 +4,10 @@ import { observer } from 'mobx-react';
import * as React from 'react';
import { ITempTagProps, templateTagCommand } from '../../../Add-on/Template/TemplateTagCommand';
import { CURRENT_HOST, TemplateUrls } from '../../../Common/HostUrl';
import { inflateBase64 } from "../../../Common/inflate";
import { MouseKey } from '../../../Common/KeyEnum';
import { PostJson, RequestStatus } from '../../../Common/Request';
import { inflate, TemplateParamsIn } from '../../../Common/SerializeMaterial';
import { TemplateParamsIn } from '../../../Common/SerializeMaterial';
import { TemplateParam } from '../../../DatabaseServices/Template/Param/TemplateParam';
import { IDrawerDoorTempInfo } from '../../Store/DoorInterface';
import { ITemplateParam } from "../../Store/RightPanelStore/ITemplateParam";
@ -168,7 +169,7 @@ export class TemplateTagCom extends React.Component<ITemplateTagComProps> {
pars = this._propsCache.get(props);
}
else
pars = TemplateParamsIn(JSON.parse(inflate(props)));
pars = TemplateParamsIn(JSON.parse(inflateBase64(props)));
observable(this.params).replace(pars);
observable(this.props.currentProps).replace(pars.map(p =>
{

@ -4,8 +4,9 @@ import { observer } from 'mobx-react';
import * as React from 'react';
import { app } from '../../../ApplicationServices/Application';
import { ToplineUrls } from '../../../Common/HostUrl';
import { inflateBase64 } from "../../../Common/inflate";
import { PostJson, RequestStatus } from '../../../Common/Request';
import { deflate, getPolylineSVG, inflate, toplineFileIn } from '../../../Common/SerializeMaterial';
import { deflate, getPolylineSVG, toplineFileIn } from '../../../Common/SerializeMaterial';
import { CADFiler } from '../../../DatabaseServices/CADFiler';
import { Polyline } from '../../../DatabaseServices/Entity/Polyline';
import { CommandWrap } from '../../../Editor/CommandMachine';
@ -94,7 +95,7 @@ export class ToplineList extends React.Component<IToplineListProps, { isContextM
if (data.err_code === RequestStatus.Ok)
{
let file = inflate(data.toplines.file);
let file = inflateBase64(data.toplines.file);
let pl = toplineFileIn(file);
await CommandWrap(() =>
{

@ -7,8 +7,9 @@ import { buildTopline } from '../../../Add-on/DrawTopline';
import { GetCloseContour } from '../../../Add-on/Sweep';
import { app } from '../../../ApplicationServices/Application';
import { ToplineUrls } from '../../../Common/HostUrl';
import { inflateBase64 } from "../../../Common/inflate";
import { DirectoryId, PostJson, RequestStatus } from '../../../Common/Request';
import { deflate, getPolylineSVG, inflate, toplineFileIn } from '../../../Common/SerializeMaterial';
import { deflate, getPolylineSVG, toplineFileIn } from '../../../Common/SerializeMaterial';
import { CADFiler } from '../../../DatabaseServices/CADFiler';
import { Polyline } from '../../../DatabaseServices/Entity/Polyline';
import { CommandWrap } from '../../../Editor/CommandMachine';
@ -170,7 +171,7 @@ export class TopllineManage extends React.Component<ITopllineManageProps, ITopll
if (data.err_code === RequestStatus.Ok)
{
let file = inflate(data.toplines.file);
let file = inflateBase64(data.toplines.file);
let polyline = toplineFileIn(file);
await CommandWrap(async () =>
{

@ -1,12 +1,12 @@
import { Intent } from '@blueprintjs/core';
import * as React from 'react';
import { CURRENT_HOST, MaterialUrls } from './../../Common/HostUrl';
import { CommandWrap } from "../../Editor/CommandMachine";
import { inflateBase64 } from "../../Common/inflate";
import { PostJson, RequestStatus } from "../../Common/Request";
import { inflate } from "../../Common/SerializeMaterial";
import { CommandWrap } from "../../Editor/CommandMachine";
import { CURRENT_HOST, MaterialUrls } from './../../Common/HostUrl';
import { MaterialInAndAppendAppData } from './../../Common/SerializeMaterial';
import { AppToaster } from './../Components/Toaster';
import { CommonIframe } from './../Components/Common/CommonIframe';
import { Intent } from '@blueprintjs/core';
import { AppToaster } from './../Components/Toaster';
export class MetarialShop extends React.Component<{}, {}>{
private mtlIdSet = new Set();
@ -35,7 +35,7 @@ export class MetarialShop extends React.Component<{}, {}>{
{
this.mtlIdSet.add(material_id);
let file = data.materials.file;
let json = inflate(file);
let json = inflateBase64(file);
let mtl = MaterialInAndAppendAppData(JSON.parse(json), data.materials.name);
if (mtl)
{
@ -53,6 +53,6 @@ export class MetarialShop extends React.Component<{}, {}>{
url={MaterialUrls.buy}
title="材质购买"
onMessage={this.OnMessage}
/>
/>;
}
}

@ -4,8 +4,9 @@ import { appCache } from "../../Common/AppCache";
import { CheckObjectType, CheckoutValid } from "../../Common/CheckoutVaildValue";
import { DataAdapter } from "../../Common/DataAdapter";
import { DirUrl, TemplateUrls } from "../../Common/HostUrl";
import { inflateBase64 } from "../../Common/inflate";
import { DirectoryId, PostJson, RequestStatus } from "../../Common/Request";
import { deflate, EntitysIn, EntitysOut, GetEntitysLogo, inflate } from "../../Common/SerializeMaterial";
import { deflate, EntitysIn, EntitysOut, GetEntitysLogo } from "../../Common/SerializeMaterial";
import { StoreageKeys } from "../../Common/StoreageKeys";
import { ExtrudeHole } from "../../DatabaseServices/3DSolid/ExtrudeHole";
import { userConfig } from "../../Editor/UserConfig";
@ -330,7 +331,7 @@ export class DrillStore extends BoardStore
if (data.err_code === RequestStatus.Ok)
{
conf.tempName = data.modules.name;
let files = JSON.parse(inflate(data.modules.file));
let files = JSON.parse(inflateBase64(data.modules.file));
ens = EntitysIn(files) as ExtrudeHole[];
appCache.set(key, ens);
appCache.set(key + "name", data.modules.name);

Loading…
Cancel
Save