From d9df4ad2f3418e7f21dc7c536533b7da8963fad5 Mon Sep 17 00:00:00 2001 From: Daniel Heckert Date: Mon, 16 Sep 2024 13:48:26 +0200 Subject: [PATCH] #157 convert builtInIcons to Dictionary --- src/app/domain/entities/dictionary.ts | 12 +- .../tools/icon-set-config/domain/allIcons.ts | 980 ++++++++++++++---- .../services/icon-dictionary.service.ts | 6 +- 3 files changed, 764 insertions(+), 234 deletions(-) diff --git a/src/app/domain/entities/dictionary.ts b/src/app/domain/entities/dictionary.ts index 5e9228bd..b359203d 100644 --- a/src/app/domain/entities/dictionary.ts +++ b/src/app/domain/entities/dictionary.ts @@ -37,7 +37,7 @@ export class Dictionary { putEntry(entry: Entry): void { if (!this.has(entry.key)) { - this.entries.push(new Entry(entry.value, entry.key)); + this.entries.push(entry); } } @@ -51,6 +51,10 @@ export class Dictionary { }); } + addBuildInIcons(buildInIcons: Dictionary): void { + buildInIcons.entries.forEach(entry => this.set(entry.key, entry.value)) + } + appendDict(dict: Dictionary): void { dict.entries.forEach((entry) => this.putEntry(entry)); } @@ -70,11 +74,13 @@ export class Dictionary { } export class Entry { - value: any; + value: any; // ToDo: dh, I think type of any is not a good choice. Try to figur out if we can use typed objects here. key: string; + keyWords: string[]; - constructor(value: any, key: string) { + constructor(value: any, key: string, keyWords: string[] = []) { this.value = value; this.key = key; + this.keyWords = keyWords; } } diff --git a/src/app/tools/icon-set-config/domain/allIcons.ts b/src/app/tools/icon-set-config/domain/allIcons.ts index 4a68ad3c..7d027f31 100644 --- a/src/app/tools/icon-set-config/domain/allIcons.ts +++ b/src/app/tools/icon-set-config/domain/allIcons.ts @@ -1,234 +1,758 @@ -import { Dictionary } from 'src/app/domain/entities/dictionary'; - +import { Dictionary, Entry } from 'src/app/domain/entities/dictionary'; export let customIcons = new Dictionary(); // These SVGs are used to render the actors/work objects on the canvas and in the iconset configuration. For palette and context pad, icons.css is used. -export const builtInIcons = { - Person: - '', - Group: - '', - Pet: '', - Conversation: - '', - World: - '', - Store: - '', - Theater: - '', - Business: - '', - Water: - '', - Hotel: - '', - Dining: - '', - 'Gas-station': - '', - 'Meeting-room': - '', - Courthouse: - '', - Flag: '', - Place: - '', - Car: '', - Bus: '', - Train: - '', - Truck: - '', - Taxi: '', - Bike: '', - Boat: '', - Motorcycle: - '', - Plane: - '', - 'Flight-takeoff': - '', - 'Flight-landing': - '', - Shuttle: - '', - Walking: - '', - Traffic: - '', - Commute: - '', - System: - '', - Printer: - '', - Document: - '', - Folder: - '', - Call: '', - Email: - '', - Copyright: - '', - DNS: '', - Settings: - '', - Cellphone: - '', - Update: - '', - Briefcase: - '', - Microphone: - '', - Signal: - '', - Key: '', - Pencil: - '', - Sum: '', - Headset: - '', - Keyboard: - '', - Mouse: - '', - Router: - '', - Scanner: - '', - Security: - '', - Desktop: - '', - 'Speaker-phone': - '', - Tablet: - '', - Label: - '', - Receipt: - '', - Calendar: - '', - Cloud: - '', - Assessment: - '', - Dashboard: - '', - 'Pie-chart': - '', - Problem: - '', - 'Picture-as-PDF': - '', - Grid: '', - Watch: - '', - Euro: '', - Dollar: - '', - Info: '', - Alarm: - '', - Wrench: - '', - 'Circle-Arrows': - '', - 'Credit-Card': - '', - Favorite: - '', - Gavel: - '', - Blind: - '', - Hourglass: - '', - Time: '', - Search: - '', - Shopping: - '', - 'Thumb-up': - '', - 'Thumb-down': - '', - 'Thumb-up-down': - '', - Couch: - '', - Attach: - '', - Ruler: - '', - Education: - '', - 'How-To-Reg': - '', - 'View-List': - '', - Accessible: - '', - 'Account-Circle': - '', - Assignment: - '', - Battery: - '', - Book: '', - Bug: '', - 'Change-History': - '', - 'Check-Circle': - '', - Code: '', - 'Contact-Mail': - '', - Crop: '', - DVR: '', - Error: - '', - Extension: - '', - Face: '', - Fastfood: - '', - Fingerprint: - '', - Hand: '', - Help: '', - Image: - '', - Lightbulb: - '', - Lock: '', - Loyalty: - '', - 'Picture-in-Picture': - '', - Portrait: - '', - Rocket: - '', - Satellite: - '', - Share: - '', - Slideshow: - '', - Star: '', - Sun: '', - Table: - '', - Videocam: - '', - Wysiwyg: - '', -}; +export const builtInIcons = new Dictionary(); +const person = new Entry( + '', + 'Person', + [], +); +builtInIcons.putEntry(person); +const group = new Entry( + '', + 'Group', + [], +); +builtInIcons.putEntry(group); +const pet = new Entry( + '', + 'Pet', + [], +); +builtInIcons.putEntry(pet); +const conversation = new Entry( + '', + 'Conversation', + [], +); +builtInIcons.putEntry(conversation); +const world = new Entry( + '', + 'World', + [], +); +builtInIcons.putEntry(world); +const store = new Entry( + '', + 'Store', + [], +); +builtInIcons.putEntry(store); +const theater = new Entry( + '', + 'Theater', + [], +); +builtInIcons.putEntry(theater); +const business = new Entry( + '', + 'Business', + [], +); +builtInIcons.putEntry(business); +const water = new Entry( + '', + 'Water', + [], +); +builtInIcons.putEntry(water); +const hotel = new Entry( + '', + 'Hotel', + [], +); +builtInIcons.putEntry(hotel); +const dining = new Entry( + '', + 'Dining', + [], +); +builtInIcons.putEntry(dining); +const gasStation = new Entry( + '', + 'Gas-station', + [], +); +builtInIcons.putEntry(gasStation); +const meetingRoom = new Entry( + '', + 'Meeting-room', + [], +); +builtInIcons.putEntry(meetingRoom); +const courthouse = new Entry( + '', + 'Courthouse', + [], +); +builtInIcons.putEntry(courthouse); +const flag = new Entry( + '', + 'Flag', + [], +); +builtInIcons.putEntry(flag); +const place = new Entry( + '', + 'Place', + [], +); +builtInIcons.putEntry(place); +const car = new Entry( + '', + 'Car', + [], +); +builtInIcons.putEntry(car); +const bus = new Entry( + '', + 'Bus', + [], +); +builtInIcons.putEntry(bus); +const train = new Entry( + '', + 'Train', + [], +); +builtInIcons.putEntry(train); +const truck = new Entry( + '', + 'Truck', + [], +); +builtInIcons.putEntry(truck); +const taxi = new Entry( + '', + 'Taxi', + [], +); +builtInIcons.putEntry(taxi); +const bike = new Entry( + '', + 'Bike', + [], +); +builtInIcons.putEntry(bike); +const boat = new Entry( + '', + 'Boat', + [], +); +builtInIcons.putEntry(boat); +const motorcycle = new Entry( + '', + 'Motorcycle', + [], +); +builtInIcons.putEntry(motorcycle); +const plane = new Entry( + '', + 'Plane', + [], +); +builtInIcons.putEntry(plane); +const flightTakeoff = new Entry( + '', + 'Flight-takeoff', + [], +); +builtInIcons.putEntry(flightTakeoff); +const flightLanding = new Entry( + '', + 'Flight-landing', + [], +); +builtInIcons.putEntry(flightLanding); +const shuttle = new Entry( + '', + 'Shuttle', + [], +); +builtInIcons.putEntry(shuttle); +const walking = new Entry( + '', + 'Walking', + [], +); +builtInIcons.putEntry(walking); +const traffic = new Entry( + '', + 'Traffic', + [], +); +builtInIcons.putEntry(traffic); +const commute = new Entry( + '', + 'Commute', + [], +); +builtInIcons.putEntry(commute); +const system = new Entry( + '', + 'System', + [], +); +builtInIcons.putEntry(system); +const printer = new Entry( + '', + 'Printer', + [], +); +builtInIcons.putEntry(printer); +const document = new Entry( + '', + 'Document', + [], +); +builtInIcons.putEntry(document); +const folder = new Entry( + '', + 'Folder', + [], +); +builtInIcons.putEntry(folder); +const call = new Entry( + '', + 'Call', + [], +); +builtInIcons.putEntry(call); +const email = new Entry( + '', + 'Email', + [], +); +builtInIcons.putEntry(email); +const copyright = new Entry( + '', + 'Copyright', + [], +); +builtInIcons.putEntry(copyright); +const dns = new Entry( + '', + 'DNS', + [], +); +builtInIcons.putEntry(dns); +const settings = new Entry( + '', + 'Settings', + [], +); +builtInIcons.putEntry(settings); +const cellphone = new Entry( + '', + 'Cellphone', + [], +); +builtInIcons.putEntry(cellphone); +const update = new Entry( + '', + 'Update', + [], +); +builtInIcons.putEntry(update); +const briefcase = new Entry( + '', + 'Briefcase', + [], +); +builtInIcons.putEntry(briefcase); +const microphone = new Entry( + '', + 'Microphone', + [], +); +builtInIcons.putEntry(microphone); +const signal = new Entry( + '', + 'Signal', + [], +); +builtInIcons.putEntry(signal); +const key = new Entry( + '', + 'Key', + [], +); +builtInIcons.putEntry(key); +const pencil = new Entry( + '', + 'Pencil', + [], +); +builtInIcons.putEntry(pencil); +const sum = new Entry( + '', + 'Sum', + [], +); +builtInIcons.putEntry(sum); +const headset = new Entry( + '', + 'Headset', + [], +); +builtInIcons.putEntry(headset); +const keyboard = new Entry( + '', + 'Keyboard', + [], +); +builtInIcons.putEntry(keyboard); +const mouse = new Entry( + '', + 'Mouse', + [], +); +builtInIcons.putEntry(mouse); +const router = new Entry( + '', + 'Router', + [], +); +builtInIcons.putEntry(router); +const scanner = new Entry( + '', + 'Scanner', + [], +); +builtInIcons.putEntry(scanner); +const security = new Entry( + '', + 'Security', + [], +); +builtInIcons.putEntry(security); +const desktop = new Entry( + '', + 'Desktop', + [], +); +builtInIcons.putEntry(desktop); +const speakerPhone = new Entry( + '', + 'Speaker-phone', + [], +); +builtInIcons.putEntry(speakerPhone); +const tablet = new Entry( + '', + 'Tablet', + [], +); +builtInIcons.putEntry(tablet); +const label = new Entry( + '', + 'Label', + [], +); +builtInIcons.putEntry(label); +const receipt = new Entry( + '', + 'Receipt', + [], +); +builtInIcons.putEntry(receipt); +const calendar = new Entry( + '', + 'Calendar', + [], +); +builtInIcons.putEntry(calendar); +const cloud = new Entry( + '', + 'Cloud', + [], +); +builtInIcons.putEntry(cloud); +const assessment = new Entry( + '', + 'Assessment', + [], +); +builtInIcons.putEntry(assessment); +const dashboard = new Entry( + '', + 'Dashboard', + [], +); +builtInIcons.putEntry(dashboard); +const pieChart = new Entry( + '', + 'Pie-chart', + [], +); +builtInIcons.putEntry(pieChart); +const problem = new Entry( + '', + 'Problem', + [], +); +builtInIcons.putEntry(problem); +const pictureAsPdf = new Entry( + '', + 'Picture-as-PDF', + [], +); +builtInIcons.putEntry(pictureAsPdf); +const grid = new Entry( + '', + 'Grid', + [], +); +builtInIcons.putEntry(grid); +const watch = new Entry( + '', + 'Watch', + [], +); +builtInIcons.putEntry(watch); +const euro = new Entry( + '', + 'Euro', + [], +); +builtInIcons.putEntry(euro); +const dollar = new Entry( + '', + 'Dollar', + [], +); +builtInIcons.putEntry(dollar); +const info = new Entry( + '', + 'Info', + [], +); +builtInIcons.putEntry(info); +const alarm = new Entry( + '', + 'Alarm', + [], +); +builtInIcons.putEntry(alarm); +const wrench = new Entry( + '', + 'Wrench', + [], +); +builtInIcons.putEntry(wrench); +const circleArrows = new Entry( + '', + 'Circle-Arrows', + [], +); +builtInIcons.putEntry(circleArrows); +const creditCard = new Entry( + '', + 'Credit-Card', + [], +); +builtInIcons.putEntry(creditCard); +const favorite = new Entry( + '', + 'Favorite', + [], +); +builtInIcons.putEntry(favorite); +const gavel = new Entry( + '', + 'Gavel', + [], +); +builtInIcons.putEntry(gavel); +const blind = new Entry( + '', + 'Blind', + [], +); +builtInIcons.putEntry(blind); +const hourglass = new Entry( + '', + 'Hourglass', + [], +); +builtInIcons.putEntry(hourglass); +const time = new Entry( + '', + 'Time', + [], +); +builtInIcons.putEntry(time); +const search = new Entry( + '', + 'Search', + [], +); +builtInIcons.putEntry(search); +const shopping = new Entry( + '', + 'Shopping', + [], +); +builtInIcons.putEntry(shopping); +const thumbUp = new Entry( + '', + 'Thumb-up', + [], +); +builtInIcons.putEntry(thumbUp); +const thumbDown = new Entry( + '', + 'Thumb-down', + [], +); +builtInIcons.putEntry(thumbDown); +const thumbUpDown = new Entry( + '', + 'Thumb-up-down', + [], +); +builtInIcons.putEntry(thumbUpDown); +const couch = new Entry( + '', + 'Couch', + [], +); +builtInIcons.putEntry(couch); +const attach = new Entry( + '', + 'Attach', + [], +); +builtInIcons.putEntry(attach); +const ruler = new Entry( + '', + 'Ruler', + [], +); +builtInIcons.putEntry(ruler); +const education = new Entry( + '', + 'Education', + [], +); +builtInIcons.putEntry(education); +const howToReg = new Entry( + '', + 'How-To-Reg', + [], +); +builtInIcons.putEntry(howToReg); +const viewList = new Entry( + '', + 'View-List', + [], +); +builtInIcons.putEntry(viewList); +const accessible = new Entry( + '', + 'Accessible', + [], +); +builtInIcons.putEntry(accessible); +const accountCircle = new Entry( + '', + 'Account-Circle', + [], +); +builtInIcons.putEntry(accountCircle); +const assignment = new Entry( + '', + 'Assignment', + [], +); +builtInIcons.putEntry(assignment); +const battery = new Entry( + '', + 'Battery', + [], +); +builtInIcons.putEntry(battery); +const book = new Entry( + '', + 'Book', + [], +); +builtInIcons.putEntry(book); +const bug = new Entry( + '', + 'Bug', + [], +); +builtInIcons.putEntry(bug); +const changeHistory = new Entry( + '', + 'Change-History', + [], +); +builtInIcons.putEntry(changeHistory); +const checkCircle = new Entry( + '', + 'Check-Circle', + [], +); +builtInIcons.putEntry(checkCircle); +const code = new Entry( + '', + 'Code', + [], +); +builtInIcons.putEntry(code); +const contactMail = new Entry( + '', + 'Contact-Mail', + [], +); +builtInIcons.putEntry(contactMail); +const crop = new Entry( + '', + 'Crop', + [], +); +builtInIcons.putEntry(crop); +const dvr = new Entry( + '', + 'DVR', + [], +); +builtInIcons.putEntry(dvr); +const error = new Entry( + '', + 'Error', + [], +); +builtInIcons.putEntry(error); +const extension = new Entry( + '', + 'Extension', + [], +); +builtInIcons.putEntry(extension); +const face = new Entry( + '', + 'Face', + [], +); +builtInIcons.putEntry(face); +const fastfood = new Entry( + '', + 'Fastfood', + [], +); +builtInIcons.putEntry(fastfood); +const fingerprint = new Entry( + '', + 'Fingerprint', + [], +); +builtInIcons.putEntry(fingerprint); +const hand = new Entry( + '', + 'Hand', + [], +); +builtInIcons.putEntry(hand); +const help = new Entry( + '', + 'Help', + [], +); +builtInIcons.putEntry(help); +const image = new Entry( + '', + 'Image', + [], +); +builtInIcons.putEntry(image); +const lightbulb = new Entry( + '', + 'Lightbulb', + [], +); +builtInIcons.putEntry(lightbulb); +const lock = new Entry( + '', + 'Lock', + [], +); +builtInIcons.putEntry(lock); +const loyalty = new Entry( + '', + 'Loyalty', + [], +); +builtInIcons.putEntry(loyalty); +const pictureInPicture = new Entry( + '', + 'Picture-in-Picture', + [], +); +builtInIcons.putEntry(pictureInPicture); +const portrait = new Entry( + '', + 'Portrait', + [], +); +builtInIcons.putEntry(portrait); +const rocket = new Entry( + '', + 'Rocket', + [], +); +builtInIcons.putEntry(rocket); +const satellite = new Entry( + '', + 'Satellite', + [], +); +builtInIcons.putEntry(satellite); +const share = new Entry( + '', + 'Share', + [], +); +builtInIcons.putEntry(share); +const slideshow = new Entry( + '', + 'Slideshow', + [], +); +builtInIcons.putEntry(slideshow); +const star = new Entry( + '', + 'Star', + [], +); +builtInIcons.putEntry(star); +const sun = new Entry( + '', + 'Sun', + [], +); +builtInIcons.putEntry(sun); +const table = new Entry( + '', + 'Table', + [], +); +builtInIcons.putEntry(table); +const videocam = new Entry( + '', + 'Videocam', + [], +); +builtInIcons.putEntry(videocam); +const wysiwyg = new Entry( + '', + 'Wysiwyg', + [], +); +builtInIcons.putEntry(wysiwyg); export function addCustomIcons(newIcons: Dictionary): void { for (const key in newIcons.keysArray().entries()) { diff --git a/src/app/tools/icon-set-config/services/icon-dictionary.service.ts b/src/app/tools/icon-set-config/services/icon-dictionary.service.ts index dcdcdbd0..1fa7702c 100644 --- a/src/app/tools/icon-set-config/services/icon-dictionary.service.ts +++ b/src/app/tools/icon-set-config/services/icon-dictionary.service.ts @@ -32,7 +32,7 @@ export class IconDictionaryService { private readonly iconConfig: IconConfiguration; constructor() { - this.builtInIconsDictionary.addEach(builtInIcons); + this.builtInIconsDictionary.addBuildInIcons(builtInIcons); this.iconConfig = new IconConfiguration(this.builtInIconsDictionary); } @@ -45,7 +45,7 @@ export class IconDictionaryService { } const allTypes = new Dictionary(); - allTypes.addEach(builtInIcons); + allTypes.addBuildInIcons(builtInIcons); allTypes.appendDict(this.getCustomIconsDictionary()); this.initDictionary( @@ -123,7 +123,7 @@ export class IconDictionaryService { } const allTypes = new Dictionary(); - allTypes.addEach(builtInIcons); + allTypes.addBuildInIcons(builtInIcons); allTypes.appendDict(customIcons); iconTypes.forEach((name) => {