@@ -2,36 +2,40 @@ import { EdaDialogAbstract, EdaDialogCloseEvent, EdaDialog } from '@eda/shared/c
2
2
import { Component , ViewChild } from '@angular/core' ;
3
3
import { PanelChartComponent } from '../panel-charts/panel-chart.component' ;
4
4
import { PanelChart } from '../panel-charts/panel-chart' ;
5
+ import { MapUtilsService } from "@eda/services/service.index" ;
6
+
5
7
6
8
7
9
8
10
@Component ( {
9
- selector : ' app-mapedit-dialog' ,
10
- templateUrl : ' ./mapedit-dialog.component.html'
11
+ selector : " app-mapedit-dialog" ,
12
+ templateUrl : " ./mapedit-dialog.component.html" ,
11
13
} )
12
-
13
14
export class MapEditDialogComponent extends EdaDialogAbstract {
14
-
15
- @ ViewChild ( 'PanelChartComponent' , { static : false } ) myPanelChartComponent : PanelChartComponent ;
15
+ @ ViewChild ( "PanelChartComponent" , { static : false } )
16
+ myPanelChartComponent : PanelChartComponent ;
16
17
17
18
public dialog : EdaDialog ;
18
19
public panelChartConfig : PanelChart = new PanelChart ( ) ;
19
20
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 ;
24
25
25
- public display :boolean = false ;
26
+ //Marc
27
+ public zoom : number ;
28
+ public coordinates : Array < Array < number > > ;
26
29
27
- constructor ( ) {
30
+ public display : boolean = false ;
28
31
32
+ constructor ( private mapUtilsService : MapUtilsService ) {
29
33
super ( ) ;
30
34
31
35
this . dialog = new EdaDialog ( {
32
36
show : ( ) => this . onShow ( ) ,
33
37
hide : ( ) => this . onClose ( EdaDialogCloseEvent . NONE ) ,
34
- title : $localize `:@@ChartProps:PROPIEDADES DEL GRAFICO`
38
+ title : $localize `:@@ChartProps:PROPIEDADES DEL GRAFICO` ,
35
39
} ) ;
36
40
this . dialog . style = {
37
41
width : "80%" ,
@@ -43,33 +47,45 @@ export class MapEditDialogComponent extends EdaDialogAbstract {
43
47
44
48
ngOnInit ( ) {
45
49
this . mapUtilsService . mapEditOpen ( ) ;
50
+ console . log ( this . mapUtilsService . getZoom ( ) ) ;
51
+ console . log ( this . mapUtilsService . getCoordinates ( ) ) ;
46
52
}
47
53
ngOnDestroy ( ) : void {
48
54
this . mapUtilsService . mapEditClose ( ) ;
49
55
}
50
56
51
57
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 ) ;
53
69
}
54
70
55
71
handleInputColor ( ) {
56
- if ( this . color . length > 6 ) {
72
+ if ( this . color . length > 6 ) {
57
73
const leafletMap = this . myPanelChartComponent . componentRef . instance ;
58
74
leafletMap . reStyleGeoJsonLayer ( this . color ) ;
59
75
}
60
76
}
61
77
62
- renderMap ( ) {
78
+ renderMap ( ) {
63
79
const leafletMap = this . myPanelChartComponent . componentRef . instance ;
64
80
leafletMap . changeScale ( this . logarithmicScale ) ;
65
81
}
66
-
82
+
67
83
nullMouseOptions ( ) {
68
84
const leafletMap = this . myPanelChartComponent . componentRef . instance ;
69
85
leafletMap . switchNoMouse ( this . draggable ) ;
70
86
}
71
87
72
- changeLegend ( ) {
88
+ changeLegend ( ) {
73
89
const leafletMap = this . myPanelChartComponent . componentRef . instance ;
74
90
leafletMap . changeLegend ( this . legendPosition ) ;
75
91
}
@@ -79,8 +95,11 @@ export class MapEditDialogComponent extends EdaDialogAbstract {
79
95
}
80
96
81
97
onShow ( ) : void {
98
+ //Funcion llamada al abrir el mapa edit
99
+ this . zoom = this . controller . params . zoom ;
100
+ this . coordinates = this . controller . params . coordinates ;
82
101
this . legendPosition = this . controller . params . legendPosition ;
83
- this . color = this . controller . params . color ;
102
+ this . color = this . controller . params . color ;
84
103
this . logarithmicScale = this . controller . params . logarithmicScale ;
85
104
this . draggable = this . controller . params . draggable ;
86
105
this . panelChartConfig = this . controller . params . panelChart ;
@@ -90,22 +109,24 @@ export class MapEditDialogComponent extends EdaDialogAbstract {
90
109
return this . controller . close ( event , response ) ;
91
110
}
92
111
93
-
94
112
rgb2hex ( rgb ) : string {
95
- rgb = rgb . match ( / ^ r g b a ? [ \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
+ / ^ r g b a ? [ \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
+ : "" ;
100
122
}
101
123
102
124
hex2rgb ( hex , opacity = 100 ) : string {
103
- hex = hex . replace ( '#' , '' ) ;
125
+ hex = hex . replace ( "#" , "" ) ;
104
126
const r = parseInt ( hex . substring ( 0 , 2 ) , 16 ) ;
105
127
const g = parseInt ( hex . substring ( 2 , 4 ) , 16 ) ;
106
128
const b = parseInt ( hex . substring ( 4 , 6 ) , 16 ) ;
107
129
108
- return ' rgba(' + r + ',' + g + ',' + b + ',' + opacity / 100 + ')' ;
130
+ return " rgba(" + r + "," + g + "," + b + "," + opacity / 100 + ")" ;
109
131
}
110
-
111
132
}
0 commit comments