I have JSON file which is contain some data related to show map. This is the JSON file
"defaultThemeData": {
"mpaStyle": "assets/mapreport/themes/vintage/style/vintageStyle.json",
"mapCSS": "assets/mapreport/themes/vintage/style/vintageStyle.CSS",
"mapSources": [
{
"name": "ship",
"obj": {
"type": "image",
"url": "assets/mapreport/themes/vintage/sprite_images/ship.png",
"coordinates": [
[
-1.828685,
66.044102
],
[
2.609791,
66.044102
],
[
2.609791,
64.177497
],
[
-1.828685,
64.177497
]
]
}
}
],
"mapExternalComponents": [
"<div id='compass' style ='position: absolute; top: 20px; left: 20px; width: 200px; height: 200px; z-index: 2; background-image: url('img/compass.png'); background-size: 200px 200px;'></div>"
],
"markerImg": "assets/mapreport/themes/vintage/sprite_images/marker.png"
}
According to this JSON file mapSources
and mapExternalComponents
are always changed according to the map theme. to read this JSON I have implemented.
here for the setMapSources() and setMapHTMLComponets()
method should be dynamic method. because don't know what kind of data coming from the JSON. so my question is how to implement dynamic methods or class for this scenario in angular.
subjection : using polymorphism