Sidebar-Industrial.js 3.16 KB

(function () {
	// Adds Atlassian shapes
	// industrial label
	Sidebar.prototype.addIndustrialPalette = function () {
		const { COMPONENT_TYPE } = this.enumCellBasicAttribute
		const { DEFAULT } = this.enumComponentType
		const gn = 'mxgraph.industrial';
		const dt = 'industrial';
		const label = '工业'
		const width = 66;
		const height = 74;
		const staticPath = `${Proxy_Prefix}/img/lib/thingskit/`
		const prefix = 'image;image=img/lib/thingskit/'
		const defaultStyle = ';imageAspect=0;'
		this.setCurrentSearchEntryLibrary(dt);

		// 自定义属性
		const cellAttribute = {
			[ COMPONENT_TYPE ]: DEFAULT
		}

		const graphPathLib = [
			{ name: '三级高速剪切机.svg', path: 'industrial/三级高速剪切机.svg' },
			{ name: '二甲氧基甲烷计量罐.svg', path: 'industrial/二甲氧基甲烷计量罐.svg' },
			{ name: '传送带.svg', path: 'industrial/传送带.svg' },
			{ name: '分仓.svg', path: 'industrial/分仓.svg' },
			{ name: '剪切机.svg', path: 'industrial/剪切机.svg' },
			{ name: '干线管道.svg', path: 'industrial/干线管道.svg' },
			{ name: '干酵母粉仓.svg', path: 'industrial/干酵母粉仓.svg' },
			{ name: '成品罐.svg', path: 'industrial/成品罐.svg' },
			{ name: '成熟度.svg', path: 'industrial/成熟度.svg' },
			{ name: '料仓.svg', path: 'industrial/料仓.svg' },
			{ name: '旋液分离器.svg', path: 'industrial/旋液分离器.svg' },
			{ name: '智能控制周期.svg', path: 'industrial/智能控制周期.svg' },
			{ name: '机组.svg', path: 'industrial/机组.svg' },
			{ name: '母液槽.svg', path: 'industrial/母液槽.svg' },
			{ name: '母液槽2.svg', path: 'industrial/母液槽2.svg' },
			{ name: '沥青混合料槽.svg', path: 'industrial/沥青混合料槽.svg' },
			{ name: '沥青膨胀罐.svg', path: 'industrial/沥青膨胀罐.svg' },
			{ name: '泄料桶.svg', path: 'industrial/泄料桶.svg' },
			{ name: '消烟管.svg', path: 'industrial/消烟管.svg' },
			{ name: '涡轮.svg', path: 'industrial/涡轮.svg' },
			{ name: '液态渣池.svg', path: 'industrial/液态渣池.svg' },
			{ name: '漏斗.svg', path: 'industrial/漏斗.svg' },
			{ name: '烧结机.svg', path: 'industrial/烧结机.svg' },
			{ name: '畜粪池.svg', path: 'industrial/畜粪池.svg' },
			{ name: '石灰粉仓.svg', path: 'industrial/石灰粉仓.svg' },
			{ name: '酒槽水.svg', path: 'industrial/酒槽水.svg' },
			{ name: '高效汽轮机.svg', path: 'industrial/高效汽轮机.svg' },
		]

		const lib = graphPathLib.map(item => {
			item.staticPath = staticPath + item.path
			return item
		})

		const fns = graphPathLib.map(item => {
			return this.addEntry(this.getTagsForStencil(gn, item.name, dt).join(' '), mxUtils.bind(this, function () {
				const cell = new mxCell('', new mxGeometry(0, 0, width, height), `${ prefix }${ item.path }${ defaultStyle }`);
				cell.setVertex(true)
				this.setCellAttributes(cell, cellAttribute)
				return this.createVertexTemplateFromCells([ cell ], cell.geometry.width, cell.geometry.height, item.name);
			}));
		})

		this.setVariableImageLib(dt, label, lib)

		this.addPaletteFunctions(dt, label, false, fns);

		this.setCurrentSearchEntryLibrary();
	};
})();