Removed unnecessary services (#125)

They have been replaced with Store.
This commit is contained in:
Nejc Zdovc
2016-10-21 16:36:41 +02:00
committed by József Farkas
parent b16e83fc30
commit a653333c9b
8 changed files with 78 additions and 102 deletions

View File

@@ -1,43 +0,0 @@
import { Injectable } from '@angular/core';
import { Keymap } from '../config-serializer/config-items/Keymap';
import { UhkConfiguration } from '../config-serializer/config-items/UhkConfiguration';
import { SvgModule } from '../components/svg/module/svg-module.model';
@Injectable()
export class DataProviderService {
private uhkConfiguration: UhkConfiguration;
constructor() {
this.uhkConfiguration = new UhkConfiguration().fromJsObject(require('json!../config-serializer/uhk-config.json'));
}
getUHKConfig(): UhkConfiguration {
return this.uhkConfiguration;
}
getDefaultKeymaps(): Keymap[] {
return (<any[]>require('json!../config-serializer/preset-keymaps.json')).map(keymap => new Keymap().fromJsObject(keymap));
}
getKeyboardSvgAttributes(): { viewBox: string, transform: string, fill: string } {
let svg: any = this.getBaseLayer();
return {
viewBox: svg.$.viewBox,
transform: svg.g[0].$.transform,
fill: svg.g[0].$.fill
};
}
getSvgModules(): SvgModule[] {
let modules = this.getBaseLayer().g[0].g.map((obj: any) => new SvgModule(obj));
return [modules[1], modules[0]]; // TODO: remove if the svg will be correct
}
private getBaseLayer(): any {
return require('xml!../../images/base-layer.svg').svg;
}
}

View File

@@ -1,20 +0,0 @@
import { Injectable } from '@angular/core';
import { UhkConfiguration } from '../config-serializer/config-items/UhkConfiguration';
import { DataProviderService } from './data-provider.service';
@Injectable()
export class UhkConfigurationService {
private configuration: UhkConfiguration;
constructor(private dataProviderService: DataProviderService) {
this.configuration = new UhkConfiguration().fromJsObject(this.dataProviderService.getUHKConfig());
}
getUhkConfiguration(): UhkConfiguration {
return this.configuration;
}
}