/** * Raw Shape API object - should always correspond with the Shape Schema * @param id * @param name * @param parentEntity * @constructor */ GameLib.D3.API.Shape = function( id, name, parentEntity ) { if (GameLib.Utils.UndefinedOrNull(id)) { id = GameLib.Utils.RandomId(); } this.id = id; if (GameLib.Utils.UndefinedOrNull(name)) { name = 'Shape (' + this.id + ')'; } this.name = name; if (GameLib.Utils.UndefinedOrNull(parentEntity)) { parentEntity = null; } this.parentEntity = parentEntity; }; GameLib.D3.API.Shape.prototype = Object.create(GameLib.Component.prototype); GameLib.D3.API.Shape.prototype.constructor = GameLib.D3.API.Shape; /** * Creates an API Shape from an Object Shape * @param objectShape * @constructor */ GameLib.D3.API.Shape.FromObject = function(objectShape) { return new GameLib.D3.API.Shape( objectShape.id, objectShape.name, objectShape.parentEntity ); };