Adapter.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. module INSPECTOR {
  2. export abstract class Adapter {
  3. protected _obj: any;
  4. // a unique name for this adapter, to retrieve its own key in the local storage
  5. private static _name: string = BABYLON.Geometry.RandomId();
  6. constructor(obj: any) {
  7. this._obj = obj;
  8. }
  9. /** Returns the name displayed in the tree */
  10. public abstract id(): string;
  11. /** Returns the type of this object - displayed in the tree */
  12. public abstract type(): string;
  13. /** Returns the list of properties to be displayed for this adapter */
  14. public abstract getProperties(): Array<PropertyLine>;
  15. /** Returns true if the given object correspond to this */
  16. public correspondsTo(obj: any) {
  17. return obj === this._obj;
  18. }
  19. /** Returns the adapter unique name */
  20. public get name(): string {
  21. return Adapter._name;
  22. }
  23. /**
  24. * Returns the actual object used for this adapter
  25. */
  26. public get object(): any {
  27. return this._obj;
  28. }
  29. /** Returns the list of tools available for this adapter */
  30. public abstract getTools(): Array<AbstractTreeTool>;
  31. }
  32. }