Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
41 changes: 26 additions & 15 deletions src/app/components/alternative-forms/alternative-forms.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { DbnaryService } from '../../services/dbnary.service';
import { GeticonService } from '../../services/geticon.service';
import { HttpClient } from '@angular/common/http';
import mullberryJson from '../../../assets/symbol-info.json';
import arasaacJson from '../../../assets/arasaac-symbol-info.json';
import arasaacColoredJson from '../../../assets/arasaac-color-symbol-info.json';
import arasaacJsonSymbol from '../../../assets/arasaac-symbol-info.json';
import arasaacJson from '../../../assets/arasaac.json';
import { MulBerryObject, ArasaacObject } from '../../libTypes';
import { Ng2ImgMaxService } from 'ng2-img-max';
import { ElementForm } from '../../types';
Expand Down Expand Up @@ -289,7 +289,7 @@ export class AlternativeFormsComponent implements OnInit {
}

/**
* Shows the image corresponding to a combination of selected library (mulberry or arasaac) and searched word (any)
* Shows the image corresponding to a combination of selected library (mulberry or arasaac) and searched word (any)
* @param elt library to be used and word to be searched
*/
previewLibrary(elt: { lib, word }) {
Expand All @@ -299,21 +299,22 @@ export class AlternativeFormsComponent implements OnInit {
this.boardService.board.libraryUsed.push('Mulberry');
}
this.previewMullberry(elt.word);
} else if (elt.lib === 'arasaacNB') {
this.previewArasaac(elt.word, false);
} else if (elt.lib === 'arasaac') {
this.imageSelectionStarted = true;
this.elementFormNameImageURL = 'assets/libs/arasaac_pictos/' + elt.word + '.png';
if (!this.boardService.board.libraryUsed.includes('Arasaac')) {
this.boardService.board.libraryUsed.push('Arasaac');
}
} else if (elt.lib === 'arasaacColor') {
this.previewArasaac(elt.word, true);
} else if (elt.lib === 'arasaacNB') {
this.previewArasaac(elt.word, false);
if (!this.boardService.board.libraryUsed.includes('Arasaac')) {
this.boardService.board.libraryUsed.push('Arasaac');
}
}
}

/**
*
*
* @param elt library to be used and word to be searched
* @returns an url corresponding to the searched image's name in the selected library
*/
Expand All @@ -324,6 +325,8 @@ export class AlternativeFormsComponent implements OnInit {
return 'url(\'assets/libs/FR_Noir_et_blanc_pictogrammes/' + elt.word + '.png\')';
} else if (elt.lib === 'arasaacColor') {
return 'url(\'assets/libs/FR_Pictogrammes_couleur/' + elt.word + '.png\')';
} else if (elt.lib === 'arasaac') {
return 'url(\'assets/libs/arasaac_pictos/' + elt.word + '.png\')';
}
}

