Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 0 additions & 106 deletions api-idee-js/src/facade/assets/images/girar-vista.svg

This file was deleted.

106 changes: 0 additions & 106 deletions api-idee-js/src/facade/assets/images/inclinar-vista.svg

This file was deleted.

1 change: 1 addition & 0 deletions api-idee-js/src/facade/js/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@
"getprojection_method": "The implementation used does not have the getProjection method.",
"no_projection": "You have not specified any projection.",
"setprojection_method": "The used implementation does not have the setProjection method.",
"no_valid_projection": "The following EPSG code is incorrect or does not exist",
"no_plugins": "You have not specified any plugins.",
"no_add_plugin_to_map": "The plugin can not be added to the map.",
"plugin_already_added": "The plugin is already added to the map.",
Expand Down
1 change: 1 addition & 0 deletions api-idee-js/src/facade/js/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@
"getprojection_method": "La implementación usada no posee el método getProjection.",
"no_projection": "No ha especificado ninguna proyección.",
"setprojection_method": "La implementación usada no posee el método setProjection.",
"no_valid_projection": "El siguiente código EPSG es erróneo o no existe",
"no_plugins": "No ha especificado ningún plugin.",
"no_add_plugin_to_map": "El plugin no puede añadirse al mapa.",
"plugin_already_added": "El plugin ya está añadido al mapa.",
Expand Down
8 changes: 4 additions & 4 deletions api-idee-js/src/impl/ol/js/projections.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import proj4 from 'proj4';
import OLProjection from 'ol/proj/Projection';
import { register } from 'ol/proj/proj4';
import { addEquivalentProjections, get as getProj } from 'ol/proj';
import { getValue } from 'IDEE/i18n/language';
import Exception from 'IDEE/exception/exception';
import { parseCRSWKTtoJSON } from '../../../facade/js/util/Utils';

/**
Expand Down Expand Up @@ -665,7 +667,7 @@ const refactorUnits = (units) => {
const getDefProjection = async (code) => {
const response = await fetch(`https://epsg.io/${code}.proj4`);
if (!response.ok) {
throw new Error(`EPSG code ${code} not found`);
Exception(`${getValue('exception').no_valid_projection}: ${code}`);
}
return response.text();
};
Expand All @@ -691,7 +693,7 @@ const setNewProjection = async (projection) => {

const response = await fetch(url);
if (!response.ok) {
throw new Error(`No se pudo obtener la definición WKT de EPSG:${code}`);
Exception(`${getValue('exception').no_valid_projection}: ${code}`);
}

const wktResponse = await response.text();
Expand Down Expand Up @@ -740,8 +742,6 @@ addProjections(projections, false);
* @api stable
*/
export default {
addProjections,
getSupportedProjs,
setNewProjection,
ensureProjection,
};
12 changes: 10 additions & 2 deletions api-idee-js/src/plugins/infocoordinates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ El constructor se inicializa con un JSON con los siguientes atributos:
- **decimalUTMcoord**: Indica el número de decimales de las coordenadas proyectadas en UTM. Por defecto: 2
- **helpUrl**: URL a la ayuda para el icono. Por defecto: 'https://www.ign.es/'
- **outputDownloadFormat**: Indica el formato de salida del documento que se va a descargar. Se puede elegir entre 'txt' o 'csv'. Por defecto: txt.
- **epsgResults**: Códigos EPSG para mostrar simultáneamente las coordenadas, pero ocultará el selector CRS. Si es nulo se utilizará solamente la proyección usada en el mapa en ese momento y se habilitará el selector CRS.

# API-REST

```javascript
URL_API?infocoordinates=position*collapsed*collapsible*tooltip*decimalGEOcoord*decimalUTMcoord*helpUrl*outputDownloadFormat
URL_API?infocoordinates=position*collapsed*collapsible*tooltip*decimalGEOcoord*decimalUTMcoord*helpUrl*outputDownloadFormat*epsgResults
```

