123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- /**
- * $Id: mxCabinets.js,v 1.0 2014/04/15 07:05:39 mate Exp $
- * Copyright (c) 2006-2014, JGraph Ltd
- */
- //**********************************************************************************************************************************************************
- //Cabinet
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxCabinetsCabinet(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxCabinetsCabinet, mxShape);
- mxCabinetsCabinet.prototype.cst = {
- HAS_STAND : 'hasStand',
- CABINET : 'mxgraph.cabinets.cabinet'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxCabinetsCabinet.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- this.background(c, 0, 0, w, h);
- c.setShadow(false);
- this.foreground(c, 0, 0, w, h);
- };
- mxCabinetsCabinet.prototype.background = function(c, x, y, w, h)
- {
- c.rect(0, 0, w, h);
- c.fillAndStroke();
- };
- mxCabinetsCabinet.prototype.foreground = function(c, x, y, w, h)
- {
- var wallTh = 15;
- c.rect(0, 0, w, wallTh);
- c.stroke();
-
- c.begin();
- c.moveTo(wallTh, wallTh);
- c.lineTo(wallTh, h);
- c.moveTo(w - wallTh, wallTh);
- c.lineTo(w - wallTh, h);
- c.stroke();
-
- var hasStand = mxUtils.getValue(this.style, mxCabinetsCabinet.prototype.cst.HAS_STAND, '1');
-
- if (hasStand === 1)
- {
- c.rect(0, h - 40, w, 40);
- c.fillAndStroke();
- }
- else
- {
- c.rect(0, h - wallTh, w, wallTh);
- c.fillAndStroke();
- };
- };
- mxCellRenderer.registerShape(mxCabinetsCabinet.prototype.cst.CABINET, mxCabinetsCabinet);
- //**********************************************************************************************************************************************************
- //Cover Plate
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxCabinetsCoverPlate(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxCabinetsCoverPlate, mxShape);
- mxCabinetsCoverPlate.prototype.cst = {
- COVER_PLATE : 'mxgraph.cabinets.coverPlate'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxCabinetsCoverPlate.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- this.background(c, 0, 0, w, h);
- c.setShadow(false);
- this.foreground(c, 0, 0, w, h);
- };
- mxCabinetsCoverPlate.prototype.background = function(c, x, y, w, h)
- {
- c.begin();
- c.moveTo(0, 0);
- c.lineTo(w, 0);
- c.lineTo(w, h);
- c.lineTo(0, h);
- c.close();
- c.moveTo(10, h * 0.5 - 12.5);
- c.lineTo(10, h * 0.5 + 12.5);
- c.lineTo(w - 10, h * 0.5 + 12.5);
- c.lineTo(w - 10, h * 0.5 - 12.5);
- c.close();
- c.fillAndStroke();
- };
- mxCabinetsCoverPlate.prototype.foreground = function(c, x, y, w, h)
- {
- };
- mxCellRenderer.registerShape(mxCabinetsCoverPlate.prototype.cst.COVER_PLATE, mxCabinetsCoverPlate);
- //**********************************************************************************************************************************************************
- //Dimension
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxCabinetsDimension(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxCabinetsDimension, mxShape);
- mxCabinetsDimension.prototype.cst = {
- DIMENSION : 'mxgraph.cabinets.dimension'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxCabinetsDimension.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- this.background(c, x, y, w, h);
- };
- mxCabinetsDimension.prototype.background = function(c, x, y, w, h)
- {
- c.begin();
- c.moveTo(0, 20);
- c.lineTo(w, 20);
- c.moveTo(10, 15);
- c.lineTo(0, 20);
- c.lineTo(10, 25);
- c.moveTo(w - 10, 15);
- c.lineTo(w, 20);
- c.lineTo(w - 10, 25);
- c.moveTo(0, 15);
- c.lineTo(0, h);
- c.moveTo(w, 15);
- c.lineTo(w, h);
- c.stroke();
- };
- mxCellRenderer.registerShape(mxCabinetsDimension.prototype.cst.DIMENSION, mxCabinetsDimension);
- //**********************************************************************************************************************************************************
- //Dimension Bottom
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxCabinetsDimensionBottom(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxCabinetsDimensionBottom, mxShape);
- mxCabinetsDimensionBottom.prototype.cst = {
- DIMENSION : 'mxgraph.cabinets.dimensionBottom'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxCabinetsDimensionBottom.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- this.background(c, x, y, w, h);
- };
- mxCabinetsDimensionBottom.prototype.background = function(c, x, y, w, h)
- {
- c.begin();
- c.moveTo(0, h - 20);
- c.lineTo(w, h - 20);
- c.moveTo(10, h - 15);
- c.lineTo(0, h - 20);
- c.lineTo(10, h - 25);
- c.moveTo(w - 10, h - 15);
- c.lineTo(w, h - 20);
- c.lineTo(w - 10, h - 25);
- c.moveTo(0, h - 15);
- c.lineTo(0, 0);
- c.moveTo(w, h - 15);
- c.lineTo(w, 0);
- c.stroke();
- };
- mxCellRenderer.registerShape(mxCabinetsDimensionBottom.prototype.cst.DIMENSION, mxCabinetsDimensionBottom);
|