Skip to content

Commit b7f0b45

Browse files
committed
Merge branch 'coordinateSizeColorFeature'
# Conflicts: # eda/eda_app/src/app/module/components/eda-panels/eda-blank-panel/maps-dialog/mapedit-dialog.component.ts
2 parents 55a60f3 + 971781d commit b7f0b45

File tree

8 files changed

+545
-329
lines changed

8 files changed

+545
-329
lines changed

eda/eda_app/src/app/module/components/eda-map/eda-geoJsonMap.component.ts

+280-182
Large diffs are not rendered by default.

eda/eda_app/src/app/module/components/eda-panels/eda-blank-panel/eda-blank-panel.component.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -970,12 +970,15 @@ export class EdaBlankPanelComponent implements OnInit {
970970
this.tableController = undefined;
971971
}
972972

973-
public onCloseMapProperties(event, response: { color: string, logarithmicScale: boolean, legendPosition: string, draggable: boolean }): void {
973+
public onCloseMapProperties(event, response: { color: string, logarithmicScale: boolean, legendPosition: string, draggable: boolean, zoom:number, coordinates: Array<Array<number>> }): void {
974974
if (!_.isEqual(event, EdaDialogCloseEvent.NONE)) {
975975
this.panel.content.query.output.config.color = response.color;
976976
this.panel.content.query.output.config.logarithmicScale = response.logarithmicScale;
977977
this.panel.content.query.output.config.legendPosition = response.legendPosition;
978978
this.panel.content.query.output.config.draggable = response.draggable;
979+
this.panel.content.query.output.config.zoom = response.zoom;
980+
this.panel.content.query.output.config.coordinates =
981+
response.coordinates;
979982
const config = new ChartConfig(this.panel.content.query.output.config);
980983
this.renderChart(this.currentQuery, this.chartLabels, this.chartData, this.graficos.chartType, this.graficos.edaChart, config);
981984
this.dashboardService._notSaved.next(true);

eda/eda_app/src/app/module/components/eda-panels/eda-blank-panel/maps-dialog/mapedit-dialog.component.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<eda-dialog [inject]="dialog">
22

3-
<div body class="grid">
4-
<div class="col-8">
3+
<div body class="grid" style=" height: 100%;">
4+
<div class="col-9">
55

6-
<div class="eda-chart-panel" style="margin-left: 6em; margin-top: 2em; width: 60%; background-color: var(--panel-color);">
7-
<panel-chart *ngIf="display" #PanelChartComponent [props]="panelChartConfig" style="height: 90%; width: 90%; display:block; margin-top:5em">
6+
<div class="eda-chart-panel" style=" width: 100%; background-color: var(--panel-color);">
7+
<panel-chart *ngIf="display" #PanelChartComponent [props]="panelChartConfig" style="height: 100%; width: 100%; display:block; margin-top:1em">
88
</panel-chart>
99
</div>
1010

1111
</div>
1212

1313

14-
<div class="col-4">
14+
<div class="col-3">
1515

1616

1717
<h6 i18n="@@colorsChartH6" class="custom-border-b1">

eda/eda_app/src/app/module/components/eda-panels/eda-blank-panel/maps-dialog/mapedit-dialog.component.ts

+48-27
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,40 @@ import { EdaDialogAbstract, EdaDialogCloseEvent, EdaDialog } from '@eda/shared/c
22
import { Component, ViewChild } from '@angular/core';
33
import { PanelChartComponent } from '../panel-charts/panel-chart.component';
44
import { PanelChart } from '../panel-charts/panel-chart';
5+
import { MapUtilsService } from "@eda/services/service.index";
6+
57

68

79

810
@Component({
9-
selector: 'app-mapedit-dialog',
10-
templateUrl: './mapedit-dialog.component.html'
11+
selector: "app-mapedit-dialog",
12+
templateUrl: "./mapedit-dialog.component.html",
1113
})
12-
1314
export class MapEditDialogComponent extends EdaDialogAbstract {
14-
15-
@ViewChild('PanelChartComponent', { static: false }) myPanelChartComponent: PanelChartComponent;
15+
@ViewChild("PanelChartComponent", { static: false })
16+
myPanelChartComponent: PanelChartComponent;
1617

1718
public dialog: EdaDialog;
1819
public panelChartConfig: PanelChart = new PanelChart();
1920

20-
public color:string = '';
21-
public logarithmicScale :boolean = false;
22-
public draggable : boolean;
23-
public legendPosition : string;
21+
public color: string = "";
22+
public logarithmicScale: boolean = false;
23+
public draggable: boolean;
24+
public legendPosition: string;
2425

25-
public display:boolean=false;
26+
//Marc
27+
public zoom: number;
28+
public coordinates: Array<Array<number>>;
2629

27-
constructor() {
30+
public display: boolean = false;
2831

32+
constructor(private mapUtilsService: MapUtilsService) {
2933
super();
3034

3135
this.dialog = new EdaDialog({
3236
show: () => this.onShow(),
3337
hide: () => this.onClose(EdaDialogCloseEvent.NONE),
34-
title: $localize`:@@ChartProps:PROPIEDADES DEL GRAFICO`
38+
title: $localize`:@@ChartProps:PROPIEDADES DEL GRAFICO`,
3539
});
3640
this.dialog.style = {
3741
width: "80%",
@@ -43,33 +47,45 @@ export class MapEditDialogComponent extends EdaDialogAbstract {
4347

4448
ngOnInit() {
4549
this.mapUtilsService.mapEditOpen();
50+
console.log(this.mapUtilsService.getZoom());
51+
console.log(this.mapUtilsService.getCoordinates());
4652
}
4753
ngOnDestroy(): void {
4854
this.mapUtilsService.mapEditClose();
4955
}
5056

5157
saveChartConfig() {
52-
this.onClose(EdaDialogCloseEvent.UPDATE, {color:this.color, logarithmicScale : this.logarithmicScale, legendPosition : this.legendPosition, draggable : this.draggable});
58+
this.onClose(EdaDialogCloseEvent.UPDATE, {
59+
color: this.color,
60+
logarithmicScale: this.logarithmicScale,
61+
legendPosition: this.legendPosition,
62+
draggable: this.draggable,
63+
zoom: this.myPanelChartComponent.componentRef.instance.inject.zoom,
64+
coordinates:
65+
this.myPanelChartComponent.componentRef.instance.inject.coordinates,
66+
});
67+
this.mapUtilsService.setCoordinates(null);
68+
this.mapUtilsService.setZoom(null);
5369
}
5470

5571
handleInputColor() {
56-
if(this.color.length > 6){
72+
if (this.color.length > 6) {
5773
const leafletMap = this.myPanelChartComponent.componentRef.instance;
5874
leafletMap.reStyleGeoJsonLayer(this.color);
5975
}
6076
}
6177

62-
renderMap(){
78+
renderMap() {
6379
const leafletMap = this.myPanelChartComponent.componentRef.instance;
6480
leafletMap.changeScale(this.logarithmicScale);
6581
}
66-
82+
6783
nullMouseOptions() {
6884
const leafletMap = this.myPanelChartComponent.componentRef.instance;
6985
leafletMap.switchNoMouse(this.draggable);
7086
}
7187

72-
changeLegend(){
88+
changeLegend() {
7389
const leafletMap = this.myPanelChartComponent.componentRef.instance;
7490
leafletMap.changeLegend(this.legendPosition);
7591
}
@@ -79,8 +95,11 @@ export class MapEditDialogComponent extends EdaDialogAbstract {
7995
}
8096

8197
onShow(): void {
98+
//Funcion llamada al abrir el mapa edit
99+
this.zoom = this.controller.params.zoom;
100+
this.coordinates = this.controller.params.coordinates;
82101
this.legendPosition = this.controller.params.legendPosition;
83-
this.color= this.controller.params.color;
102+
this.color = this.controller.params.color;
84103
this.logarithmicScale = this.controller.params.logarithmicScale;
85104
this.draggable = this.controller.params.draggable;
86105
this.panelChartConfig = this.controller.params.panelChart;
@@ -90,22 +109,24 @@ export class MapEditDialogComponent extends EdaDialogAbstract {
90109
return this.controller.close(event, response);
91110
}
92111

93-
94112
rgb2hex(rgb): string {
95-
rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
96-
return (rgb && rgb.length === 4) ? '#' +
97-
('0' + parseInt(rgb[1], 10).toString(16)).slice(-2) +
98-
('0' + parseInt(rgb[2], 10).toString(16)).slice(-2) +
99-
('0' + parseInt(rgb[3], 10).toString(16)).slice(-2) : '';
113+
rgb = rgb.match(
114+
/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i
115+
);
116+
return rgb && rgb.length === 4
117+
? "#" +
118+
("0" + parseInt(rgb[1], 10).toString(16)).slice(-2) +
119+
("0" + parseInt(rgb[2], 10).toString(16)).slice(-2) +
120+
("0" + parseInt(rgb[3], 10).toString(16)).slice(-2)
121+
: "";
100122
}
101123

102124
hex2rgb(hex, opacity = 100): string {
103-
hex = hex.replace('#', '');
125+
hex = hex.replace("#", "");
104126
const r = parseInt(hex.substring(0, 2), 16);
105127
const g = parseInt(hex.substring(2, 4), 16);
106128
const b = parseInt(hex.substring(4, 6), 16);
107129

108-
return 'rgba(' + r + ',' + g + ',' + b + ',' + opacity / 100 + ')';
130+
return "rgba(" + r + "," + g + "," + b + "," + opacity / 100 + ")";
109131
}
110-
111132
}

eda/eda_app/src/app/module/components/eda-panels/eda-blank-panel/panel-charts/panel-chart.component.ts

+14-6
Original file line numberDiff line numberDiff line change
@@ -594,18 +594,26 @@ export class PanelChartComponent implements OnInit, OnChanges, OnDestroy {
594594
inject.maps = this.props.maps;
595595
inject.query = this.props.query;
596596
inject.draggable = this.props.draggable;
597-
try{
598-
inject.coordinates = this.props.config['config']['coordinates'];
597+
//Marc
598+
inject.zoom = this.props.zoom;
599+
inject.coordinates = this.props.coordinates;
600+
601+
602+
603+
try {
604+
inject.coordinates = this.props.config['config']['coordinates'];
599605
}catch{
600606
inject.coordinates = null ;
601607
}
602-
try{
603-
inject.zoom = this.props.config['config']['zoom'];
608+
try {
609+
if (true) {
610+
inject.zoom = this.props.config["config"]["zoom"];
611+
} else {}
604612
}catch{
605-
inject.zoom = null ;
613+
inject.zoom = 1 ;
606614
}
607615
try{
608-
inject.color = this.props.config['config']['color'] ;
616+
inject.color = this.props.config['config']['color'];
609617
}catch{
610618
inject.color = '#006400';
611619
}

eda/eda_app/src/app/module/components/eda-panels/eda-blank-panel/panel-charts/panel-chart.ts

+10-8
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@ import { ChartConfig } from './chart-configuration-models/chart-config';
44

55

66
export class PanelChart {
7-
public data : {labels:any[], values:any[]};
8-
public query : any;
9-
public chartType : string;
10-
public config : ChartConfig;
11-
public edaChart : string;
12-
public maps : Array<string>;
13-
public size : {x:number, y:number};
14-
public linkedDashboardProps : LinkedDashboardProps;
7+
public data: { labels: any[]; values: any[] };
8+
public query: any;
9+
public chartType: string;
10+
public config: ChartConfig;
11+
public edaChart: string;
12+
public maps: Array<string>;
13+
public size: { x: number; y: number };
14+
public linkedDashboardProps: LinkedDashboardProps;
1515
public addTrend: boolean;
1616
public noRepetitions: boolean;
1717
public draggable: boolean;
18+
public coordinates: Array<Array<number>>;
19+
public zoom: number;
1820

1921
constructor(init?: Partial<PanelChart>) {
2022
Object.assign(this, init);

eda/eda_app/src/app/module/components/eda-panels/eda-blank-panel/panel-utils/panel-menu-options.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ export const PanelOptions = {
6767
color: panelComponent.panelChart.componentRef.instance.color,
6868
logarithmicScale: panelComponent.panelChart.componentRef.instance.logarithmicScale,
6969
legendPosition: panelComponent.panelChart.componentRef.instance.legendPosition,
70-
draggable: panelComponent.panelChart.componentRef.instance.draggable
70+
draggable: panelComponent.panelChart.componentRef.instance.draggable,
71+
zoom: panelComponent.panelChart.componentRef.instance.inject.zoom,
72+
coordinates: panelComponent.panelChart.componentRef.instance.inject.coordinates,
7173
},
7274
close: (event, response) => { panelComponent.onCloseMapProperties(event, response) }
7375
});

0 commit comments

Comments
 (0)