/** * Raw ImageFactory API object - should always correspond with the ImageFactory Schema * @param id * @param name * @param baseUrl String * @param parentEntity * @constructor */ GameLib.D3.API.ImageFactory = function( id, name, baseUrl, parentEntity ) { GameLib.Component.call( this, GameLib.Component.COMPONENT_IMAGE_FACTORY, null, parentEntity ); if (GameLib.Utils.UndefinedOrNull(id)) { id = GameLib.Utils.RandomId(); } this.id = id; if (GameLib.Utils.UndefinedOrNull(name)) { name = 'ImageFactory (' + this.id + ')'; } this.name = name; if (GameLib.Utils.UndefinedOrNull(baseUrl)) { baseUrl = ''; console.warn('No baseURL defined for image factory'); } this.baseUrl = baseUrl; }; GameLib.D3.API.ImageFactory.prototype = Object.create(GameLib.Component.prototype); GameLib.D3.API.ImageFactory.prototype.constructor = GameLib.D3.API.ImageFactory; /** * Returns an API ImageFactory from an Object ImageFactory * @param objectImageFactory * @constructor */ GameLib.D3.API.ImageFactory.FromObjectImageFactory = function(objectImageFactory) { return new GameLib.D3.API.ImageFactory( objectImageFactory.id, objectImageFactory.name, objectImageFactory.baseUrl, objectImageFactory.parentEntity ); };