<table>
Expand Down Expand Up @@ -112,6 +113,11 @@ URL_API?infocoordinates=position*collapsed*collapsible*tooltip*decimalGEOcoord*d
<td>txt/csv</td>
<td>Base64 ✔️ | Separador ✔️</td>
</tr>
<tr>
<td>outputDownloadFormat</td>
<td>Array de códigos EPSG</td>
<td>Base64 ✔️ | Separador ❌</td>
</tr>
</table>


Expand Down Expand Up @@ -141,6 +147,7 @@ Ejemplo del constructor:
decimalGEOcoord: 4,
decimalUTMcoord: 4,
helpUrl: "https://www.ign.es/",
epsgResults: [25831,4326,4258,3857],
}
```

Expand All @@ -162,7 +169,8 @@ const mp = new IDEE.plugin.Infocoordinates({
order: 0,
tooltip: 'Información coordenadas',
decimalGEOcoord: 4,
decimalUTMcoord: 2
decimalUTMcoord: 2,
epsgResults: [25831,4326,4258,3857],
});

map.addPlugin(mp);
Expand Down
5 changes: 5 additions & 0 deletions api-idee-js/src/plugins/infocoordinates/src/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
"type": "simple",
"name": "outputDownloadFormat",
"position": 7
},
{
"type": "simple",
"name": "epsgResults",
"position": 8
}
]
}],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@

.grid-row--3col {
display: grid;
grid-template-columns: 74px 74px 36px;
grid-template-columns: 74px 74px 40px;
column-gap: 8px;
align-items: center;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"exception": {
"impl": "The implementation used cannot create Infocoordinates controls.",
"query_profile": "The altitude data for this point could not be queried.",
"srs": "The EPSG code entered is not valid. Default will be used: "
"srs": "The EPSG code entered is not valid. Default will be used: ",
"epsgResultsInvalid": "The following EPSG code for the 'epsgResults' parameter is invalid:"
},
"textHelp": {
"help1": "Click on the map to obtain the coordinates of a point in the selected reference system.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"exception": {
"impl": "La implementación no puede crear controles de Infocoordinates",
"query_profile": "No se han podido consultar los datos de altitud para este punto.",
"srs": "El código EPSG introducido no es válido. Se usará por defecto: "
"srs": "El código EPSG introducido no es válido. Se usará por defecto: ",
"epsgResultsInvalid": "El siguiente código EPSG del parámetro 'epsgResults no es válido:"
},
"textHelp": {
"help1": "Haga clic en el mapa para obtener las coordenadas de un punto en el sistema de referencia seleccionado.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ export default class Infocoordinates extends IDEE.Plugin {
*/
this.outputDownloadFormat_ = options.outputDownloadFormat || 'txt';

/**
* EPSG codes to display simultaneously. Accepts "EPSG:4326" or "4326" format.
* When null, single-EPSG mode is used with the selector.
* @private
* @type {string[]|null}
*/
this.epsgResults_ = options.epsgResults
? (Array.isArray(options.epsgResults) ? options.epsgResults : String(options.epsgResults).split(','))
.map((code) => {
const str = String(code).trim();
return str.startsWith('EPSG:') ? str : `EPSG:${str}`;
})
.filter((code) => code !== 'EPSG:')
: null;

/**
* Plugin parameters
* @public
Expand Down Expand Up @@ -136,6 +151,7 @@ export default class Infocoordinates extends IDEE.Plugin {
helpUrl: this.helpUrl_,
order: this.order,
outputDownloadFormat: this.outputDownloadFormat_,
epsgResults: this.epsgResults_,
});

this.controls.push(this.control_);
Expand Down Expand Up @@ -186,7 +202,7 @@ export default class Infocoordinates extends IDEE.Plugin {
* @api
*/
getAPIRest() {
return `${this.name}=${this.position}*${this.collapsed_}*${this.order}*${this.tooltip}*${this.decimalGEOcoord_}*${this.decimalUTMcoord_}*${this.helpUrl_}*${this.outputDownloadFormat_}`;
return `${this.name}=${this.position}*${this.collapsed_}*${this.order}*${this.tooltip}*${this.decimalGEOcoord_}*${this.decimalUTMcoord_}*${this.helpUrl_}*${this.outputDownloadFormat_}*${this.epsgResults_}`;
}

/**
Expand Down
Loading