Expand Down Expand Up @@ -360,17 +363,25 @@ export class AlternativeFormsComponent implements OnInit {
let tempList = [];

if (this.configurationService.LANGUAGE_VALUE === 'FR') {
(arasaacJson as unknown as ArasaacObject)[0].wordList.forEach(word => {
if (text !== null && text !== '' && word.toLowerCase().includes(text.toLocaleLowerCase()) && this.getSimilarity(text.toLowerCase(), word.toLowerCase()) >= 0.5) {
const url = word;
tempList.push({ lib: 'arasaacNB', word: this.cleanString(url) });
let idInArasaac: { id: number, keyword: string }[] = [];
// @ts-ignore
for (const item of arasaacJson) {
for (const k of item.keywords) {
if (text !== null && text !== '' && k.keyword === text && k.keyword.toLowerCase().includes(text.toLocaleLowerCase()) && this.getSimilarity(text.toLowerCase(), k.keyword.toLowerCase()) >= 0.5) {
idInArasaac.push({ id: item._id, keyword: k.keyword });
}
}
}, this);
}
if(idInArasaac.length > 0){
idInArasaac.forEach(elementId => {
tempList.push({ lib: 'arasaac', word: elementId.id });
});
}

(arasaacColoredJson as unknown as ArasaacObject)[0].wordList.forEach(word => {
(arasaacJsonSymbol as unknown as ArasaacObject)[0].wordList.forEach(word => {
if (text !== null && text !== '' && word.toLowerCase().includes(text.toLocaleLowerCase()) && this.getSimilarity(text.toLowerCase(), word.toLowerCase()) >= 0.5) {
const url = word;
tempList.push({ lib: 'arasaacColor', word: this.cleanString(url) });
tempList.push({ lib: 'arasaacNB', word: this.cleanString(url) });
}
}, this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<input checked id="radioAraasac" name="typeFormat" type="radio" (click)="getLibrairy('arasaacNB')">
<label class="radio" for="radioAraasac">{{this.multilinguism.translate("arasaacNB")}}</label>

<input id="radioAraasacColored" name="typeFormat" type="radio" (click)="getLibrairy('arasaacColor')">
<input id="radioAraasacColored" name="typeFormat" type="radio" (click)="getLibrairy('arasaac')">
<label class="radio" for="radioAraasacColored">{{this.multilinguism.translate("arasaacColored")}}</label>
</div>

Expand Down Expand Up @@ -67,4 +67,4 @@
{{this.multilinguism.translate(errorType)}}
</div>
</div>
{{this.configuration.VERSION}}
{{this.configuration.VERSION}}
44 changes: 25 additions & 19 deletions src/app/components/generator-grid/generator-grid.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import {Component, OnInit} from '@angular/core';
import {ConfigurationService} from '../../services/configuration.service';
import {FolderGoTo, Grid, GridElementGenerated, Page} from '../../types';
import {BoardService} from '../../services/board.service';
import arasaacJson from '../../../assets/arasaac-symbol-info.json';
import arasaacJsonSymbol from '../../../assets/arasaac-symbol-info.json';
import arasaacJson from '../../../assets/arasaac.json';
import {ArasaacObject, MulBerryObject} from '../../libTypes';
import arasaacColoredJson from '../../../assets/arasaac-color-symbol-info.json';
import mullberryJson from '../../../assets/symbol-info.json';
import {EditionService} from '../../services/edition.service';
import {FunctionsService} from '../../services/functions.service';
Expand Down Expand Up @@ -111,20 +111,23 @@ export class GeneratorGridComponent implements OnInit {
this.addOnlyOneImage = false;
console.log('Search the exact word : ');
if (this.libToUse === 'arasaacNB') {
(arasaacJson as unknown as ArasaacObject)[0].wordList.forEach(word => {
(arasaacJsonSymbol as unknown as ArasaacObject)[0].wordList.forEach(word => {
if (text !== null && text !== '' && word.toLowerCase() === text.toLocaleLowerCase() && !this.addOnlyOneImage) {
this.addOnlyOneImage = true;
this.imageList.push({ lib: 'arasaacNB', word: this.cleanString(word) });
return;
}
}, this);
} else if (this.libToUse === 'arasaacColor') {
(arasaacColoredJson as unknown as ArasaacObject)[0].wordList.forEach(word => {
if (text !== null && text !== '' && word.toLowerCase() === text.toLocaleLowerCase() && !this.addOnlyOneImage) {
this.addOnlyOneImage = true;
this.imageList.push({ lib: 'arasaacColor', word: this.cleanString(word) });
} else if (this.libToUse === 'arasaac') {
// @ts-ignore
for (const item of arasaacJson) {
for (const k of item.keywords) {
if (text !== null && text !== '' && k.keyword === text && k.keyword.toLowerCase() === text.toLocaleLowerCase() && !this.addOnlyOneImage) {
this.addOnlyOneImage = true;
this.imageList.push({ lib: 'arasaac', word: item._id });
}
}
}, this);
}
}
if (!this.addOnlyOneImage) {
console.log('No find in arasaac lib !');
Expand All @@ -145,20 +148,23 @@ export class GeneratorGridComponent implements OnInit {
searchTheClosestWordInLib(text: string) {
console.log('Search the closest word :');
if (this.libToUse === 'arasaacNB') {
(arasaacJson as unknown as ArasaacObject)[0].wordList.forEach(word => {
(arasaacJsonSymbol as unknown as ArasaacObject)[0].wordList.forEach(word => {
if (text !== null && text !== '' && word.toLowerCase().includes(text.toLocaleLowerCase()) && !this.addOnlyOneImage) {
this.addOnlyOneImage = true;
this.imageList.push({ lib: 'arasaacNB', word: this.cleanString(word) });
return;
}
}, this);
} else if (this.libToUse === 'arasaacColor') {
(arasaacColoredJson as unknown as ArasaacObject)[0].wordList.forEach(word => {
if (text !== null && text !== '' && word.toLowerCase().includes(text.toLocaleLowerCase()) && !this.addOnlyOneImage) {
this.addOnlyOneImage = true;
this.imageList.push({ lib: 'arasaacColor', word: this.cleanString(word) });
} else if (this.libToUse === 'arasaac') {
// @ts-ignore
for (const item of arasaacJson) {
for (const k of item.keywords) {
if (text !== null && text !== '' && k.keyword === text && k.keyword.toLowerCase().includes(text.toLocaleLowerCase()) && !this.addOnlyOneImage) {
this.addOnlyOneImage = true;
this.imageList.push({ lib: 'arasaac', word: item._id });
}
}
}, this);
}
}
if (!this.addOnlyOneImage) {
(mullberryJson as unknown as MulBerryObject[]).forEach(value => {
Expand All @@ -181,7 +187,7 @@ export class GeneratorGridComponent implements OnInit {
this.previewMullberry(elt.word);
} else if (elt.lib === 'arasaacNB') {
this.previewArasaac(elt.word, false);
} else if (elt.lib === 'arasaacColor') {
} else if (elt.lib === 'arasaac') {
this.previewArasaac(elt.word, true);
}
}
Expand All @@ -193,8 +199,8 @@ export class GeneratorGridComponent implements OnInit {

previewArasaac(t: string, isColored: boolean) {
if (isColored) {
this.previewWithURL('assets/libs/FR_Pictogrammes_couleur/' + t + '.png');
console.log('assets/libs/FR_Pictogrammes_couleur/' + t + '.png');
this.previewWithURL('assets/libs/arasaac_pictos/' + t + '.png');
console.log('assets/libs/arasaac_pictos/' + t + '.png');
} else {
this.previewWithURL('assets/libs/FR_Noir_et_blanc_pictogrammes/' + t + '.png');
console.log('assets/libs/FR_Noir_et_blanc_pictogrammes/' + t + '.png');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ import { Component, OnInit } from '@angular/core';
import { EditionService } from '../../services/edition.service';
import { Ng2ImgMaxService } from 'ng2-img-max';
import mullberryJson from '../../../assets/symbol-info.json';
import arasaacJson from '../../../assets/arasaac-symbol-info.json';
import arasaacColoredJson from '../../../assets/arasaac-color-symbol-info.json';
import arasaacJsonSymbol from '../../../assets/arasaac-symbol-info.json';
import arasaacJson from '../../../assets/arasaac.json';
import { ArasaacObject, MulBerryObject } from '../../libTypes';
import { MultilinguismService } from '../../services/multilinguism.service';
import { ConfigurationService } from "../../services/configuration.service";
import { Observable } from "rxjs";
import { FormControl } from "@angular/forms";
import { map, startWith } from "rxjs/operators";
import { DialogAddUserComponent } from "../dialog-add-user/dialog-add-user.component";
import { MatDialog } from "@angular/material/dialog";
import { DialogModifyColorInsideComponent } from "../dialog-modify-color-inside/dialog-modify-color-inside.component";
import { DialogModifyColorBorderComponent } from "../dialog-modify-color-border/dialog-modify-color-border.component";
Expand Down Expand Up @@ -98,8 +97,8 @@ export class ImageSelectionPageComponent implements OnInit {
return 'url(\'assets/libs/mulberry-symbols/EN-symbols/' + elt.word + '.svg\')';
} else if (elt.lib === 'arasaacNB') {
return 'url(\'assets/libs/FR_Noir_et_blanc_pictogrammes/' + elt.word + '.png\')';
} else if (elt.lib === 'arasaacColor') {
return 'url(\'assets/libs/FR_Pictogrammes_couleur/' + elt.word + '.png\')';
} else if (elt.lib === 'arasaac') {
return 'url(\'assets/libs/arasaac_pictos/' + elt.word + '.png\')';
}
}

Expand All @@ -124,7 +123,7 @@ export class ImageSelectionPageComponent implements OnInit {

previewArasaac(t: string, isColored: boolean) {
if (isColored) {
this.previewWithURL('assets/libs/FR_Pictogrammes_couleur/' + t + '.png');
this.previewWithURL('assets/libs/arasaac_pictos/' + t + '.png');
} else {
console.log('assets/libs/FR_Noir_et_blanc_pictogrammes/' + t + '.png');
this.previewWithURL('assets/libs/FR_Noir_et_blanc_pictogrammes/' + t + '.png');
Expand All @@ -142,7 +141,7 @@ export class ImageSelectionPageComponent implements OnInit {
if (!this.boardService.board.libraryUsed.includes('Arasaac')) {
this.boardService.board.libraryUsed.push('Arasaac');
}
} else if (elt.lib === 'arasaacColor') {
} else if (elt.lib === 'arasaac') {
this.previewArasaac(elt.word, true);
if (!this.boardService.board.libraryUsed.includes('Arasaac')) {
this.boardService.board.libraryUsed.push('Arasaac');
Expand Down Expand Up @@ -171,19 +170,26 @@ export class ImageSelectionPageComponent implements OnInit {
let tempList = [];

if (this.configurationService.LANGUAGE_VALUE === 'FR') {
(arasaacJson as unknown as ArasaacObject)[0].wordList.forEach(word => {
if (text !== null && text !== '' && word.toLowerCase().includes(text.toLocaleLowerCase()) && this.getSimilarity(text.toLowerCase(), word.toLowerCase()) >= 0.5) {
console.log(word + "; " + text + "; " + this.getSimilarity(text, word));
const url = word;
tempList.push({ lib: 'arasaacNB', word: this.cleanString(url) });
let idInArasaac: { id: number, keyword: string }[] = [];
// @ts-ignore
for (const item of arasaacJson) {
for (const k of item.keywords) {
if (text !== null && text !== '' && k.keyword === text && k.keyword.toLowerCase().includes(text.toLocaleLowerCase()) && this.getSimilarity(text.toLowerCase(), k.keyword.toLowerCase()) >= 0.5) {
idInArasaac.push({ id: item._id, keyword: k.keyword });
}
}
}, this);
}
if(idInArasaac.length > 0){
idInArasaac.forEach(elementId => {
tempList.push({ lib: 'arasaac', word: elementId.id });
});
}

(arasaacColoredJson as unknown as ArasaacObject)[0].wordList.forEach(word => {
(arasaacJsonSymbol as unknown as ArasaacObject)[0].wordList.forEach(word => {
if (text !== null && text !== '' && word.toLowerCase().includes(text.toLocaleLowerCase()) && this.getSimilarity(text.toLowerCase(), word.toLowerCase()) >= 0.5) {
console.log(word + "; " + text + "; " + this.getSimilarity(text, word));
const url = word;
tempList.push({ lib: 'arasaacColor', word: this.cleanString(url) });
tempList.push({ lib: 'arasaacNB', word: this.cleanString(url) });
}
}, this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ import { BoardService } from '../../services/board.service';
import { Grid, GridElement, Page } from '../../types';
import { LayoutService } from '../../services/layout.service';
import { Router } from '@angular/router';
import arasaacColoredJson from '../../../assets/arasaac-color-symbol-info.json';
import scleraJson from '../../../assets/sclera.json';
import parlerPictoJson from '../../../assets/parlerpictos.json';
import arasaacJson from '../../../assets/arasaac.json';
import arasaacJsonLCC from '../../../assets/arasaacLCC.json';
import fontawesomeJson from '../../../assets/fontawesome.json';
import mulberryJson from '../../../assets/mulberry-symbols-lcc.json';
import {
arasaacLCCObject,
ArasaacObject,
fontawesomeObject,
mulberryObject,
ParlerPictoObject,
Expand Down Expand Up @@ -338,17 +336,6 @@ export class LifeCompanion2augComponent implements OnInit {
return gridElement;
}

private getPathImageArsaacLibrary(textContent: any): string {
if (textContent !== null) {
const index = (arasaacColoredJson as unknown as ArasaacObject)[0].wordList.findIndex(word => {
return textContent.toLowerCase().trim() === word.toLowerCase();
});
if (index > -1) {
return 'assets/libs/FR_Pictogrammes_couleur/' + (arasaacColoredJson as unknown as ArasaacObject)[0].wordList[index] + '.png';
}
}
}

private getPathImageFromLibraries(idImage: any): string {
if (idImage !== undefined) {
//sclera
Expand All @@ -367,11 +354,11 @@ export class LifeCompanion2augComponent implements OnInit {
}
// ca commence ici
//arasaac-lifecompanion
index = (arasaacJson as unknown as arasaacLCCObject).images.findIndex(word => {
index = (arasaacJsonLCC as unknown as arasaacLCCObject).images.findIndex(word => {
return idImage === word.id;
});
if (index > -1) {
return 'assets/libs/arasaac/' + (arasaacJson as unknown as arasaacLCCObject).images[index].id + '.png';
return 'assets/libs/arasaac/' + (arasaacJsonLCC as unknown as arasaacLCCObject).images[index].id + '.png';
}
//mulberry-lifecompanion
index = (mulberryJson as unknown as mulberryObject).images.findIndex(word => {
Expand Down Expand Up @@ -402,24 +389,6 @@ export class LifeCompanion2augComponent implements OnInit {
return '';
}

private addImageButton(element: any) {
try {
const pathImage = this.getPathImageArsaacLibrary(element.attr.textContent);
this.grid.ImageList.push({
ID: element.attr.textContent,
OriginalName: element.attr.textContent,
Path: pathImage !== undefined ? pathImage : '',
});
} catch (e) {
const pathImage = this.getPathImageArsaacLibrary(element.attr.text);
this.grid.ImageList.push({
ID: element.attr.text,
OriginalName: element.attr.text,
Path: pathImage !== undefined ? pathImage : '',
});
}
}

private addImageButtonFullLibrary(element: any) {
let pathImage: string;

Expand Down
Loading
Loading