diff --git a/js-src/conquer/interface/select-team.ts b/js-src/conquer/interface/select-team.ts index 516955a..73cc937 100644 --- a/js-src/conquer/interface/select-team.ts +++ b/js-src/conquer/interface/select-team.ts @@ -72,6 +72,7 @@ export default class SelectTeamUI extends AbstractTopBarInterface { console.error(responseBody.error); return; } + this.runCallbacks('update-nodes'); this.runCallbacks('close') } catch (error) { console.error('Error parsing json', error); diff --git a/js-src/conquer/map-node.ts b/js-src/conquer/map-node.ts index 3b2893e..fad0011 100644 --- a/js-src/conquer/map-node.ts +++ b/js-src/conquer/map-node.ts @@ -78,6 +78,9 @@ export default class MapNode { public openSelectTeam(interfaceManager: InterfaceManager): void { const selectTeamUI = new SelectTeamUI(this); + selectTeamUI.on('update-nodes', () => { + this.runCallbacks('update-nodes'); + }); selectTeamUI.on('close', () => { interfaceManager.remove(selectTeamUI); }); diff --git a/public/js/bundle.js b/public/js/bundle.js index ed678a5..d15cf80 100644 --- a/public/js/bundle.js +++ b/public/js/bundle.js @@ -177,7 +177,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ SelectTeamUI)\n/* harmony export */ });\n/* harmony import */ var _burguillosinfo_conquer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @burguillosinfo/conquer */ \"./js-src/conquer/index.ts\");\n/* harmony import */ var _burguillosinfo_conquer_user__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @burguillosinfo/conquer/user */ \"./js-src/conquer/user.ts\");\n/* harmony import */ var _burguillosinfo_conquer_interface_abstract_top_bar_interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @burguillosinfo/conquer/interface/abstract-top-bar-interface */ \"./js-src/conquer/interface/abstract-top-bar-interface.ts\");\n/* harmony import */ var _burguillosinfo_conquer_team__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @burguillosinfo/conquer/team */ \"./js-src/conquer/team.ts\");\n\n\n\n\nclass SelectTeamUI extends _burguillosinfo_conquer_interface_abstract_top_bar_interface__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n constructor(node) {\n super();\n this.form = null;\n this.node = node;\n }\n async run() {\n const user = await _burguillosinfo_conquer_user__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getSelfUser();\n if (user === null) {\n this.runCallbacks('close');\n return;\n }\n this.user = user;\n await this.populateTeams();\n this.getForm().classList.remove('conquer-display-none');\n this.getMainNode().append(this.getForm());\n this.getMainNode().classList.remove('conquer-display-none');\n }\n async populateTeams() {\n const teams = await _burguillosinfo_conquer_team__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getTeams();\n for (const team of teams) {\n this.populateTeam(team);\n }\n }\n populateTeam(team) {\n const teamDiv = this.getNodeFromTemplateId('conquer-team-to-select-template');\n const nameParagraph = teamDiv.querySelector('p.conquer-name');\n const descriptionParagraph = teamDiv.querySelector('p.conquer-description');\n const submit = teamDiv.querySelector('button.conquer-submit');\n if (!(nameParagraph instanceof HTMLParagraphElement)\n || !(descriptionParagraph instanceof HTMLParagraphElement)\n || !(submit instanceof HTMLButtonElement)) {\n _burguillosinfo_conquer__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fail('Select team name inclusive or description container are not correctly defined in template.');\n }\n nameParagraph.innerText = team.getName();\n descriptionParagraph.innerText = team.getDescription();\n nameParagraph.style.color = team.getColor();\n submit.addEventListener('click', async () => {\n this.onSelectTeam(team);\n });\n this.getForm().append(teamDiv);\n }\n async onSelectTeam(team) {\n const urlTeam = new URL('/conquer/user/team', window.location.protocol + '//'\n + window.location.hostname + ':'\n + window.location.port);\n const response = await fetch(urlTeam, {\n method: 'POST',\n body: JSON.stringify({\n team: team.getUUID(),\n node: this.node.getUUID(),\n }),\n });\n let responseBody;\n try {\n responseBody = await response.json();\n if (response.status !== 200) {\n console.error(responseBody.error);\n return;\n }\n this.runCallbacks('close');\n }\n catch (error) {\n console.error('Error parsing json', error);\n }\n }\n getForm() {\n if (this.form === null) {\n const form = this.getNodeFromTemplateId('conquer-select-team-list-template');\n this.form = form;\n }\n return this.form;\n }\n}\n\n\n//# sourceURL=webpack://BurguillosInfo/./js-src/conquer/interface/select-team.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ SelectTeamUI)\n/* harmony export */ });\n/* harmony import */ var _burguillosinfo_conquer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @burguillosinfo/conquer */ \"./js-src/conquer/index.ts\");\n/* harmony import */ var _burguillosinfo_conquer_user__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @burguillosinfo/conquer/user */ \"./js-src/conquer/user.ts\");\n/* harmony import */ var _burguillosinfo_conquer_interface_abstract_top_bar_interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @burguillosinfo/conquer/interface/abstract-top-bar-interface */ \"./js-src/conquer/interface/abstract-top-bar-interface.ts\");\n/* harmony import */ var _burguillosinfo_conquer_team__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @burguillosinfo/conquer/team */ \"./js-src/conquer/team.ts\");\n\n\n\n\nclass SelectTeamUI extends _burguillosinfo_conquer_interface_abstract_top_bar_interface__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n constructor(node) {\n super();\n this.form = null;\n this.node = node;\n }\n async run() {\n const user = await _burguillosinfo_conquer_user__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getSelfUser();\n if (user === null) {\n this.runCallbacks('close');\n return;\n }\n this.user = user;\n await this.populateTeams();\n this.getForm().classList.remove('conquer-display-none');\n this.getMainNode().append(this.getForm());\n this.getMainNode().classList.remove('conquer-display-none');\n }\n async populateTeams() {\n const teams = await _burguillosinfo_conquer_team__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getTeams();\n for (const team of teams) {\n this.populateTeam(team);\n }\n }\n populateTeam(team) {\n const teamDiv = this.getNodeFromTemplateId('conquer-team-to-select-template');\n const nameParagraph = teamDiv.querySelector('p.conquer-name');\n const descriptionParagraph = teamDiv.querySelector('p.conquer-description');\n const submit = teamDiv.querySelector('button.conquer-submit');\n if (!(nameParagraph instanceof HTMLParagraphElement)\n || !(descriptionParagraph instanceof HTMLParagraphElement)\n || !(submit instanceof HTMLButtonElement)) {\n _burguillosinfo_conquer__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fail('Select team name inclusive or description container are not correctly defined in template.');\n }\n nameParagraph.innerText = team.getName();\n descriptionParagraph.innerText = team.getDescription();\n nameParagraph.style.color = team.getColor();\n submit.addEventListener('click', async () => {\n this.onSelectTeam(team);\n });\n this.getForm().append(teamDiv);\n }\n async onSelectTeam(team) {\n const urlTeam = new URL('/conquer/user/team', window.location.protocol + '//'\n + window.location.hostname + ':'\n + window.location.port);\n const response = await fetch(urlTeam, {\n method: 'POST',\n body: JSON.stringify({\n team: team.getUUID(),\n node: this.node.getUUID(),\n }),\n });\n let responseBody;\n try {\n responseBody = await response.json();\n if (response.status !== 200) {\n console.error(responseBody.error);\n return;\n }\n this.runCallbacks('update-nodes');\n this.runCallbacks('close');\n }\n catch (error) {\n console.error('Error parsing json', error);\n }\n }\n getForm() {\n if (this.form === null) {\n const form = this.getNodeFromTemplateId('conquer-select-team-list-template');\n this.form = form;\n }\n return this.form;\n }\n}\n\n\n//# sourceURL=webpack://BurguillosInfo/./js-src/conquer/interface/select-team.ts?"); /***/ }), @@ -210,7 +210,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! typescript-json-serializer */ \"./node_modules/typescript-json-serializer/dist/index.esm.js\");\n/* harmony import */ var ol_style_Style__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ol/style/Style */ \"./node_modules/ol/style/Style.js\");\n/* harmony import */ var ol_Feature__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ol/Feature */ \"./node_modules/ol/Feature.js\");\n/* harmony import */ var ol_style_Circle__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ol/style/Circle */ \"./node_modules/ol/style/Circle.js\");\n/* harmony import */ var ol_geom_Point__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ol/geom/Point */ \"./node_modules/ol/geom/Point.js\");\n/* harmony import */ var ol_style_Fill__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ol/style/Fill */ \"./node_modules/ol/style/Fill.js\");\n/* harmony import */ var ol_style_Stroke__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ol/style/Stroke */ \"./node_modules/ol/style/Stroke.js\");\n/* harmony import */ var _burguillosinfo_conquer_interface_node_view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @burguillosinfo/conquer/interface/node-view */ \"./js-src/conquer/interface/node-view.ts\");\n/* harmony import */ var _burguillosinfo_conquer_serializer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @burguillosinfo/conquer/serializer */ \"./js-src/conquer/serializer.ts\");\n/* harmony import */ var _burguillosinfo_conquer_interface_select_team__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @burguillosinfo/conquer/interface/select-team */ \"./js-src/conquer/interface/select-team.ts\");\n/* harmony import */ var _burguillosinfo_conquer_team__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @burguillosinfo/conquer/team */ \"./js-src/conquer/team.ts\");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nvar __param = (undefined && undefined.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nvar MapNode_1;\n\n\n\n\n\n\n\n\n\n\n\nlet MapNode = MapNode_1 = class MapNode {\n constructor(uuid, coordinate_1, coordinate_2, type, name, description, kind, is_near, team) {\n this.uuid = uuid;\n this.coordinate_1 = coordinate_1;\n this.coordinate_2 = coordinate_2;\n this.type = type;\n this.name = name;\n this.description = description;\n this.kind = kind;\n this.is_near = is_near;\n this.team = team;\n this.feature = null;\n this.callbacks = {};\n }\n async getTeam() {\n if (this.team === null) {\n return null;\n }\n return _burguillosinfo_conquer_team__WEBPACK_IMPORTED_MODULE_4__[\"default\"].getTeam(this.team);\n }\n async fetch() {\n const urlNode = new URL('/conquer/node/' + this.uuid, window.location.protocol + '//' + window.location.hostname + ':' + window.location.port);\n const response = await fetch(urlNode);\n let responseBody;\n const errorThrow = new Error('Unable to fetch node updated.');\n try {\n responseBody = await response.json();\n }\n catch (error) {\n console.error('Error parseando json: ' + responseBody);\n console.error(error);\n throw errorThrow;\n }\n if (response.status !== 200) {\n console.error(responseBody.error);\n throw errorThrow;\n }\n const node = _burguillosinfo_conquer_serializer__WEBPACK_IMPORTED_MODULE_2__[\"default\"].deserialize(responseBody, MapNode_1);\n if (!(node instanceof MapNode_1)) {\n console.error('Unexpected JSON value for MapNode.');\n throw errorThrow;\n }\n return node;\n }\n click(interfaceManager) {\n const viewNodeInterface = new _burguillosinfo_conquer_interface_node_view__WEBPACK_IMPORTED_MODULE_1__[\"default\"](this);\n viewNodeInterface.on('close', () => {\n interfaceManager.remove(viewNodeInterface);\n });\n viewNodeInterface.on('update-nodes', () => {\n this.runCallbacks('update-nodes');\n });\n viewNodeInterface.on('open-select-team', () => {\n this.openSelectTeam(interfaceManager);\n });\n interfaceManager.push(viewNodeInterface);\n this.runCallbacks('click');\n }\n openSelectTeam(interfaceManager) {\n const selectTeamUI = new _burguillosinfo_conquer_interface_select_team__WEBPACK_IMPORTED_MODULE_3__[\"default\"](this);\n selectTeamUI.on('close', () => {\n interfaceManager.remove(selectTeamUI);\n });\n interfaceManager.push(selectTeamUI);\n }\n on(eventName, callback) {\n if (this.callbacks[eventName] === undefined) {\n this.callbacks[eventName] = [];\n }\n this.callbacks[eventName].push(callback);\n }\n runCallbacks(eventName) {\n const callbacks = this.callbacks[eventName];\n if (callbacks === undefined) {\n return;\n }\n for (const callback of callbacks) {\n callback();\n }\n }\n getType() {\n return this.type;\n }\n isNear() {\n return this.is_near;\n }\n getName() {\n return this.name;\n }\n getDescription() {\n return this.description;\n }\n getId() {\n return 'node-' + this.uuid;\n }\n getUUID() {\n return this.uuid;\n }\n getFeature() {\n if (this.feature === null) {\n this.feature = new ol_Feature__WEBPACK_IMPORTED_MODULE_5__[\"default\"]({\n geometry: new ol_geom_Point__WEBPACK_IMPORTED_MODULE_6__[\"default\"]([this.coordinate_1, this.coordinate_2]),\n type: 'node-' + this.uuid,\n });\n }\n return this.feature;\n }\n async getStyle() {\n const team = await this.getTeam();\n let color = 'white';\n if (team !== null) {\n color = team.getColor();\n }\n return new ol_style_Style__WEBPACK_IMPORTED_MODULE_7__[\"default\"]({\n image: new ol_style_Circle__WEBPACK_IMPORTED_MODULE_8__[\"default\"]({\n radius: 14,\n fill: new ol_style_Fill__WEBPACK_IMPORTED_MODULE_9__[\"default\"]({ color: color }),\n stroke: new ol_style_Stroke__WEBPACK_IMPORTED_MODULE_10__[\"default\"]({\n color: 'gray',\n width: 2,\n })\n })\n });\n }\n};\nMapNode = MapNode_1 = __decorate([\n (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonObject)(),\n __param(0, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __param(1, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __param(2, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __param(3, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __param(4, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __param(5, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __param(6, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __param(7, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __param(8, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __metadata(\"design:paramtypes\", [String, Number, Number, String, String, String, String, Boolean, String])\n], MapNode);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MapNode);\n\n\n//# sourceURL=webpack://BurguillosInfo/./js-src/conquer/map-node.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! typescript-json-serializer */ \"./node_modules/typescript-json-serializer/dist/index.esm.js\");\n/* harmony import */ var ol_style_Style__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ol/style/Style */ \"./node_modules/ol/style/Style.js\");\n/* harmony import */ var ol_Feature__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ol/Feature */ \"./node_modules/ol/Feature.js\");\n/* harmony import */ var ol_style_Circle__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ol/style/Circle */ \"./node_modules/ol/style/Circle.js\");\n/* harmony import */ var ol_geom_Point__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ol/geom/Point */ \"./node_modules/ol/geom/Point.js\");\n/* harmony import */ var ol_style_Fill__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ol/style/Fill */ \"./node_modules/ol/style/Fill.js\");\n/* harmony import */ var ol_style_Stroke__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ol/style/Stroke */ \"./node_modules/ol/style/Stroke.js\");\n/* harmony import */ var _burguillosinfo_conquer_interface_node_view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @burguillosinfo/conquer/interface/node-view */ \"./js-src/conquer/interface/node-view.ts\");\n/* harmony import */ var _burguillosinfo_conquer_serializer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @burguillosinfo/conquer/serializer */ \"./js-src/conquer/serializer.ts\");\n/* harmony import */ var _burguillosinfo_conquer_interface_select_team__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @burguillosinfo/conquer/interface/select-team */ \"./js-src/conquer/interface/select-team.ts\");\n/* harmony import */ var _burguillosinfo_conquer_team__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @burguillosinfo/conquer/team */ \"./js-src/conquer/team.ts\");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (undefined && undefined.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nvar __param = (undefined && undefined.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nvar MapNode_1;\n\n\n\n\n\n\n\n\n\n\n\nlet MapNode = MapNode_1 = class MapNode {\n constructor(uuid, coordinate_1, coordinate_2, type, name, description, kind, is_near, team) {\n this.uuid = uuid;\n this.coordinate_1 = coordinate_1;\n this.coordinate_2 = coordinate_2;\n this.type = type;\n this.name = name;\n this.description = description;\n this.kind = kind;\n this.is_near = is_near;\n this.team = team;\n this.feature = null;\n this.callbacks = {};\n }\n async getTeam() {\n if (this.team === null) {\n return null;\n }\n return _burguillosinfo_conquer_team__WEBPACK_IMPORTED_MODULE_4__[\"default\"].getTeam(this.team);\n }\n async fetch() {\n const urlNode = new URL('/conquer/node/' + this.uuid, window.location.protocol + '//' + window.location.hostname + ':' + window.location.port);\n const response = await fetch(urlNode);\n let responseBody;\n const errorThrow = new Error('Unable to fetch node updated.');\n try {\n responseBody = await response.json();\n }\n catch (error) {\n console.error('Error parseando json: ' + responseBody);\n console.error(error);\n throw errorThrow;\n }\n if (response.status !== 200) {\n console.error(responseBody.error);\n throw errorThrow;\n }\n const node = _burguillosinfo_conquer_serializer__WEBPACK_IMPORTED_MODULE_2__[\"default\"].deserialize(responseBody, MapNode_1);\n if (!(node instanceof MapNode_1)) {\n console.error('Unexpected JSON value for MapNode.');\n throw errorThrow;\n }\n return node;\n }\n click(interfaceManager) {\n const viewNodeInterface = new _burguillosinfo_conquer_interface_node_view__WEBPACK_IMPORTED_MODULE_1__[\"default\"](this);\n viewNodeInterface.on('close', () => {\n interfaceManager.remove(viewNodeInterface);\n });\n viewNodeInterface.on('update-nodes', () => {\n this.runCallbacks('update-nodes');\n });\n viewNodeInterface.on('open-select-team', () => {\n this.openSelectTeam(interfaceManager);\n });\n interfaceManager.push(viewNodeInterface);\n this.runCallbacks('click');\n }\n openSelectTeam(interfaceManager) {\n const selectTeamUI = new _burguillosinfo_conquer_interface_select_team__WEBPACK_IMPORTED_MODULE_3__[\"default\"](this);\n selectTeamUI.on('update-nodes', () => {\n this.runCallbacks('update-nodes');\n });\n selectTeamUI.on('close', () => {\n interfaceManager.remove(selectTeamUI);\n });\n interfaceManager.push(selectTeamUI);\n }\n on(eventName, callback) {\n if (this.callbacks[eventName] === undefined) {\n this.callbacks[eventName] = [];\n }\n this.callbacks[eventName].push(callback);\n }\n runCallbacks(eventName) {\n const callbacks = this.callbacks[eventName];\n if (callbacks === undefined) {\n return;\n }\n for (const callback of callbacks) {\n callback();\n }\n }\n getType() {\n return this.type;\n }\n isNear() {\n return this.is_near;\n }\n getName() {\n return this.name;\n }\n getDescription() {\n return this.description;\n }\n getId() {\n return 'node-' + this.uuid;\n }\n getUUID() {\n return this.uuid;\n }\n getFeature() {\n if (this.feature === null) {\n this.feature = new ol_Feature__WEBPACK_IMPORTED_MODULE_5__[\"default\"]({\n geometry: new ol_geom_Point__WEBPACK_IMPORTED_MODULE_6__[\"default\"]([this.coordinate_1, this.coordinate_2]),\n type: 'node-' + this.uuid,\n });\n }\n return this.feature;\n }\n async getStyle() {\n const team = await this.getTeam();\n let color = 'white';\n if (team !== null) {\n color = team.getColor();\n }\n return new ol_style_Style__WEBPACK_IMPORTED_MODULE_7__[\"default\"]({\n image: new ol_style_Circle__WEBPACK_IMPORTED_MODULE_8__[\"default\"]({\n radius: 14,\n fill: new ol_style_Fill__WEBPACK_IMPORTED_MODULE_9__[\"default\"]({ color: color }),\n stroke: new ol_style_Stroke__WEBPACK_IMPORTED_MODULE_10__[\"default\"]({\n color: 'gray',\n width: 2,\n })\n })\n });\n }\n};\nMapNode = MapNode_1 = __decorate([\n (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonObject)(),\n __param(0, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __param(1, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __param(2, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __param(3, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __param(4, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __param(5, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __param(6, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __param(7, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __param(8, (0,typescript_json_serializer__WEBPACK_IMPORTED_MODULE_0__.JsonProperty)()),\n __metadata(\"design:paramtypes\", [String, Number, Number, String, String, String, String, Boolean, String])\n], MapNode);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MapNode);\n\n\n//# sourceURL=webpack://BurguillosInfo/./js-src/conquer/map-node.ts?"); /***/ }),