mirror of
https://github.com/billsonnn/nitro-converter.git
synced 2024-11-22 15:40:52 +01:00
Add stuff skelly missed
This commit is contained in:
parent
3127b33eb5
commit
e6a7f3dde5
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -6,6 +6,7 @@
|
||||
"typescript.format.placeOpenBraceOnNewLineForFunctions": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll": true,
|
||||
"source.fixAll.sortJSON": false,
|
||||
"source.organizeImports": true,
|
||||
},
|
||||
"emmet.showExpandedAbbreviation": "never",
|
||||
|
4
src/mapping/json/figuredata/IFigureDataHiddenLayer.ts
Normal file
4
src/mapping/json/figuredata/IFigureDataHiddenLayer.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export interface IFigureDataHiddenLayer
|
||||
{
|
||||
partType?: string;
|
||||
}
|
@ -1,12 +1,15 @@
|
||||
import { IFigureDataHiddenLayer } from './IFigureDataHiddenLayer';
|
||||
import { IFigureDataPart } from './IFigureDataPart';
|
||||
|
||||
export interface IFigureDataSet
|
||||
{
|
||||
id?: number;
|
||||
gender?: string;
|
||||
club?: boolean;
|
||||
club?: number;
|
||||
colorable?: boolean;
|
||||
selectable?: boolean;
|
||||
preselectable?: boolean;
|
||||
sellable?: boolean;
|
||||
parts?: IFigureDataPart[];
|
||||
hiddenLayers?: IFigureDataHiddenLayer[];
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
export * from './IFigureData';
|
||||
export * from './IFigureDataColor';
|
||||
export * from './IFigureDataHiddenLayer';
|
||||
export * from './IFigureDataPalette';
|
||||
export * from './IFigureDataPart';
|
||||
export * from './IFigureDataSet';
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { IFigureDataHiddenLayer } from '../json';
|
||||
import { IFigureDataPalette } from '../json/figuredata/IFigureDataPalette';
|
||||
import { IFigureDataSet } from '../json/figuredata/IFigureDataSet';
|
||||
import { FigureDataHiddenLayerXML } from '../xml';
|
||||
import { FigureDataColorXML } from '../xml/figuredata/FigureDataColorXML';
|
||||
import { FigureDataPaletteXML } from '../xml/figuredata/FigureDataPaletteXML';
|
||||
import { FigureDataXML } from '../xml/figuredata/FigureDataXML';
|
||||
@ -131,6 +133,7 @@ export class FigureDataMapper extends Mapper
|
||||
if(setXML.colorable !== undefined) setType.colorable = setXML.colorable;
|
||||
if(setXML.selectable !== undefined) setType.selectable = setXML.selectable;
|
||||
if(setXML.preselectable !== undefined) setType.preselectable = setXML.preselectable;
|
||||
if(setXML.sellable !== undefined) setType.sellable = setXML.sellable;
|
||||
|
||||
if(setXML.parts !== undefined)
|
||||
{
|
||||
@ -142,6 +145,16 @@ export class FigureDataMapper extends Mapper
|
||||
}
|
||||
}
|
||||
|
||||
if(setXML.hiddenLayers !== undefined)
|
||||
{
|
||||
if(setXML.hiddenLayers.length)
|
||||
{
|
||||
setType.hiddenLayers = [];
|
||||
|
||||
FigureDataMapper.mapFigureDataHiddenLayers(setXML.hiddenLayers, setType.hiddenLayers);
|
||||
}
|
||||
}
|
||||
|
||||
output.push(setType);
|
||||
}
|
||||
}
|
||||
@ -163,4 +176,18 @@ export class FigureDataMapper extends Mapper
|
||||
output.push(part);
|
||||
}
|
||||
}
|
||||
|
||||
private static mapFigureDataHiddenLayers(xml: FigureDataHiddenLayerXML[], output: IFigureDataHiddenLayer[]): void
|
||||
{
|
||||
if(!xml || !xml.length || !output) return;
|
||||
|
||||
for(const hiddenLayerXML of xml)
|
||||
{
|
||||
const hiddenLayer: IFigureDataHiddenLayer = {};
|
||||
|
||||
if(hiddenLayerXML.partType !== undefined) hiddenLayer.partType = hiddenLayerXML.partType;
|
||||
|
||||
output.push(hiddenLayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
16
src/mapping/xml/figuredata/FigureDataHiddenLayerXML.ts
Normal file
16
src/mapping/xml/figuredata/FigureDataHiddenLayerXML.ts
Normal file
@ -0,0 +1,16 @@
|
||||
export class FigureDataHiddenLayerXML
|
||||
{
|
||||
private _partType: string;
|
||||
|
||||
constructor(xml: any)
|
||||
{
|
||||
const attributes = xml.$;
|
||||
|
||||
this._partType = ((attributes && attributes.parttype) || '');
|
||||
}
|
||||
|
||||
public get partType(): string
|
||||
{
|
||||
return this._partType;
|
||||
}
|
||||
}
|
@ -1,14 +1,17 @@
|
||||
import { FigureDataHiddenLayerXML } from './FigureDataHiddenLayerXML';
|
||||
import { FigureDataPartXML } from './FigureDataPartXML';
|
||||
|
||||
export class FigureDataSetXML
|
||||
{
|
||||
private _id: number;
|
||||
private _gender: string;
|
||||
private _club: boolean;
|
||||
private _club: number;
|
||||
private _colorable: boolean;
|
||||
private _selectable: boolean;
|
||||
private _preselectable: boolean;
|
||||
private _sellable: boolean;
|
||||
private _parts: FigureDataPartXML[];
|
||||
private _hiddenLayers: FigureDataHiddenLayerXML[];
|
||||
|
||||
constructor(xml: any)
|
||||
{
|
||||
@ -16,10 +19,11 @@ export class FigureDataSetXML
|
||||
|
||||
this._id = ((attributes && parseInt(attributes.id)) || 0);
|
||||
this._gender = ((attributes && attributes.gender) || '');
|
||||
this._club = ((attributes && parseInt(attributes.club) === 1) || false);
|
||||
this._club = ((attributes && parseInt(attributes.club)) || 0);
|
||||
this._colorable = ((attributes && parseInt(attributes.colorable) === 1) || false);
|
||||
this._selectable = ((attributes && parseInt(attributes.selectable) === 1) || false);
|
||||
this._preselectable = ((attributes && parseInt(attributes.preselectable) === 1) || false);
|
||||
this._sellable = ((attributes && parseInt(attributes.sellable) === 1) || false);
|
||||
|
||||
if(xml.part !== undefined)
|
||||
{
|
||||
@ -35,6 +39,21 @@ export class FigureDataSetXML
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(xml.hiddenlayers !== undefined)
|
||||
{
|
||||
this._hiddenLayers = [];
|
||||
|
||||
for(const hiddenLayer of xml.hiddenlayers)
|
||||
{
|
||||
const layers = hiddenLayer.layer;
|
||||
|
||||
if(layers !== undefined)
|
||||
{
|
||||
if(Array.isArray(layers)) for(const layer of layers) this._hiddenLayers.push(new FigureDataHiddenLayerXML(layer));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public get id(): number
|
||||
@ -47,7 +66,7 @@ export class FigureDataSetXML
|
||||
return this._gender;
|
||||
}
|
||||
|
||||
public get club(): boolean
|
||||
public get club(): number
|
||||
{
|
||||
return this._club;
|
||||
}
|
||||
@ -67,8 +86,18 @@ export class FigureDataSetXML
|
||||
return this._preselectable;
|
||||
}
|
||||
|
||||
public get sellable(): boolean
|
||||
{
|
||||
return this._sellable;
|
||||
}
|
||||
|
||||
public get parts(): FigureDataPartXML[]
|
||||
{
|
||||
return this._parts;
|
||||
}
|
||||
|
||||
public get hiddenLayers(): FigureDataHiddenLayerXML[]
|
||||
{
|
||||
return this._hiddenLayers;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
export * from './FigureDataColorXML';
|
||||
export * from './FigureDataHiddenLayerXML';
|
||||
export * from './FigureDataPaletteXML';
|
||||
export * from './FigureDataPartXML';
|
||||
export * from './FigureDataSetTypeXML';
|
||||
|
Loading…
Reference in New Issue
Block a user