diff --git a/CHANGELOG b/CHANGELOG
index 16d465671..076cc1d68 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,7 +1,6 @@
15/09/2023 - Versión 4.8.0
- Se activa nueva política de versionado de CORE y plugins
- Se implementa plugin layerswitcher para la gestión de capas dejando obsoleto el plugin fulltoc y toc
-- Se implementa plugin printerviewmanagement para la gestión de impresión dejando obsoletos los plugins printermap, georefimage y georefimae2
- Se implementa plugin comparators para la gestión de comparaciones dejando obsoletos los plugins transparency, lyrcompare, mirrorpanel y comparepanel
- Se implementa plugin modal para sustituir al plugin popup
- Se implementa método getSupportedProjs para conocer las proyecciones disponibles. M.impl.ol.js.projections.getSupportedProjs()
diff --git a/api-ign-js/src/facade/js/i18n/language.js b/api-ign-js/src/facade/js/i18n/language.js
index f60977661..5e8e28a2a 100644
--- a/api-ign-js/src/facade/js/i18n/language.js
+++ b/api-ign-js/src/facade/js/i18n/language.js
@@ -81,8 +81,6 @@ export const getTranslation = (lang) => {
configuration.translations[lang].printermap = pluginsLanguage.printermap.esPrintermap;
configuration.translations[lang].queryattributes = pluginsLanguage.queryattributes
.esQueryattributes;
- configuration.translations[lang].printviewmanagement =
- pluginsLanguage.printviewmanagement.esPrintviewmanagement;
// configuration.translations[lang].querydatabase = pluginsLanguage
// .querydatabase.esQuerydatabase;
configuration.translations[lang].rescale = pluginsLanguage.rescale.esRescale;
@@ -137,8 +135,6 @@ export const getTranslation = (lang) => {
configuration.translations[lang].predefinedzoom = pluginsLanguage.predefinedzoom
.enPredefinedzoom;
configuration.translations[lang].printermap = pluginsLanguage.printermap.enPrintermap;
- configuration.translations[lang].printviewmanagement =
- pluginsLanguage.printviewmanagement.enPrintviewmanagement;
// configuration.translations[lang].querydatabase = pluginsLanguage
// .querydatabase.enQuerydatabase;
configuration.translations[lang].rescale = pluginsLanguage.rescale.enRescale;
diff --git a/api-ign-js/src/facade/js/i18n/plugins.js b/api-ign-js/src/facade/js/i18n/plugins.js
index 49b6194e2..af7563aa8 100644
--- a/api-ign-js/src/facade/js/i18n/plugins.js
+++ b/api-ign-js/src/facade/js/i18n/plugins.js
@@ -206,10 +206,6 @@ import enLocator from '../../../plugins/locator/src/facade/js/i18n/en';
import esLocatorscn from '../../../plugins/locatorscn/src/facade/js/i18n/es';
import enLocatorscn from '../../../plugins/locatorscn/src/facade/js/i18n/en';
-// Printviewmanagement
-import esPrintviewmanagement from '../../../plugins/printviewmanagement/src/facade/js/i18n/es';
-import enPrintviewmanagement from '../../../plugins/printviewmanagement/src/facade/js/i18n/en';
-
/**
* Este objeto devuelve un objeto JSON dinámico que contiene
* los plugins disponibles que soportan traducciones.
@@ -413,10 +409,6 @@ const pluginsLanguage = {
esLocatorscn,
enLocatorscn,
},
- printviewmanagement: {
- esPrintviewmanagement,
- enPrintviewmanagement,
- },
};
export default pluginsLanguage;
diff --git a/api-ign-js/src/plugins/printviewmanagement/.eslintrc b/api-ign-js/src/plugins/printviewmanagement/.eslintrc
deleted file mode 100644
index 743dba50c..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/.eslintrc
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "extends": "airbnb",
- "globals": {
- "M": true,
- "ol": true,
- "CustomEvent": true,
- "Handlebars": true,
- "proj4": true,
- "ActiveXObject": true,
- "jsts": true,
- "document": true,
- "window": true,
- "DOMParser": true,
- "XMLHttpRequest": true,
- "Image": true,
- "Draggabilly": true,
- "XMLSerializer": true
- },
- "rules": {
- "no-underscore-dangle": ["error", { "allowAfterThis": true }],
- "import/extensions": ["error", "never"],
- "import/no-unresolved": "off",
- "prefer-destructuring": "off",
- "arrow-body-style": "off",
- "no-unused-vars": ["error", {
- "vars": "all",
- "args": "none"
- }],
- "class-methods-use-this": "off",
- "no-case-declarations": "off",
- "import/no-mutable-exports": "off",
- "no-template-curly-in-string": "off",
- "import/no-duplicates": "off",
- "import/no-named-default": "off"
- }
-}
diff --git a/api-ign-js/src/plugins/printviewmanagement/.gitignore b/api-ign-js/src/plugins/printviewmanagement/.gitignore
deleted file mode 100644
index 6ec558cfc..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/.gitignore
+++ /dev/null
@@ -1,11 +0,0 @@
-# Directorios y ficheros ignorados por git
-build/
-dist/
-node_modules/
-node
-target
-externs
-libraries
-doc
-src/index.js
-*~
diff --git a/api-ign-js/src/plugins/printviewmanagement/LICENSE b/api-ign-js/src/plugins/printviewmanagement/LICENSE
deleted file mode 100644
index a74f04438..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/LICENSE
+++ /dev/null
@@ -1,274 +0,0 @@
-European Union Public Licence
-V. 1.2
-
-EUPL © the European Union 2007, 2016
-
-This European Union Public Licence (the ‘EUPL’) applies to the Work (as
-defined below) which is provided under the terms of this Licence. Any use of
-the Work, other than as authorised under this Licence is prohibited (to the
-extent such use is covered by a right of the copyright holder of the Work).
-
-The Work is provided under the terms of this Licence when the Licensor (as
-defined below) has placed the following notice immediately following the
-copyright notice for the Work: “Licensed under the EUPL”, or has expressed by
-any other means his willingness to license under the EUPL.
-
-1. Definitions
-
-In this Licence, the following terms have the following meaning:
-— ‘The Licence’: this Licence.
-— ‘The Original Work’: the work or software distributed or communicated by the
- ‘Licensor under this Licence, available as Source Code and also as
- ‘Executable Code as the case may be.
-— ‘Derivative Works’: the works or software that could be created by the
- ‘Licensee, based upon the Original Work or modifications thereof. This
- ‘Licence does not define the extent of modification or dependence on the
- ‘Original Work required in order to classify a work as a Derivative Work;
- ‘this extent is determined by copyright law applicable in the country
- ‘mentioned in Article 15.
-— ‘The Work’: the Original Work or its Derivative Works.
-— ‘The Source Code’: the human-readable form of the Work which is the most
- convenient for people to study and modify.
-
-— ‘The Executable Code’: any code which has generally been compiled and which
- is meant to be interpreted by a computer as a program.
-— ‘The Licensor’: the natural or legal person that distributes or communicates
- the Work under the Licence.
-— ‘Contributor(s)’: any natural or legal person who modifies the Work under
- the Licence, or otherwise contributes to the creation of a Derivative Work.
-— ‘The Licensee’ or ‘You’: any natural or legal person who makes any usage of
- the Work under the terms of the Licence.
-— ‘Distribution’ or ‘Communication’: any act of selling, giving, lending,
- renting, distributing, communicating, transmitting, or otherwise making
- available, online or offline, copies of the Work or providing access to its
- essential functionalities at the disposal of any other natural or legal
- person.
-
-2. Scope of the rights granted by the Licence
-
-The Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
-sublicensable licence to do the following, for the duration of copyright
-vested in the Original Work:
-
-— use the Work in any circumstance and for all usage,
-— reproduce the Work,
-— modify the Work, and make Derivative Works based upon the Work,
-— communicate to the public, including the right to make available or display
- the Work or copies thereof to the public and perform publicly, as the case
- may be, the Work,
-— distribute the Work or copies thereof,
-— lend and rent the Work or copies thereof,
-— sublicense rights in the Work or copies thereof.
-
-Those rights can be exercised on any media, supports and formats, whether now
-known or later invented, as far as the applicable law permits so.
-
-In the countries where moral rights apply, the Licensor waives his right to
-exercise his moral right to the extent allowed by law in order to make
-effective the licence of the economic rights here above listed.
-
-The Licensor grants to the Licensee royalty-free, non-exclusive usage rights
-to any patents held by the Licensor, to the extent necessary to make use of
-the rights granted on the Work under this Licence.
-
-3. Communication of the Source Code
-
-The Licensor may provide the Work either in its Source Code form, or as
-Executable Code. If the Work is provided as Executable Code, the Licensor
-provides in addition a machine-readable copy of the Source Code of the Work
-along with each copy of the Work that the Licensor distributes or indicates,
-in a notice following the copyright notice attached to the Work, a repository
-where the Source Code is easily and freely accessible for as long as the
-Licensor continues to distribute or communicate the Work.
-
-4. Limitations on copyright
-
-Nothing in this Licence is intended to deprive the Licensee of the benefits
-from any exception or limitation to the exclusive rights of the rights owners
-in the Work, of the exhaustion of those rights or of other applicable
-limitations thereto.
-
-5. Obligations of the Licensee
-
-The grant of the rights mentioned above is subject to some restrictions and
-obligations imposed on the Licensee. Those obligations are the following:
-
-Attribution right: The Licensee shall keep intact all copyright, patent or
-trademarks notices and all notices that refer to the Licence and to the
-disclaimer of warranties. The Licensee must include a copy of such notices and
-a copy of the Licence with every copy of the Work he/she distributes or
-communicates. The Licensee must cause any Derivative Work to carry prominent
-notices stating that the Work has been modified and the date of modification.
-
-Copyleft clause: If the Licensee distributes or communicates copies of the
-Original Works or Derivative Works, this Distribution or Communication will be
-done under the terms of this Licence or of a later version of this Licence
-unless the Original Work is expressly distributed only under this version of
-the Licence — for example by communicating ‘EUPL v. 1.2 only’. The Licensee
-(becoming Licensor) cannot offer or impose any additional terms or conditions
-on the Work or Derivative Work that alter or restrict the terms of the
-Licence.
-
-Compatibility clause: If the Licensee Distributes or Communicates Derivative
-Works or copies thereof based upon both the Work and another work licensed
-under a Compatible Licence, this Distribution or Communication can be done
-under the terms of this Compatible Licence. For the sake of this clause,
-‘Compatible Licence’ refers to the licences listed in the appendix attached to
-this Licence. Should the Licensee's obligations under the Compatible Licence
-conflict with his/her obligations under this Licence, the obligations of the
-Compatible Licence shall prevail.
-
-Provision of Source Code: When distributing or communicating copies of the
-Work, the Licensee will provide a machine-readable copy of the Source Code or
-indicate a repository where this Source will be easily and freely available
-for as long as the Licensee continues to distribute or communicate the Work.
-
-Legal Protection: This Licence does not grant permission to use the trade
-names, trademarks, service marks, or names of the Licensor, except as required
-for reasonable and customary use in describing the origin of the Work and
-reproducing the content of the copyright notice.
-
-6. Chain of Authorship
-
-The original Licensor warrants that the copyright in the Original Work granted
-hereunder is owned by him/her or licensed to him/her and that he/she has the
-power and authority to grant the Licence.
-
-Each Contributor warrants that the copyright in the modifications he/she
-brings to the Work are owned by him/her or licensed to him/her and that he/she
-has the power and authority to grant the Licence.
-
-Each time You accept the Licence, the original Licensor and subsequent
-Contributors grant You a licence to their contributions to the Work, under the
-terms of this Licence.
-
-7. Disclaimer of Warranty
-
-The Work is a work in progress, which is continuously improved by numerous
-Contributors. It is not a finished work and may therefore contain defects or
-‘bugs’ inherent to this type of development.
-
-For the above reason, the Work is provided under the Licence on an ‘as is’
-basis and without warranties of any kind concerning the Work, including
-without limitation merchantability, fitness for a particular purpose, absence
-of defects or errors, accuracy, non-infringement of intellectual property
-rights other than copyright as stated in Article 6 of this Licence.
-
-This disclaimer of warranty is an essential part of the Licence and a
-condition for the grant of any rights to the Work.
-
-8. Disclaimer of Liability
-
-Except in the cases of wilful misconduct or damages directly caused to natural
-persons, the Licensor will in no event be liable for any direct or indirect,
-material or moral, damages of any kind, arising out of the Licence or of the
-use of the Work, including without limitation, damages for loss of goodwill,
-work stoppage, computer failure or malfunction, loss of data or any commercial
-damage, even if the Licensor has been advised of the possibility of such
-damage. However, the Licensor will be liable under statutory product liability
-laws as far such laws apply to the Work.
-
-9. Additional agreements
-
-While distributing the Work, You may choose to conclude an additional
-agreement, defining obligations or services consistent with this Licence.
-However, if accepting obligations, You may act only on your own behalf and on
-your sole responsibility, not on behalf of the original Licensor or any other
-Contributor, and only if You agree to indemnify, defend, and hold each
-Contributor harmless for any liability incurred by, or claims asserted against
-such Contributor by the fact You have accepted any warranty or additional
-liability.
-
-10. Acceptance of the Licence
-
-The provisions of this Licence can be accepted by clicking on an icon ‘I
-agree’ placed under the bottom of a window displaying the text of this Licence
-or by affirming consent in any other similar way, in accordance with the rules
-of applicable law. Clicking on that icon indicates your clear and irrevocable
-acceptance of this Licence and all of its terms and conditions.
-
-Similarly, you irrevocably accept this Licence and all of its terms and
-conditions by exercising any rights granted to You by Article 2 of this
-Licence, such as the use of the Work, the creation by You of a Derivative Work
-or the Distribution or Communication by You of the Work or copies thereof.
-
-11. Information to the public
-
-In case of any Distribution or Communication of the Work by means of
-electronic communication by You (for example, by offering to download the Work
-from a remote location) the distribution channel or media (for example, a
-website) must at least provide to the public the information requested by the
-applicable law regarding the Licensor, the Licence and the way it may be
-accessible, concluded, stored and reproduced by the Licensee.
-
-12. Termination of the Licence
-
-The Licence and the rights granted hereunder will terminate automatically upon
-any breach by the Licensee of the terms of the Licence. Such a termination
-will not terminate the licences of any person who has received the Work from
-the Licensee under the Licence, provided such persons remain in full
-compliance with the Licence.
-
-13. Miscellaneous
-
-Without prejudice of Article 9 above, the Licence represents the complete
-agreement between the Parties as to the Work.
-
-If any provision of the Licence is invalid or unenforceable under applicable
-law, this will not affect the validity or enforceability of the Licence as a
-whole. Such provision will be construed or reformed so as necessary to make it
-valid and enforceable.
-
-The European Commission may publish other linguistic versions or new versions
-of this Licence or updated versions of the Appendix, so far this is required
-and reasonable, without reducing the scope of the rights granted by the
-Licence. New versions of the Licence will be published with a unique version
-number.
-
-All linguistic versions of this Licence, approved by the European Commission,
-have identical value. Parties can take advantage of the linguistic version of
-their choice.
-
-14. Jurisdiction
-
-Without prejudice to specific agreement between parties,
-— any litigation resulting from the interpretation of this License, arising
- between the European Union institutions, bodies, offices or agencies, as a
- Licensor, and any Licensee, will be subject to the jurisdiction of the Court
- of Justice of the European Union, as laid down in article 272 of the Treaty
- on the Functioning of the European Union,
-— any litigation arising between other parties and resulting from the
- interpretation of this License, will be subject to the exclusive
- jurisdiction of the competent court where the Licensor resides or conducts
- its primary business.
-
-15. Applicable Law
-
-Without prejudice to specific agreement between parties,
-— this Licence shall be governed by the law of the European Union Member State
- where the Licensor has his seat, resides or has his registered office,
-— this licence shall be governed by Belgian law if the Licensor has no seat,
- residence or registered office inside a European Union Member State.
-
-Appendix
-
-‘Compatible Licences’ according to Article 5 EUPL are:
-— GNU General Public License (GPL) v. 2, v. 3
-— GNU Affero General Public License (AGPL) v. 3
-— Open Software License (OSL) v. 2.1, v. 3.0
-— Eclipse Public License (EPL) v. 1.0
-— CeCILL v. 2.0, v. 2.1
-— Mozilla Public Licence (MPL) v. 2
-— GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
-— Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for
- works other than software
-— European Union Public Licence (EUPL) v. 1.1, v. 1.2
-— Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or
- Strong Reciprocity (LiLiQ-R+)
-
-— The European Commission may update this Appendix to later versions of the
- above licences without producing a new version of the EUPL, as long as they
- provide the rights granted in Article 2 of this Licence and protect the
- covered Source Code from exclusive appropriation.
-— All other changes or additions to this Appendix require the production of a
- new EUPL version.
diff --git a/api-ign-js/src/plugins/printviewmanagement/README.md b/api-ign-js/src/plugins/printviewmanagement/README.md
deleted file mode 100644
index 963d2dd25..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/README.md
+++ /dev/null
@@ -1,349 +0,0 @@
-
-
-
-APICNIG 🔌 M.plugin.printviewmanagement
-
-# Descripción
-
-Plugin que permite utilizar diferentes herramientas de impresión.
-- Impresión de imagen con plantilla.
-- Impresión de imagen (desde servidor o desde cliente).
-- Impresión de imágenes de capas precargadas.
-- Posibilidad de añadir fichero de georreferenciación (WLD).
-
-# Dependencias
-
-Para que el plugin funcione correctamente es necesario importar las siguientes dependencias en el documento html:
-
-- **printviewmanagement.ol.min.js**
-- **printviewmanagement.ol.min.css**
-
-```html
-
-
-```
-
-# Uso del histórico de versiones
-
-Existe un histórico de versiones de todos los plugins de API-CNIG en [api-ign-legacy](https://github.com/IGN-CNIG/API-CNIG/tree/master/api-ign-legacy/plugins) para hacer uso de versiones anteriores.
-Ejemplo:
-```html
-
-
-```
-
-# Parámetros
-
-El constructor se inicializa con un JSON con los siguientes atributos:
-
-- **position**: Ubicación del plugin sobre el mapa.
- - 'TL': (top left) - Arriba a la izquierda (por defecto).
- - 'TR': (top right) - Arriba a la derecha.
- - 'BL': (bottom left) - Abajo a la izquierda.
- - 'BR': (bottom right) - Abajo a la derecha.
-- **collapsed**: Indica si el plugin viene colapsado de entrada (true/false). Por defecto: true.
-- **collapsible**: Indica si el plugin puede abrirse y cerrarse (true) o si permanece siempre abierto (false). Por defecto: true.
-- **tooltip**: Texto que se muestra al dejar el ratón encima del plugin. Por defecto: Impresión del mapa.
-- **isDraggable**: "True" para que el plugin se pueda desplazar, por defecto false.
-- **useProxy**: Define si el plugin utilizará el proxy o no, valores "true" o "false".
-- **serverUrl**: URL del servidor Geoprint. Por defecto: https://componentes.cnig.es/geoprint.
-- **printStatusUrl**: URL para consultar el estado de la impresión. Por defecto: https://componentes.cnig.es/geoprint/print/status.
-- **georefImageEpsg**: Indica si el control "Impresión de imágenes de capas precargadas" se añade al plugin (true/false). Por defecto: true.
- - **tooltip**: Texto que se muestra al dejar el ratón encima del plugin. Por defecto: Impresión del mapa.
- - **layers**: Array de objetos con información de las capas a imprimir.
- - url: URL de la capa.
- - name: Nombre de la capa.
- - format: Formato de la capa.
- - legend: Leyenda de la capa.
- - EPSG: Opcional, por defecto 3857.
- ```JavaScript
- layers: [
- {
- url: 'http://www.ign.es/wms-inspire/mapa-raster?',
- name: 'mtn_rasterizado',
- format: 'image/jpeg',
- legend: 'Mapa ETRS89 UTM',
- EPSG: 'EPSG:4326',
- },
- {
- url: 'http://www.ign.es/wms-inspire/pnoa-ma?',
- name: 'OI.OrthoimageCoverage',
- format: 'image/jpeg',
- legend: 'Imagen (PNOA) ETRS89 UTM',
- // EPSG: 'EPSG:4258',
- },
- ],
-
- ```
-- **georefImage**: Indica si el control "Impresión de imagen (desde servidor o desde cliente)" se añade al plugin (true/false). Por defecto: true.
- - **tooltip**: Texto que se muestra al dejar el ratón encima del plugin. Por defecto: Impresión del mapa.
- - **printTemplateUrl**: URL con las plantillas.
- - **printSelector**: Añade los dos modos de impresión (true/false). Por defecto: true.
- - **printType**: Define el modo de impresión (client/server), es necesario que printSelector tenga valor false.
-- **printermap**: Indica si el control "Impresión de imagen con plantilla" se añade al plugin (true/false). Por defecto: true.
- - **tooltip**: Texto que se muestra al dejar el ratón encima del plugin. Por defecto: Impresión del mapa.
- - **printTemplateUrl**: URL con las plantillas a utilizar. Por defecto: https://componentes.cnig.es/geoprint/print/CNIG.
- - **fixedDescription**: Valor booleano que indica si añadir por defecto un texto a la descripción específico de fototeca sin posibilidad de edición (true/false). Por defecto: false.
- - **headerLegend**: URL de una imagen para añadir como leyenda en la parte central de la cabecera.
- - **filterTemplates**: Listado de nombres de plantillas que queremos tener disponibles, si no se manda el parámetro aparecerán todas por defecto.
- - **logo**: URL de una imagen para añadir como logo en la esquina superior derecha.
-- **defaultOpenControl**: Indica el control que aparecerá abierto al inicio. Por defecto: 0.
-
-# API-REST
-
-```javascript
-URL_API?printviewmanagement=position*collapsed*collapsible*tooltip*isDraggable*serverUrl*printStatusUrl*georefImageEpsg*georefImage*printermap*defaultOpenControl
-```
-
-
-
- Parámetros
- Opciones/Descripción
- Disponibilidad
-
-
- position
- TR/TL/BR/BL
- Base64 ✔️ | Separador ✔️
-
-
- collapsed
- true/false
- Base64 ✔️ | Separador ✔️
-
-
- collapsible
- true/false
- Base64 ✔️ | Separador ✔️
-
-
- tooltip
- tooltip
- Base64 ✔️ | Separador ✔️
-
-
- isDraggable
- true/false
- Base64 ✔️ | Separador ✔️
-
-
- serverUrl
- serverUrl
- Base64 ✔️ | Separador ✔️
-
-
- printStatusUrl
- printStatusUrl
- Base64 ✔️ | Separador ✔️
-
-
- georefImageEpsg (*)
- true/false
- Base64 ✔️ | Separador ✔️
-
-
- georefImage (*)
- true/false
- Base64 ✔️ | Separador ✔️
-
-
- printermap (*)
- true/false
- Base64 ✔️ | Separador ✔️
-
-
- defaultOpenControl
- 0, 1, 2, 3
- Base64 ✔️ | Separador ✔️
-
-
-(*) Este parámetro podrá ser enviado por API-REST con los valores true o false. Si es true indicará al plugin que se añada el control con los valores por defecto. Para añadir los zooms deseados en los que se podrá centrar el mapa se deberá realizar mediante API-REST en base64.
-
-### Ejemplos de uso API-REST
-
-```
-https://componentes.cnig.es/api-core?printviewmanagement=TL*true*true*Imprimir*true***false*false*true
-```
-
-```
-https://componentes.cnig.es/api-core?printviewmanagement=TL*true*true*Imprimir*true***false*true*true*0
-
-### Ejemplos de uso API-REST en base64
-
-Para la codificación en base64 del objeto con los parámetros del plugin podemos hacer uso de la utilidad M.utils.encodeBase64.
-Ejemplo:
-```javascript
-M.utils.encodeBase64(obj_params);
-```
-
-1) Ejemplo de constructor del plugin:
-
-```javascript
-{
- isDraggable: true,
- position: 'TL',
- collapsible: true,
- collapsed: true,
- tooltip: 'Imprimir',
- georefImageEpsg: {
- tooltip: 'Georeferenciar imagen',
- layers: [
- {
- url: 'http://www.ign.es/wms-inspire/mapa-raster?',
- name: 'mtn_rasterizado',
- format: 'image/jpeg',
- legend: 'Mapa ETRS89 UTM',
- EPSG: 'EPSG:4326',
- },
- {
- url: 'http://www.ign.es/wms-inspire/pnoa-ma?',
- name: 'OI.OrthoimageCoverage',
- format: 'image/jpeg',
- legend: 'Imagen (PNOA) ETRS89 UTM',
- },
- ],
- },
- georefImage: {
- tooltip: 'Georeferenciar imagen',
- printTemplateUrl: 'https://componentes.cnig.es/geoprint/print/mapexport',
- printSelector: true,
- },
- printermap: true,
- defaultOpenControl: 3
-}
-```
-```
-https://componentes.cnig.es/api-core?printviewmanagement=base64=eyJpc0RyYWdnYWJsZSI6dHJ1ZSwicG9zaXRpb24iOiJUTCIsImNvbGxhcHNpYmxlIjp0cnVlLCJjb2xsYXBzZWQiOnRydWUsInRvb2x0aXAiOiJJbXByaW1pciIsImdlb3JlZkltYWdlRXBzZyI6eyJ0b29sdGlwIjoiR2VvcmVmZXJlbmNpYXIgaW1hZ2VuIiwibGF5ZXJzIjpbeyJ1cmwiOiJodHRwOi8vd3d3Lmlnbi5lcy93bXMtaW5zcGlyZS9tYXBhLXJhc3Rlcj8iLCJuYW1lIjoibXRuX3Jhc3Rlcml6YWRvIiwiZm9ybWF0IjoiaW1hZ2UvanBlZyIsImxlZ2VuZCI6Ik1hcGEgRVRSUzg5IFVUTSIsIkVQU0ciOiJFUFNHOjQzMjYifSx7InVybCI6Imh0dHA6Ly93d3cuaWduLmVzL3dtcy1pbnNwaXJlL3Bub2EtbWE/IiwibmFtZSI6Ik9JLk9ydGhvaW1hZ2VDb3ZlcmFnZSIsImZvcm1hdCI6ImltYWdlL2pwZWciLCJsZWdlbmQiOiJJbWFnZW4gKFBOT0EpIEVUUlM4OSBVVE0ifV19LCJnZW9yZWZJbWFnZSI6eyJ0b29sdGlwIjoiR2VvcmVmZXJlbmNpYXIgaW1hZ2VuIiwicHJpbnRUZW1wbGF0ZVVybCI6Imh0dHBzOi8vY29tcG9uZW50ZXMuY25pZy5lcy9nZW9wcmludC9wcmludC9tYXBleHBvcnQiLCJwcmludFNlbGVjdG9yIjp0cnVlfSwicHJpbnRlcm1hcCI6dHJ1ZSwiZGVmYXVsdE9wZW5Db250cm9sIjozfQ==
-```
-
-
-2) Ejemplo de constructor del plugin:
-```javascript
-{
- isDraggable: true,
- position: 'TL',
- collapsible: true,
- collapsed: true,
- tooltip: 'Imprimir',
- georefImageEpsg: false,
- georefImage: false,
- printermap: true
-}
-```
-```
-https://componentes.cnig.es/api-core?printviewmanagement=base64=eyJpc0RyYWdnYWJsZSI6dHJ1ZSwicG9zaXRpb24iOiJUTCIsImNvbGxhcHNpYmxlIjp0cnVlLCJjb2xsYXBzZWQiOnRydWUsInRvb2x0aXAiOiJJbXByaW1pciIsImdlb3JlZkltYWdlRXBzZyI6ZmFsc2UsImdlb3JlZkltYWdlIjpmYWxzZSwicHJpbnRlcm1hcCI6dHJ1ZX0=
-```
-
-# Ejemplo de uso
-
-```javascript
-const map = M.map({
- container: 'map'
-});
-
-const mp = new M.plugin.PrintViewManagement({
- isDraggable: true,
- position: 'TL',
- collapsible: true,
- collapsed: true,
- tooltip: 'Imprimir',
- serverUrl: 'https://componentes.cnig.es/geoprint',
- printStatusUrl: 'https://componentes.cnig.es/geoprint/print/status',
- defaultOpenControl: 3
- georefImageEpsg: {
- tooltip: 'Georeferenciar imagen',
- layers: [
- {
- url: 'http://www.ign.es/wms-inspire/mapa-raster?',
- name: 'mtn_rasterizado',
- format: 'image/jpeg',
- legend: 'Mapa ETRS89 UTM',
- EPSG: 'EPSG:4326',
- },
- {
- url: 'http://www.ign.es/wms-inspire/pnoa-ma?',
- name: 'OI.OrthoimageCoverage',
- format: 'image/jpeg',
- legend: 'Imagen (PNOA) ETRS89 UTM',
- // EPSG: 'EPSG:4258',
- },
- ],
- },
- georefImage: {
- tooltip: 'Georeferenciar imagen',
- printTemplateUrl: 'https://componentes.cnig.es/geoprint/print/mapexport',
- printSelector: false,
- printType: 'client', // 'client' or 'server'
- },
- printermap: {
- printTemplateUrl: 'https://componentes.cnig.es/geoprint/print/CNIG',
- // fixedDescription: true,
- headerLegend: 'https://www.idee.es/csw-codsi-idee/images/cabecera-CODSI.png',
- filterTemplates: ['A3 Horizontal'],
- logo: 'https://www.idee.es/csw-codsi-idee/images/cabecera-CODSI.png',
- },
-});
-
-map.addPlugin(mp);
-
-```
-
-
-# 👨💻 Desarrollo
-
-Para el stack de desarrollo de este componente se ha utilizado
-
-* NodeJS Version: 14.16
-* NPM Version: 6.14.11
-* Entorno Windows.
-
-## 📐 Configuración del stack de desarrollo / *Work setup*
-
-
-### 🐑 Clonar el repositorio / *Cloning repository*
-
-Para descargar el repositorio en otro equipo lo clonamos:
-
-```bash
-git clone [URL del repositorio]
-```
-
-### 1️⃣ Instalación de dependencias / *Install Dependencies*
-
-```bash
-npm i
-```
-
-### 2️⃣ Arranque del servidor de desarrollo / *Run Application*
-
-```bash
-npm run start
-```
-
-## 📂 Estructura del código / *Code scaffolding*
-
-```any
-/
-├── src 📦 # Código fuente
-├── task 📁 # EndPoints
-├── test 📁 # Testing
-├── webpack-config 📁 # Webpack configs
-└── ...
-```
-## 📌 Metodologías y pautas de desarrollo / *Methodologies and Guidelines*
-
-Metodologías y herramientas usadas en el proyecto para garantizar el Quality Assurance Code (QAC)
-
-* ESLint
- * [NPM ESLint](https://www.npmjs.com/package/eslint) \
- * [NPM ESLint | Airbnb](https://www.npmjs.com/package/eslint-config-airbnb)
-
-## ⛽️ Revisión e instalación de dependencias / *Review and Update Dependencies*
-
-Para la revisión y actualización de las dependencias de los paquetes npm es necesario instalar de manera global el paquete/ módulo "npm-check-updates".
-
-```bash
-# Install and Run
-$npm i -g npm-check-updates
-$ncu
-```
diff --git a/api-ign-js/src/plugins/printviewmanagement/package.json b/api-ign-js/src/plugins/printviewmanagement/package.json
deleted file mode 100644
index ecb91943c..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/package.json
+++ /dev/null
@@ -1,55 +0,0 @@
-{
- "name": "printviewmanagement",
- "version": "1.0.0",
- "description": "",
- "keywords": [
- "map",
- "mapping",
- "tool",
- "sigcorporativo-ja",
- "mapea",
- "plugin"
- ],
- "license": "ISC",
- "scripts": {
- "start": "webpack-dev-server --config=webpack-config/webpack.development.config.js",
- "prebuild": "node task/create-entrypoint.js",
- "build": "webpack --config=webpack-config/webpack.production.config.js",
- "test-build": "npm run build && live-server --open=test/prod.html",
- "check": "eslint ./src",
- "fix": "eslint --fix ./src"
- },
- "author": "",
- "devDependencies": {
- "@babel/core": "^7.0.0-beta.51",
- "@babel/plugin-proposal-export-default-from": "^7.0.0-beta.51",
- "@babel/preset-env": "^7.0.0-beta.51",
- "async": "2.1.4",
- "babel-eslint": "^10.0.1",
- "babel-loader": "^8.0.0-beta.4",
- "copy-webpack-plugin": "^4.5.2",
- "css-loader": "^2.1.1",
- "eslint": "^4.19.1",
- "eslint-config-airbnb": "^16.1.0",
- "eslint-loader": "^2.0.0",
- "eslint-plugin-import": "^2.9.0",
- "eslint-plugin-jsx-a11y": "^6.0.3",
- "eslint-plugin-react": "^7.7.0",
- "fs-extra": "2.0.0",
- "handlebars": "^4.0.11",
- "html-loader": "^0.5.5",
- "live-server": "^1.2.1",
- "mini-css-extract-plugin": "^0.4.1",
- "optimize-css-assets-webpack-plugin": "^5.0.1",
- "style-loader": "^0.21.0",
- "terser-webpack-plugin": "^1.2.3",
- "url-loader": "^1.0.1",
- "webpack": "^4.12.0",
- "webpack-cli": "^3.0.8",
- "webpack-dev-server": "^3.1.14"
- },
- "dependencies": {
- "file-saver": "2.0.2",
- "jszip": "3.2.2"
- }
-}
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/api.json b/api-ign-js/src/plugins/printviewmanagement/src/api.json
deleted file mode 100644
index 9faa1b7ca..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/api.json
+++ /dev/null
@@ -1,95 +0,0 @@
-{
- "url": {
- "name": "printviewmanagement",
- "separator": "*"
- },
- "constructor": "M.plugin.PrintViewManagement",
- "parameters": [{
- "type": "object",
- "properties": [
- {
- "type": "simple",
- "name": "position",
- "position": 0,
- "possibleValues": [
- "TL",
- "TR",
- "BR",
- "BL"
- ]
- },
- {
- "type": "boolean",
- "name": "collapsed",
- "position": 1
- },
- {
- "type": "boolean",
- "name": "collapsible",
- "position": 2
- },
- {
- "type": "simple",
- "name": "tooltip",
- "position": 3
- },
- {
- "type": "simple",
- "name": "isDraggable",
- "position": 4
- },
- {
- "type": "simple",
- "name": "serverUrl",
- "position": 5
- },
- {
- "type": "simple",
- "name": "printStatusUrl",
- "position": 6
- },
- {
- "type": "boolean",
- "name": "georefImageEpsg",
- "position": 7
- },
- {
- "type": "boolean",
- "name": "georefImage",
- "position": 8
- },
- {
- "type": "boolean",
- "name": "printermap",
- "position": 9
- },
- {
- "type": "number",
- "name": "defaultOpenControl",
- "position": 10,
- "possibleValues": [0, 1, 2, 3]
- }
- ]
- }],
- "files": {
- "ol": {
- "scripts": [
- "printviewmanagement.ol.min.js"
- ],
- "styles": [
- "printviewmanagement.ol.min.css"
- ]
- }
- },
- "metadata": {
- "name": "printviewmanagement",
- "description": "Offer different zoom tools",
- "text": "It offers different zoom tools.",
- "version": "1.0.0",
- "date": "27th April 2023",
- "author": "CNIG",
- "org": "CNIG",
- "tags": "mapea,plugin",
- "icon": "./facade/assets/icons/icons.svg"
- }
-}
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/facade/assets/css/printviewmanagement.css b/api-ign-js/src/plugins/printviewmanagement/src/facade/assets/css/printviewmanagement.css
deleted file mode 100644
index 77a42c2c1..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/facade/assets/css/printviewmanagement.css
+++ /dev/null
@@ -1,732 +0,0 @@
-@font-face {
- font-family: 'printviewmanagement';
- src: url('../fonts/printviewmanagement.eot?j5vahz');
- src: url('../fonts/printviewmanagement.eot?j5vahz#iefix') format('embedded-opentype'),
- url('../fonts/printviewmanagement.ttf?j5vahz') format('truetype'),
- url('../fonts/printviewmanagement.woff?j5vahz') format('woff'),
- url('../fonts/printviewmanagement.svg?j5vahz#printviewmanagement') format('svg');
- font-weight: normal;
- font-style: normal;
- font-display: block;
- }
-
- [class^="printviewmanagement-icon-"], [class*=" printviewmanagement-icon-"] {
- /* use !important to prevent issues with browser extensions that change fonts */
- font-family: 'printviewmanagement' !important;
- speak: never;
- font-style: normal;
- font-weight: normal;
- font-variant: normal;
- text-transform: none;
- line-height: 1;
- }
-
-
-/* Opening & closing buttons */
-
-.m-panel.m-plugin-printviewmanagement.collapsed {
- height: 40px;
-}
-
-.m-plugin-printviewmanagement.opened .m-panel-btn.g-cartografia-flecha-derecha,
-.m-plugin-printviewmanagement.opened .m-panel-btn.g-cartografia-flecha-izquierda {
- background-color: white !important;
- color: #71a7d3 !important;
-}
-
-.m-areas>div.m-area.m-right>div.m-plugin-printviewmanagement.opened>button.m-panel-btn {
- position: absolute;
- left: -40px;
-}
-
-.m-areas>div.m-area.m-left>div.m-plugin-printviewmanagement.opened>button.m-panel-btn {
- position: absolute;
- right: -40px;
-}
-
-/* Title and images container */
-
-.m-control.m-container.m-printviewmanagement {
- width: 450px;
-}
-
-/* Título */
-
-.m-printviewmanagement-title {
- background-color: #71a7d3;
- color: white;
- display: block;
- font-size: 15px;
- height: 40px;
- line-height: 40px;
- padding: 0 5px;
- text-align: center;
- width: 100%;
-}
-
-.m-printviewmanagement-previews {
- background-color: white;
-}
-
-#m-printviewmanagement-printermap,
-#m-printviewmanagement-georefImage,
-#m-printviewmanagement-zoompanel,
-.printviewmanagement-georefImageEpsg {
- padding: 10px;
- font-size: 22px;
- cursor: pointer;
-
- font-family: 'printviewmanagement';
- background-color: white;
- border: none;
- color: #6c6c6c;
-}
-
-.printviewmanagement-icon-flecha-historial.activated,
-.printviewmanagement-icon-zoompanel.activated,
-.printviewmanagement-icon-expand.activated:before ,
-.printviewmanagement-icon-zoom-extension.activated,
-.printviewmanagement-georefImageEpsg.activated,
-.printviewmanagement-icon-flecha-izquierda3.activated:before,
-.printviewmanagement-icon-flecha-derecha3.activated:before,
-.printviewmanagement-icon-zoom-in.activated:before,
-.printviewmanagement-icon-zoom-out.activated:before {
- color: #71a7d3 !important;
-}
-
-.m-printviewmanagement-previews {
- display: flex;
- justify-content: center;
-}
-
-#m-printermap-panel,
-#m-zoompanel-panel {
- background-color: #ededed;
- border-top: 1px solid #adadad;
- padding: 10px;
- text-align: center;
- width: 230px;
-}
-
-.printviewmanagement-icon-expand {
- border: none;
- background-color: transparent;
- font-size: 22px;
- cursor: pointer;
-}
-
-/* Images container */
-
-.m-printviewmanagement .activeprintviewmanagementDiv {
- border: 5px solid #92c1e7 !important;
-}
-
-/* Bottom positions fix when images row turns into columns */
-
-.m-printviewmanagement-previews {
- background-color: white;
- display: flex;
- /* width: 220px; */
-}
-
-.m-bottom.m-left>.m-panel.m-plugin-printviewmanagement.opened>.m-panel-controls {
- display: flow-root;
-}
-
-.m-bottom.m-left>.m-plugin-printviewmanagement.opened>.m-panel-btn {
- position: relative;
- right: -40px;
-}
-
-.m-areas>div.m-area>div.m-panel.opened.m-plugin-printviewmanagement {
- background-color: transparent !important;
- /* box-shadow: none !important; */
- order: 0;
-}
-
-.m-areas>div.m-area.m-left>div.m-panel.opened.m-plugin-printviewmanagement {
- display: block !important;
-}
-
-.m-areas>div.m-area.m-bottom.m-right>div.m-panel.opened.no-collapsible.m-plugin-printviewmanagement>div.m-panel-controls>div.m-control.m-container.m-printviewmanagement {
- padding-right: 0px;
-}
-
-.m-areas>div.m-area>div.m-panel.collapsed>div.m-panel-controls {
- display: none;
-}
-
-.m-areas>div.m-area>div.m-panel.m-plugin-printviewmanagement.collapsed>div.m-panel-controls>div {
- display: none;
-}
-
-/* Firefox fix */
-
-@-moz-document url-prefix() {
- .m-bottom.m-right .m-plugin-printviewmanagement.opened {
- display: flex;
- }
-
- .m-areas>div.m-area.m-bottom.m-right>div.m-panel.opened.m-plugin-printviewmanagement>div.m-panel-controls>div.m-control.m-container.m-printviewmanagement {
- padding-right: unset;
- }
-
- .m-areas>div.m-area.m-bottom.m-right>div.m-panel.opened.no-collapsible.m-plugin-printviewmanagement>div.m-panel-controls>div.m-control.m-container.m-printviewmanagement {
- padding-right: 0px;
- }
-}
-
-/* Mobile fix */
-
-@media only screen and (max-width: 1000px) {
- .m-areas>div.m-area.m-right>div.m-panel.m-plugin-printviewmanagement.opened {
- margin-right: 10px;
- }
-
- .m-areas>div.m-area.m-right>div.m-panel.m-plugin-printviewmanagement.opened {
- margin-left: 10px;
- }
-
- .m-areas>div.m-area>div.m-panel.opened {
- z-index: 10;
- }
-
- .m-printviewmanagement-title {
- font-size: 13px;
- padding-left: 0;
- padding-right: 0;
- }
-
- /* Firefox fix */
-
- @-moz-document url-prefix() {
- .m-bottom.m-left>.m-panel.m-plugin-printviewmanagement.opened>.m-panel-controls {
- display: flow-root;
- }
-
- .m-areas>div.m-area>div.m-panel.m-plugin-printviewmanagement.opened {
- width: auto;
- }
-
- .m-bottom.m-left>.m-panel.m-plugin-printviewmanagement.opened>.m-panel-controls {
- display: flex;
- }
-
- .m-bottom.m-left>.m-panel.m-plugin-printviewmanagement.opened>button {
- left: 0px;
- }
-
- .m-areas>div.m-area>div.m-panel>div.m-panel-controls {
- display: flex;
- }
- }
-
- /* Edge fix */
-
- @supports (-ms-ime-align:auto) {
-
- .m-areas>div.m-area>div.m-panel>div.m-panel-controls {
- padding-left: 0px;
- }
-
- .m-bottom.m-left>.m-plugin-printviewmanagement.opened>.m-panel-btn {
- position: static;
- }
- }
-}
-
-/* Edge fix */
-@supports (-ms-ime-align:auto) {
- .m-areas>div.m-area>div.m-panel>div.m-panel-controls {
- padding-left: 40px;
- }
-
- .m-bottom.m-left>.m-plugin-printviewmanagement.opened>.m-panel-btn {
- right: 0px;
- }
-}
-
-
-
-.printviewmanagement-icon-zoom-in:before {
- content: "\e802";
- color: #646464;
-}
-
-.printviewmanagement-icon-zoom-out:before {
- content: "\e803";
- color: #646464;
-}
-
-.printviewmanagement-icon-zoompanel:before {
- content: "\e90d";
-}
-
-.printviewmanagement-georefImageEpsg:before {
- content: "\e933";
-}
-
-.printviewmanagement-icon-expand:before {
- content: "\e919";
- color: #646464;
-}
-
-.printviewmanagement-icon-flecha-derecha3:before {
- content: "\e1900";
- color: #646464;
-}
-
-.printviewmanagement-icon-flecha-izquierda3:before {
- content: "\e1901";
- color: #646464;
-}
-
-.printviewmanagement-icon-zoom-extension:before {
- content: "\e90d";
-}
-
-.printviewmanagement-icon-zoom-mapa:before {
- content: "\e9c7";
-}
-
-.printviewmanagement-icon-flecha-historial:before {
- content: "\e954";
-}
-
-.printviewmanagement-icon-clipboard:before {
- content: "\e92c";
-}
-
-
-div.m-area.m-top.m-left>div.m-plugin-printviewmanagement.m-panel>button.m-panel-btn {
- font-family: printviewmanagement !important;
-}
-
-div.m-area.m-top.m-left>div.m-plugin-printviewmanagement.m-panel.opened>button.m-panel-btn {
- font-family: g-cartografia !important;
-}
-
-div.m-area.m-top.m-right>div.m-plugin-printviewmanagement.m-panel>button.m-panel-btn {
- font-family: printviewmanagement !important;
-}
-
-div.m-area.m-top.m-right>div.m-plugin-printviewmanagement.m-panel.opened>button.m-panel-btn {
- font-family: g-cartografia !important;
-}
-
-div.m-area.m-bottom.m-right>div.m-plugin-printviewmanagement.m-panel>button.m-panel-btn {
- font-family: printviewmanagement !important;
-}
-
-div.m-area.m-bottom.m-right>div.m-plugin-printviewmanagement.m-panel.opened>button.m-panel-btn {
- font-family: g-cartografia !important;
-}
-
-div.m-area.m-bottom.m-left>div.m-plugin-printviewmanagement.m-panel>button.m-panel-btn {
- font-family: printviewmanagement !important;
-}
-
-div.m-area.m-bottom.m-left>div.m-plugin-printviewmanagement.m-panel.opened>button.m-panel-btn {
- font-family: g-cartografia !important;
-}
-
- .m-georefimageepsg-container,.m-georefimage-container, .m-printermap-container {
- display: flex;
- justify-content: center;
- align-items: center;
- flex-direction: column;
- width: 100%;
- gap: 20px;
- background-color: white;
- padding: 20px 0;
- }
-
- .m-georefimage-container {
- justify-content: space-between;
- padding: 0;
- gap: 0;
- }
-
-/*********************
- georefimageepsg
- *********************/
- .m-georefimageepsg-container select {
- width: 90%;
- padding: 5px;
- border-radius: 4px;
- border: 1px solid rgba(0, 0, 0, 0.4);
- font-size: 15px;
- line-height: 25px;
- cursor: pointer;
- color: #404040;
- background-color: #e9e9e9;
- opacity: 1;
- font-family: 'Muli', 'sans-serif' !important;
- }
-
- .m-georefimageepsg-container button {
- margin: 0 auto;
- text-align: center;
- display: table;
-
- border-radius: 4px;
- border: 1px solid rgba(0, 0, 0, 0.4);
- font-size: 15px;
- line-height: 25px;
- cursor: pointer;
- color: #404040;
- background-color: #e9e9e9;
- opacity: 1;
- font-family: 'Muli', 'sans-serif' !important;
- cursor: pointer;
- width: 60%;
- padding: 5px;
- }
-
-
- .m-georefimageepsg-container button:focus {
- outline: none;
- }
-
- .m-georefimageepsg-container button:before {
- font-size: 21px;
- margin-right: 10px;
- }
-
- .m-georefimageepsg-container button i {
- font-size: 20px;
- vertical-align: text-bottom;
- }
-
-
- /*********************
- georefimage
- *********************/
-
- /* Oculta el label sin perder accesibilidad */
- .m-georefimage-titleFormat label,
- .m-printermap-titleFormat label,
- .m-printermap-paramsLabel,
- .m-georefimageepsg-label,
- .m-printermap-labelTextarea{
- position: absolute;
- clip: rect(1px 1px 1px 1px);
- border: 0;
- height: 1px;
- width: 1px;
- overflow: hidden;
- }
-
- .m-georefimage-container fieldset {
- border: 1px solid #ccc;
- padding: 10px;
- margin: 0 auto;
- width: 90%;
- border-radius: 4px;
-
- display: flex;
- justify-content: center;
- align-items: center;
- flex-direction: column;
-
- font-size: 1rem;
-
- margin-bottom: 10px;
- }
-
- .m-georefimage-container fieldset h3 {
- margin-block-start: 0px;
- margin-block-end: 0px;
- }
-
- .m-georefimage-container h2 {
- font-size: 1.1rem;
- margin-block-start: 0px;
- margin-block-end: 30px;
- }
-
- .m-georefimage-fieldsetInput div{
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 5px;
- margin: 10px 0;
- }
-
- .m-georefimage-titleFormat, .m-printermap-titleFormat{
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- gap: 10px;
-
- font-size: 1rem;
- }
-
- .m-georefimage-projectionOther, .m-georefimage-download-button {
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
-
- font-size: 1rem;
- gap: 25px;
- }
-
- .m-georefimage-projection {
- text-align: center;
- }
-
- #m-georefimage-dpi{
- width: 40px;
- }
-
- .georefimage-jgwKeppview {
- display: flex;
- justify-content: center;
- align-items: center;
- gap: 20px;
-
- font-size: 1rem;
- margin: 25px 0;
- }
-
- .georefimage-jgwKeppview input[type="number"] {
- width: 50px;
- height: 21px;
- margin-left: 5px;
- }
-
-
- .m-georefimage-titleFormat input, .m-printermap-titleFormat input{
- width: 65%;
- height: 21px;
- }
-
- .georefimage-projectionTypeImg {
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
-
- margin: 20px 0;
-
- }
-
- .georefimage-projection {
- font-size: 1.1rem;
- }
-
- .georefimage-projection select,
- .m-georefimage-titleFormat select,
- .m-printermap-titleFormat select,
- .m-printermap-params select{
-
- padding: 5px;
- border-radius: 4px;
- border: 1px solid rgba(0, 0, 0, 0.4);
- font-size: 15px;
- line-height: 25px;
- cursor: pointer;
- color: #404040;
- background-color: #e9e9e9;
- opacity: 1;
- font-family: 'Muli', 'sans-serif' !important;
- }
-
- .m-georefimage-download-button {
- width: 100%;
- margin: 0 auto;
- text-align: center;
- background-color: rgb(170, 170, 170) !important;
- }
-
-
-.m-georefimage-download-button button {
- border-radius: 4px;
- border: 1px solid rgba(0, 0, 0, 0.4);
- font-size: 15px;
- line-height: 25px;
- cursor: pointer;
- opacity: 0.75;
- -webkit-transition: opacity 0.25s ease 0s;
- transition: opacity 0.25s ease 0s;
- color: #404040;
-}
-
-.m-georefimage-download-button button i {
- font-size: 20px;
- vertical-align: text-bottom;
-}
-
-.m-georefimage-download-button button:hover {
- opacity: 1;
-}
-
-.m-georefimage-download-button button:focus {
- outline: none;
-}
-
-.m-georefimage-download-button button:before {
- font-size: 21px;
- margin-right: 10px;
-}
-
-.m-georefimage-download-button .print {
- width: 60%;
- margin: 10px 5% 10px 5%;
- padding: 5px;
- background-color: #fff;
- font-family: 'Muli', 'sans-serif' !important;
- cursor: pointer;
-}
-
-.m-georefimage-download-button .remove {
- width: 25%;
- margin: 10px 5% 10px 0;
- padding: 5px;
- background-color: #fff;
- font-family: 'Muli', 'sans-serif' !important;
- cursor: pointer;
-}
-
-.printviewmanagement-icon-clipboard {
- background-color: #fff;
- border: none;
-}
-
-.printviewmanagement-icon-clipboard:hover {
- color: #71a7d3;
- cursor: pointer;
-}
-
-
-
-
-/*********************
- QUEUE PANEL
-*********************/
-
-.m-printviewmanagement-queue{
- width: 100%;
- height: 100%;
- overflow: auto;
- padding: 0px;
- margin: 0px;
- list-style: none;
- font-family: 'Muli', 'sans-serif' !important;
- background-color: white;
-}
-
-@media only screen and (min-width: 769px) {
- .m-printviewmanagement-queue {
- max-height: 20vh;
- overflow: auto;
- }
-}
-
-
-/*********************
- QUEUE ELEM
-*********************/
-
-.queue-container {
- padding-inline-start: 0px;
- display: flex;
- justify-content: center;
- flex-direction: column;
- align-items: center;
-}
-
-.m-printviewmanagement-queue .queue-container>li {
- position: relative;
- padding: 10px;
- -webkit-transition: box-shadow 0.3s ease 0s, background 0.3s ease 0s, transform 0.05s ease 0s;
- transition: box-shadow 0.3s ease 0s, background 0.3s ease 0s, transform 0.05s ease 0s;
- cursor: pointer;
- margin: 0px;
- border-top: 1px solid rgba(0, 0, 0, 0.13);
- box-sizing: border-box;
- font-family: 'Muli', 'sans-serif' !important;
- speak: none;
- font-style: normal;
- font-weight: normal;
- font-variant: normal;
- text-transform: none;
- /* Better Font Rendering =========== */
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- list-style: none;
- width: 95%;
-}
-
-.m-printviewmanagement-queue .queue-container>li:after,
-.m-printviewmanagement-queue .queue-container>li.printing:after {
- position: absolute;
- right: 15px;
- font-size: 19px;
- color: #e7338c;
- font-family: 'printviewmanagement' !important;
-}
-
-.m-printviewmanagement-queue .finished:after {
- content: '\e960';
-}
-
-.m-printviewmanagement-queue .printing:after {
- /* border: 1px solid #A914DA;*/
- content: '\e97f';
- -webkit-animation: mloading 1s linear infinite;
- -moz-animation: mloading 1s linear infinite;
- animation: mloading 1s linear infinite;
-}
-
-.m-printviewmanagement-queue .queue-container>li:nth-child(1) {
- border-top: 0px;
-}
-
-.m-printviewmanagement-queue .queue-container>li:not(.printing):hover {
- background-color: rgba(231, 51, 140, 0.1);
- box-sizing: border-box;
- border-bottom: 0;
-}
-
-/*********************
- Printermap
-*********************/
-
-.m-printermap-textarea {
- width: 90%;
- height: 100px;
- resize: none;
-}
-
-.m-printermap-params {
- display: flex;
- justify-content: space-around;
- align-items: center;
-
- width: 100%;
-}
-
-.m-printermap-params div label {
- margin-right: 5px;
-}
-
-@media (width <= 507px) {
- .m-control.m-container.m-printviewmanagement {
- width: 300px;
- }
-
- .georefimage-jgwKeppview {
- flex-direction: column;
- }
- .m-georefimage-titleFormat input {
- width: 50%;
- }
-
- .georefimage-jgwKeppview div:first-child {
- width: 80%;
- }
-}
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/facade/assets/fonts/printviewmanagement.eot b/api-ign-js/src/plugins/printviewmanagement/src/facade/assets/fonts/printviewmanagement.eot
deleted file mode 100644
index 9a669daad..000000000
Binary files a/api-ign-js/src/plugins/printviewmanagement/src/facade/assets/fonts/printviewmanagement.eot and /dev/null differ
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/facade/assets/fonts/printviewmanagement.svg b/api-ign-js/src/plugins/printviewmanagement/src/facade/assets/fonts/printviewmanagement.svg
deleted file mode 100644
index 91778ee13..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/facade/assets/fonts/printviewmanagement.svg
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-Generated by IcoMoon
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/facade/assets/fonts/printviewmanagement.ttf b/api-ign-js/src/plugins/printviewmanagement/src/facade/assets/fonts/printviewmanagement.ttf
deleted file mode 100644
index 1c02120ff..000000000
Binary files a/api-ign-js/src/plugins/printviewmanagement/src/facade/assets/fonts/printviewmanagement.ttf and /dev/null differ
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/facade/assets/fonts/printviewmanagement.woff b/api-ign-js/src/plugins/printviewmanagement/src/facade/assets/fonts/printviewmanagement.woff
deleted file mode 100644
index 3da910745..000000000
Binary files a/api-ign-js/src/plugins/printviewmanagement/src/facade/assets/fonts/printviewmanagement.woff and /dev/null differ
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/georefimagecontrol.js b/api-ign-js/src/plugins/printviewmanagement/src/facade/js/georefimagecontrol.js
deleted file mode 100644
index 01e337dfd..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/georefimagecontrol.js
+++ /dev/null
@@ -1,1000 +0,0 @@
-/**
- * @module M/control/GeorefimageControl
- */
-import GeorefimageControlImpl from '../../impl/ol/js/georefimagecontrol';
-import { reproject, transformExt } from '../../impl/ol/js/utils';
-import georefimageHTML from '../../templates/georefimage';
-import { getValue } from './i18n/language';
-
-import {
- innerQueueElement,
- removeLoadQueueElement,
- getQueueContainer,
- createWLD,
- createZipFile,
- LIST_SERVICES,
- generateTitle,
- formatImageBase64,
- getBase64Image,
-} from './utils';
-
-// ID ELEMENTS
-const ID_TITLE = '#m-georefimage-title';
-const ID_FORMAT_SELECT = '#m-georefimage-format';
-const ID_WLD = '#m-georefimage-wld';
-const ID_DPI = '#m-georefimage-dpi';
-const ID_PROJECTION = '#m-georefimage-projection';
-const ID_FIELDSET = '#m-georefimage-fieldset';
-const ID_LIST_SERVICES = '#m-georefimage-listServices';
-const ID_CLIPBOARD = '#m-georefimage-clipboard';
-
-// SELECTOR CANVAS
-const SELECTOR_CANVAS = '.ol-layer canvas';
-
-// DEFAULTS PARAMS
-const FILE_EXTENSION_GEO = '.wld'; // .jgw
-const TYPE_SAVE = '.zip';
-
-export default class GeorefimageControl extends M.Control {
- /**
- * @classdesc
- * Main constructor of the class.
- *
- * @constructor
- * @extends {M.Control}
- * @api stable
- */
- constructor({
- serverUrl,
- printTemplateUrl,
- printStatusUrl,
- printSelector,
- printType,
- }, map, statusProxy, useProxy) {
- const impl = new GeorefimageControlImpl(map);
- super(impl, GeorefimageControl.NAME);
- this.map_ = map;
- if (M.utils.isUndefined(GeorefimageControlImpl)) {
- M.exception('La implementación usada no puede crear controles Georefimage');
- }
-
- if (M.utils.isUndefined(GeorefimageControlImpl.prototype.encodeLayer)) {
- M.exception('La implementación usada no posee el método encodeLayer');
- }
-
- /**
- * Mapfish server url
- * @private
- * @type {String}
- */
- this.serverUrl_ = serverUrl || 'https://componentes.cnig.es/geoprint';
-
- /**
- * Mapfish template url
- * @private
- * @type {String}
- */
- this.printTemplateUrl_ = printTemplateUrl || 'https://componentes.cnig.es/geoprint/print/mapexport';
-
- /**
- * Url for getting priting status
- * @private
- * @type {String}
- */
- this.printStatusUrl_ = printStatusUrl || 'https://componentes.cnig.es/geoprint/print/status';
-
- this.printSelector = !!printSelector;
-
- this.printType = printType === 'client' ? 'client' : 'server';
-
- /**
- * Map title
- * @private
- * @type {HTMLElement}
- */
- this.elementTitle_ = null;
-
- /**
- * Map description
- * @private
- * @type {HTMLElement}
- */
- this.areaDescription_ = null;
-
- /**
- * Layout
- * @private
- * @type {HTMLElement}
- */
- this.layout_ = null;
-
- /**
- * Map format to print
- * @private
- * @type {HTMLElement}
- */
- this.format_ = null;
-
- /**
- * Map projection to print
- * @private
- * @type {HTMLElement}
- */
- this.projection_ = null;
-
- /**
- * Map dpi to print
- * @private
- * @type {HTMLElement}
- */
- this.dpi_ = null;
-
- /**
- * Force scale boolean
- * @private
- * @type {HTMLElement}
- */
- this.forceScale_ = null;
-
- /**
- * Mapfish params
- * @private
- * @type {String}
- */
- this.params_ = {
- layout: {
- outputFilename: 'mapa_${yyyy-MM-dd_hhmmss}',
- },
- pages: {
- clientLogo: '', // logo url
- creditos: getValue('printInfo'),
- },
- parameters: {},
- };
-
- /**
- * Facade of the map
- * @private
- * @type {Promise}
- */
- this.capabilitiesPromise_ = null;
-
- /**
- * Mapfish options params
- * @private
- * @type {String}
- */
- this.options_ = {
- dpi: 150,
- forceScale: false,
- format: 'jpg',
- legend: 'false',
- layout: 'A4 horizontal jpg',
- };
-
- this.layoutOptions_ = [];
- this.dpisOptions_ = [];
- this.outputFormats_ = ['pdf', 'png', 'jpg'];
- this.documentRead_ = document.createElement('img');
- this.canvas_ = document.createElement('canvas');
- this.proyectionsDefect_ = ['EPSG:3857'];
- // this.proyectionsDefect_ = ['EPSG:25828', 'EPSG:25829',
- // 'EPSG:25830', 'EPSG:25831', 'EPSG:3857', 'EPSG:4326', 'EPSG:4258'];
-
- this.statusProxy = statusProxy;
- this.useProxy = useProxy;
- }
-
- /**
- * This function checks when map printing is finished.
- * @param {String} url - Mapfish GET request url
- * @param {Function} callback - function that removes loading icon class.
- */
- getStatus(url, callback, queueEl) {
- M.proxy(this.useProxy);
- const newUrl = `${url}?timestamp=${new Date().getTime()}`;
- M.remote.get(newUrl).then((response) => {
- if (response.code === 404) {
- throw new Error('Error 404');
- }
-
- const statusJson = response.text ? JSON.parse(response.text) : 'error';
- const { status } = statusJson;
- if (status === 'finished') {
- callback(queueEl);
- } else if (status === 'error' || status === 'cancelled') {
- callback(queueEl);
- if (statusJson.error.toLowerCase().indexOf('network is unreachable') > -1 || statusJson.error.toLowerCase().indexOf('illegalargument') > -1) {
- M.toast.error(getValue('exception.teselaError'), 6000);
- } else {
- M.toast.error(getValue('exception.printError'), 6000);
- }
- } else {
- setTimeout(() => this.getStatus(url, callback, queueEl), 1000);
- }
- }).catch((err) => {
- callback(queueEl);
- queueEl.remove();
- M.dialog.error(getValue('exception.error_download_image'));
- });
- M.proxy(this.statusProxy);
- }
-
- active(html) {
- this.html_ = html;
- const button = this.html_.querySelector('#m-printviewmanagement-georefImage');
-
- const promise = new Promise((success, fail) => {
- // Tareas #4827
- // "Hasta que no veamos cómo hacer las transformaciones al vuelo en cliente y mapfish,
- // si es con servidor lo dejaría estático a 3857"
- //
- // this.getCapabilities().then((capabilitiesParam) => {
- // const capabilities = capabilitiesParam;
- // let i = 0;
- // let ilen;
- // this.dpi_ = capabilitiesParam.layouts[0].attributes[0].clientInfo.maxDPI;
- // // default layout
- // for (i = 0, ilen = capabilities.layouts.length; i < ilen; i += 1) {
- // const layout = capabilities.layouts[i];
- // if (layout.name === this.options_.layout) {
- // layout.default = true;
- // break;
- // }
- // }
-
- // this.layoutOptions_ = [].concat(capabilities.layouts.map((item) => {
- // return item.name;
- // }));
-
- // capabilities.proyections = [];
- // const proyectionsDefect = this.proyectionsDefect_;
- // for (i = 0, ilen = proyectionsDefect.length; i < ilen; i += 1) {
- // if (proyectionsDefect[i] !== null) {
- // const proyection = proyectionsDefect[i];
- // const object = { value: proyection };
- // if (proyection === 'EPSG:4258') {
- // object.default = true;
- // }
-
- // capabilities.proyections.push(object);
- // }
- // }
-
- // if (Array.isArray(capabilities.formats)) {
- // this.outputFormats_ = capabilities.formats;
- // }
-
- // capabilities.format = this.outputFormats_.map((format) => {
- // return {
- // name: format,
- // default: format === 'pdf',
- // };
- // });
-
- // // forceScale
- // capabilities.forceScale = this.options_.forceScale;
- const template = M.template.compileSync(georefimageHTML, {
- jsonp: true,
- vars: {
- // capabilities,
- translations: {
- referenced: getValue('referenced'),
- projection: getValue('projection'),
- down: getValue('down'),
- title: getValue('title'),
- georefimageWld: getValue('georefimageWld'),
- typeDownload: getValue('typeDownload'),
- typeClient: getValue('typeClient'),
- typeServer: getValue('typeServer'),
- format: getValue('format'),
- clipBoard: getValue('clipBoard'),
- },
- },
- });
- this.template_ = template;
- success(template);
- // });
- });
- promise.then((t) => {
- const proj = M.impl.ol.js.projections.getSupportedProjs().filter(({ codes }) => {
- return codes.includes(this.map_.getProjection().code);
- })[0];
-
- const projFormat = `${proj.datum} - ${proj.proj.toUpperCase()} (${proj.codes[0]})`;
-
- this.projection_ = this.map_.getProjection().code;
- this.projectionFormat_ = projFormat;
-
- // Select Element Template
- this.selectElementHTML(t);
-
- // SET EPSG PROJECTION DEPENS FIELDSET
- this.defaultValueFieldset = null;
- if (this.printSelector) {
- this.defaultValueFieldset = this.elementFieldset_.querySelector('input[type="radio"]:checked').value;
- this.elementProjection_.innerText = this.projectionFormat_;
- } else {
- this.defaultValueFieldset = this.printType;
- this.removeSelector();
- }
-
- // Add event template
- this.addEvents();
-
- if (!button.classList.contains('activated')) {
- this.html_.querySelector('#m-printviewmanagement-controls').appendChild(t);
- } else {
- document.querySelector('.m-georefimage-container').remove();
- }
- button.classList.toggle('activated');
- });
- }
-
- removeSelector() {
- this.elementFieldset_.remove();
-
- if (this.printType === 'client') {
- this.template_.querySelector('.georefimage-jgwKeppview').remove();
- }
-
- const format = document.createElement('h3');
- format.id = 'm-georefimage-projection';
- format.classList.add('m-georefimage-projection');
- format.title = 'EPSG';
- format.innerText = this.projectionFormat_;
-
- this.template_.appendChild(format);
- }
-
- /**
- * Esta función añade los eventos a los elementos del control
- *
- * @public
- * @function
- * @param {HTMLElement} html Contenedor del control
- * @api stable
- */
- addEvents() {
- const DEFAULT_PROJECTION_SERVER = 'EPSG:3857';
-
- // ADD EVENT LIST SERVICES DIALOG
- this.elementListServices_.addEventListener('click', () => M.dialog.info(LIST_SERVICES));
-
- // Disable m-georefimage-dpi when elementFieldset_ is client
- this.elementFieldset_.addEventListener('change', ({ target }) => {
- const value = target.value;
- const elementDpi = document.querySelector(ID_DPI);
-
- if (value === 'client') {
- elementDpi.setAttribute('disabled', 'disabled');
- } else {
- elementDpi.removeAttribute('disabled');
- }
-
- if (value === 'client') {
- const proj = M.impl.ol.js.projections.getSupportedProjs().filter(({ codes }) => {
- return codes.includes(this.map_.getProjection().code);
- })[0];
- if (proj) {
- this.elementProjection_.innerText = `${proj.datum} - ${proj.proj.toUpperCase()} (${proj.codes[0]})`;
- }
- } else {
- const proj = M.impl.ol.js.projections.getSupportedProjs().filter(({ codes }) => {
- return codes[0] === DEFAULT_PROJECTION_SERVER;
- })[0];
- this.elementProjection_.innerText = `${proj.datum} - ${proj.proj.toUpperCase()} (${proj.codes[0]})`;
- }
- });
-
- this.elementClipboard_.addEventListener('click', () => {
- M.utils.copyImageClipBoard(this.map_);
- });
-
- // ADD ENABLE TOUCH SCROLL
- M.utils.enableTouchScroll(getQueueContainer(this.html_));
- }
-
- selectElementHTML(html) {
- // ELEMENTS
- this.elementTitle_ = html.querySelector(ID_TITLE);
- this.elementFormatSelect_ = html.querySelector(ID_FORMAT_SELECT);
- this.elementWld_ = html.querySelector(ID_WLD);
- this.elementProjection_ = html.querySelector(ID_PROJECTION);
- this.elementFieldset_ = html.querySelector(ID_FIELDSET);
- this.elementListServices_ = html.querySelector(ID_LIST_SERVICES);
- this.elementClipboard_ = html.querySelector(ID_CLIPBOARD);
-
- // CANVAS ELEMENT
- this.elementCanvas_ = document.querySelector(SELECTOR_CANVAS);
- }
-
- /**
- * This function prints on click
- *
- * @private
- * @function
- */
- printClick(evt) {
- evt.preventDefault();
- const valueFieldset = (this.printSelector) ? this.elementFieldset_.querySelector('input[type="radio"]:checked').value : this.printType;
- if (valueFieldset === 'server') {
- this.downloadServer();
- } else {
- this.downloadClient();
- }
- }
-
- downloadServer() {
- this.getPrintData().then((printData) => {
- let printUrl = M.utils.concatUrlPaths([this.printTemplateUrl_, `report.${printData.outputFormat}`]);
-
- const queueEl = innerQueueElement(
- this.html_,
- this.elementTitle_,
- this.elementQueueContainer_,
- );
-
- printUrl = M.utils.addParameters(printUrl, 'mapeaop=geoprint');
- // FIXME: delete proxy deactivation and uncomment if/else when proxy is fixed on Mapea
- M.proxy(this.useProxy);
- M.remote.post(printUrl, printData).then((responseParam) => {
- let response = responseParam;
- const responseStatusURL = response.text && JSON.parse(response.text);
- const ref = responseStatusURL.ref;
- const statusURL = M.utils.concatUrlPaths([this.printStatusUrl_, `${ref}.json`]);
- this.getStatus(
- statusURL,
- e => removeLoadQueueElement(e),
- queueEl,
- );
-
- // if (response.error !== true) { // withoud proxy, response.error === true
- let downloadUrl;
- try {
- response = JSON.parse(response.text);
- if (this.serverUrl_.endsWith('/geoprint')) {
- const url = this.serverUrl_.substring(0, this.serverUrl_.lastIndexOf('/geoprint'));
- downloadUrl = M.utils.concatUrlPaths([url, response.downloadURL]);
- } else {
- downloadUrl = M.utils.concatUrlPaths([this.serverUrl_, response.downloadURL]);
- }
- this.documentRead_.src = downloadUrl;
- } catch (err) {
- M.exception(err);
- }
- queueEl.setAttribute(GeorefimageControl.DOWNLOAD_ATTR_NAME, downloadUrl);
- queueEl.addEventListener('click', this.downloadPrint.bind(this));
- queueEl.addEventListener('keydown', this.downloadPrint.bind(this));
- // } else {
- // M.dialog.error('Se ha producido un error en la impresión.');
- // }
- });
-
- M.proxy(this.statusProxy);
- });
- }
-
- downloadClient() {
- const title = document.querySelector(ID_TITLE);
- const format = document.querySelector(ID_FORMAT_SELECT).value;
-
- const queueEl = innerQueueElement(
- this.html_,
- title,
- this.elementQueueContainer_,
- );
-
- try {
- const base64image = M.utils.getImageMap(this.map_, `image/${format}`);
- queueEl.addEventListener('click', evt => this.downloadPrint(evt, base64image));
- } catch (exceptionVar) {
- queueEl.parentElement.remove();
- M.toast.error('Error CrossOrigin', null, 6000);
- } finally {
- removeLoadQueueElement(queueEl);
- }
- }
-
- getSourceAsDOM(url) {
- const xmlhttp = new XMLHttpRequest();
- xmlhttp.open('GET', url, true);
- xmlhttp.send();
- const parser = new DOMParser();
- const parser2 = parser.parseFromString(xmlhttp.responseText, 'text/html');
- return parser2;
- }
-
- /**
- * Gets capabilities
- *
- * @public
- * @function
- * @param {M.Map} map to add the control
- * @api stable
- */
- getCapabilities() {
- if (M.utils.isNullOrEmpty(this.capabilitiesPromise_)) {
- this.capabilitiesPromise_ = new Promise((success, fail) => {
- const capabilitiesUrl = M.utils.concatUrlPaths([this.printTemplateUrl_, 'capabilities.json']);
- M.proxy(this.useProxy);
- M.remote.get(capabilitiesUrl).then((response) => {
- let capabilities = {};
- try {
- capabilities = JSON.parse(response.text);
- } catch (err) {
- M.exception(err);
- }
- success(capabilities);
- });
-
- M.proxy(this.statusProxy);
- });
- }
-
- return this.capabilitiesPromise_;
- }
-
- /**
- * Converts decimal degrees coordinates to degrees, minutes, seconds
- * @public
- * @function
- * @param {String} coordinate - single coordinate (one of a pair)
- * @api
- */
- converterDecimalToDMS(coordinate) {
- let dms;
- let aux;
- const coord = coordinate.toString();
- const splittedCoord = coord.split('.');
- // Degrees
- dms = `${splittedCoord[0]}º `;
- // Minutes
- aux = `0.${splittedCoord[1]}`;
- aux *= 60;
- aux = aux.toString();
- aux = aux.split('.');
- dms = `${dms}${aux[0]}' `;
- // Seconds
- aux = `0.${aux[1]}`;
- aux *= 60;
- aux = aux.toString();
- aux = aux.split('.');
- dms = `${dms}${aux[0]}'' `;
- return dms;
- }
-
- /**
- * Converts original bbox coordinates to DMS coordinates.
- * @public
- * @function
- * @api
- * @param {Array} bbox - { x: {min, max}, y: {min, max} }
- */
- convertBboxToDMS(bbox) {
- const proj = this.map_.getProjection();
- let dmsBbox = bbox;
- if (proj.units === 'm') {
- const min = [bbox.x.min, bbox.y.min];
- const max = [bbox.x.max, bbox.y.max];
- const newMin = reproject(proj.code, min);
- const newMax = reproject(proj.code, max);
- dmsBbox = {
- x: {
- min: newMin[0],
- max: newMax[0],
- },
- y: {
- min: newMin[1],
- max: newMax[1],
- },
- };
- }
-
- dmsBbox = this.convertDecimalBoxToDMS(dmsBbox);
- return dmsBbox;
- }
-
- /**
- * Converts decimal coordinates Bbox to DMS coordinates Bbox.
- * @public
- * @function
- * @api
- * @param { Array < Object > } bbox - { x: { min, max }, y: { min, max } }
- */
- convertDecimalBoxToDMS(bbox) {
- return {
- x: {
- min: this.converterDecimalToDMS(bbox.x.min),
- max: this.converterDecimalToDMS(bbox.x.max),
- },
- y: {
- min: this.converterDecimalToDMS(bbox.y.min),
- max: this.converterDecimalToDMS(bbox.y.max),
- },
- };
- }
-
- /**
- * This function returns request JSON.
- *
- * @private
- * @function
- */
- getPrintData() {
- let projection;
- const elementDpi = document.querySelector(ID_DPI);
-
- if (this.projection_ === 'EPSG:4326' || this.projection_ === 'EPSG:4258') {
- projection = this.map_.getProjection().code;
- this.projection_ = projection;
- } else {
- projection = this.projection_;
- }
-
- const bbox = this.map_.getBbox();
- const width = this.map_.getMapImpl().getSize()[0];
- const height = this.map_.getMapImpl().getSize()[1];
- const layout = 'plain';
- const dpi = elementDpi.value;
- const outputFormat = 'jpg';
- const parameters = this.params_.parameters;
- const printData = M.utils.extend({
- layout,
- outputFormat,
- attributes: {
- map: {
- dpi,
- projection,
- },
- },
- }, this.params_.layout);
-
- const map = this.map_;
- return this.encodeLayers().then((encodedLayers) => {
- const returnData = encodedLayers;
- let encodedLayersModified = [];
- if (projection === 'EPSG:25830') {
- for (let i = 0; i < returnData.length; i += 1) {
- if (returnData[i].matrixSet != null) {
- const matrixSet = returnData[i].matrixSet.replace('GoogleMapsCompatible', 'EPSG:25830');
- returnData[i].matrixSet = matrixSet;
- }
-
- encodedLayersModified.push(returnData[i]);
- }
- } else {
- encodedLayersModified = encodedLayers;
- }
-
- printData.attributes.map.layers = encodedLayersModified;
- printData.attributes = Object.assign(printData.attributes, parameters);
- printData.attributes.map.projection = projection;
- printData.attributes.map.dpi = dpi;
- printData.attributes.map.width = width;
- printData.attributes.map.height = height;
- printData.attributes.map.bbox = [bbox.x.min, bbox.y.min, bbox.x.max, bbox.y.max];
- if (map.getProjection().code !== projection) {
- printData.attributes.map.bbox = transformExt(
- printData.attributes.map.bbox, this.map_.getProjection().code,
- projection,
- );
- }
-
- if (projection !== 'EPSG:3857' && this.map_.getLayers().some(layer => (layer.type === M.layer.type.OSM))) {
- printData.attributes.map.projection = 'EPSG:3857';
- printData.attributes.map.bbox = transformExt(printData.attributes.map.bbox, projection, 'EPSG:3857');
- }
-
- return printData;
- });
- }
-
- /**
- * This function encodes layers.
- *
- * @private
- * @function
- */
- encodeLayers() {
- // Filters WMS and WMTS visible layers whose resolution is inside map resolutions range
- // and that doesn't have Cluster style.
- const mapZoom = this.map_.getZoom();
- let layers = this.map_.getLayers().filter((layer) => {
- return (layer.isVisible() && layer.inRange() && layer.name !== 'cluster_cover' && layer.name !== 'selectLayer' &&
- layer.name !== 'empty_layer' &&
- layer.name !== '__draw__' &&
- layer.type !== 'GenericRaster' &&
- layer.type !== 'GenericVector' &&
- layer.type !== 'MBTiles' &&
- layer.type !== 'MBTilesVector' &&
- mapZoom > layer.getImpl().getMinZoom() && mapZoom <= layer.getImpl().getMaxZoom());
- });
-
- const errorLayers = this.map_.getLayers().filter((layer) => {
- return (layer.isVisible() && layer.inRange() && layer.name !== 'cluster_cover' && layer.name !== 'selectLayer' &&
- layer.name !== 'empty_layer' &&
- layer.name !== '__draw__' && (
- layer.type === 'GenericRaster' ||
- layer.type === 'GenericVector' ||
- layer.type === 'MBTiles' ||
- layer.type === 'MBTilesVector'
- ));
- });
-
- if (errorLayers.length !== 0) {
- M.toast.warning(getValue('exception.error_layers') + errorLayers.map(l => l.name).join(', '), null, 6000);
- }
-
- if (mapZoom === 20) {
- let contains = false;
- layers.forEach((l) => {
- if (l.url !== undefined && l.url === 'https://tms-pnoa-ma.idee.es/1.0.0/pnoa-ma/{z}/{x}/{-y}.jpeg') {
- contains = true;
- }
- });
-
- if (contains) {
- layers = layers.filter((l) => {
- return l.url !== 'https://tms-pnoa-ma.idee.es/1.0.0/pnoa-ma/{z}/{x}/{-y}.jpeg';
- });
- }
- } else if (mapZoom < 20) {
- let contains = false;
- layers.forEach((l) => {
- if (l.url !== undefined && l.name !== undefined && l.url === 'https://www.ign.es/wmts/pnoa-ma?' && l.name === 'OI.OrthoimageCoverage') {
- contains = true;
- }
- });
-
- if (contains) {
- layers = layers.filter((l) => {
- return l.url !== 'https://www.ign.es/wmts/pnoa-ma?' && l.name !== 'OI.OrthoimageCoverage';
- });
- }
- }
-
- const encodedLayersModified = [];
- if (this.projection_ === 'EPSG:3857') {
- for (let i = 0; i < layers.length; i += 1) {
- if (layers[i].matrixSet != null) {
- const matrixSet = layers[i].matrixSet.replace(layers[i].matrixSet, 'GoogleMapsCompatible');
- layers[i].matrixSet = matrixSet;
- if (layers[i].options.matrixSet) {
- const optsMatrixSet = layers[i].options.matrixSet.replace(layers[i].matrixSet, 'GoogleMapsCompatible');
- layers[i].options.matrixSet = optsMatrixSet;
- }
- }
-
- encodedLayersModified.push(layers[i]);
- }
-
- layers = encodedLayersModified;
- } else {
- for (let i = 0; i < layers.length; i += 1) {
- if (layers[i].matrixSet != null) {
- const matrixSet = layers[i].matrixSet
- .replace(layers[i].matrixSet, this.projection_.value);
- const optsMatrixSet = layers[i].options.matrixSet
- .replace(layers[i].matrixSet, this.projection_.value);
- layers[i].matrixSet = matrixSet;
- layers[i].options.matrixSet = optsMatrixSet;
- }
-
- encodedLayersModified.push(layers[i]);
- }
-
- layers = encodedLayersModified;
- }
-
- let numLayersToProc = layers.length;
- const otherLayers = this.getImpl().getParametrizedLayers(this.map_, 'IMAGEN', layers);
- if (otherLayers.length > 0) {
- layers = layers.concat(otherLayers);
- numLayersToProc = layers.length;
- }
-
- layers = layers.sort((a, b) => {
- let res = 0;
- const zia = a.getZIndex() !== null ? a.getZIndex() : 0;
- const zib = b.getZIndex() !== null ? b.getZIndex() : 0;
- if (zia > zib) {
- res = 1;
- } else if (zia < zib) {
- res = -1;
- }
-
- return res;
- });
-
- return (new Promise((success, fail) => {
- const encodedLayers = [];
- layers.forEach((layer, index) => {
- this.getImpl().encodeLayer(layer).then((encodedLayer) => {
- if (!M.utils.isNullOrEmpty(encodedLayer)) {
- encodedLayers[index] = encodedLayer;
- }
-
- numLayersToProc -= 1;
- if (numLayersToProc === 0) {
- // Mapfish requires reverse order
- success(encodedLayers.reverse());
- }
- });
- });
- }));
- }
-
-
- /**
- * This function downloads printed map.
- *
- * @public
- * @function
- * @api stable
- */
- downloadPrint(evt, imgBase64) {
- if (evt.key !== undefined && evt.key !== 'Enter' && evt.key !== ' ') {
- return;
- }
-
- const formatImage = document.querySelector(ID_FORMAT_SELECT).value;
- const title = document.querySelector(ID_TITLE).value;
- const elementDpi = document.querySelector(ID_DPI);
-
- // PARAMS
- const dpi = M.utils.isNullOrEmpty(elementDpi) ? 120 : elementDpi.value;
- const code = this.map_.getProjection().code;
- const addWLD = this.elementWld_.checked;
-
- // GET IMAGE
- const base64image = (imgBase64) ? formatImageBase64(imgBase64) : getBase64Image(
- this.documentRead_.src,
- formatImage,
- );
-
- // GET BBOX
- let bbox = [
- this.map_.getBbox().x.min,
- this.map_.getBbox().y.min,
- this.map_.getBbox().x.max,
- this.map_.getBbox().y.max,
- ];
- bbox = transformExt(bbox, code, this.projection_);
-
- // GET TITLE
- const titulo = generateTitle(title);
-
- // CONTENT ZIP
- const fileIMG = {
- name: titulo.concat(`.${formatImage}`),
- data: base64image,
- base64: true,
- };
-
-
- const files = (addWLD) ? [{
- name: titulo.concat(FILE_EXTENSION_GEO),
- data: createWLD(bbox, dpi, this.map_.getMapImpl().getSize()),
- base64: false,
- },
- fileIMG,
- ] : [fileIMG];
-
- // CREATE ZIP
- createZipFile(files, TYPE_SAVE, titulo);
- }
-
- /**
- * Converts epsg code to projection name.
- * @public
- * @function
- * @param {String} projection - EPSG:xxxx
- * @api
- */
- turnProjIntoLegend(projection) {
- let projectionLegend;
- switch (projection) {
- case 'EPSG:4258':
- projectionLegend = 'ETRS89 (4258)';
- break;
- case 'EPSG:4326':
- projectionLegend = 'WGS84 (4326)';
- break;
- case 'EPSG:3857':
- projectionLegend = 'WGS84 (3857)';
- break;
- case 'EPSG:25831':
- projectionLegend = 'UTM zone 31N (25831)';
- break;
- case 'EPSG:25830':
- projectionLegend = 'UTM zone 30N (25830)';
- break;
- case 'EPSG:25829':
- projectionLegend = 'UTM zone 29N (25829)';
- break;
- case 'EPSG:25828':
- projectionLegend = 'UTM zone 28N (25828)';
- break;
- default:
- projectionLegend = '';
- }
- return projectionLegend;
- }
-
- /**
- * This function checks if an object is equal to this control.
- *
- * @function
- * @api stable
- */
- equals(obj) {
- let equals = false;
- if (obj instanceof GeorefimageControl) {
- equals = (this.name === obj.name);
- }
-
- return equals;
- }
-
- deactive() {
- this.template_.remove();
-
- // TO-DO [ ] ADD BUTTON REMOVE AND ALL EVENTS
- // TO-DO [ ] Deactive dowloand when change the contorl
- }
-
- /**
- * This function destroys this control
- *
- * @public
- * @function
- * @api
- */
- destroy() {}
-}
-
-/**
- * Name for this controls
- * @const
- * @type {string}
- * @public
- * @api stable
- */
-GeorefimageControl.NAME = 'georefimagecontrol';
-
-/**
- * M.template for this controls
- * @const
- * @type {string}
- * @public
- * @api stable
- */
-GeorefimageControl.TEMPLATE = 'georefimage.html';
-
-/**
- * M.template for this controls
- * @const
- * @type {string}
- * @public
- * @api stable
- */
-GeorefimageControl.LOADING_CLASS = 'printing';
-
-/**
- * M.template for this controls
- * @const
- * @type {string}
- * @public
- * @api stable
- */
-GeorefimageControl.DOWNLOAD_ATTR_NAME = 'data-donwload-url-print';
-
-/**
- * M.template for this controls
- * @const
- * @type {string}
- * @public
- * @api stable
- */
-GeorefimageControl.NO_TITLE = '(Sin titulo)';
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/georefimageepsgcontrol.js b/api-ign-js/src/plugins/printviewmanagement/src/facade/js/georefimageepsgcontrol.js
deleted file mode 100644
index 130dee01d..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/georefimageepsgcontrol.js
+++ /dev/null
@@ -1,351 +0,0 @@
-/**
- * @module M/control/GeorefImageEpsgControl
- */
-import Georefimage2ControlImpl from '../../impl/ol/js/georefimageepsgcontrol';
-import { reproject } from '../../impl/ol/js/utils';
-import georefimage2HTML from '../../templates/georefimageepsg';
-import { getValue } from './i18n/language';
-
-import {
- innerQueueElement,
- removeLoadQueueElement,
- getQueueContainer,
- createWLD,
- getBase64Image,
- generateTitle,
- createZipFile,
-} from './utils';
-
-export default class GeorefImageEpsgControl extends M.Control {
- /**
- * @classdesc
- * Main constructor of the class.
- *
- * @constructor
- * @extends {M.Control}
- * @api stable
- */
- constructor({ order, layers }, map) {
- const impl = new Georefimage2ControlImpl(map);
- super(impl, 'georefimage2control');
- this.map_ = map;
- if (M.utils.isUndefined(Georefimage2ControlImpl)) {
- M.exception(getValue('exception.impl'));
- }
-
- this.layers_ = layers || [
- {
- url: 'http://www.ign.es/wms-inspire/mapa-raster?',
- name: 'mtn_rasterizado',
- format: 'image/jpeg',
- legend: 'Mapa ETRS89 UTM',
- },
- {
- url: 'http://www.ign.es/wms-inspire/pnoa-ma?',
- name: 'OI.OrthoimageCoverage',
- format: 'image/jpeg',
- legend: 'Imagen (PNOA) ETRS89 UTM',
- },
- ];
-
- /**
- * Layout
- * @private
- * @type {HTMLElement}
- */
- this.layout_ = 'A4 horizontal jpg';
-
- /**
- * Map format to print
- * @private
- * @type {HTMLElement}
- */
- this.format_ = 'jpg';
-
- /**
- * Map dpi to print
- * @private
- * @type {HTMLElement}
- */
- this.dpi_ = 72;
-
- /**
- * Mapfish params
- * @private
- * @type {String}
- */
- this.params_ = {
- layout: {
- outputFilename: 'mapa_${yyyy-MM-dd_hhmmss}',
- },
- pages: {
- clientLogo: '',
- creditos: getValue('printInfo'),
- },
- parameters: {},
- };
-
- /**
- * Mapfish options params
- * @private
- * @type {String}
- */
- this.options_ = {
- legend: 'false',
- forceScale: false,
- dpi: this.dpi_,
- format: this.format_,
- layout: this.layout_,
- };
-
- this.documentRead_ = document.createElement('img');
- this.canvas_ = document.createElement('canvas');
- this.canceled = false;
-
- this.order = order >= -1 ? order : null;
- }
-
- active(html) {
- this.html_ = html;
- const button = this.html_.querySelector('#m-printviewmanagement-georefImageEpsg');
-
-
- const template = new Promise((resolve, reject) => {
- this.template_ = M.template.compileSync(georefimage2HTML, {
- jsonp: true,
- vars: {
- translations: {
- selectLayer: getValue('selectLayer'),
- },
- layers: this.layers_,
- },
- });
- resolve(this.template_);
- });
-
-
- template.then((t) => {
- if (!button.classList.contains('activated')) {
- this.html_.querySelector('#m-printviewmanagement-controls').appendChild(t);
- } else {
- document.querySelector('.m-georefimageepsg-container').remove();
- }
- button.classList.toggle('activated');
- });
-
- this.accessibilityTab(html);
- }
-
- /**
- * This function prints on click
- *
- * @private
- * @function
- */
- printClick(evt) { // Se llama desde printviewmanagementcontrol
- evt.preventDefault();
- const date = new Date();
- this.titulo_ = 'mapa_'.concat(
- date.getFullYear(), '-',
- date.getMonth() + 1, '-',
- date.getDay() + 1, '_',
- date.getHours(),
- date.getMinutes(),
- date.getSeconds(),
- );
-
- this.queueEl = innerQueueElement(
- this.html_,
- this.titulo_,
- );
-
- this.canceled = false;
-
- // La del mapa, hacer un getProjection si se cambia
- const DEFAULT_EPSG = this.map_.getProjection().code;
- const ID_IMG_EPSG = '#m-georefimageepsg-select';
-
- // get value select option id m-georefimageepsg-select
- const value = this.template_.querySelector(ID_IMG_EPSG).selectedIndex;
- const {
- url, name, format, EPSG: epsg, version,
- } = this.layers_[value];
-
- // Bbox Mapa
- const mapBbox = this.map_.getBbox();
- // Size
- const size = this.map_.getMapImpl().getSize();
-
- // Ext WLD
- let extWLD = [];
-
- if (epsg) {
- const projection = epsg;
- let ext = false;
- if (DEFAULT_EPSG === projection) {
- ext = M.utils.ObjectToArrayExtent(mapBbox, DEFAULT_EPSG);
- extWLD = ext;
- } else if (version === '1.1.1' || version === '1.1.0') {
- const transformBbox = [mapBbox.x.min, mapBbox.y.min, mapBbox.x.max, mapBbox.y.max];
- ext = ol.proj.transformExtent(transformBbox, DEFAULT_EPSG, projection);
- extWLD = ext;
- } else {
- const transformBbox = M.utils.ObjectToArrayExtent(mapBbox, DEFAULT_EPSG);
- ext = ol.proj.transformExtent(transformBbox, DEFAULT_EPSG, projection);
- extWLD = ext;
- ext = this.transformExtentOL(ext, projection);
- }
-
- const extString = ext.join(',');
-
- const urlLayer =
- this.generateURLLayer_(url, projection, size, extString, format, name, version);
- this.downloadPrint(urlLayer, extWLD, true);
- } else {
- const projection = this.getUTMZoneProjection();
-
- const v = this.map_.getMapImpl().getView();
- let ext = v.calculateExtent(size);
-
- ext = ol.proj.transformExtent(ext, DEFAULT_EPSG, projection);
- const f = (ext[2] - ext[0]) / size[0];
- ext[3] = ext[1] + (f * size[1]);
-
- const urlLayer = this.generateURLLayer_(url, projection, size, ext, format, name, version);
- this.downloadPrint(urlLayer, ext, false);
- }
- }
-
- transformExtentOL(extent, projection) {
- const { def } = M.impl.ol.js.projections.getSupportedProjs()
- .filter(proj => proj.codes.includes(projection))[0];
- const typeCoordinates = def.includes('+proj=longlat');
-
- if (typeCoordinates) {
- return [extent[1], extent[0], extent[3], extent[2]];
- }
-
- return extent;
- }
-
- generateURLLayer_(url, projection, size, bbox, format, name, version = '1.3.0') {
- let urlLayer = url;
- const coord = (version === '1.1.1' || version === '1.1.0') ? 'SRS' : 'CRS';
- urlLayer += `SERVICE=WMS&VERSION=${version}&REQUEST=GetMap&${coord}=${projection}&WIDTH=${size[0]}&HEIGHT=${size[1]}`;
- urlLayer += `&BBOX=${bbox}&FORMAT=${format}&TRANSPARENT=true&STYLES=default`;
- urlLayer += `&LAYERS=${name}`;
- return urlLayer;
- }
-
- getUTMZoneProjection() {
- let res = this.map_.getProjection().code;
- const mapCenter = [this.map_.getCenter().x, this.map_.getCenter().y];
- const center = reproject(this.map_.getProjection().code, mapCenter);
- if (center[0] < -12 && center[0] >= -20) {
- res = 'EPSG:25828';
- } else if (center[0] < -6 && center[0] >= -12) {
- res = 'EPSG:25829';
- } else if (center[0] < 0 && center[0] >= -6) {
- res = 'EPSG:25830';
- } else if (center[0] <= 6 && center[0] >= 0) {
- res = 'EPSG:25831';
- }
-
- return res;
- }
-
- /**
- * This function downloads printed map.
- *
- * @public
- * @function
- * @api stable
- */
- downloadPrint(url, bbox, epsgUser) {
- const FILE_EXTENSION_GEO = '.wld'; // .jgw
- const FILE_EXTENSION_IMG = '.jpg';
- const TYPE_SAVE = '.zip';
-
- const imageUrl = url !== null ? url : this.documentRead_.src;
- const dpi = this.dpi_;
-
- const base64image = getBase64Image(imageUrl);
- if (!this.canceled) {
- base64image.then((resolve) => {
- if (!this.canceled) {
- // GET TITLE
- const titulo = generateTitle('');
-
- // CONTENT ZIP
- const files = [{
- name: titulo.concat(FILE_EXTENSION_GEO),
- // EPSG:3857 -> bbox
- data: createWLD(bbox, dpi, this.map_.getMapImpl().getSize(), epsgUser),
- base64: false,
- },
- {
- name: titulo.concat(FILE_EXTENSION_IMG),
- data: resolve,
- base64: true,
- },
- ];
-
- // CREATE ZIP
- this.queueEl.addEventListener('click', () => {
- createZipFile(files, TYPE_SAVE, titulo);
- });
-
- // Enter event create zip
- this.queueEl.addEventListener('keydown', (evt) => {
- if (evt.keyCode === 13) {
- createZipFile(files, TYPE_SAVE, titulo);
- }
- });
-
- // REMOVE QUEUE ELEMENT
- removeLoadQueueElement(this.queueEl);
- }
- }).catch((err) => {
- getQueueContainer(this.html_).lastChild.remove();
- M.dialog.error(getValue('exception.imageError'));
- });
- } else {
- getQueueContainer(this.html_).lastChild.remove();
- }
- }
-
- /**
- * This function checks if an object is equal to this control.
- *
- * @function
- * @api stable
- */
- equals(obj) {
- let equals = false;
- if (obj instanceof GeorefImageEpsgControl) {
- equals = (this.name === obj.name);
- }
-
- return equals;
- }
-
- accessibilityTab(html) {
- html.querySelectorAll('[tabindex="0"]').forEach(el => el.setAttribute('tabindex', this.order));
- }
-
- deactive() {
- this.template_.remove();
- // TO-DO ADD BUTTON REMOVE AND ALL EVENTS
- }
-
- /**
- * This function destroys this control
- *
- * @public
- * @function
- * @api
- */
- destroy() {
- }
-}
-
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/i18n/en.json b/api-ign-js/src/plugins/printviewmanagement/src/facade/js/i18n/en.json
deleted file mode 100644
index 82c071cd7..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/i18n/en.json
+++ /dev/null
@@ -1,64 +0,0 @@
-{
- "exception": {
- "impl": "The implementation used cannot create PrintViewManagementControl.",
- "impl_printermap": "The implementation used cannot create PrinterMapControl.",
- "no_controls": "The PrintViewManagement plugin needs to activate at least one control.",
- "encode": "The implementation used cannot use encodeLayer.",
- "error": "An error has occurred while printing.",
- "imageError": "The download could not be completed at this time. Please try again later.",
- "error_layers": "The following layers will not be displayed when printing the map: ",
- "teselaError": "The request has caused an error in printing. < br / > Please try again.",
- "printError": "Printing has failed.",
- "encode_method": "The used implementation does not have the encodeLayer method",
- "tile": "The request for some tile has caused a printing error. Please try again.",
- "support": "MBTiles and MBTilesVector layers are not supported",
- "error_download_image": "The download could not be completed at this time."
- },
- "tooltip": "Map printing",
- "map_printing": "Map printing",
- "nextView": "Next view",
- "previousView": "Previous view",
- "service_epsg": "Service EPSG",
- "georeferenced_img": "Georeferenced image",
- "format": "Format",
- "errorProjectionCapabilities": "The selected projection is not available for this base layer. Please choose another projection.",
- "printInfor": "Print generated by Mapea",
- "generating": "Generating georeferenced image",
- "referenced": "Georeferenced image",
- "projection": "Projection",
- "downImg": "Download image",
- "delete": "Delete",
- "down": "Download",
- "title": "Title",
- "notitle": "(No title)",
- "cancel": "Cancel",
- "accept": "Accept",
- "download_modal": "The use of the information of the geographic data products and services defined in the Order FOM/2807/2015 , as well as its derivatives, entails the acceptance by the user of the general conditions of said order, specified in the following license of use , compatible with CC-BY 4.0.",
- "use_license": "License of use",
- "map": "Map",
- "pnoa": "Image (PNOA)",
- "screen": "Screen Image",
- "fixeddescription": "This document has no legal validity",
- "description": "Description",
- "layout": "Layout",
- "credits": "Print generated through api-core",
- "base": "Base Cartography",
- "zone": "zone",
- "georefimageWld":"Georeferencing file (WLD)",
- "typeDownload":"Select the type of download:",
- "typeClient": "From Client: Screen Content",
- "typeServer": "From Server: Georeferenced Image",
- "selectLayer": "Select the layer to download",
- "clipBoard": "Copy to clipboard",
- "layer_wms": "WMS returns a map in image format from a set of raster or vector layers. Allowing customization of layers through styles.",
- "layer_wmts": " WMTS (Web Map Tile Service) es un estándar OGC para servir información geográfica en forma de tiles pregenerados a unas resoluciones específicas.",
- "layer_tms": "TMS (Tile Map Service) layers are geographic information services in the form of tiles very similar to XYZ layers.",
- "layer_xyz": "Las capas XYZ son servicios de información geográfica en forma de tiles. Cada tile representa una combinación de tres parámetros.",
- "layer_raster": "Layers raster:",
- "layer_vector": "Layers vector:",
- "layer_geojson": "Despite not being an OGC standard (it is on its way to becoming one), it is a very widespread geographic information exchange format that, like WFS, allows all the elements to be on the client.",
- "layers_wfs": "(Web Feature Service) is an OGC standard for the download and transfer of geographic information, where the geographic elements or features are transmitted in their entirety to the client.",
- "layers_kml": "(Keyhole Markup Language). KML is an XML-based markup language for representing geographic data in three dimensions.",
- "layer_OGCAPIFeatures": "(OGC API - FEATURES) is an OGC standard that provides the ability to create, modify, and query spatial data on the Web and specifies requirements and recommendations for APIs that want to follow a standard way of sharing feature data.",
- "tooltip_georefimageepsg": "EPSG code of the georeferenced image"
-}
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/i18n/es.json b/api-ign-js/src/plugins/printviewmanagement/src/facade/js/i18n/es.json
deleted file mode 100644
index 56a0074ab..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/i18n/es.json
+++ /dev/null
@@ -1,64 +0,0 @@
-{
- "exception": {
- "impl": "La implementación usada no puede crear controles PrintViewManagementControl.",
- "impl_printermap": "La implementación usada no puede crear controles PrinterMapControl.",
- "no_controls": "El plugin PrintViewManagement necesita activar al menos un control.",
- "encode": "La implementación usada no posee el método encodeLayer.",
- "error": "Se ha producido un error en la impresión.",
- "imageError": "No ha podido realizarse la descarga en este momento. Por favor, inténtelo más tarde.",
- "error_layers": "Las siguientes capas no se visualizarán al imprimir el mapa: ",
- "teselaError": "La petición de alguna tesela ha provocado un error en la impresión. Por favor, inténtelo de nuevo.",
- "printError": "Se ha producido un error en la impresión.",
- "encode_method": "La implementación usada no posee el método encodeLayer",
- "tile": "La petición de alguna tesela ha provocado un error en la impresión. Por favor, inténtelo de nuevo.",
- "support": "Las capas MBTiles y MBTilesVector no están soportadas.",
- "error_download_image": "No ha podido realizarse la descarga."
- },
- "tooltip": "Impresión del mapa",
- "map_printing": "Impresión del mapa",
- "nextView": "Vista siguiente",
- "previousView": "Vista anterior",
- "service_epsg": "Servicios EPSG",
- "georeferenced_img": "Imagen georreferenciada",
- "format": "Formato",
- "errorProjectionCapabilities": "La proyeccion seleccionada no está disponible para esta capa base. Por favor elija otra proyección.",
- "printInfo": "Impresión generada a través de Mapea",
- "generating": "Generando imagen georreferenciada",
- "referenced": "Imagen georreferenciada",
- "projection": "Proyección",
- "downImg": "Descargar imagen",
- "delete": "Borrar",
- "down": "Descargar",
- "title": "Título",
- "notitle": "(Sin título)",
- "cancel": "Cancelar",
- "accept": "Aceptar",
- "download_modal": "El uso de la información de los productos y servicios de datos geográficos definidos en la Orden FOM/2807/2015 , así como sus derivados, conlleva la aceptación por el usuario de las condiciones generales de dicha orden, concretada en la siguiente licencia de uso , compatible con CC-BY 4.0.",
- "use_license": "Licencia de uso",
- "map": "Mapa",
- "pnoa": "Imagen (PNOA)",
- "screen": "Imagen Pantalla",
- "fixeddescription": "Este documento no tiene validez legal",
- "description": "Descripción",
- "layout": "Plantilla",
- "credits": "Print generated through api-core",
- "base": "Cartografía base",
- "zone": "huso",
- "georefimageWld":"Fichero de georreferenciación (WLD)",
- "typeDownload": "Selecciona el tipo de descarga:",
- "typeClient": "Desde cliente: contenido de pantalla",
- "typeServer": "Desde servidor: contenido de servidor",
- "selectLayer": "Selecciona la capa a descargar",
- "clipBoard": "Copiar al portapapeles",
- "layer_wms": "WMS devuelve un mapa en formato imagen de un conjunto capas ráster o vectoriales. Permitiendo las personalización de las capas mediante estilos. ",
- "layer_wmts": " WMTS (Web Map Tile Service) es un estándar OGC para servir información geográfica en forma de tiles pregenerados a unas resoluciones específicas.",
- "layer_tms": "Las capas TMS (Tile Map Service) son servicios de información geográfica en forma de tiles muy similares a las capas XYZ.",
- "layer_xyz": "Las capas XYZ son servicios de información geográfica en forma de tiles. Cada tile representa una combinación de tres parámetros.",
- "layer_raster": "Capas ráster:",
- "layer_vector": "Capas vectoriales:",
- "layer_geojson": "Pese a no ser un estándar OGC (está camino de convertirse en ello), es un formato de intercambio de información geográfica muy extendido que, al igual que WFS, permite tener todos los elementos en el cliente.",
- "layer_wfs": "(Web Feature Service) es un estándar OGC para la descarga y transferencia de información geográfica, donde los elementos geográficos o features se transmiten en su totalidad al cliente.",
- "layer_kml": "(Keyhole Markup Language). KML es un lenguaje de marcado basado en XML para representar datos geográficos en tres dimensiones.",
- "layer_OGCAPIFeatures": "(OGC API - FEATURES) es un estándar OGC que ofrece la capacidad de crear, modificar y consultar datos espaciales en la Web y especifica requisitos y recomendaciones para las API que desean seguir una forma estándar de compartir datos de entidades.",
- "tooltip_georefimageepsg": "Georreferenciar imagen predefinida"
-}
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/i18n/language.js b/api-ign-js/src/plugins/printviewmanagement/src/facade/js/i18n/language.js
deleted file mode 100644
index 02db048de..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/i18n/language.js
+++ /dev/null
@@ -1,72 +0,0 @@
-import en from './en';
-import es from './es';
-
-/**
- * Default object with es and en translate.
- *
- * @const
- * @type {object}
- */
-const translations = {
- en,
- es,
-};
-
-const getLang = () => {
- let res = 'es';
- if (typeof M.language.getLang === 'function') {
- res = M.language.getLang();
- }
-
- return res;
-};
-
-/**
- * This function sets a new language translate.
- * @param {string} lang
- * @param {JSON} json
- * @public
- * @api
- */
-export const addTranslation = (lang, json) => {
- translations[lang] = json;
-};
-
-/**
- * This function gets a language translate.
- *
- * @param {string} lang
- * @return {JSON}
- * @public
- * @api
- */
-export const getTranslation = (lang) => {
- if (lang === 'es' || lang === 'en') {
- return translations[lang];
- }
- return M.language.getTranslation(lang).printviewmanagement;
-};
-
-/**
- * This function gets a language value from key
- *
- * @public
- * @param {string}
- * @param {string}
- * @return {string}
- * @public
- * @api
- */
-
-export const getValue = (keyPath, lang = getLang()) => {
- const translation = getTranslation(lang);
- let value = '';
- if (M.utils.isNullOrEmpty(translation)) {
- /* eslint-disable no-console */
- console.warn(`The translation '${lang}' has not been defined.`);
- } else {
- value = keyPath.split('.').reduce((prev, current) => prev[current], translation);
- }
-
- return value;
-};
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/printermapcontrol.js b/api-ign-js/src/plugins/printviewmanagement/src/facade/js/printermapcontrol.js
deleted file mode 100644
index f6ff9763f..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/printermapcontrol.js
+++ /dev/null
@@ -1,950 +0,0 @@
-/**
- * @module M/control/PrinterMapControl
- */
-
-import JsZip from 'jszip';
-import { saveAs } from 'file-saver';
-import PrinterMapControlImpl from '../../impl/ol/js/printermapcontrol';
-import { reproject, transformExt } from '../../impl/ol/js/utils';
-import printermapHTML from '../../templates/printermap';
-import { getValue } from './i18n/language';
-
-import { getBase64Image, removeLoadQueueElement, innerQueueElement } from './utils';
-
-export default class PrinterMapControl extends M.Control {
- /**
- * @classdesc
- * Main constructor of the class.
- *
- * @constructor
- * @extends {M.Control}
- * @api stable
- */
- constructor(
- {
- serverUrl,
- printTemplateUrl,
- printStatusUrl,
- credits,
- logo,
- fixedDescription,
- headerLegend,
- filterTemplates,
- order,
- tooltip,
- }, map, statusProxy,
- useProxy,
- ) {
- const impl = new PrinterMapControlImpl(map);
-
- super(impl, PrinterMapControl.NAME);
-
- this.map_ = map;
-
- if (M.utils.isUndefined(PrinterMapControlImpl)) {
- M.exception(getValue('exception.impl'));
- }
-
- if (M.utils.isUndefined(PrinterMapControlImpl.prototype.encodeLayer)) {
- M.exception(getValue('exception.encode'));
- }
-
- /**
- * Mapfish server url
- * @private
- * @type {String}
- */
- this.serverUrl_ = serverUrl || 'https://componentes.cnig.es/geoprint';
-
-
- /**
- * Mapfish template url
- * @private
- * @type {String}
- */
- this.printTemplateUrl_ = printTemplateUrl || 'https://componentes.cnig.es/geoprint/print/CNIG';
-
- /**
- * Url for getting priting status
- * @private
- * @type {String}
- */
- this.printStatusUrl_ = printStatusUrl || 'https://componentes.cnig.es/geoprint/print/status';
-
-
- /**
- * Credits text for template
- * @private
- * @type {String}
- */
- this.credits_ = credits || '';
-
- /**
- * Active or disable fixedDescription fixed description
- * @private
- * @type {Boolean}
- */
- this.fixedDescription_ = fixedDescription !== undefined ? fixedDescription : false;
-
- /**
- * Layout
- * @private
- * @type {HTMLElement}
- */
- this.layout_ = null;
-
- /**
- * Map format to print
- * @private
- * @type {HTMLElement}
- */
- this.format_ = null;
-
- /**
- * Map projection to print
- * @private
- * @type {HTMLElement}
- */
- this.projection_ = null;
-
- /**
- * Map dpi to print
- * @private
- * @type {HTMLElement}
- */
- this.dpi_ = null;
-
- /**
- * Max map dpi to print
- * @private
- * @type {HTMLElement}
- */
- this.dpiMax_ = null;
-
- this.dpiGeo_ = 120;
-
- /**
- * Keep view boolean
- * @private
- * @type {HTMLElement}
- */
- this.keepView_ = null;
-
- /**
- * Georref image boolean
- * @private
- * @type {HTMLElement}
- */
- this.georef_ = null;
-
- this.headerLegend_ = headerLegend || '';
-
- /**
- * Mapfish params
- * @private
- * @type {String}
- */
- this.params_ = {
- layout: {
- outputFilename: 'mapa_${yyyy-MM-dd_hhmmss}',
- },
- pages: {
- clientLogo: '', // logo url
- creditos: getValue('credits'),
- },
- parameters: {
- logo,
- headerLegend: this.headerLegend_,
- },
- };
-
- /**
- * Mapfish params for georef
- * @private
- * @type {String}
- */
- this.paramsGeo_ = {
- layout: {
- outputFilename: 'mapa_${yyyy-MM-dd_hhmmss}',
- },
- pages: {
- clientLogo: '', // logo url
- creditos: getValue('printInfo'),
- },
- parameters: {},
- };
-
- /**
- * Container of maps available for download
- * @private
- * @type {HTMLElement}
- */
- this.queueContainer_ = null;
-
- /**
- * Facade of the map
- * @private
- * @type {Promise}
- */
- this.capabilitiesPromise_ = null;
-
- /**
- * Mapfish options params
- * @private
- * @type {String}
- */
- this.options_ = {
- dpi: 150,
- keepView: true,
- format: 'pdf',
- legend: 'false',
- layout: 'A4 horizontal',
- };
-
- this.layoutOptions_ = [];
- this.dpisOptions_ = [];
- // this.outputFormats_ = ['pdf', 'png' /*, 'jpg'*/];
- this.outputFormats_ = ['pdf', 'png'];
- this.documentRead_ = document.createElement('img');
- this.canvas_ = document.createElement('canvas');
- this.proyectionsDefect_ = ['EPSG:25828', 'EPSG:25829', 'EPSG:25830', 'EPSG:25831', 'EPSG:3857', 'EPSG:4326', 'EPSG:4258'];
- this.filterTemplates_ = filterTemplates || [];
-
- this.order = order >= -1 ? order : null;
-
- this.tooltip_ = tooltip || getValue('tooltip');
-
- this.statusProxy = statusProxy;
- this.useProxy = useProxy;
- }
-
- /**
- * This function checks when map printing is finished.
- * @param {String} url - Mapfish GET request url
- * @param {Function} callback - function that removes loading icon class.
- */
- getStatus(url, callback, queueEl) {
- M.proxy(this.useProxy);
- const param = new Date().getTime();
- M.remote.get(`${url}?timestamp=${param}`).then((response) => {
- if (response.code === 404) {
- throw new Error('Error 404');
- }
-
- const statusJson = JSON.parse(response.text);
- const { status } = statusJson;
- if (status === 'finished') {
- M.proxy(this.statusProxy);
- callback();
- } else if (status === 'error' || status === 'cancelled') {
- M.proxy(this.statusProxy);
- callback();
- if (statusJson.error.toLowerCase().indexOf('network is unreachable') > -1 || statusJson.error.toLowerCase().indexOf('illegalargument') > -1) {
- M.dialog.error(getValue('exception.tile'));
- } else {
- M.dialog.error(getValue('exception.error'));
- }
-
- // this.queueContainer_.lastChild.remove();
- } else {
- M.proxy(this.statusProxy);
- setTimeout(() => this.getStatus(url, callback), 1000);
- }
- }).catch((err) => {
- // eslint-disable-next-line no-console
- console.log(err, 'method getStatus');
- callback(queueEl);
- queueEl.remove();
- M.dialog.error(getValue('exception.error_download_image'));
- });
- }
-
- /**
- * This function creates the view to the specified map.
- *
- * @public
- * @function
- * @param {M.Map} map to add the control
- * @api stabletrue
- */
- active(html) {
- this.html_ = html;
- const button = this.html_.querySelector('#m-printviewmanagement-printermap');
-
- const promise = new Promise((success, fail) => {
- this.getCapabilities().then((capabilitiesParam) => {
- const capabilities = capabilitiesParam;
- let i = 0;
- let ilen;
-
- // default layout
- for (i = 0, ilen = capabilities.layouts.length; i < ilen; i += 1) {
- const layout = capabilities.layouts[i];
- if (layout.name === this.options_.layout) {
- layout.default = true;
- break;
- }
- }
-
- if (this.filterTemplates_.length > 0) {
- capabilities.layouts = capabilities.layouts.filter((l) => {
- return this.filterTemplates_.indexOf(l.name) > -1;
- });
- }
-
- // show only template names without 'jpg' on their names
- capabilities.layouts = capabilities.layouts.filter((l) => {
- return !l.name.endsWith('jpg');
- });
-
- capabilities.layouts.sort((a, b) => {
- let res = 0;
- if (a.name.indexOf('(Perfil') > -1 && b.name.indexOf('(Perfil') === -1) {
- res = 1;
- } else if (a.name.indexOf('(Perfil') === -1 && b.name.indexOf('(Perfil') > -1) {
- res = -1;
- } else if (a.name === b.name) {
- res = 0;
- } else {
- res = a.name > b.name ? 1 : -1;
- }
-
- return res;
- });
-
- this.layoutOptions_ = [].concat(capabilities.layouts.map((item) => {
- return item.name;
- }));
-
- capabilities.proyections = [];
- const proyectionsDefect = this.proyectionsDefect_;
-
- for (i = 0, ilen = proyectionsDefect.length; i < ilen; i += 1) {
- if (proyectionsDefect[i] !== null) {
- const proyection = proyectionsDefect[i];
- const object = { value: proyection };
- if (proyection === 'EPSG:4258') {
- object.default = true;
- }
-
- capabilities.proyections.push(object);
- }
- }
-
- capabilities.dpis = [];
- let attribute;
- // default dpi
- // recommended DPI list attribute search
- for (i = 0, ilen = capabilities.layouts[0].attributes.length; i < ilen; i += 1) {
- if (capabilities.layouts[0].attributes[i].clientInfo !== undefined) {
- attribute = capabilities.layouts[0].attributes[i];
- this.dpiMax_ = attribute.clientInfo.maxDPI;
- }
- }
-
- for (i = 1, ilen = attribute.clientInfo.dpiSuggestions.length; i < ilen; i += 1) {
- const dpi = attribute.clientInfo.dpiSuggestions[i];
-
- if (parseInt(dpi, 10) === this.options_.dpi) {
- dpi.default = true;
- break;
- }
- const object = { value: dpi };
- capabilities.dpis.push(object);
- }
-
- this.dpisOptions_ = [].concat(capabilities.dpis.map((item) => {
- return item.value;
- }));
-
- if (Array.isArray(capabilities.formats)) {
- this.outputFormats_ = capabilities.formats.filter((f) => {
- return f !== 'jpg';
- });
- }
-
- capabilities.format = this.outputFormats_.map((format) => {
- return {
- name: format,
- default: format === 'pdf',
- };
- });
-
- // keepView
- capabilities.keepView = this.options_.keepView;
-
- // fixedDescription
- capabilities.fixedDescription = this.fixedDescription_;
-
- // translations
- capabilities.translations = {
- tooltip: getValue('tooltip'),
- title: getValue('title'),
- description: getValue('description'),
- layout: getValue('layout'),
- format: getValue('format'),
- projection: getValue('projection'),
- delete: getValue('delete'),
- download: getValue('download'),
- fixeddescription: getValue('fixeddescription'),
- };
-
- const template = M.template.compileSync(printermapHTML, {
- jsonp: true,
- vars: capabilities,
- });
-
- this.accessibilityTab(template);
-
- this.selectElementHTML(template);
-
- this.template_ = template;
- success(template);
- });
- });
- promise.then((template) => {
- if (!button.classList.contains('activated')) {
- this.html_.querySelector('#m-printviewmanagement-controls').appendChild(template);
- } else {
- document.querySelector('.m-printermap-container').remove();
- }
- button.classList.toggle('activated');
- });
- }
-
- /**
- * This function adds event listeners.
- *
- * @public
- * @function
- * @param {M.Map} map to add the control
- * @api stable
- */
- selectElementHTML(html) {
- // IDs
- const ID_TITLE = '#m-printermap-title';
- const ID_FORMAT = '#m-printermap-format';
- const ID_TEXT_AREA = '#m-printermap-description';
- const ID_LAYOUT = '#m-printermap-layout';
- const ID_DPI = '#m-printermap-dpi';
-
- // Elements
- this.elementTitle_ = html.querySelector(ID_TITLE);
- this.elementFormat_ = html.querySelector(ID_FORMAT);
- this.elementTextArea_ = html.querySelector(ID_TEXT_AREA);
- this.elementLayout_ = html.querySelector(ID_LAYOUT);
- this.elementDPI_ = html.querySelector(ID_DPI);
- }
-
- /**
- * This function prints on click
- *
- * @private
- * @function
- */
- printClick(evt) {
- evt.preventDefault();
-
- const getPrintData = this.getPrintData();
- const printUrl = this.printTemplateUrl_;
-
- let download;
- download = this.downloadPrint;
-
-
- getPrintData.then((printData) => {
- if (this.georef_) {
- download = this.downloadGeoPrint.bind(this, printData.attributes.map.bbox);
- }
-
- let url = M.utils.concatUrlPaths([printUrl, `report.${printData.outputFormat}`]);
-
- const queueEl = innerQueueElement(
- this.html_,
- this.elementTitle_,
- this.elementQueueContainer_,
- );
-
- url = M.utils.addParameters(url, 'mapeaop=geoprint');
- const profilControl = this.map_.getMapImpl().getControls().getArray().filter((c) => {
- return c.element !== undefined && c.element.classList !== undefined && c.element.classList.contains('ol-profil');
- });
-
- if ((this.georef_ === null || !this.georef_) && profilControl.length > 0) {
- // eslint-disable-next-line no-param-reassign
- printData.attributes.profil = profilControl[0].getImage();
- }
-
- // FIXME: delete proxy deactivation and uncomment if/else when proxy is fixed on Mapea
- M.proxy(this.useProxy);
- M.remote.post(url, printData).then((responseParam) => {
- let response = responseParam;
- const responseStatusURL = response.text && JSON.parse(response.text);
- const ref = responseStatusURL.ref;
- const statusURL = M.utils.concatUrlPaths([this.printStatusUrl_, `${ref}.json`]);
- this.getStatus(statusURL, () => removeLoadQueueElement(queueEl), queueEl);
-
- // if (response.error !== true) { // withoud proxy, response.error === true
- let downloadUrl;
- try {
- response = JSON.parse(response.text);
- const imageUrl = response.downloadURL.substring(response.downloadURL.indexOf('/print'), response.downloadURL.length);
- downloadUrl = M.utils.concatUrlPaths([this.serverUrl_, imageUrl]);
- this.documentRead_.src = downloadUrl;
- } catch (err) {
- M.exception(err);
- }
-
- queueEl.setAttribute(PrinterMapControl.DOWNLOAD_ATTR_NAME, downloadUrl);
- queueEl.addEventListener('click', download);
- queueEl.addEventListener('keydown', download);
- // } else {
- // M.dialog.error('Se ha producido un error en la impresión.');
- // }
- });
- M.proxy(this.statusProxy);
- });
- if (!M.utils.isNullOrEmpty(this.getImpl().errors)) {
- M.toast.warning(getValue('exception.error_layers') + this.getImpl().errors.join(', '), null, 6000);
- this.getImpl().errors = [];
- }
- }
-
- /**
- * Gets capabilities
- *
- * @public
- * @function
- * @param {M.Map} map to add the control
- * @api stable
- */
- getCapabilities() {
- if (M.utils.isNullOrEmpty(this.capabilitiesPromise_)) {
- this.capabilitiesPromise_ = new Promise((success, fail) => {
- const capabilitiesUrl = M.utils.concatUrlPaths([this.printTemplateUrl_, 'capabilities.json']);
- M.proxy(this.useProxy);
- M.remote.get(capabilitiesUrl).then((response) => {
- let capabilities = {};
- try {
- capabilities = JSON.parse(response.text);
- } catch (err) {
- M.exception(err);
- }
- success(capabilities);
- });
-
- M.proxy(this.statusProxy);
- });
- }
- return this.capabilitiesPromise_;
- }
-
- /**
- * Converts decimal degrees coordinates to degrees, minutes, seconds
- * @public
- * @function
- * @param {String} coordinate - single coordinate (one of a pair)
- * @api
- */
- converterDecimalToDMS(coordinate) {
- let dms;
- let aux;
- const coord = coordinate.toString();
- const splittedCoord = coord.split('.');
- // Degrees
- dms = `${splittedCoord[0]}º `;
- // Minutes
- aux = `0.${splittedCoord[1]}`;
- aux *= 60;
- aux = aux.toString();
- aux = aux.split('.');
- dms = `${dms}${aux[0]}' `;
- // Seconds
- aux = `0.${aux[1]}`;
- aux *= 60;
- aux = aux.toString();
- aux = aux.split('.');
- dms = `${dms}${aux[0]}'' `;
- return dms;
- }
-
- /**
- * Converts original bbox coordinates to DMS coordinates.
- * @public
- * @function
- * @api
- * @param {Array} bbox - { x: {min, max}, y: {min, max} }
- */
- convertBboxToDMS(bbox) {
- const proj = this.map_.getProjection();
- let dmsBbox = bbox;
- if (proj.units === 'm') {
- const min = [bbox.x.min, bbox.y.min];
- const max = [bbox.x.max, bbox.y.max];
- const newMin = reproject(proj.code, min);
- const newMax = reproject(proj.code, max);
- dmsBbox = {
- x: {
- min: newMin[0],
- max: newMax[0],
- },
- y: {
- min: newMin[1],
- max: newMax[1],
- },
- };
- }
-
- dmsBbox = this.convertDecimalBoxToDMS(dmsBbox);
- return dmsBbox;
- }
-
- /**
- * Converts decimal coordinates Bbox to DMS coordinates Bbox.
- * @public
- * @function
- * @api
- * @param { Array < Object > } bbox - { x: { min, max }, y: { min, max } }
- */
- convertDecimalBoxToDMS(bbox) {
- return {
- x: {
- min: this.converterDecimalToDMS(bbox.x.min),
- max: this.converterDecimalToDMS(bbox.x.max),
- },
- y: {
- min: this.converterDecimalToDMS(bbox.y.min),
- max: this.converterDecimalToDMS(bbox.y.max),
- },
- };
- }
-
- /**
- * This function returns request JSON.
- *
- * @private
- * @function
- */
- getPrintData() {
- const title = this.elementTitle_.value;
- let description = this.elementTextArea_.value;
- const credits = this.credits_;
- if (credits.length > 2) {
- if (description.length > 0) {
- description += ` - ${credits}`;
- } else {
- description += credits;
- }
- }
-
- const projection = this.map_.getProjection().code;
- const bbox = this.map_.getBbox();
- const dmsBbox = this.convertBboxToDMS(bbox);
- let layout = this.elementLayout_.value;
- const dpi = this.elementDPI_.value;
-
- const outputFormat = this.elementFormat_.value;
- const parameters = this.params_.parameters;
-
- const attributionContainer = document.querySelector('#m-attributions-container>div>a');
- const attribution = attributionContainer !== null ?
- `${getValue('base')}: ${attributionContainer.innerHTML}` : '';
-
- if (outputFormat === 'jpg') {
- layout += ' jpg';
- }
-
- const date = new Date();
- const currentDate = ''.concat(date.getDate(), '/', date.getMonth() + 1, '/', date.getFullYear());
- let fileTitle = title.replace(' ', '');
- if (fileTitle.length <= 8) {
- fileTitle = fileTitle.concat('${yyyyMMddhhmmss}');
- this.params_.layout.outputFilename = fileTitle;
- } else {
- fileTitle = fileTitle.substring(0, 7).concat('${yyyyMMddhhmmss}');
- this.params_.layout.outputFilename = fileTitle;
- }
-
- const printData = M.utils.extend({
- layout,
- outputFormat,
- attributes: {
- title,
- description,
- attributionInfo: attribution,
- refsrs: this.turnProjIntoLegend(projection),
- printDate: currentDate,
- map: {
- dpi,
- projection,
- useAdjustBounds: true,
- },
- xCoordTopLeft: dmsBbox.y.max,
- yCoordTopLeft: dmsBbox.x.min,
- xCoordTopRight: dmsBbox.y.max,
- yCoordTopRight: dmsBbox.x.max,
- xCoordBotRight: dmsBbox.y.min,
- yCoordBotRight: dmsBbox.x.max,
- xCoordBotLeft: dmsBbox.y.min,
- yCoordBotLeft: dmsBbox.x.min,
- },
- }, this.params_.layout);
-
- return this.encodeLayers().then((encodedLayers) => {
- printData.attributes.map.layers = encodedLayers.filter(l => M.utils.isObject(l));
- printData.attributes = Object.assign(printData.attributes, parameters);
- if (projection !== 'EPSG:3857' && this.map_.getLayers().some(layer => (layer.type === M.layer.type.OSM || layer.type === M.layer.type.Mapbox))) {
- printData.attributes.map.projection = 'EPSG:3857';
- }
-
- printData.attributes.map.bbox = [bbox.x.min, bbox.y.min, bbox.x.max, bbox.y.max];
- if (projection !== 'EPSG:3857' && this.map_.getLayers().some(layer => (layer.type === M.layer.type.OSM || layer.type === M.layer.type.Mapbox))) {
- printData.attributes.map.bbox = transformExt(printData.attributes.map.bbox, projection, 'EPSG:3857');
- }
-
- return printData;
- });
- }
-
- getDPI_() {
- if (!this.keepView_) {
- return this.dpi_.value;
- }
- return 120;
- }
-
- /**
- * This function encodes layers.
- *
- * @private
- * @function
- */
- encodeLayers() {
- // Filters visible layers whose resolution is inside map resolutions range
- // and that doesn't have Cluster style.
- const mapZoom = this.map_.getZoom();
- let layers = this.map_.getLayers().filter((layer) => {
- return (layer.isVisible() && layer.inRange() && layer.name !== 'cluster_cover' && layer.name !== 'selectLayer' && layer.name !== 'empty_layer' &&
- mapZoom > layer.getImpl().getMinZoom() && mapZoom <= layer.getImpl().getMaxZoom());
- });
-
- if (mapZoom === 20) {
- let contains = false;
- layers.forEach((l) => {
- if (l.url !== undefined && l.url === 'https://tms-pnoa-ma.idee.es/1.0.0/pnoa-ma/{z}/{x}/{-y}.jpeg') {
- contains = true;
- }
- });
-
- if (contains) {
- layers = layers.filter((l) => {
- return l.url !== 'https://tms-pnoa-ma.idee.es/1.0.0/pnoa-ma/{z}/{x}/{-y}.jpeg';
- });
- }
- } else if (mapZoom < 20) {
- let contains = false;
- layers.forEach((l) => {
- if (l.url !== undefined && l.name !== undefined && l.url === 'https://www.ign.es/wmts/pnoa-ma?' && l.name === 'OI.OrthoimageCoverage') {
- contains = true;
- }
- });
-
- if (contains) {
- layers = layers.filter((l) => {
- return l.url !== 'https://www.ign.es/wmts/pnoa-ma?' && l.name !== 'OI.OrthoimageCoverage';
- });
- }
- }
-
- let numLayersToProc = layers.length;
- const otherLayers = this.getImpl().getParametrizedLayers('IMAGEN', layers);
- if (otherLayers.length > 0) {
- layers = layers.concat(otherLayers);
- numLayersToProc = layers.length;
- }
-
- layers = layers.sort((a, b) => {
- let res = 0;
- const zia = a.getZIndex() !== null ? a.getZIndex() : 0;
- const zib = b.getZIndex() !== null ? b.getZIndex() : 0;
- if (zia > zib) {
- res = 1;
- } else if (zia < zib) {
- res = -1;
- }
-
- return res;
- });
-
- return (new Promise((success, fail) => {
- const encodedLayers = [];
- layers.forEach((layer, index) => {
- this.getImpl().encodeLayer(layer).then((encodedLayer) => {
- if (!M.utils.isNullOrEmpty(encodedLayer)) {
- encodedLayers[index] = encodedLayer;
- }
-
- numLayersToProc -= 1;
- if (numLayersToProc === 0) {
- // Mapfish requires reverse order
- success(encodedLayers.reverse());
- }
- });
- });
- }));
- }
-
- /**
- * This function downloads printed map.
- *
- * @public
- * @function
- * @api stable
- */
- downloadPrint(event) {
- event.preventDefault();
- if (event.key === undefined || event.key === 'Enter' || event.key === ' ') {
- const downloadUrl = this.getAttribute(PrinterMapControl.DOWNLOAD_ATTR_NAME);
- if (!M.utils.isNullOrEmpty(downloadUrl)) {
- window.open(downloadUrl, '_blank');
- }
- }
- }
-
- /**
- * This function downloads geo printed map.
- *
- * @public
- * @function
- * @api stable
- */
- downloadGeoPrint(bbox, event) {
- const base64image = getBase64Image(this.documentRead_.src);
- base64image.then((resolve) => {
- const size = this.map_.getMapImpl().getSize();
- const Px = (((bbox[2] - bbox[0]) / size[0]) * (72 / this.dpiGeo_)).toString();
- const GiroA = (0).toString();
- const GiroB = (0).toString();
- const Py = (-((bbox[3] - bbox[1]) / size[1]) * (72 / this.dpiGeo_)).toString();
- const Cx = (bbox[0] + (Px / 2)).toString();
- const Cy = (bbox[3] + (Py / 2)).toString();
- const f = new Date();
- const titulo = 'mapa_'.concat(f.getFullYear(), '-', f.getMonth() + 1, '-', f.getDay() + 1, '_', f.getHours(), f.getMinutes(), f.getSeconds());
- const zip = new JsZip();
- zip.file(titulo.concat('.jgw'), Px.concat('\n', GiroA, '\n', GiroB, '\n', Py, '\n', Cx, '\n', Cy));
- zip.file(titulo.concat('.jpg'), resolve, { base64: true });
- zip.generateAsync({ type: 'blob' }).then((content) => {
- saveAs(content, titulo.concat('.zip'));
- });
- }).catch((err) => {
- M.dialog.error(getValue('exception.imageError'));
- });
- }
-
- /**
- * Converts epsg code to projection name.
- * @public
- * @function
- * @param {String} projection - EPSG:xxxx
- * @api
- */
- turnProjIntoLegend(projection) {
- let projectionLegend;
- switch (projection) {
- case 'EPSG:4258':
- projectionLegend = 'EPSG:4258 (ETRS89)';
- break;
- case 'EPSG:4326':
- projectionLegend = 'EPSG:4326 (WGS84)';
- break;
- case 'EPSG:3857':
- projectionLegend = 'EPSG:3857 (WGS84)';
- break;
- case 'EPSG:25831':
- projectionLegend = `EPSG:25831 (UTM ${getValue('zone')} 31N)`;
- break;
- case 'EPSG:25830':
- projectionLegend = `EPSG:25830 (UTM ${getValue('zone')} 30N)`;
- break;
- case 'EPSG:25829':
- projectionLegend = `EPSG:25829 (UTM ${getValue('zone')} 29N)`;
- break;
- case 'EPSG:25828':
- projectionLegend = `EPSG:25828 (UTM ${getValue('zone')} 28N)`;
- break;
- default:
- projectionLegend = '';
- }
- return projectionLegend;
- }
-
- /**
- * This function checks if an object is equal to this control.
- *
- * @function
- * @api stable
- */
- equals(obj) {
- let equals = false;
- if (obj instanceof PrinterMapControl) {
- equals = (this.name === obj.name);
- }
- return equals;
- }
-
- accessibilityTab(html) {
- html.querySelectorAll('[tabindex="0"]').forEach(el => el.setAttribute('tabindex', this.order));
- }
-
- deactive() {
- this.template_.remove();
- // TO-DO ADD BUTTON REMOVE AND ALL EVENTS
- }
-
- /**
- * This function destroys this control
- *
- * @public
- * @function
- * @api
- */
- destroy() {
- }
-}
-
-/**
- * Name for this controls
- * @const
- * @type {string}
- * @public
- * @api stable
- */
-PrinterMapControl.NAME = 'printermapcontrol';
-
-/**
- * M.template for this controls
- * @const
- * @type {string}
- * @public
- * @api stable
- */
-PrinterMapControl.TEMPLATE = 'printermap.html';
-
-/**
- * M.template for this controls
- * @const
- * @type {string}
- * @public
- * @api stable
- */
-PrinterMapControl.LOADING_CLASS = 'printing';
-
-/**
- * M.template for this controls
- * @const
- * @type {string}
- * @public
- * @api stable
- */
-PrinterMapControl.DOWNLOAD_ATTR_NAME = 'data-donwload-url-print';
-
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/printviewmanagement.js b/api-ign-js/src/plugins/printviewmanagement/src/facade/js/printviewmanagement.js
deleted file mode 100644
index 211b2fb44..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/printviewmanagement.js
+++ /dev/null
@@ -1,322 +0,0 @@
-/**
- * @module M/plugin/PrintViewManagement
- */
-import '../assets/css/printviewmanagement';
-import PrintViewManagementControl from './printviewmanagementcontrol';
-import es from './i18n/es';
-import en from './i18n/en';
-import { getValue } from './i18n/language';
-
-export default class PrintViewManagement extends M.Plugin {
- /**
- * @classdesc
- * Main facade plugin object. This class creates a plugin
- * object which has an implementation Object
- *
- * @constructor
- * @extends {M.Plugin}
- * @param {Object} impl implementation object
- * @api
- */
- constructor(options = {}) {
- super();
- /**
- * Facade of the map
- * @private
- * @type {M.Map}
- */
- this.map_ = null;
-
- /**
- * Array of controls
- * @private
- * @type {Array}
- */
- this.controls_ = [];
-
- /**
- * Plugin name
- * @public
- * @type {String}
- */
- this.name = 'printviewmanagement';
-
- /**
- * Plugin parameters
- * @public
- * @type {Object}
- */
- this.options = options;
-
- /**
- * Position of the plugin
- *
- * @private
- * @type {String} TL | TR | BL | BR
- */
- this.position_ = options.position || 'TL';
-
- /**
- * Option to allow the plugin to be collapsed or not
- * @private
- * @type {Boolean}
- */
- this.collapsed = !M.utils.isUndefined(options.collapsed) ? options.collapsed : true;
-
- /**
- * Option to allow the plugin to be collapsible or not
- * @private
- * @type {Boolean}
- */
- this.collapsible = !M.utils.isUndefined(options.collapsible) ? options.collapsible : true;
-
- /**
- * Tooltip of plugin
- * @private
- * @type {String}
- */
- this.tooltip_ = options.tooltip || getValue('tooltip');
-
- /**
- * Option to allow the plugin to be draggable or not
- * @private
- * @type {Boolean}
- */
- this.isDraggable = options.isDraggable === true || options.isDraggable === 'true';
-
- const { georefImageEpsg = true } = options;
-
- /**
- * Indicates if the control georefImageEpsg is added to the plugin
- * @private
- * @type {Boolean|Array}
- */
- if (georefImageEpsg === true) {
- this.georefImageEpsg = {
- layers: [
- {
- url: 'http://www.ign.es/wms-inspire/mapa-raster?',
- name: 'mtn_rasterizado',
- format: 'image/jpeg',
- legend: 'Mapa ETRS89 UTM',
- },
- {
- url: 'http://www.ign.es/wms-inspire/pnoa-ma?',
- name: 'OI.OrthoimageCoverage',
- format: 'image/jpeg',
- legend: 'Imagen (PNOA) ETRS89 UTM',
- },
- ],
- order: 0,
- };
- } else if (options.georefImageEpsg) {
- this.georefImageEpsg = this.getGeorefImageEpsg();
- } else {
- this.georefImageEpsg = false;
- }
-
- const { georefImage = true } = options;
-
- /**
- * Indicates if the control georefImage is added to the plugin
- * @private
- * @type {Boolean}
- */
- if (georefImage === true) {
- this.georefImage = {
- tooltip: 'Georeferenciar imagen',
- printTemplateUrl: 'https://componentes.cnig.es/geoprint/print/mapexport',
- printSelector: true,
- };
- } else if (options.georefImage) {
- this.georefImage = options.georefImage;
- } else {
- this.georefImage = false;
- }
-
- const { printermap = true } = options;
-
- /**
- * Indicates if the control printermap is added to the plugin
- * @private
- * @type {Boolean}
- */
- if (printermap === true) {
- this.printermap = {
- printTemplateUrl: 'https://componentes.cnig.es/geoprint/print/CNIG',
- // headerLegend: 'https://www.idee.es/csw-codsi-idee/images/cabecera-CODSI.png',
- filterTemplates: [],
- credits: '',
- // logo: 'https://www.idee.es/csw-codsi-idee/images/cabecera-CODSI.png',
- };
- } else if (options.printermap) {
- this.printermap = options.printermap;
- } else {
- this.printermap = false;
- }
-
- let serverUrl = options.serverUrl;
- if (serverUrl && serverUrl.endsWith('/geoprint/')) {
- serverUrl = serverUrl.replace('/geoprint/', '/geoprint');
- }
- this.serverUrl = serverUrl || 'https://componentes.cnig.es/geoprint';
-
- this.printStatusUrl = options.printStatusUrl || 'https://componentes.cnig.es/geoprint/print/status';
-
- this.defaultOpenControl = options.defaultOpenControl || 0;
-
- /**
- * Indicates order to the plugin
- * @private
- * @type {Number}
- */
- this.order = options.order >= -1 ? options.order : null;
-
- /**
- * Indicates if you want to use proxy in requests
- * @private
- * @type {Boolean}
- */
- this.useProxy = M.utils.isUndefined(options.useProxy) ? true : options.useProxy;
-
- /**
- * Stores the proxy state at plugin load time
- * @private
- * @type {Boolean}
- */
- this.statusProxy = M.useproxy;
- }
-
- /**
- * Return plugin language
- *
- * @public
- * @function
- * @param {string} lang type language
- * @api
- */
- static getJSONTranslations(lang) {
- if (lang === 'en' || lang === 'es') {
- return (lang === 'en') ? en : es;
- }
- return M.language.getTranslation(lang).printviewmanagement;
- }
-
- /**
- * This function adds this plugin into the map
- *
- * @public
- * @function
- * @param {M.Map} map the map to add the plugin
- * @api
- */
- addTo(map) {
- this.map_ = map;
- if (this.georefImageEpsg === false && this.georefImage === false &&
- this.printermap === false) {
- M.dialog.error(getValue('exception.no_controls'));
- }
-
- // TO-DO Cambiar por un objeto
- this.controls_.push(new PrintViewManagementControl({
- isDraggable: this.isDraggable,
- georefImageEpsg: this.georefImageEpsg,
- georefImage: this.georefImage,
- printermap: this.printermap,
- order: this.order,
- map: this.map_,
- serverUrl: this.serverUrl,
- printTemplateUrl: this.printTemplateUrl,
- printStatusUrl: this.printStatusUrl,
- defaultOpenControl: this.defaultOpenControl,
- useProxy: this.useProxy,
- statusProxy: this.statusProxy,
- }));
-
- this.panel_ = new M.ui.Panel('panelPrintViewManagement', {
- collapsible: this.collapsible,
- collapsed: this.collapsed,
- position: M.ui.position[this.position_],
- className: 'm-plugin-printviewmanagement',
- tooltip: this.tooltip_,
- collapsedButtonClass: 'printviewmanagement-icon-zoom-mapa',
- order: this.order,
- });
-
- this.panel_.addControls(this.controls_);
- map.addPanels(this.panel_);
- }
-
- /**
- * the control georefImageEpsg
- *
- * @public
- * @function
- * @returns Default center and zoom level
- * @api
- */
- getGeorefImageEpsg() {
- const { layers, tooltip } = this.options.georefImageEpsg;
-
- const order = 0; // ?¿
- const georefImageEpsg = {
- layers,
- order,
- tooltip,
- };
- return georefImageEpsg;
- }
-
- /**
- * Gets the API REST Parameters of the plugin
- *
- * @function
- * @public
- * @api
- */
- getAPIRest() {
- return `${this.name}=${this.position_}*${this.collapsed}*${this.collapsible}*${this.tooltip_}*${this.isDraggable}` +
- `*${this.serverUrl}*${this.printStatusUrl}*${!M.utils.isNullOrEmpty(this.georefImageEpsg)}*${!M.utils.isNullOrEmpty(this.georefImage)}*${!M.utils.isNullOrEmpty(this.printermap)}*${this.defaultOpenControl}`;
- }
-
- /**
- * Gets the API REST Parameters in base64 of the plugin
- *
- * @function
- * @public
- * @api
- */
- getAPIRestBase64() {
- return `${this.name}=base64=${M.utils.encodeBase64(this.options)}`;
- }
-
- /**
- * This function destroys this plugin
- *
- * @public
- * @function
- * @api
- */
- destroy() {
- this.map_.removeControls(this.controls_);
- this.map_ = null;
- this.controls_ = null;
- this.panel_ = null;
- this.name = null;
- }
-
- /**
- * This function compare if pluging recieved by param is instance of M.plugin.PrintViewManagement
- *
- * @public
- * @function
- * @param {M.plugin} plugin to comapre
- * @api
- */
- equals(plugin) {
- if (plugin instanceof PrintViewManagement) {
- return true;
- }
- return false;
- }
-}
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/printviewmanagementcontrol.js b/api-ign-js/src/plugins/printviewmanagement/src/facade/js/printviewmanagementcontrol.js
deleted file mode 100644
index 208b6baa0..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/printviewmanagementcontrol.js
+++ /dev/null
@@ -1,343 +0,0 @@
-/**
- * @module M/control/PrintViewManagementControl
- */
-
-import template from '../../templates/printviewmanagement';
-import PrintViewManagementImpl from '../../impl/ol/js/printviewmanagement';
-import { getValue } from './i18n/language';
-import PrinterMapControl from './printermapcontrol';
-import GeorefImageEpsgControl from './georefimageepsgcontrol';
-import GeorefimageControl from './georefimagecontrol';
-
-import { removeQueueElements } from './utils';
-
-export default class PrintViewManagementControl extends M.Control {
- /**
- * Main constructor of the class. Creates a PluginControl
- * control
- *
- * @constructor
- * @extends {M.Control}
- * @api
- */
- constructor({
- isDraggable, georefImageEpsg, georefImage, printermap, order, map,
- serverUrl, printStatusUrl, defaultOpenControl, useProxy, statusProxy,
- }) {
- if (M.utils.isUndefined(PrintViewManagementImpl)) {
- M.exception(getValue('exception.impl'));
- }
-
- const impl = new PrintViewManagementImpl();
- super(impl, 'PrintViewManagement');
- /**
- * Option to allow the plugin to be draggable or not
- * @private
- * @type {Boolean}
- */
- this.isDraggable_ = isDraggable;
-
- /**
- * Order of plugin
- * @public
- * @type {Number}
- */
- this.order = order;
-
- /**
- @private *
- @type { string }
- * @type { string }
- */
- this.tooltipGeorefImageEpsg_ = georefImageEpsg.tooltip || getValue('tooltip_georefimageepsg');
-
-
- /**
- * Indicates if the control georefImageEpsg is added to the plugin
- * @private
- * @type {Boolean|Array}
- */
- this.georefImageEpsg_ = georefImageEpsg;
-
- /**
- * Indicates if the control georefImage is added to the plugin
- * @private
- * @type {Boolean}
- */
- this.georefImage_ = georefImage;
- if (this.georefImage_ instanceof Object) {
- this.georefImage_.serverUrl = serverUrl;
- this.georefImage_.printStatusUrl = printStatusUrl;
- }
-
- this.tooltipGeorefImage_ = georefImage.tooltip || getValue('georeferenced_img');
-
- /**
- * Indicates if the control printermap is added to the plugin
- * @private
- * @type {Boolean}
- */
- this.printermap_ = printermap;
- if (this.printermap_ instanceof Object) {
- this.printermap_.serverUrl = serverUrl;
- this.printermap_.printStatusUrl = printStatusUrl;
- }
-
- this.tooltipPrintermap_ = printermap.tooltip || getValue('map_printing');
-
- this.defaultOpenControl = defaultOpenControl;
-
- this.statusProxy = statusProxy;
-
- this.useProxy = useProxy;
- }
- /**
- * This function creates the view
- *
- * @public
- * @function
- * @param {M.Map} map to add the control
- * @api
- */
- createView(map) {
- this.map_ = map;
- return new Promise((success, fail) => {
- const html = M.template.compileSync(template, {
- vars: {
- georefImageEpsg: !!this.georefImageEpsg_,
- georefImage: !!this.georefImage_,
- printermap: !!this.printermap_,
- translations: {
- headertitle: getValue('tooltip'),
- tooltipGeorefImageEpsg: this.tooltipGeorefImageEpsg_,
- georefImage: this.tooltipGeorefImage_,
- printermap: this.tooltipPrintermap_,
- downImg: getValue('downImg'),
- delete: getValue('delete'),
- },
- },
- });
-
- this.html = html;
-
- if (this.georefImageEpsg_) { this.addGeorefImageEpsgControl(html); }
-
- if (this.georefImage_) { this.addGeorefImageControl(html); }
-
- if (this.printermap_) { this.addPrinterMapControl(html); }
-
- if (this.isDraggable_) { M.utils.draggabillyPlugin(this.getPanel(), '#m-printviewmanagement-title'); }
-
- this.accessibilityTab(html);
- this.selectElementHTML();
- this.addEvent();
- this.defaultOpenControl_(html);
- success(html);
- });
- }
-
-
- selectElementHTML() {
- // IDs
- const ID_REMOVE_BUTTON = '#m-printviewmanagement-remove';
- const ID_PRINT_BUTTON = '#m-printviewmanagement-print';
-
- // Elements
- this.elementRemoveButton_ = this.html.querySelector(ID_REMOVE_BUTTON);
- this.elementPrintButton_ = this.html.querySelector(ID_PRINT_BUTTON);
- }
-
- addEvent() {
- // ADD EVENT REMOVE
- // TO-DO EVITAR PETICIONES ? Problem CORE
- this.elementRemoveButton_.addEventListener('click', () => removeQueueElements(this.html));
-
- // ADD EVENT PRINT
- this.elementPrintButton_.addEventListener('click', (evt) => {
- const active = this.getControlActive(this.html);
-
- if (active) {
- if (active.id === 'm-printviewmanagement-georefImage') {
- this.georefImageControl.printClick(evt);
- }
-
- if (active.id === 'm-printviewmanagement-georefImageEpsg') {
- this.georefImageEpsgControl.printClick(evt);
- }
-
- if (active.id === 'm-printviewmanagement-printermap') {
- this.printerMapControl.printClick(evt);
- }
- }
- });
-
- document.addEventListener('keydown', (evt) => {
- if (evt.key === 'Escape') {
- const elem = document.querySelector('.m-panel.m-plugin-printviewmanagement.opened');
- if (elem !== null) {
- elem.querySelector('button.m-panel-btn').click();
- }
- }
- });
- }
-
- defaultOpenControl_(html) {
- if (this.defaultOpenControl === 1 && this.printermap_) {
- this.showDownloadButton();
- this.deactive(html, 'printermap');
- this.printerMapControl.active(html);
- }
-
- if (this.defaultOpenControl === 2 && this.georefImage_) {
- this.showDownloadButton();
- this.deactive(html, 'georefImage');
- this.georefImageControl.active(html);
- }
-
- if (this.defaultOpenControl === 3 && this.georefImageEpsg_) {
- this.showDownloadButton();
- this.deactive(html, 'georefImageEpsg');
- this.georefImageEpsgControl.active(html);
- }
- }
-
- /**
- * This function compares controls
- *
- * @public
- * @function
- * @param {M.Control} control to compare
- * @api
- */
- equals(control) {
- return control instanceof PrintViewManagementControl;
- }
-
- addGeorefImageEpsgControl(html) {
- this.georefImageEpsgControl = new GeorefImageEpsgControl(
- this.georefImageEpsg_,
- this.map_,
- );
- html.querySelector('#m-printviewmanagement-georefImageEpsg').addEventListener('click', () => {
- this.showDownloadButton();
- this.deactive(html, 'georefImageEpsg');
- this.georefImageEpsgControl.active(html);
- });
- }
-
- addPrinterMapControl(html) {
- this.printerMapControl = new PrinterMapControl(
- this.printermap_, this.map_,
- this.statusProxy, this.useProxy,
- );
- html.querySelector('#m-printviewmanagement-printermap').addEventListener('click', () => {
- this.showDownloadButton();
- this.deactive(html, 'printermap');
- this.printerMapControl.active(html);
- });
- }
-
- addGeorefImageControl(html) {
- this.georefImageControl = new GeorefimageControl(
- this.georefImage_, this.map_,
- this.statusProxy, this.useProxy,
- );
- html.querySelector('#m-printviewmanagement-georefImage').addEventListener('click', () => {
- this.showDownloadButton();
- this.deactive(html, 'georefImage');
- this.georefImageControl.active(html);
- });
- }
-
- showDownloadButton() {
- const ID_DOWNLOAD_BUTTON = '#m-georefimage-download-button';
- this.elementDownloadButton_ = this.html.querySelector(ID_DOWNLOAD_BUTTON);
-
- const display = this.elementDownloadButton_.style.display;
- if (display === 'none') {
- this.elementDownloadButton_.style.display = 'flex';
- }
- }
-
- hidemDownloadButton() {
- const ID_DOWNLOAD_BUTTON = '#m-georefimage-download-button';
- this.elementDownloadButton_ = this.html.querySelector(ID_DOWNLOAD_BUTTON);
-
- const display = this.elementDownloadButton_.style.display;
- if (display === 'flex') {
- this.elementDownloadButton_.style.display = 'none';
- }
- }
-
- /**
- * This function deactivates the activated control
- * before activating another
- *
- * @public
- * @function
- * @param {Node} html
- * @param {String} control
- * @api
- */
- deactive(html, control) {
- const active = this.getControlActive(html);
- if (!active) { return; } // TO-DO NO SALE ?¿
-
- if (active && active.id !== `m-printviewmanagement-${control}`) {
- if (active.id === 'm-printviewmanagement-georefImage') {
- this.georefImageControl.deactive();
- }
-
- if (active.id === 'm-printviewmanagement-georefImageEpsg') {
- this.georefImageEpsgControl.deactive();
- }
-
- if (active.id === 'm-printviewmanagement-printermap') {
- this.printerMapControl.deactive();
- }
-
- active.classList.remove('activated');
- // const container = document.querySelector('#div-contenedor-printviewmanagement');
- // if (container && container.children.length > 2) {
- // container.removeChild(container.children[2]);
- // }
- } else if (active.id === `m-printviewmanagement-${control}`) {
- this.hidemDownloadButton();
- }
- }
-
- getControlActive(html) {
- if (html.querySelectorAll('#m-printviewmanagement-previews .activated').length === 0) {
- return false;
- }
- return html.querySelectorAll('#m-printviewmanagement-previews .activated')[0];
- }
-
- /**
- * This function changes number of tabindex
- *
- * @public
- * @function
- * @param {Node} html
- * @api
- */
- accessibilityTab(html) {
- html.querySelectorAll('[tabindex="0"]').forEach(el => el.setAttribute('tabindex', this.order));
- }
-
- /**
- * This function destroys controls inside this control
- *
- * @public
- * @function
- * @api
- */
- destroy() {
- if (!M.utils.isNullOrEmpty(this.georefImageControl)) {
- this.georefImageControl.destroy();
- }
- if (!M.utils.isNullOrEmpty(this.printerMapControl)) {
- this.printerMapControl.destroy();
- }
- }
-}
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/utils.js b/api-ign-js/src/plugins/printviewmanagement/src/facade/js/utils.js
deleted file mode 100644
index a64e4fe04..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/facade/js/utils.js
+++ /dev/null
@@ -1,173 +0,0 @@
-import { getValue } from './i18n/language';
-// eslint-disable-next-line import/first
-import JsZip from 'jszip';
-// eslint-disable-next-line import/first
-import { saveAs } from 'file-saver';
-
-// ID and CLASS
-const LOADING_CLASS = 'printing';
-const CONTAINER_QUEUE_CLASS = 'm-printviewmanagement-queue';
-const FINISHED_CLASS = 'finished';
-const ID_QUEUE_CONTAINER = '#m-georefimage-queue-container';
-// FORMAT IMAGE (png|jpeg)
-const REGEX_FORMAT_IMAGE = /^data:image\/(png|jpeg);base64,/;
-
-/**
-* This function creates list element.
-*
-* @public
-* @function
-* @api stable
-*/
-export function createQueueElement(title) {
- const queueElem = document.createElement('li');
- queueElem.innerHTML = title || getValue('notitle');
- queueElem.tabIndex = 0;
- return queueElem;
-}
-
-// Show Container Queue
-export function showQueueElement(element) {
- const e = element;
- if (e.style.display === 'none') {
- e.style.display = 'block';
- }
-}
-
-
-// Return container queue
-export function getQueueContainer(html) {
- return html.querySelector(ID_QUEUE_CONTAINER);
-}
-
-// Insert element in Container Queue
-export function innerQueueElement(html, elementTitle) {
- const elementQueueContainer = getQueueContainer(html);
- showQueueElement(html.querySelector(`.${CONTAINER_QUEUE_CLASS}`));
- const queueEl = createQueueElement(elementTitle.value);
- if ([...elementQueueContainer.childNodes].length > 0) {
- elementQueueContainer.insertBefore(queueEl, elementQueueContainer.firstChild);
- } else {
- elementQueueContainer.appendChild(queueEl);
- }
- queueEl.classList.add(LOADING_CLASS);
- return queueEl;
-}
-
-// Remove element in Container Queue
-export function removeLoadQueueElement(queueEl) {
- queueEl.classList.remove(LOADING_CLASS);
- queueEl.classList.add(FINISHED_CLASS);
-}
-
-// Remove all element Container Queue
-export function removeQueueElements(html) {
- const elementQueueContainer = getQueueContainer(html);
- const elements = [...elementQueueContainer.childNodes];
- if (elements.length === 0) { return; }
-
- elements.forEach((element) => {
- elementQueueContainer.removeChild(element);
- });
-
- elementQueueContainer.parentElement.style.display = 'none';
-}
-
-// Generate wld file
-export function createWLD(bbox, dpi, size, epsgUser) {
- const epsgWLD = epsgUser;
- const rotateX = 0;
- const rotateY = 0;
-
- if (epsgWLD) {
- const sizePixelX = ((bbox[2] - bbox[0]) / size[0]);
- const sizePixelY = ((bbox[3] - bbox[1]) / size[1]) * -1;
- const upperLeftX = bbox[0] + (sizePixelX / 2);
- const upperLeftY = bbox[3] + (sizePixelY / 2);
-
- return sizePixelX.toString().concat('\n', rotateX.toString(), '\n', rotateY.toString(), '\n', sizePixelY.toString(), '\n', upperLeftX.toString(), '\n', upperLeftY.toString());
- }
-
- const Px = (((bbox[2] - bbox[0]) / size[0]) * (72 / dpi)).toString();
- const GiroA = (0).toString();
- const GiroB = (0).toString();
- const Py = (-((bbox[3] - bbox[1]) / size[1]) * (72 / dpi)).toString();
- const Cx = (bbox[0] + (Px / 2)).toString();
- const Cy = (bbox[3] + (Py / 2)).toString();
- return Px.concat('\n', GiroA, '\n', GiroB, '\n', Py, '\n', Cx, '\n', Cy);
-}
-
-
-// Create jsZip file
-export function createZipFile(files, type, titulo) {
- const zip = new JsZip();
-
- files.forEach(({ name, data, base64 }) => {
- zip.file(name, data, { base64 });
- });
-
- zip.generateAsync({ type: 'blob' }).then((content) => {
- // see FileSaver.js
- saveAs(content, titulo.concat(type));
- });
-}
-
-// Generate title
-export function generateTitle(titulo = '') {
- if (titulo === '' || titulo === getValue('notitle')) {
- const f = new Date();
- return 'mapa_'.concat(f.getFullYear(), '-', f.getMonth() + 1, '-', f.getDay() + 1, '_', f.getHours(), f.getMinutes(), f.getSeconds());
- }
- return titulo;
-}
-
-// Get base64 image
-export function getBase64Image(imgUrl, format) {
- const formatType = format || 'jpeg';
- return new Promise((resolve, reject) => {
- const img = new Image();
- img.setAttribute('crossorigin', 'anonymous');
- img.src = imgUrl;
- img.onload = function can() {
- const canvas = document.createElement('canvas');
- canvas.width = img.width;
- canvas.height = img.height;
- const ctx = canvas.getContext('2d');
- ctx.drawImage(img, 0, 0);
- const dataURL = canvas.toDataURL(`image/${formatType}`, 1.0);
- resolve(dataURL.replace(REGEX_FORMAT_IMAGE, ''));
- };
-
- img.onerror = function rej() {
- Promise.reject(new Error(getValue('exception.loaderror')));
- M.dialog.error(getValue('exception.imageError'));
- };
- });
-}
-
-// Get base64 image client
-export function formatImageBase64(base64) {
- return base64.replace(REGEX_FORMAT_IMAGE, '');
-}
-
-// Services SIG Geoprint List
-export const LIST_SERVICES = `
-
- Fuentes disponibles
- ${getValue('layer_raster')}
-
- WMS: ${getValue('layer_wms')}
- WMTS: ${getValue('layer_wmts')}
- TMS: ${getValue('layer_tms')}
- XYZ: ${getValue('layer_xyz')}
-
- ${getValue('layer_vector')}
-
- GeoJSON: ${getValue('layer_geojson')}
- WFS: ${getValue('layer_wfs')}
- KML: ${getValue('layer_kml')}
- OGCAPIFeatures: ${getValue('layer_OGCAPIFeatures')}
-
- Más información: https://github.com/IGN-CNIG/API-CNIG/wiki/2.1.-Capas
-
-`;
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/encoders.js b/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/encoders.js
deleted file mode 100644
index 1e98e3766..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/encoders.js
+++ /dev/null
@@ -1,688 +0,0 @@
-import { getValue } from '../../../facade/js/i18n/language';
-
-const inflateCoordinates = (flatCoordinates, offset, end, stride, optCoordinates) => {
- const coordinates = optCoordinates !== undefined ? optCoordinates : [];
- let i = 0;
- for (let j = offset; j < end; j += stride) {
- // eslint-disable-next-line no-plusplus
- coordinates[i++] = flatCoordinates.slice(j, j + stride);
- }
- coordinates.length = i;
- return coordinates;
-};
-
-const inflateCoordinatesArray = (
- parseType, flatCoordinates,
- offset, ends, stride, optCoordinatess,
-) => {
- let coordinatess = optCoordinatess !== undefined ? optCoordinatess : [];
- let i = 0;
- // eslint-disable-next-line no-plusplus
- for (let j = 0, jj = ends.length; j < jj; ++j) {
- const end = ends[j];
- const arrtmp = inflateCoordinates(
- flatCoordinates,
- offset,
- end,
- stride,
- coordinatess[i],
- );
- if (parseType === 'point' || ((parseType === 'line' || parseType === 'linestring') && arrtmp.length >= 2) || (parseType === 'polygon' && arrtmp.length > 3)) {
- // eslint-disable-next-line no-plusplus
- coordinatess[i++] = arrtmp;
- }
- // eslint-disable-next-line no-param-reassign
- offset = end;
- }
- coordinatess.length = i;
- if ((parseType === 'line' || parseType === 'linestring') && coordinatess.length === 1) {
- // eslint-disable-next-line no-plusplus
- coordinatess = coordinatess[0];
- }
- return coordinatess;
-};
-
-
-export const encodeKML = (layer, facadeMap) => {
- let encodedLayer = null;
-
- const olLayer = layer.getImpl().getOL3Layer();
- const features = olLayer.getSource().getFeatures();
- const layerName = layer.name;
- const layerOpacity = olLayer.getOpacity();
- const geoJSONFormat = new ol.format.GeoJSON();
- let bbox = facadeMap.getBbox();
- bbox = [bbox.x.min, bbox.y.min, bbox.x.max, bbox.y.max];
- const resolution = facadeMap.getMapImpl().getView().getResolution();
-
- const encodedFeatures = [];
- let indexText = 1;
- let indexGeom = 1;
- let index = 1;
- let style = '';
- const stylesNames = {};
- const stylesNamesText = {};
- let nameFeature;
- let filter;
-
- features.forEach((feature) => {
- const geometry = feature.getGeometry();
- let styleId = feature.get('styleUrl');
- if (!M.utils.isNullOrEmpty(styleId)) {
- styleId = styleId.replace('#', '');
- }
- const styleFn = feature.getStyle();
- if (!M.utils.isNullOrEmpty(styleFn)) {
- let featureStyle;
- try {
- const resultStyle = styleFn(feature, resolution);
- featureStyle = Array.isArray(resultStyle) ? resultStyle[0] : resultStyle;
- } catch (e) {
- featureStyle = styleFn.call(feature, resolution)[0];
- }
- if (!M.utils.isNullOrEmpty(featureStyle)) {
- const img = featureStyle.getImage();
- let imgSize = img.getImageSize();
- if (M.utils.isNullOrEmpty(imgSize)) {
- imgSize = [64, 64];
- }
-
- let parseType;
- if (feature.getGeometry().getType().toLowerCase() === 'multipolygon') {
- parseType = 'polygon';
- } else if (feature.getGeometry().getType().toLowerCase() === 'multipoint') {
- parseType = 'point';
- } else {
- parseType = feature.getGeometry().getType().toLowerCase();
- }
-
- const stroke = featureStyle.getStroke();
- let styleText;
- const styleGeom = {
- id: styleId,
- externalGraphic: img.getSrc(),
- graphicHeight: imgSize[0],
- graphicWidth: imgSize[1],
- graphicOpacity: img.getOpacity(),
- strokeWidth: stroke ? stroke.getWidth() : undefined,
- type: parseType,
- };
- const text = (featureStyle.getText && featureStyle.getText());
- if (!M.utils.isNullOrEmpty(text)) {
- styleText = {
- conflictResolution: 'false',
- fontColor: M.utils.isNullOrEmpty(text.getFill()) ? '' : M.utils.rgbToHex(M.utils.isArray(text.getFill().getColor()) ?
- `rgba(${text.getFill().getColor().toString()})` :
- text.getFill().getColor()),
- fontSize: '11px',
- fontFamily: 'Helvetica, sans-serif',
- fontWeight: 'bold',
- label: M.utils.isNullOrEmpty(text.getText()) ? feature.get('name') : text.getText(),
- labelAlign: text.getTextAlign(),
- labelXOffset: text.getOffsetX(),
- labelYOffset: text.getOffsetY(),
- labelOutlineColor: M.utils.isNullOrEmpty(text.getStroke()) ? '' : M.utils.rgbToHex(M.utils.isArray(text.getStroke().getColor()) ?
- `rgba(${text.getStroke().getColor().toString()})` :
- text.getStroke().getColor()),
- labelOutlineWidth: M.utils.isNullOrEmpty(text.getStroke()) ? '' : text.getStroke().getWidth(),
- type: 'text',
- };
- styleText.fontColor = styleText.fontColor.slice(0, 7);
- styleText.labelOutlineColor = styleText.labelOutlineColor.slice(0, 7);
- }
-
- nameFeature = `draw${index}`;
-
- if ((!M.utils.isNullOrEmpty(geometry) && geometry.intersectsExtent(bbox)) &&
- !M.utils.isNullOrEmpty(text)) {
- const styleStr = JSON.stringify(styleGeom);
- const styleTextStr = JSON.stringify(styleText);
- let styleName = stylesNames[styleStr];
- let styleNameText = stylesNamesText[styleTextStr];
-
- if (M.utils.isUndefined(styleName) || M.utils.isUndefined(styleNameText)) {
- const symbolizers = [];
- let flag = 0;
- if (!M.utils.isNullOrEmpty(geometry) && geometry.intersectsExtent(bbox) &&
- M.utils.isUndefined(styleName)) {
- styleName = indexGeom;
- stylesNames[styleStr] = styleName;
- flag = 1;
- symbolizers.push(styleStr);
- indexGeom += 1;
- index += 1;
- }
- if (!M.utils.isNullOrEmpty(text) && M.utils.isUndefined(styleNameText)) {
- styleNameText = indexText;
- stylesNamesText[styleTextStr] = styleNameText;
- symbolizers.push(styleTextStr);
- indexText += 1;
- if (flag === 0) {
- index += 1;
- symbolizers.push(styleStr);
- }
- }
-
- if (styleName === undefined) {
- styleName = 0;
- }
- if (styleNameText === undefined) {
- styleNameText = 0;
- }
-
- filter = `"[_gx_style ='${styleName + styleNameText}']"`;
-
- if (!M.utils.isNullOrEmpty(symbolizers)) {
- const a = `${filter}: {"symbolizers": [${symbolizers}]}`;
- if (style !== '') {
- style += `,${a}`;
- } else {
- style += `{${a}, "version": "2"`;
- }
- }
- }
-
- const geoJSONFeature = geoJSONFormat.writeFeatureObject(feature);
- geoJSONFeature.properties = {
- name: nameFeature,
- _gx_style: styleName + styleNameText,
- };
- encodedFeatures.push(geoJSONFeature);
- }
- }
- }
- });
-
- if (style !== '') {
- style = JSON.parse(style.concat('}'));
- } else {
- style = {
- '*': {
- symbolizers: [],
- },
- version: '2',
- };
- }
-
- encodedLayer = {
- type: 'Vector',
- style,
- geoJson: {
- type: 'FeatureCollection',
- features: encodedFeatures,
- },
- name: layerName,
- opacity: layerOpacity,
- };
-
- return encodedLayer;
-};
-
-export const encodeWMS = (layer) => {
- let encodedLayer = null;
- const olLayer = layer.getImpl().getOL3Layer();
- const layerUrl = layer.url;
- const layerOpacity = olLayer.getOpacity();
- const params = olLayer.getSource().getParams();
- const paramsLayers = [params.LAYERS];
- // const paramsFormat = params.FORMAT;
- const paramsStyles = [params.STYLES];
- encodedLayer = {
- baseURL: layerUrl,
- opacity: layerOpacity,
- type: 'WMS',
- layers: paramsLayers.join(',').split(','),
- // format: paramsFormat || 'image/jpeg',
- styles: paramsStyles.join(',').split(','),
- };
-
- /** ***********************************
- MAPEO DE CAPAS TILEADA.
- ************************************ */
- // eslint-disable-next-line no-underscore-dangle
- if (layer._updateNoCache) {
- // eslint-disable-next-line no-underscore-dangle
- layer._updateNoCache();
- const noCacheName = layer.getNoCacheName();
- const noChacheUrl = layer.getNoCacheUrl();
- if (!M.utils.isNullOrEmpty(noCacheName) && !M.utils.isNullOrEmpty(noChacheUrl)) {
- encodedLayer.layers = [noCacheName];
- encodedLayer.baseURL = noChacheUrl;
- }
- } else {
- const noCacheName = layer.getNoChacheName();
- const noCacheUrl = layer.getNoChacheUrl();
- if (!M.utils.isNullOrEmpty(noCacheName) && !M.utils.isNullOrEmpty(noCacheUrl)) {
- encodedLayer.layers = [noCacheName];
- encodedLayer.baseURL = noCacheUrl;
- }
- }
-
- /** ********************************* */
-
- // defaults
- encodedLayer.customParams = {
- // service: 'WMS',
- // version: '1.1.1',
- // request: 'GetMap',
- // styles: '',
- // format: 'image/jpeg',
- };
-
- const propKeys = Object.keys(params);
- propKeys.forEach((key) => {
- if ('iswmc,transparent'.indexOf(key.toLowerCase()) !== -1) {
- encodedLayer.customParams[key] = params[key];
- }
- });
- return encodedLayer;
-};
-
-export const encodeImage = (layer) => {
- let encodedLayer = null;
- const olLayer = layer;
- const params = olLayer.getSource().getParams();
- const paramsLayers = [params.LAYERS];
- const paramsStyles = [params.STYLES];
- encodedLayer = {
- baseURL: olLayer.getSource().getUrl(),
- opacity: olLayer.getOpacity(),
- type: 'WMS',
- layers: paramsLayers.join(',').split(','),
- // format: params.FORMAT || 'image/jpeg',
- styles: paramsStyles.join(',').split(','),
- };
-
- encodedLayer.customParams = {
- IMAGEN: params.IMAGEN,
- transparent: true,
- iswmc: false,
- };
-
- return encodedLayer;
-};
-
-export const encodeXYZ = (layer) => {
- const layerImpl = layer.getImpl();
- const olLayer = layerImpl.getOL3Layer();
- const layerSource = olLayer.getSource();
- const tileGrid = layerSource.getTileGrid();
- let layerUrl = layer.url;
- const layerOpacity = olLayer.getOpacity();
- const layerExtent = tileGrid.getExtent();
- const tileSize = tileGrid.getTileSize();
- const resolutions = tileGrid.getResolutions();
-
- if (layer.type === M.layer.type.OSM) {
- layerUrl = layer.url || 'http://tile.openstreetmap.org/';
- }
-
- return {
- opacity: layerOpacity,
- baseURL: layerUrl,
- maxExtent: layerExtent,
- tileSize: [tileSize, tileSize],
- resolutions,
- type: 'osm',
- };
-};
-
-export const encodeWMTS = (layer) => {
- const layerImpl = layer.getImpl();
- const olLayer = layerImpl.getOL3Layer();
- const layerSource = olLayer.getSource();
-
- const layerUrl = layer.url;
- const layerName = layer.name;
- const layerOpacity = olLayer.getOpacity();
- const layerReqEncoding = layerSource.getRequestEncoding();
- const matrixSet = layer.matrixSet;
-
- /**
- * @see http: //www.mapfish.org/doc/print/protocol.html#layers-params
- */
- return layer.getImpl().getCapabilities().then((capabilities) => {
- const matrixIdsObj = capabilities.Contents.TileMatrixSet.filter((tileMatrixSet) => {
- return (tileMatrixSet.Identifier === matrixSet);
- })[0];
-
- try {
- return {
- baseURL: layerUrl,
- imageFormat: layer.options.imageFormat || layer.options.format || 'image/png',
- layer: layerName,
- matrices: matrixIdsObj.TileMatrix.map((tileMatrix, i) => {
- return {
- identifier: tileMatrix.Identifier,
- matrixSize: [tileMatrix.MatrixHeight, tileMatrix.MatrixWidth],
- scaleDenominator: tileMatrix.ScaleDenominator,
- tileSize: [tileMatrix.TileWidth, tileMatrix.TileHeight],
- topLeftCorner: tileMatrix.TopLeftCorner,
- };
- }),
- matrixSet,
- opacity: layerOpacity,
- requestEncoding: layerReqEncoding,
- style: layer.getImpl().getOL3Layer().getSource().getStyle() || 'default',
- type: 'WMTS',
- version: '1.3.0',
- };
- } catch (e) {
- M.toast.error(getValue('errorProjectionCapabilities'), 6000);
- return null;
- }
- });
-};
-
-export const encodeMVT = (layer, facadeMap) => {
- let encodedLayer = null;
- // const projection = facadeMap.getProjection();
- const features = layer.getFeatures();
- const layerName = layer.name;
- const layerOpacity = layer.getOpacity();
- const layerStyle = layer.getImpl().getOL3Layer().getStyle();
- let bbox = facadeMap.getBbox();
- bbox = [bbox.x.min, bbox.y.min, bbox.x.max, bbox.y.max];
- const resolution = facadeMap.getMapImpl().getView().getResolution();
- const encodedFeatures = [];
- let nameFeature;
- let filter;
- let index = 1;
- let indexText = 1;
- let indexGeom = 1;
- let style = '';
- const stylesNames = {};
- const stylesNamesText = {};
- features.forEach((feature) => {
- const geometry = feature.getImpl().getOLFeature().getGeometry();
- let featureStyle;
- const fStyle = feature.getImpl().getOLFeature().getStyleFunction();
- if (!M.utils.isNullOrEmpty(fStyle)) {
- featureStyle = fStyle;
- } else if (!M.utils.isNullOrEmpty(layerStyle)) {
- featureStyle = layerStyle;
- }
-
- if (featureStyle instanceof Function) {
- featureStyle =
- featureStyle.call(featureStyle, feature.getImpl().getOLFeature(), resolution);
- }
-
- if (featureStyle instanceof Array) {
- // SRC style has priority
- if (featureStyle.length > 1) {
- featureStyle = (!M.utils.isNullOrEmpty(featureStyle[1].getImage()) &&
- featureStyle[1].getImage().getSrc) ?
- featureStyle[1] : featureStyle[0];
- } else {
- featureStyle = featureStyle[0];
- }
- }
-
- if (!M.utils.isNullOrEmpty(featureStyle)) {
- const image = featureStyle.getImage();
- const imgSize = M.utils
- .isNullOrEmpty(image) ? [0, 0] : (image.getImageSize() || [24, 24]);
- let text = featureStyle.getText();
- if (M.utils.isNullOrEmpty(text) && !M.utils.isNullOrEmpty(featureStyle.textPath)) {
- text = featureStyle.textPath;
- }
-
- let parseType;
- if (geometry.getType().toLowerCase() === 'multipolygon') {
- parseType = 'polygon';
- } else if (geometry.getType().toLowerCase() === 'multipoint') {
- parseType = 'point';
- } else if (geometry.getType().toLowerCase().indexOf('linestring') > -1) {
- parseType = 'line';
- } else {
- parseType = geometry.getType().toLowerCase();
- }
-
- const stroke = M.utils.isNullOrEmpty(image) ?
- featureStyle.getStroke() : (image.getStroke && image.getStroke());
- const fill = M.utils.isNullOrEmpty(image) ?
- featureStyle.getFill() : (image.getFill && image.getFill());
-
-
- let styleText;
- const lineDash = (featureStyle.getStroke() !== null &&
- featureStyle.getStroke() !== undefined) ?
- featureStyle.getStroke().getLineDash() : undefined;
- const styleGeom = {
- type: parseType,
- fillColor: M.utils.isNullOrEmpty(fill) || (layer.name.indexOf(' Reverse') > -1 && layer.name.indexOf('Cobertura') > -1) ? '#000000' : M.utils.rgbaToHex(fill.getColor()).slice(0, 7),
- fillOpacity: M.utils.isNullOrEmpty(fill) ?
- 0 : M.utils.getOpacityFromRgba(fill.getColor()),
- strokeColor: M.utils.isNullOrEmpty(stroke) ? '#000000' : M.utils.rgbaToHex(stroke.getColor()),
- strokeOpacity: M.utils.isNullOrEmpty(stroke) ?
- 0 : M.utils.getOpacityFromRgba(stroke.getColor()),
- strokeWidth: M.utils.isNullOrEmpty(stroke) ? 0 : (stroke.getWidth && stroke.getWidth()),
- pointRadius: M.utils.isNullOrEmpty(image) ? '' : (image.getRadius && image.getRadius()),
- externalGraphic: M.utils.isNullOrEmpty(image) ? '' : (image.getSrc && image.getSrc()),
- graphicHeight: imgSize[0],
- graphicWidth: imgSize[1],
- strokeLinecap: 'round',
- };
-
- if (layer.name === 'coordinateresult') {
- styleGeom.fillOpacity = 1;
- styleGeom.strokeOpacity = 1;
- styleGeom.fillColor = '#ffffff';
- styleGeom.strokeColor = '#ff0000';
- styleGeom.strokeWidth = 2;
- }
-
- if (layer.name === 'infocoordinatesLayerFeatures') {
- styleGeom.fillColor = '#ffffff';
- styleGeom.fillOpacity = 1;
- styleGeom.strokeWidth = 1;
- styleGeom.strokeColor = '#2690e7';
- styleGeom.strokeOpacity = 1;
- styleGeom.graphicName = 'cross';
- styleGeom.graphicWidth = 15;
- styleGeom.graphicHeight = 15;
- }
-
- if (layer.name.indexOf(' Reverse') > -1 && layer.name.indexOf('Cobertura') > -1) {
- styleGeom.fillColor = styleGeom.strokeColor;
- styleGeom.fillOpacity = 0.5;
- }
-
- if (lineDash !== undefined && lineDash !== null && lineDash.length > 0) {
- if (lineDash[0] === 1 && lineDash.length === 2) {
- styleGeom.strokeDashstyle = 'dot';
- } else if (lineDash[0] === 10) {
- styleGeom.strokeDashstyle = 'dash';
- } else if (lineDash[0] === 1 && lineDash.length > 2) {
- styleGeom.strokeDashstyle = 'dashdot';
- }
- }
-
- if (!M.utils.isNullOrEmpty(text)) {
- let tAlign = text.getTextAlign();
- let tBLine = text.getTextBaseline();
- let align = '';
- if (!M.utils.isNullOrEmpty(tAlign)) {
- if (tAlign === M.style.align.LEFT) {
- tAlign = 'l';
- } else if (tAlign === M.style.align.RIGHT) {
- tAlign = 'r';
- } else if (tAlign === M.style.align.CENTER) {
- tAlign = 'c';
- } else {
- tAlign = '';
- }
- }
- if (!M.utils.isNullOrEmpty(tBLine)) {
- if (tBLine === M.style.baseline.BOTTOM) {
- tBLine = 'b';
- } else if (tBLine === M.style.baseline.MIDDLE) {
- tBLine = 'm';
- } else if (tBLine === M.style.baseline.TOP) {
- tBLine = 't';
- } else {
- tBLine = '';
- }
- }
- if (!M.utils.isNullOrEmpty(tAlign) && !M.utils.isNullOrEmpty(tBLine)) {
- align = tAlign.concat(tBLine);
- }
- const font = text.getFont();
- const fontWeight = !M.utils.isNullOrEmpty(font) && font.indexOf('bold') > -1 ? 'bold' : 'normal';
- let fontSize = '11px';
- if (!M.utils.isNullOrEmpty(font)) {
- const px = font.substr(0, font.indexOf('px'));
- if (!M.utils.isNullOrEmpty(px)) {
- const space = px.lastIndexOf(' ');
- if (space > -1) {
- fontSize = px.substr(space, px.length).trim().concat('px');
- } else {
- fontSize = px.concat('px');
- }
- }
- }
-
- styleText = {
- type: 'text',
- label: text.getText(),
- fontColor: M.utils.isNullOrEmpty(text.getFill()) ? '#000000' : M.utils.rgbToHex(text.getFill().getColor()),
- fontSize,
- fontFamily: 'Helvetica, sans-serif',
- fontStyle: 'normal',
- fontWeight,
- conflictResolution: 'false',
- labelXOffset: text.getOffsetX(),
- labelYOffset: text.getOffsetY(),
- fillColor: styleGeom.fillColor || '#FF0000',
- fillOpacity: styleGeom.fillOpacity || 1,
- labelOutlineColor: M.utils.isNullOrEmpty(text.getStroke()) ? '' : M.utils.rgbToHex(text.getStroke().getColor() || '#FF0000'),
- labelOutlineWidth: M.utils.isNullOrEmpty(text.getStroke()) ? '' : text.getStroke().getWidth(),
- labelAlign: align,
- };
- } else if (layer.name === 'infocoordinatesLayerFeatures') {
- text = true;
- styleText = {
- type: 'text',
- conflictResolution: 'false',
- fontFamily: 'Helvetica, sans-serif',
- fontStyle: 'normal',
- fontColor: '#ffffff',
- fontSize: '12px',
- label: `${feature.getId()}`,
- labelAlign: 'lb',
- labelXOffset: '4',
- labelYOffset: '3',
- haloColor: '#2690e7',
- haloRadius: '1',
- haloOpacity: '1',
- };
- }
-
- nameFeature = `draw${index}`;
- const extent = geometry.getExtent();
- if ((!M.utils.isNullOrEmpty(geometry) && ol.extent.intersects(bbox, extent)) ||
- !M.utils.isNullOrEmpty(text)) {
- const styleStr = JSON.stringify(styleGeom);
- const styleTextStr = JSON.stringify(styleText);
- let styleName = stylesNames[styleStr];
- let styleNameText = stylesNamesText[styleTextStr];
-
- if (M.utils.isUndefined(styleName) || M.utils.isUndefined(styleNameText)) {
- const symbolizers = [];
- let flag = 0;
- if (!M.utils.isNullOrEmpty(geometry) && ol.extent.intersects(bbox, extent) &&
- M.utils.isUndefined(styleName)) {
- styleName = indexGeom;
- stylesNames[styleStr] = styleName;
- flag = 1;
- symbolizers.push(styleStr);
- indexGeom += 1;
- index += 1;
- }
- if (!M.utils.isNullOrEmpty(text) && M.utils.isUndefined(styleNameText)) {
- styleNameText = indexText;
- stylesNamesText[styleTextStr] = styleNameText;
- symbolizers.push(styleTextStr);
- indexText += 1;
- if (flag === 0) {
- index += 1;
- symbolizers.push(styleStr);
- }
- }
- if (styleName === undefined) {
- styleName = 0;
- }
- if (styleNameText === undefined) {
- styleNameText = 0;
- }
- filter = `"[_gx_style ='${styleName + styleNameText}']"`;
- if (!M.utils.isNullOrEmpty(symbolizers)) {
- const a = `${filter}: {"symbolizers": [${symbolizers}]}`;
- if (style !== '') {
- style += `,${a}`;
- } else {
- style += `{${a},"version":"2"`;
- }
- }
- }
-
- let coordinates = geometry.getFlatCoordinates();
- coordinates =
- inflateCoordinatesArray(parseType, coordinates.slice(), 0, geometry.getEnds(), 2);
- if (coordinates.length > 0) {
- const geoJSONFeature = {
- id: feature.getId(),
- type: 'Feature',
- geometry: {
- type: geometry.getType(),
- coordinates,
- },
- };
- geoJSONFeature.properties = {
- _gx_style: styleName + styleNameText,
- name: nameFeature,
- };
- encodedFeatures.push(geoJSONFeature);
- }
-
- /*
- if (projection.code !== 'EPSG:3857' && this.facadeMap_.getLayers().some(layerParam =>
- (layerParam.type === M.layer.type.OSM || layerParam.type === M.layer.type.Mapbox))) {
- geoJSONFeature = geoJSONFormat.writeFeatureObject(feature.getImpl().getOLFeature(), {
- featureProjection: projection.code,
- dataProjection: 'EPSG:3857',
- });
- } else {
- geoJSONFeature = geoJSONFormat.writeFeatureObject(feature.getImpl().getOLFeature());
- }
- */
- }
- }
- });
-
- if (style !== '') {
- style = JSON.parse(style.concat('}'));
- } else {
- style = {
- '*': {
- symbolizers: [],
- },
- version: '2',
- };
- }
-
- encodedLayer = {
- type: 'Vector',
- style,
- // styleProperty: '_gx_style',
- geoJson: {
- type: 'FeatureCollection',
- features: encodedFeatures,
- },
- name: layerName,
- opacity: layerOpacity,
- };
-
- return encodedLayer;
-};
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/georefimagecontrol.js b/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/georefimagecontrol.js
deleted file mode 100644
index 4cad3bae3..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/georefimagecontrol.js
+++ /dev/null
@@ -1,460 +0,0 @@
-/**
- * @module M/impl/control/GeorefimageControl
- */
-
-import { encodeKML, encodeWMS, encodeImage, encodeXYZ, encodeWMTS, encodeMVT } from './encoders';
-
-export default class GeorefimageControl extends M.impl.Control {
- /**
- * @classdesc
- * Main constructor of the measure conrol.
- *
- * @constructor
- * @extends {ol.control.Control}
- * @api stable
- */
- constructor(map) {
- super();
- /**
- * Facade of the map
- * @private
- * @type {M.Map}
- */
- this.facadeMap_ = map;
- }
-
- /**
- * This function adds the control to the specified map
- *
- * @public
- * @function
- * @param {M.Map} map to add the plugin
- * @param {function} template template of this control
- * @api stable
- */
- addTo(map, element) {
- this.facadeMap_ = map;
-
- ol.control.Control.call(this, {
- element,
- target: null,
- });
- map.getMapImpl().addControl(this);
- }
-
- /**
- * This function encodes a layer.
- * Esta función codifica una capa, se usa tanto en el control de
- * georreferenciación como en el de georreferenciación de imagen
- *
- * @public
- * @function
- * @param {Layer} layer to encode
- * @api stable
- */
- getParametrizedLayers(facadeMap, paramName, layers) {
- let others = facadeMap.getMapImpl().getLayers().getArray().filter((layer) => {
- return !M.utils.isNullOrEmpty(layer.getSource()) &&
- // eslint-disable-next-line no-underscore-dangle
- !M.utils.isNullOrEmpty(layer.getSource().params_) &&
- layer.getSource().getParams()[paramName] !== undefined;
- });
-
- others = others.filter((layer) => {
- return !(layers.some((l) => {
- return l.url !== undefined && l.url === layer.getSource().getUrl();
- }));
- });
-
- return others;
- }
- /**
- * This function encodes a layer.
- *
- * @public
- * @function
- * @param {Layer} layer to encode
- * @api stable
- */
- encodeLayer(layer) {
- return (new Promise((success, fail) => {
- if (layer.type === M.layer.type.MVT) {
- success(encodeMVT(layer, this.facadeMap_));
- } else if (layer.type === M.layer.type.KML &&
- // eslint-disable-next-line no-underscore-dangle
- layer.getImpl().formater_.extractStyles_ !== false) {
- success(encodeKML(layer, this.facadeMap_));
- } else if (layer.type === M.layer.type.KML &&
- // eslint-disable-next-line no-underscore-dangle
- layer.getImpl().formater_.extractStyles_ === false) {
- success(this.encodeWFS(layer));
- } else if (layer.type === M.layer.type.WMS) {
- success(encodeWMS(layer));
- } else if (layer.type === M.layer.type.WFS) {
- success(this.encodeWFS(layer));
- } else if (layer.type === M.layer.type.GeoJSON) {
- success(this.encodeWFS(layer));
- } else if (layer.type === M.layer.type.WMTS) {
- encodeWMTS(layer).then((encodedLayer) => {
- success(encodedLayer);
- });
- } else if (M.utils.isNullOrEmpty(layer.type) && layer instanceof M.layer.Vector) {
- success(this.encodeWFS(layer));
- // eslint-disable-next-line no-underscore-dangle
- } else if (layer.type === undefined && layer.className_ === 'ol-layer') {
- success(encodeImage(layer));
- } else if ([M.layer.type.XYZ, M.layer.type.TMS, M.layer.type.OSM].indexOf(layer.type) >
- -1) {
- success(encodeXYZ(layer));
- } else {
- success(this.encodeWFS(layer));
- }
- }));
- }
-
- /**
- * This function adds the control to the specified map
- *
- * @public
- * @function
- * @param {M.Map} map to add the plugin
- * @param {function} template template of this control
- * @api stable
- */
- encodeWFS(layer) {
- let encodedLayer = null;
- const continuePrint = true;
- if (continuePrint) {
- const projection = this.facadeMap_.getProjection();
- const olLayer = layer.getImpl().getOL3Layer();
- const features = olLayer.getSource().getFeatures();
- const layerName = layer.name;
- const layerOpacity = olLayer.getOpacity();
- const layerStyle = olLayer.getStyle();
- const geoJSONFormat = new ol.format.GeoJSON();
- let bbox = this.facadeMap_.getBbox();
- bbox = [bbox.x.min, bbox.y.min, bbox.x.max, bbox.y.max];
- const resolution = this.facadeMap_.getMapImpl().getView().getResolution();
-
- const encodedFeatures = [];
- let nameFeature;
- let filter;
- let index = 1;
- let indexText = 1;
- let indexGeom = 1;
- let style = '';
- const stylesNames = {};
- const stylesNamesText = {};
- features.forEach((feature) => {
- const geometry = feature.getGeometry();
- let featureStyle;
- const fStyle = feature.getStyle();
-
- if (!M.utils.isNullOrEmpty(fStyle)) {
- featureStyle = fStyle;
- } else if (!M.utils.isNullOrEmpty(layerStyle)) {
- featureStyle = layerStyle;
- }
-
- if (featureStyle instanceof Function) {
- featureStyle = featureStyle.call(featureStyle, feature, resolution);
- }
-
- if (featureStyle instanceof Array) {
- // SRC style has priority
- if (featureStyle.length > 1) {
- featureStyle = (!M.utils.isNullOrEmpty(featureStyle[1].getImage()) &&
- featureStyle[1].getImage().getSrc) ?
- featureStyle[1] : featureStyle[0];
- } else {
- featureStyle = featureStyle[0];
- }
- }
-
- if (!M.utils.isNullOrEmpty(featureStyle)) {
- const image = featureStyle.getImage();
- const imgSize = M.utils
- .isNullOrEmpty(image) ? [0, 0] : (image.getImageSize() || [24, 24]);
- let text = featureStyle.getText();
- if (M.utils.isNullOrEmpty(text) && !M.utils.isNullOrEmpty(featureStyle.textPath)) {
- text = featureStyle.textPath;
- }
-
- let parseType;
- if (feature.getGeometry().getType().toLowerCase() === 'multipolygon') {
- parseType = 'polygon';
- } else if (feature.getGeometry().getType().toLowerCase() === 'multipoint') {
- parseType = 'point';
- } else if (feature.getGeometry().getType().toLowerCase().indexOf('linestring') > -1) {
- parseType = 'line';
- } else {
- parseType = feature.getGeometry().getType().toLowerCase();
- }
-
- const stroke = M.utils.isNullOrEmpty(image) ?
- featureStyle.getStroke() : (image.getStroke && image.getStroke());
- const fill = M.utils.isNullOrEmpty(image) ?
- featureStyle.getFill() : (image.getFill && image.getFill());
-
-
- let styleText;
- const styleGeom = {
- type: parseType,
- fillColor: M.utils.isNullOrEmpty(fill) ? '#000000' : M.utils.rgbaToHex(fill.getColor()).slice(0, 7),
- fillOpacity: M.utils.isNullOrEmpty(fill) ?
- 0 : M.utils.getOpacityFromRgba(fill.getColor()),
- strokeColor: M.utils.isNullOrEmpty(stroke) ? '#000000' : M.utils.rgbaToHex(stroke.getColor()),
- strokeOpacity: M.utils.isNullOrEmpty(stroke) ?
- 0 : M.utils.getOpacityFromRgba(stroke.getColor()),
- strokeWidth: M.utils.isNullOrEmpty(stroke) ? 0 : (stroke.getWidth && stroke.getWidth()),
- pointRadius: M.utils.isNullOrEmpty(image) ? '' : (image.getRadius && image.getRadius()),
- externalGraphic: M.utils.isNullOrEmpty(image) ? '' : (image.getSrc && image.getSrc()),
- graphicHeight: imgSize[0],
- graphicWidth: imgSize[1],
- };
- if (!M.utils.isNullOrEmpty(text)) {
- let tAlign = text.getTextAlign();
- let tBLine = text.getTextBaseline();
- let align = '';
- if (!M.utils.isNullOrEmpty(tAlign)) {
- if (tAlign === M.style.align.LEFT) {
- tAlign = 'l';
- } else if (tAlign === M.style.align.RIGHT) {
- tAlign = 'r';
- } else if (tAlign === M.style.align.CENTER) {
- tAlign = 'c';
- } else {
- tAlign = '';
- }
- }
- if (!M.utils.isNullOrEmpty(tBLine)) {
- if (tBLine === M.style.baseline.BOTTOM) {
- tBLine = 'b';
- } else if (tBLine === M.style.baseline.MIDDLE) {
- tBLine = 'm';
- } else if (tBLine === M.style.baseline.TOP) {
- tBLine = 't';
- } else {
- tBLine = '';
- }
- }
- if (!M.utils.isNullOrEmpty(tAlign) && !M.utils.isNullOrEmpty(tBLine)) {
- align = tAlign.concat(tBLine);
- }
- const font = text.getFont();
- const fontWeight = !M.utils.isNullOrEmpty(font) && font.indexOf('bold') > -1 ? 'bold' : 'normal';
- let fontSize = '11px';
- if (!M.utils.isNullOrEmpty(font)) {
- const px = font.substr(0, font.indexOf('px'));
- if (!M.utils.isNullOrEmpty(px)) {
- const space = px.lastIndexOf(' ');
- if (space > -1) {
- fontSize = px.substr(space, px.length).trim().concat('px');
- } else {
- fontSize = px.concat('px');
- }
- }
- }
- styleText = {
- type: 'text',
- label: text.getText(),
- fontColor: M.utils.isNullOrEmpty(text.getFill()) ? '#000000' : M.utils.rgbToHex(text.getFill().getColor()),
- fontSize,
- fontFamily: 'Helvetica, sans-serif',
- fontStyle: 'normal',
- fontWeight,
- conflictResolution: 'false',
- labelXOffset: text.getOffsetX(),
- labelYOffset: text.getOffsetY(),
- fillColor: styleGeom.fillColor || '#FF0000',
- fillOpacity: styleGeom.fillOpacity || 1,
- labelOutlineColor: M.utils.isNullOrEmpty(text.getStroke()) ? '' : M.utils.rgbToHex(text.getStroke().getColor() || '#FF0000'),
- labelOutlineWidth: M.utils.isNullOrEmpty(text.getStroke()) ? '' : text.getStroke().getWidth(),
- labelAlign: align,
- };
- }
-
- nameFeature = `draw${index}`;
-
- if ((!M.utils.isNullOrEmpty(geometry) && geometry.intersectsExtent(bbox)) ||
- !M.utils.isNullOrEmpty(text)) {
- const styleStr = JSON.stringify(styleGeom);
- const styleTextStr = JSON.stringify(styleText);
- let styleName = stylesNames[styleStr];
- let styleNameText = stylesNamesText[styleTextStr];
-
- if (M.utils.isUndefined(styleName) || M.utils.isUndefined(styleNameText)) {
- const symbolizers = [];
- let flag = 0;
- if (!M.utils.isNullOrEmpty(geometry) && geometry.intersectsExtent(bbox) &&
- M.utils.isUndefined(styleName)) {
- styleName = indexGeom;
- stylesNames[styleStr] = styleName;
- flag = 1;
- symbolizers.push(styleStr);
- indexGeom += 1;
- index += 1;
- }
- if (!M.utils.isNullOrEmpty(text) && M.utils.isUndefined(styleNameText)) {
- styleNameText = indexText;
- stylesNamesText[styleTextStr] = styleNameText;
- symbolizers.push(styleTextStr);
- indexText += 1;
- if (flag === 0) {
- index += 1;
- symbolizers.push(styleStr);
- }
- }
- if (styleName === undefined) {
- styleName = 0;
- }
- if (styleNameText === undefined) {
- styleNameText = 0;
- }
- filter = `"[_gx_style ='${styleName + styleNameText}']"`;
- if (!M.utils.isNullOrEmpty(symbolizers)) {
- const a = `${filter}: {"symbolizers": [${symbolizers}]}`;
- if (style !== '') {
- style += `,${a}`;
- } else {
- style += `{${a},"version":"2"`;
- }
- }
- }
-
- let geoJSONFeature;
- if (projection.code !== 'EPSG:3857' && this.facadeMap_.getLayers().some(layerParam => (layerParam.type === M.layer.type.OSM || layerParam.type === M.layer.type.Mapbox))) {
- geoJSONFeature = geoJSONFormat.writeFeatureObject(feature, {
- featureProjection: projection.code,
- dataProjection: 'EPSG:3857',
- });
- } else {
- geoJSONFeature = geoJSONFormat.writeFeatureObject(feature);
- }
- geoJSONFeature.properties = {
- _gx_style: styleName + styleNameText,
- name: nameFeature,
- };
- encodedFeatures.push(geoJSONFeature);
- }
- }
- }, this);
-
- if (style !== '') {
- style = JSON.parse(style.concat('}'));
- } else {
- style = {
- '*': {
- symbolizers: [],
- },
- version: '2',
- };
- }
-
- encodedLayer = {
- type: 'Vector',
- style,
- geoJson: {
- type: 'FeatureCollection',
- features: encodedFeatures,
- },
- name: layerName,
- opacity: layerOpacity,
- };
- }
- return encodedLayer;
- }
-
- /**
- * This function
- *
- * @public
- * @function
- * @param {M.Map} map to add the plugin
- * @param {function} template template of this control
- * @api stable
- */
- encodeOSM(layer) {
- let encodedLayer = null;
-
- const layerImpl = layer.getImpl();
- const olLayer = layerImpl.getOL3Layer();
- const layerSource = olLayer.getSource();
- const tileGrid = layerSource.getTileGrid();
-
- const layerUrl = layer.url || 'http://tile.openstreetmap.org/';
- const layerName = layer.name;
- const layerOpacity = olLayer.getOpacity();
- const tiled = layerImpl.tiled;
- const layerExtent = tileGrid.getExtent();
- const tileSize = tileGrid.getTileSize();
- const resolutions = tileGrid.getResolutions();
- encodedLayer = {
- baseURL: layerUrl,
- opacity: layerOpacity,
- singleTile: !tiled,
- layer: layerName,
- maxExtent: layerExtent,
- tileSize: [tileSize, tileSize],
- resolutions,
- type: 'OSM',
- extension: 'png',
- };
- return encodedLayer;
- }
-
- /**
- * This function adds the control to the specified map
- *
- * @public
- * @function
- * @param {M.Map} map to add the plugin
- * @param {function} template template of this control
- * @api stable
- */
- encodeMapbox(layer) {
- let encodedLayer = null;
-
- const layerImpl = layer.getImpl();
- const olLayer = layerImpl.getOL3Layer();
- const layerSource = olLayer.getSource();
- const tileGrid = layerSource.getTileGrid();
-
- const layerUrl = M.utils.concatUrlPaths([M.config.MAPBOX_URL, layer.name]);
- const layerOpacity = olLayer.getOpacity();
- const layerExtent = tileGrid.getExtent();
-
- const tileSize = tileGrid.getTileSize();
- const resolutions = tileGrid.getResolutions();
-
-
- const customParams = {};
- customParams[M.config.MAPBOX_TOKEN_NAME] = M.config.MAPBOX_TOKEN_VALUE;
- encodedLayer = {
- opacity: layerOpacity,
- baseURL: layerUrl,
- customParams,
- maxExtent: layerExtent,
- tileSize: [tileSize, tileSize],
- resolutions,
- extension: M.config.MAPBOX_EXTENSION,
- type: 'xyz',
- path_format: '/${z}/${x}/${y}.png',
- };
-
- return encodedLayer;
- }
-
- /**
- * This function destroys this control, clearing the HTML
- * and unregistering all events
- *
- * @public
- * @function
- * @api stable
- */
- destroy() {
- this.facadeMap_.getMapImpl().removeControl(this);
- this.facadeMap_ = null;
- }
-}
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/georefimageepsgcontrol.js b/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/georefimageepsgcontrol.js
deleted file mode 100644
index 6e16af891..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/georefimageepsgcontrol.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * @module M/impl/control/GeorefImageEpsgControl
- */
-
-export default class GeorefImageEpsgControl extends M.impl.Control {
- /**
- * @classdesc
- * Main constructor of the measure conrol.
- *
- * @constructor
- * @extends {ol.control.Control}
- * @api stable
- */
- constructor(map) {
- super();
- /**
- * Facade of the map
- * @private
- * @type {M.Map}
- */
- this.facadeMap_ = map;
- }
-
- /**
- * This function adds the control to the specified map
- *
- * @public
- * @function
- * @param {M.Map} map to add the plugin
- * @param {function} template template of this control
- * @api stable
- */
- addTo(map, element) {
- this.facadeMap_ = map;
-
- ol.control.Control.call(this, {
- element,
- target: null,
- });
- map.getMapImpl().addControl(this);
- }
-
- /**
- * This function destroys this control, clearing the HTML
- * and unregistering all events
- *
- * @public
- * @function
- * @api stable
- */
- destroy() {
- this.facadeMap_.getMapImpl().removeControl(this);
- this.facadeMap_ = null;
- }
-}
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/printermapcontrol.js b/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/printermapcontrol.js
deleted file mode 100644
index ad9db6bac..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/printermapcontrol.js
+++ /dev/null
@@ -1,594 +0,0 @@
-/**
- * @module M/impl/control/PrinterMapControl
- */
-
-import { encodeKML, encodeWMS, encodeImage, encodeXYZ, encodeWMTS, encodeMVT } from './encoders';
-
-export default class PrinterMapControl extends M.impl.Control {
- /**
- * @classdesc
- * Main constructor of the measure conrol.
- *
- * @constructor
- * @extends {ol.control.Control}
- * @api stable
- */
- constructor(map) {
- super();
- /**
- * Facade of the map
- * @private
- * @type {M.Map}
- */
- this.facadeMap_ = map;
-
- this.errors = [];
- }
-
- /**
- * This function adds the control to the specified map
- *
- * @public
- * @function
- * @param {M.Map} map to add the plugin
- * @param {function} template template of this control
- * @api stable
- */
- addTo(map, element) {
- this.facadeMap_ = map;
-
- ol.control.Control.call(this, {
- element,
- target: null,
- });
- map.getMapImpl().addControl(this);
- }
-
- /**
- * This function encodes a layer.
- *
- * @public
- * @function
- * @param {Layer} layer to encode
- * @api stable
- */
- getParametrizedLayers(paramName, layers) {
- let others = this.facadeMap_.getMapImpl().getLayers().getArray().filter((layer) => {
- return !M.utils.isNullOrEmpty(layer.getSource()) &&
- // eslint-disable-next-line no-underscore-dangle
- !M.utils.isNullOrEmpty(layer.getSource().params_) &&
- layer.getSource().getParams()[paramName] !== undefined;
- });
-
- others = others.filter((layer) => {
- return !(layers.some((l) => {
- return l.url !== undefined && l.url === layer.getSource().getUrl();
- }));
- });
-
- return others;
- }
-
- /**
- * This function encodes a layer.
- *
- * @public
- * @function
- * @param {Layer} layer to encode
- * @api stable
- */
- encodeLayer(layer) {
- return (new Promise((success, fail) => {
- try {
- // eslint-disable-next-line no-underscore-dangle
- if (layer.type === M.layer.type.KML && layer.getImpl().formater_.extractStyles_ !== false) {
- success(encodeKML(layer, this.facadeMap_));
- } else if (layer.type === M.layer.type.KML &&
- // eslint-disable-next-line no-underscore-dangle
- layer.getImpl().formater_.extractStyles_ === false) {
- success(this.encodeWFS(layer));
- } else if (layer.type === M.layer.type.WMS) {
- success(encodeWMS(layer));
- } else if (layer.type === M.layer.type.WFS) {
- success(this.encodeWFS(layer));
- } else if (layer.type === M.layer.type.GeoJSON) {
- success(this.encodeWFS(layer));
- } else if (layer.type === M.layer.type.WMTS) {
- encodeWMTS(layer).then((encodedLayer) => {
- success(encodedLayer);
- });
- } else if (M.utils.isNullOrEmpty(layer.type) && layer instanceof M.layer.Vector) {
- success(this.encodeWFS(layer));
- // eslint-disable-next-line no-underscore-dangle
- } else if (layer.type === undefined && layer.className_ === 'ol-layer') {
- success(encodeImage(layer));
- } else if ([M.layer.type.XYZ, M.layer.type.TMS, M.layer.type.OSM].indexOf(layer.type) >
- -1) {
- success(encodeXYZ(layer));
- } else if (layer.type === M.layer.type.MVT) {
- success(encodeMVT(layer, this.facadeMap_));
- } else if (layer.type === M.layer.type.MBTiles ||
- layer.type === M.layer.type.MBTilesVector) {
- this.errors.push(layer.name);
- success('');
- } else {
- success(this.encodeWFS(layer));
- }
- } catch (e) {
- this.errors.push(layer.name);
- success('');
- }
- }));
- }
-
- /**
- * This function adds the control to the specified map
- *
- * @public
- * @function
- * @param {M.Map} map to add the plugin
- * @param {function} template template of this control
- * @api stable
- */
- encodeWFS(layer) {
- let encodedLayer = null;
- const olLayer = layer.getImpl().getOL3Layer();
- const features = olLayer.getSource().getFeatures();
- const layerName = layer.name;
- const layerOpacity = olLayer.getOpacity();
- let encodedFeatures = [];
- let style = '';
- let index = 1;
- let indexText = 1;
- let indexGeom = 1;
- const stylesNames = {};
- const stylesNamesText = {};
- features.forEach((feature) => {
- let encodedFeature = null;
- if (feature.getGeometry().getType().toLowerCase() === 'geometrycollection') {
- encodedFeature = this.encodeGeometryCollection_(layer, feature, style, index, indexGeom);
- if (encodedFeature.geojson.length > 0) {
- encodedFeatures = encodedFeatures.concat(encodedFeature.geojson);
- style += encodedFeature.style;
- index += encodedFeature.plusIndex;
- indexGeom += encodedFeature.plusIndexGeom;
- }
- } else {
- encodedFeature = this.encodeFeature_(
- layer, feature, style, index,
- indexText, indexGeom, stylesNames, stylesNamesText,
- );
-
- if (encodedFeature.geojson !== null) {
- encodedFeatures.push(encodedFeature.geojson);
- style = encodedFeature.style;
- index += encodedFeature.plusIndex;
- indexGeom += encodedFeature.plusIndexGeom;
- indexText += encodedFeature.plusIndexText;
- }
- }
- }, this);
- if (style !== '') {
- style = JSON.parse(style.concat('}'));
- } else {
- style = {
- '*': {
- symbolizers: [],
- },
- version: '2',
- };
- }
-
- encodedLayer = {
- type: 'Vector',
- style,
- geoJson: {
- type: 'FeatureCollection',
- features: encodedFeatures,
- },
- name: layerName,
- opacity: layerOpacity,
- };
-
- return encodedLayer;
- }
-
- encodeFeature_(layer, feature, style, index, indexText, indexGeom, stylesNames, stylesNamesText) {
- let res = null;
- const projection = this.facadeMap_.getProjection();
- const olLayer = layer.getImpl().getOL3Layer();
- const layerStyle = olLayer.getStyle();
- const geoJSONFormat = new ol.format.GeoJSON();
- let bbox = this.facadeMap_.getBbox();
- bbox = [bbox.x.min, bbox.y.min, bbox.x.max, bbox.y.max];
- const resolution = this.facadeMap_.getMapImpl().getView().getResolution();
- let nameFeature;
- let filter;
- let plusIndex = 0;
- let plusIndexText = 0;
- let plusIndexGeom = 0;
- const geometry = feature.getGeometry();
- let featureStyle;
- const fStyle = feature.getStyle();
- let newStyle = `${style}`;
- if (!M.utils.isNullOrEmpty(fStyle)) {
- featureStyle = fStyle;
- } else if (!M.utils.isNullOrEmpty(layerStyle)) {
- featureStyle = layerStyle;
- }
-
- if (featureStyle instanceof Function) {
- featureStyle = featureStyle.call(featureStyle, feature, resolution);
- }
-
- let styleIcon = null;
- if (featureStyle instanceof Array) {
- // SRC style has priority
- if (featureStyle.length > 1) {
- styleIcon = !M.utils.isNullOrEmpty(featureStyle[1]) &&
- !M.utils.isNullOrEmpty(featureStyle[1].getImage()) &&
- featureStyle[1].getImage().getGlyph ?
- featureStyle[1].getImage() : null;
- featureStyle = (!M.utils.isNullOrEmpty(featureStyle[1].getImage()) &&
- featureStyle[1].getImage().getSrc) ?
- featureStyle[1] : featureStyle[0];
- } else {
- featureStyle = featureStyle[0];
- }
- }
-
- if (!M.utils.isNullOrEmpty(featureStyle)) {
- const image = featureStyle.getImage();
- const imgSize = M.utils
- .isNullOrEmpty(image) ? [0, 0] : (image.getImageSize() || [24, 24]);
- let text = featureStyle.getText();
- if (M.utils.isNullOrEmpty(text) && !M.utils.isNullOrEmpty(featureStyle.textPath)) {
- text = featureStyle.textPath;
- }
-
- let parseType;
- if (feature.getGeometry().getType().toLowerCase() === 'multipolygon') {
- parseType = 'polygon';
- } else if (feature.getGeometry().getType().toLowerCase() === 'multipoint') {
- parseType = 'point';
- } else if (feature.getGeometry().getType().toLowerCase().indexOf('linestring') > -1) {
- parseType = 'line';
- } else {
- parseType = feature.getGeometry().getType().toLowerCase();
- }
-
- const stroke = M.utils.isNullOrEmpty(image) ?
- featureStyle.getStroke() : (image.getStroke && image.getStroke());
- const fill = M.utils.isNullOrEmpty(image) ?
- featureStyle.getFill() : (image.getFill && image.getFill());
-
-
- let styleText;
- const lineDash = (featureStyle.getStroke() !== null &&
- featureStyle.getStroke() !== undefined) ?
- featureStyle.getStroke().getLineDash() : undefined;
- const styleGeom = {
- type: parseType,
- fillColor: M.utils.isNullOrEmpty(fill) || (layer.name.indexOf(' Reverse') > -1 && layer.name.indexOf('Cobertura') > -1) ? '#000000' : M.utils.rgbaToHex(fill.getColor()).slice(0, 7),
- fillOpacity: M.utils.isNullOrEmpty(fill) ?
- 0 : M.utils.getOpacityFromRgba(fill.getColor()),
- strokeColor: M.utils.isNullOrEmpty(stroke) ? '#000000' : M.utils.rgbaToHex(stroke.getColor()),
- strokeOpacity: M.utils.isNullOrEmpty(stroke) ?
- 0 : M.utils.getOpacityFromRgba(stroke.getColor()),
- strokeWidth: M.utils.isNullOrEmpty(stroke) ? 0 : (stroke.getWidth && stroke.getWidth()),
- pointRadius: M.utils.isNullOrEmpty(image) ? '' : (image.getRadius && image.getRadius()),
- externalGraphic: M.utils.isNullOrEmpty(image) ? '' : (image.getSrc && image.getSrc()),
- graphicHeight: imgSize[0],
- graphicWidth: imgSize[1],
- strokeLinecap: 'round',
- };
-
- if (layer.name === 'coordinateresult') {
- styleGeom.fillOpacity = 1;
- styleGeom.strokeOpacity = 1;
- styleGeom.fillColor = '#ffffff';
- styleGeom.strokeColor = '#ff0000';
- styleGeom.strokeWidth = 2;
- }
-
- if (layer.name === 'infocoordinatesLayerFeatures') {
- styleGeom.fillColor = '#ffffff';
- styleGeom.fillOpacity = 1;
- styleGeom.strokeWidth = 1;
- styleGeom.strokeColor = '#2690e7';
- styleGeom.strokeOpacity = 1;
- styleGeom.graphicName = 'cross';
- styleGeom.graphicWidth = 15;
- styleGeom.graphicHeight = 15;
- }
-
- if (layer.name.indexOf(' Reverse') > -1 && layer.name.indexOf('Cobertura') > -1) {
- styleGeom.fillColor = styleGeom.strokeColor;
- styleGeom.fillOpacity = 0.5;
- }
-
- if (lineDash !== undefined && lineDash !== null && lineDash.length > 0) {
- if (lineDash[0] === 1 && lineDash.length === 2) {
- styleGeom.strokeDashstyle = 'dot';
- } else if (lineDash[0] === 10) {
- styleGeom.strokeDashstyle = 'dash';
- } else if (lineDash[0] === 1 && lineDash.length > 2) {
- styleGeom.strokeDashstyle = 'dashdot';
- }
- }
-
- const imageIcon = !M.utils.isNullOrEmpty(styleIcon) &&
- styleIcon.getImage ? styleIcon.getImage() : null;
- if (!M.utils.isNullOrEmpty(imageIcon)) {
- if (styleIcon.getRadius && styleIcon.getRadius()) {
- styleGeom.pointRadius = styleIcon.getRadius && styleIcon.getRadius();
- }
-
- if (styleIcon.getOpacity && styleIcon.getOpacity()) {
- styleGeom.graphicOpacity = styleIcon.getOpacity();
- }
-
- styleGeom.externalGraphic = imageIcon.toDataURL();
- }
-
- if (!M.utils.isNullOrEmpty(text)) {
- let tAlign = text.getTextAlign();
- let tBLine = text.getTextBaseline();
- let align = '';
- if (!M.utils.isNullOrEmpty(tAlign)) {
- if (tAlign === M.style.align.LEFT) {
- tAlign = 'l';
- } else if (tAlign === M.style.align.RIGHT) {
- tAlign = 'r';
- } else if (tAlign === M.style.align.CENTER) {
- tAlign = 'c';
- } else {
- tAlign = '';
- }
- }
- if (!M.utils.isNullOrEmpty(tBLine)) {
- if (tBLine === M.style.baseline.BOTTOM) {
- tBLine = 'b';
- } else if (tBLine === M.style.baseline.MIDDLE) {
- tBLine = 'm';
- } else if (tBLine === M.style.baseline.TOP) {
- tBLine = 't';
- } else {
- tBLine = '';
- }
- }
- if (!M.utils.isNullOrEmpty(tAlign) && !M.utils.isNullOrEmpty(tBLine)) {
- align = tAlign.concat(tBLine);
- }
- const font = text.getFont();
- const fontWeight = !M.utils.isNullOrEmpty(font) && font.indexOf('bold') > -1 ? 'bold' : 'normal';
- let fontSize = '11px';
- if (!M.utils.isNullOrEmpty(font)) {
- const px = font.substr(0, font.indexOf('px'));
- if (!M.utils.isNullOrEmpty(px)) {
- const space = px.lastIndexOf(' ');
- if (space > -1) {
- fontSize = px.substr(space, px.length).trim().concat('px');
- } else {
- fontSize = px.concat('px');
- }
- }
- }
-
- styleText = {
- type: 'text',
- label: text.getText(),
- fontColor: M.utils.isNullOrEmpty(text.getFill()) ? '#000000' : M.utils.rgbToHex(text.getFill().getColor()),
- fontSize,
- fontFamily: 'Helvetica, sans-serif',
- fontStyle: 'normal',
- fontWeight,
- conflictResolution: 'false',
- labelXOffset: text.getOffsetX(),
- labelYOffset: text.getOffsetY(),
- fillColor: styleGeom.fillColor || '#FF0000',
- fillOpacity: styleGeom.fillOpacity || 1,
- labelOutlineColor: M.utils.isNullOrEmpty(text.getStroke()) ? '' : M.utils.rgbToHex(text.getStroke().getColor() || '#FF0000'),
- labelOutlineWidth: M.utils.isNullOrEmpty(text.getStroke()) ? '' : text.getStroke().getWidth(),
- labelAlign: align,
- };
- } else if (layer.name === 'infocoordinatesLayerFeatures') {
- text = true;
- styleText = {
- type: 'text',
- conflictResolution: 'false',
- fontFamily: 'Helvetica, sans-serif',
- fontStyle: 'normal',
- fontColor: '#ffffff',
- fontSize: '12px',
- label: `${feature.getId()}`,
- labelAlign: 'lb',
- labelXOffset: '4',
- labelYOffset: '3',
- haloColor: '#2690e7',
- haloRadius: '1',
- haloOpacity: '1',
- };
- }
-
- nameFeature = `draw${index}`;
- if ((!M.utils.isNullOrEmpty(geometry) && geometry.intersectsExtent(bbox)) ||
- !M.utils.isNullOrEmpty(text)) {
- const styleStr = JSON.stringify(styleGeom);
- const styleTextStr = JSON.stringify(styleText);
- let styleName = stylesNames[styleStr];
- let styleNameText = stylesNamesText[styleTextStr];
- if (M.utils.isUndefined(styleName) || M.utils.isUndefined(styleNameText)) {
- const symbolizers = [];
- let flag = 0;
- if (!M.utils.isNullOrEmpty(geometry) && geometry.intersectsExtent(bbox) &&
- M.utils.isUndefined(styleName)) {
- styleName = indexGeom;
- // eslint-disable-next-line no-param-reassign
- stylesNames[styleStr] = styleName;
- flag = 1;
- symbolizers.push(styleStr);
- plusIndexGeom += 1;
- plusIndex += 1;
- }
- if (!M.utils.isNullOrEmpty(text) && M.utils.isUndefined(styleNameText)) {
- styleNameText = indexText;
- // eslint-disable-next-line no-param-reassign
- stylesNamesText[styleTextStr] = styleNameText;
- symbolizers.push(styleTextStr);
- plusIndexText += 1;
- if (flag === 0) {
- plusIndex += 1;
- symbolizers.push(styleStr);
- }
- }
- if (styleName === undefined) {
- styleName = 0;
- }
- if (styleNameText === undefined) {
- styleNameText = 0;
- }
- filter = `"[_gx_style ='${styleName + styleNameText}']"`;
- if (!M.utils.isNullOrEmpty(symbolizers)) {
- const a = `${filter}: {"symbolizers": [${symbolizers}]}`;
- if (newStyle.indexOf(filter) === -1) {
- if (newStyle !== '') {
- // eslint-disable-next-line no-param-reassign
- newStyle += `,${a}`;
- } else {
- // eslint-disable-next-line no-param-reassign
- newStyle += `{${a},"version":"2"`;
- }
- }
- }
- }
-
- let geoJSONFeature;
- if (projection.code !== 'EPSG:3857' && this.facadeMap_.getLayers().some(layerParam => (layerParam.type === M.layer.type.OSM || layerParam.type === M.layer.type.Mapbox))) {
- geoJSONFeature = geoJSONFormat.writeFeatureObject(feature, {
- featureProjection: projection.code,
- dataProjection: 'EPSG:3857',
- });
- } else {
- geoJSONFeature = geoJSONFormat.writeFeatureObject(feature);
- }
-
- geoJSONFeature.properties = {
- _gx_style: styleName + styleNameText,
- name: nameFeature,
- };
-
- res = geoJSONFeature;
- }
- }
-
- return {
- style: newStyle,
- geojson: res,
- plusIndex,
- plusIndexText,
- plusIndexGeom,
- };
- }
-
- encodeGeometryCollection_(layer, gc, style, index, indexGeom) {
- const res = [];
- const stylesNames = {};
- let nameFeature;
- let bbox = this.facadeMap_.getBbox();
- bbox = [bbox.x.min, bbox.y.min, bbox.x.max, bbox.y.max];
- let filter;
- let newStyle = `${style}`;
- let plusIndex = 0;
- let plusIndexGeom = 0;
- gc.getGeometry().getGeometries().forEach((geometry) => {
- let parseType;
- if (geometry.getType().toLowerCase() === 'multipolygon') {
- parseType = 'polygon';
- } else if (geometry.getType().toLowerCase() === 'multipoint') {
- parseType = 'point';
- } else if (geometry.getType().toLowerCase().indexOf('linestring') > -1) {
- parseType = 'line';
- } else {
- parseType = geometry.getType().toLowerCase();
- }
-
- if (parseType === 'polygon') {
- const styleGeom = {
- type: parseType,
- fillColor: '#3399CC',
- fillOpacity: 0,
- strokeColor: '#3399CC',
- strokeWidth: 2,
- strokeLinecap: 'round',
- };
-
- nameFeature = `draw${index}`;
- if (!M.utils.isNullOrEmpty(geometry) && geometry.intersectsExtent(bbox)) {
- const styleStr = JSON.stringify(styleGeom);
- let styleName = stylesNames[styleStr];
- if (M.utils.isUndefined(styleName)) {
- const symbolizers = [];
- if (!M.utils.isNullOrEmpty(geometry) && geometry.intersectsExtent(bbox) &&
- M.utils.isUndefined(styleName)) {
- styleName = indexGeom;
- stylesNames[styleStr] = styleName;
- symbolizers.push(styleStr);
- plusIndexGeom += 1;
- plusIndex += 1;
- }
-
- if (styleName === undefined) {
- styleName = 0;
- }
- filter = `"[_gx_style ='${styleName}']"`;
- if (!M.utils.isNullOrEmpty(symbolizers)) {
- const a = `${filter}: {"symbolizers": [${symbolizers}]}`;
- if (newStyle !== '') {
- // eslint-disable-next-line no-param-reassign
- newStyle += `,${a}`;
- } else {
- // eslint-disable-next-line no-param-reassign
- newStyle += `{${a},"version":"2"`;
- }
- }
- }
-
- const geoJSONFeature = {
- type: 'Feature',
- geometry: {
- type: geometry.getType(),
- coordinates: geometry.getCoordinates(),
- },
- properties: {
- _gx_style: styleName,
- name: nameFeature,
- },
- };
-
- res.push(geoJSONFeature);
- }
- }
- });
-
- return {
- style: newStyle,
- geojson: res,
- plusIndex,
- plusIndexGeom,
- };
- }
-
- /**
- * This function destroys this control, clearing the HTML
- * and unregistering all events
- *
- * @public
- * @function
- * @api stable
- */
- destroy() {
- this.facadeMap_.getMapImpl().removeControl(this);
- this.facadeMap_ = null;
- }
-}
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/printviewmanagement.js b/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/printviewmanagement.js
deleted file mode 100644
index ccb9c4d35..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/printviewmanagement.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * @module M/impl/control/PrintViewManagementControl
- */
-export default class PrintViewManagementControl extends M.impl.Control {
- /**
- * This function adds the control to the specified map
- *
- * @public
- * @function
- * @param {M.Map} map to add the plugin
- * @param {HTMLElement} html of the plugin
- * @api stable
- */
- addTo(map, html) {
- // super addTo - don't delete
- super.addTo(map, html);
-
- this.facadeMap_ = map;
- }
-
- /**
- * This functions transform coordinates of center to the
- * predefined zoom
- *
- * @public
- * @function
- * @param {Array} coordinates Coordinates
- * @param {String} srs SRS
- * @returns Coordinates transformed
- * @api
- */
- transformCenter(coordinates, srs) {
- const mapsrs = this.facadeMap_.getProjection().code;
- return ol.proj.transform(coordinates, srs, mapsrs);
- }
-}
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/utils.js b/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/utils.js
deleted file mode 100644
index 284e89d89..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/impl/ol/js/utils.js
+++ /dev/null
@@ -1,17 +0,0 @@
-
-const EPSG_DEFAULT = 'EPSG:4326';
-
-export const reproject = (origin, coordinates) => {
- const originProj = ol.proj.get(origin);
- const destProj = ol.proj.get(EPSG_DEFAULT);
- const coordinatesTransform = ol.proj.transform(coordinates, originProj, destProj);
- return coordinatesTransform;
-};
-
-export const transformExt = (box, code, currProj) => {
- return ol.proj.transformExtent(box, code, currProj);
-};
-
-export const transform = (box, code, currProj) => {
- return ol.proj.transform(box, code, currProj);
-};
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/templates/georefimage.html b/api-ign-js/src/plugins/printviewmanagement/src/templates/georefimage.html
deleted file mode 100644
index ccdc37f28..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/templates/georefimage.html
+++ /dev/null
@@ -1,41 +0,0 @@
-
\ No newline at end of file
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/templates/georefimageepsg.html b/api-ign-js/src/plugins/printviewmanagement/src/templates/georefimageepsg.html
deleted file mode 100644
index ecdb71bd7..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/templates/georefimageepsg.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
- {{translations.selectLayer}}
-
- {{#each layers}}
- {{legend}}
- {{/each}}
-
-
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/templates/printermap.html b/api-ign-js/src/plugins/printviewmanagement/src/templates/printermap.html
deleted file mode 100644
index f4c94e7d7..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/templates/printermap.html
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
- {{translations.description}}
- {{#if fixedDescription}}
-
- {{^}}
-
- {{/if}}
-
-
-
- {{translations.layout}}
-
- {{#each layouts}}
- {{name}}
- {{/each}}
-
-
-
-
- DPI
-
- {{#each dpis}}
- {{value}}
- {{/each}}
-
-
-
-
\ No newline at end of file
diff --git a/api-ign-js/src/plugins/printviewmanagement/src/templates/printviewmanagement.html b/api-ign-js/src/plugins/printviewmanagement/src/templates/printviewmanagement.html
deleted file mode 100644
index d6975c4ad..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/src/templates/printviewmanagement.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
{{translations.headertitle}}
-
-
-
- {{#if printermap}}
-
- {{/if}}
- {{#if georefImage}}
-
- {{/if}}
- {{#if georefImageEpsg}}
-
- {{/if}}
-
-
-
-
-
-
-
- {{translations.downImg}}
- {{translations.delete}}
-
-
-
-
-
\ No newline at end of file
diff --git a/api-ign-js/src/plugins/printviewmanagement/task/create-entrypoint.js b/api-ign-js/src/plugins/printviewmanagement/task/create-entrypoint.js
deleted file mode 100644
index 596e6001f..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/task/create-entrypoint.js
+++ /dev/null
@@ -1,66 +0,0 @@
-const path = require('path');
-const fs = require('fs-extra');
-const SRC_PATH = path.resolve(__dirname, '..', 'src');
-const DIST_PATH = path.resolve(__dirname, '..', 'dist');
-const FACADE_PATH = path.resolve(SRC_PATH, 'facade', 'js');
-const IMPL_PATH = path.resolve(SRC_PATH, 'impl', 'ol', 'js');
-
-const files = [];
-const namespaces = [];
-const uniqueNS = [];
-let imports = '';
-let exportedClasses = '';
-let createNS = '';
-
-const getAbsolutePath = (fileNames, fullPath) => {
- const absolutePaths = fileNames.map(fileName => path.resolve(fullPath, fileName));
- absolutePaths.forEach((absolutePath) => {
- if (fs.lstatSync(absolutePath).isDirectory() === true) {
- getAbsolutePath(fs.readdirSync(absolutePath), absolutePath);
- } else if (/.js$/.test(absolutePath)) {
- files.push(absolutePath);
- }
- });
-};
-
-const facadeFiles = fs.readdirSync(FACADE_PATH);
-const implFiles = fs.readdirSync(IMPL_PATH);
-getAbsolutePath(facadeFiles, FACADE_PATH);
-getAbsolutePath(implFiles, IMPL_PATH);
-
-files.forEach((file) => {
- const match = fs.readFileSync(file, 'utf8').match(/@module.*/);
- if (match !== null) {
- const namespace = match[0].replace(/@module (.*)/, '$1');
- namespaces.push({
- alias: namespace.replace(/\//g, '$'),
- namespace: namespace.replace(/\//g, '.'),
- path: file.replace(/.*\/src(\/.*)/, './$1'),
- });
- }
-});
-
-namespaces.forEach((namespace) => {
- const partitions = namespace.namespace.split('.');
- for (let i = 2; i < partitions.length; i += 1) {
- const partition = partitions.slice(0, i).join('.');
- if (uniqueNS.includes(partition) === false) {
- uniqueNS.push(partition);
- }
- }
-});
-
-namespaces.forEach((namespace) => {
- imports += `import ${namespace.alias} from '${namespace.path.replace(/(.*)\.js/, '$1')}';\n`;
- exportedClasses += `window.${namespace.namespace} = ${namespace.alias};\n`;
-});
-
-uniqueNS.forEach((ns) => {
- createNS += `if (!window.${ns}) window.${ns} = {};\n`;
-});
-
-const contentEntryPoint = `${imports}\n${createNS}${exportedClasses}`;
-
-fs.writeFileSync(path.join(SRC_PATH, 'index.js'), contentEntryPoint);
-fs.removeSync(DIST_PATH);
-fs.ensureDirSync(DIST_PATH);
diff --git a/api-ign-js/src/plugins/printviewmanagement/test/dev.html b/api-ign-js/src/plugins/printviewmanagement/test/dev.html
deleted file mode 100644
index ddfefed91..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/test/dev.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
- PrintViewManagement TEST
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/api-ign-js/src/plugins/printviewmanagement/test/prod.html b/api-ign-js/src/plugins/printviewmanagement/test/prod.html
deleted file mode 100644
index e1e2c92ec..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/test/prod.html
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
- PrintViewManagement Production TEST
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/api-ign-js/src/plugins/printviewmanagement/test/test.js b/api-ign-js/src/plugins/printviewmanagement/test/test.js
deleted file mode 100644
index d8f5d301c..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/test/test.js
+++ /dev/null
@@ -1,239 +0,0 @@
-import PrintViewManagement from 'facade/printviewmanagement';
-
-M.language.setLang('es');
-
-// const suelo = new M.layer.WMTS({
-// url: 'https://servicios.idee.es/wmts/ocupacion-suelo?',
-// name: 'LU.ExistingLandUse',
-// legend: 'Ocupación del suelo WMTS',
-// matrixSet: 'GoogleMapsCompatible',
-// maxZoom: 20,
-// minZoom: 4,
-// visibility: true,
-// }, { crossOrigin: 'anonymous' });
-
-const map = M.map({
- container: 'mapjs',
- zoom: 9,
- maxZoom: 20,
- minZoom: 4,
- // layers: [suelo],
- center: [-467062.8225, 4683459.6216],
-});
-
-const capaKML1 = new M.layer.KML({
- url: 'https://www.ign.es/web/resources/delegaciones/delegacionesIGN.kml',
- name: 'Capa KML',
- legend: 'Capa KML',
- extract: true,
-}, {
- // extractStyles: false,
- // style: new M.style.Point({
- // radius: 5,
- // fill: {
- // color: 'green',
- // opacity: 0.5,
- // },
- // stroke: {
- // color: '#FF0000',
- // },
- // }),
-});
-
-map.addLayers(capaKML1);
-
-// const capaWFS = new M.layer.WFS({
-// url: 'http://geostematicos-sigc.juntadeandalucia.es/geoserver/sepim/ows?',
-// namespace: 'sepim',
-// name: 'campamentos',
-// legend: 'Capa WFS l',
-// geometry: 'MPOINT',
-// });
-
-// map.addLayers(capaWFS);
-
-// añadir wmts API-CNIG {url: 'http://www.ign.es/wms-inspire/mapa-raster?', name: 'mtn_rasterizado',format: 'image/jpeg',legend: 'Mapa ETRS89 UTM',EPSG: 'EPSG:4258',},
-// WMTS -> OK
-
-const mp = new PrintViewManagement({
- isDraggable: true,
- position: 'TL',
- collapsible: true,
- collapsed: true,
- tooltip: 'Imprimir',
- serverUrl: 'https://componentes.cnig.es/geoprint',
- printStatusUrl: 'https://componentes.cnig.es/geoprint/print/status',
- defaultOpenControl: 2,
- georefImageEpsg: {
- tooltip: 'Georeferenciar imagen',
- layers: [{
- url: 'http://www.ign.es/wms-inspire/mapa-raster?',
- name: 'mtn_rasterizado',
- format: 'image/jpeg',
- legend: 'Mapa ETRS89 UTM',
- EPSG: 'EPSG:4326',
- },
- {
- url: 'http://www.ign.es/wms-inspire/pnoa-ma?',
- name: 'OI.OrthoimageCoverage',
- format: 'image/jpeg',
- legend: 'Imagen (PNOA) ETRS89 UTM',
- // EPSG: 'EPSG:4258',
- },
- ],
- },
- georefImage: {
- tooltip: 'Georeferenciar imagen',
- printTemplateUrl: 'https://componentes.cnig.es/geoprint/print/mapexport',
- printSelector: true,
- // printType: 'client', // 'client' or 'server'
- },
- printermap: {
- printTemplateUrl: 'https://componentes.cnig.es/geoprint/print/CNIG',
- fixedDescription: true,
- headerLegend: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACUAAAAkCAYAAAAOwvOmAAAJMElEQVR42rVYC1SN6RpuZpa1zjkzzNKo1N7737fal3b33f2m29FNdHUpkcZINyqSE0PKZRJyD03OcS2SLiiEChExRorCkFzOhGHcZxb1nO/7kTaptObstd61d9/f933Pft/nfd733WpqfXt9znzNDBTo8EaIGGavmOHf1hUIX8h19V7qSySviL2UiMTPyPotIcMcEHB4kwUaGoPJvs/U/k+vz3XUdXjkojwxXwBqMl1duDrYYs70aGxavQgbl8/H7ITJ8HB2hKmBAnoCIUQ85i5nMMeZ7P/iL0WjqampJeDxKqVi3T+iIyIIGD24uzigoboYT5pP4cWtsx32/OYZPLtxGncvVeHUwTwEeA+FiOG3Ec/tIkf1+yvwfCHk8DLsrW0eZGdlYfuWLQgZNRK56zNeX95SiyfXjuPR5cN41FiO3y/uJ1amYr/Vl6F089J2pZFBu4DL7CNn/q3PaHTU1XkChmmIjpiMI+XlSE1JwbChrqg/XsQCevLLsS5BfMzOlv4IG6UJ3gD7dI5pqal9qcsXtiyaPx8Vhw8hJioGPh7uaL1YxQJ6dPlIr8F0trKtmZCIRODzeBmfDIxkVlyQnz/2FBXCf4QvnB2HtDfV7GE586jpcKeLiKdU/v64Pb1+Eg3Ey3NnRFOOtQs5HONeA+JrcVzIpmYDmRw+Xl5YuWwZfL29Wf48vlrVccnjK5XIz1mGsYHDMTHYH/fO7+kW1OLvEzDE2hwKiR6buQIud0WvAGloaHxFU9jR1g7/yclBfl4eFqYtIJ5ywrXa0neXXDqIHT8uhZO1BVKnT8KqtATcq+seVMupAvb95ukCxE4YSYDxn/aK9ISEmXI9Ccr3lyF+ajxio2NZo6Cu1xR1XHD5eD4MpFJcOZbXJ25R83J2AE9b27EXXOI/T06agR8WLuoARM3D1UU1k8pyULwxvU9gHjaUspZGPMxwuVO6zzgtrS9prFcuz1QBRC3Ef1jPFxKdOlaYpbL2oH4f/nu2SGWtviIXd84WYue6NAh4zLJuQamrqw+goKgedQZE5SByXGB7d4CoRFCpWJA8leXM23VK/qSo0E7JUYGW8+WYHBqAQ7nLIeQym3qKXj9C8pczpyciPGwCwsdPQGREJKIjozFtUkhbT1562lyDusp8xE0cw4bn7bPw0cPx60+vvdVaV4rGozswzNUBO7JSqTTk94ZT9xRSGZuypPpDrifFuLHjEBU2qtvQ5a6ZR4qwHVKmTYRMLCYhK+x4Vpi9EB5OdmwoU+InQk8ohIm+DNWFa0mx5hd0C4irxbWiYJalJrHK/fDqCaQkxsBSaY7QUQHdgmo4sgXZi2ciPTn6gwRo/bkEY/09sXr+NNaDrT8Xs++XKrZCyGN2dAtKyOXG2JqbofHkHowY6gRzIwM0niiE0sgQJgpFn1Of2q/nimFtaoyCDQs71s6QWkg6j5zuQXF4s1OTYtlCO3/GJDQdzUXUuEDUlW9S4UhfjXqTqnl1URZ7XtmWJeBzmcXdCyeHGR/s78NmyL+XzmI3Vuxc2XcgtJ0hpajz2vJ58fD3dGHPzlqUSAtzdPc1T1vbjJK7+VQhmqq2dQhdXwC1nivBxWO72HLUec3PwwXLU+LYcyPG+oHhcFx7Sr6/0547fVbsB0T9VFA3anaxod+3KYOkfhoWJE3GmBHuKCFJcJ/UyNskOz2d7Nr69+//TY+SMGjQIB0iCy9ixgexHPBxc8Sa9Nm9BnP9ZD7uEsGknoidMAr2FmZI+C6YrO8gnirGT6Q8+bgNYT8bymSne926aH+jLaedApUHFztr/H7tJAnDgY+DIc+eXj/Bfj64LRNWJMucbCzgTXp4Pw9nxIQFYQXhkqWJEatRtSTrls6ZQvk07VObz34CDifORKHP9lGPmt51mjdrd38A7Mm1aqwhOnR6bzYuVW5lNYu2NL7uzgjwdMXu7EXITJlKPLURN07tgpxMQVxNrtEnt8RcTU0jwrGXTTV7iUwc7QBAeVKxc1WX1T8yNBBbVszByeJ1+O3Cvi49u3FpMh27zvd15PoH4dednTmZeNZ8UuXyqPEBrCB+KJJFLGeoJ2j4pWIRlIYKtk2h++oPb6Yh/IOc/VXfJxoNDVMPlyGkA6hli+47IdzM8ubOe20Jtft1e3H1eB4uHNqMxsptuH2msENaQvw8qZfu0cG2z6D4OtwYOkjmblhCvFWj4q1awp/vgn2J8m/vWbfOlyAixA8SiRy6Yr12UvMadHR0eJ8EhtHWVgp4/FIKSCJTwNHaEherS4hCV6gAO1qwGoFebthJ2pC75z/Us2sndrDVwURfDrFQDPvRUXAOT4JET07aFuYWFewewQwcOPBrMmWsF/GFbXJjC7hEfA/3qYsgN1RCIhSxvxnUH9mOKyQ8v1TnISkyFH6kbNBZjvInmuhbzpJkZCTHIGiYG11vI9xqp/wyJNVCqieDW3QahsYuAP2yxGNPqAM+HqrBg72IZx5IZAbtTuOnwyM+HZ4JGaw5jEsgxBVi7apVOLB/P9avXQvfYd6YIpdhM9EfnzfEpp6dEj7yYXJM2OPctfOeLUyKfKwvELzaSbTruo0VppP/V9i6Yci3yfhnVCr0Ta3onlZ1NbUBKmDIRGFOEJeIBMJXFu6B7LegQKiHHMISYREYAaXvBJh4h8DA2hkhY0KwIWsdPFxcUWtpjhZbSzTbWuA4aXv+pa8PY6n0VYCX65/Bvu7Pg+SytjoyhrWQpLhorcR6YwNIidfpeTbBU+EQGgcxI3jMMMzAzmVFmwB6KpUbsvH2iF/MuteOeErpG85uft9MPEdDZmYDiUCE0wTUBXLZW2skADYYv/ZcjYUpvMn7XqUpLr95XmBqBKnCpOMsY/cgyq0WWnffCeQADT06Qjt/OxPucT/AalRUl0C6MoW5PWoslSqgqDcOExA2pJzsVxrBjXDtnKUZ6qzM2Oe7TQ0hNbZ6d4a9O2n0+LvfL8D9Caj7Vj4hBFR6rwG9/ZYHzE1VQFHbbmIAa3MLzEpMRNrcOTAlBHcg4PxJ7+4lEsNgiHfHGTJTGwi7GEg/E3GZarmxOcsju9D4XoMyG04GCoWBCqC5ChmMJbI/k2fMQMuNZhyrqkRVRQWU1vbPp2XvahuTOA8SEj6zEWHsGWJdWUvnX1/+B6GXy1Z/prUqAAAAAElFTkSuQmCC',
- // filterTemplates: ['A3 Horizontal'],
- logo: 'https://www.idee.es/csw-codsi-idee/images/cabecera-CODSI.png',
- },
-});
-
-
-map.addPlugin(mp);
-
-window.map = map;
-
-// CAPAS
-
-// const capaGeoJSON = new M.layer.GeoJSON({
-// name: 'Capa GeoJSON',
-// legend: 'Capa GeoJSON',
-// url: 'http://geostematicos-sigc.juntadeandalucia.es/geoserver/tematicos/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=tematicos:Provincias&maxFeatures=50&outputFormat=application%2Fjson',
-// extract: true,
-// });
-
-// map.addLayers(capaGeoJSON);
-
-const capaOSM = new M.layer.OSM({
- name: 'Capa OSM',
- legend: 'Capa OSM',
- transparent: true,
- url: 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png',
- matrixSet: 'EPSG:3857',
-});
-
-// map.addLayers(capaOSM);
-
-
-// const capaKML = new M.layer.KML({
-// url: 'https://www.ign.es/web/resources/delegaciones/delegacionesIGN.kml',
-// name: 'Capa KML',
-// legend: 'Capa KML',
-// extract: true,
-// }, { crossOrigin: 'anonymous' });
-
-// map.addLayers(capaKML);
-
-// const capaMVT = new M.layer.MVT({
-// url: 'https://www.ign.es/web/resources/mapa-base-xyz/vt/{z}/{x}/{y}.pbf',
-// // layers: ['camino_lin'],
-// name: 'Capa MVT',
-// legend: 'Capa MVT',
-// projection: 'EPSG:3857',
-// extract: true,
-// }, { crossOrigin: 'anonymous' });
-
-// map.addLayers(capaMVT);
-
-// const capaOGCAPIFeatures = new M.layer.OGCAPIFeatures({
-// url: 'https://api-features.idee.es/collections/',
-// name: 'hidrografia/Falls',
-// legend: 'Capa OGCAPIFeatures L',
-// limit: 20,
-// });
-
-// map.addLayers(capaOGCAPIFeatures);
-
-// const capaTMS = new M.layer.TMS({
-// url: 'https://tms-mapa-raster.ign.es/1.0.0/mapa-raster/{z}/{x}/{-y}.jpeg',
-// name: 'Capa TMS',
-// legend: 'Capa TMS L',
-// projection: 'EPSG:3857',
-// }, { crossOrigin: 'anonymous' });
-
-// map.addLayers(capaTMS);
-
-// const capaVector = new M.layer.Vector({
-// name: 'capaVector',
-// legend: 'vector legend',
-// attribution: {
-// nameLayer: 'Nombre capa',
-// name: 'Otro nombre', // se puede llamar description?
-// url: 'https://www.google.es',
-// contentAttributions: 'https://mapea-lite.desarrollo.guadaltel.es/api-core/files/attributions/WMTS_PNOA_20170220/atribucionPNOA_Url.kml',
-// contentType: 'kml',
-// },
-// });
-// const feature = new M.Feature('localizacion', {
-// type: 'Feature',
-// properties: { text: 'prueba' },
-// geometry: {
-// type: 'Point',
-// coordinates: [-458757.1288, 4795217.2530],
-// },
-// });
-// capaVector.addFeatures(feature);
-
-// map.addLayers(capaVector);
-
-const capaWMS = new M.layer.WMS({
- url: 'https://www.ign.es/wms-inspire/unidades-administrativas?',
- name: 'AU.AdministrativeUnit',
- legend: 'Capa WMS l',
-}, { crossOrigin: 'anonymous' });
-
-// map.addLayers(capaWMS);
-
-
-const capaWMTS = new M.layer.WMTS({
- url: 'https://servicios.idee.es/wmts/ocupacion-suelo',
- name: 'LC.LandCoverSurfaces',
- legend: 'LC.LandCoverSurfaces l',
- matrixSet: 'GoogleMapsCompatible',
- format: 'image/png',
-}, { crossOrigin: 'anonymous' });
-
-// map.addLayers(capaWMTS);
-
-const capaXYZ = new M.layer.XYZ({
- url: 'https://www.ign.es/web/catalogo-cartoteca/resources/webmaps/data/cresques/{z}/{x}/{y}.jpg',
- name: 'Capa XYZ',
- legend: 'Capa XYZ l',
- projection: 'EPSG:3857',
-}, { crossOrigin: 'anonymous' });
-
-// map.addLayers(capaXYZ);
-
-
-// window.fetch('./cabrera.mbtiles').then((response) => {
-// const mbtile = new M.layer.MBTiles({
-// name: 'mbtiles',
-// legend: 'Capa MBTiles L',
-// source: response,
-// });
-// map.addLayers(mbtile);
-// window.mbtile = mbtile;
-// }).catch((e) => {
-// throw e;
-// });
-
-// window.fetch('./countries.mbtiles').then((response) => {
-// const mbtilesvector = new M.layer.MBTilesVector({
-// name: 'mbtiles_vector',
-// legend: 'Capa MBTilesVector L',
-// source: response,
-// // maxZoomLevel: 5,
-// });
-// map.addLayers(mbtilesvector);
-// }).catch((e) => {
-// throw e;
-// });
diff --git a/api-ign-js/src/plugins/printviewmanagement/webpack-config/GenerateVersionPlugin.js b/api-ign-js/src/plugins/printviewmanagement/webpack-config/GenerateVersionPlugin.js
deleted file mode 100644
index 5274bfc63..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/webpack-config/GenerateVersionPlugin.js
+++ /dev/null
@@ -1,52 +0,0 @@
-const pathmodule = require('path');
-const fs = require('fs');
-/**
- * Webpack plugin that allows overwrite functions definitions after import.
- * This plugin is directly related to the class src/impl/ol/js/patches.js, which is used to
- * overwrite functions of openlayers that we can not access by inheritance of classes.
- * @class AllowMutateEsmExports
- */
-class GenerateVersionPlugin {
- constructor(opt) {
- this.version = opt.version;
- this.regex = opt.regex;
- this.fileName = opt.fileName;
- this.aliasRoot = opt.aliasRoot;
- }
- /**
- * This function apply the logic plugin.
- * @function
- */
- apply(compiler) {
- compiler.hooks.done.tap('GenerateVersionPlugin', (stats) => {
- const { path } = stats.compilation.options.output;
- stats.compilation.chunks.forEach((chunk) => {
- chunk.files.forEach((file, index) => {
- const basename = pathmodule.basename(file);
- const version = this.version || this.geExecuteCB(index, stats);
- let replacePath;
- if (this.regex instanceof RegExp) {
- replacePath = basename.replace(this.regex, `$1-${version}$2`);
- }
- const realPath = pathmodule.resolve(path, file);
- const newPath = pathmodule.join(pathmodule.dirname(realPath), replacePath);
- fs.copyFileSync(realPath, newPath);
- });
- });
- });
- }
-
- /**
- * @function
- */
- geExecuteCB(index, stats) {
- const entry = Object.keys(stats.compilation.options.entry)[index];
- const name = entry.split('/').slice(-1)[0];
- const context = stats.compilation.options.resolve.alias[this.aliasRoot];
- const absolutePath = pathmodule.resolve(context, name, this.fileName);
- const version = JSON.parse(fs.readFileSync(absolutePath)).version;
- return version;
- }
-}
-
-module.exports = GenerateVersionPlugin;
diff --git a/api-ign-js/src/plugins/printviewmanagement/webpack-config/webpack.development.config.js b/api-ign-js/src/plugins/printviewmanagement/webpack-config/webpack.development.config.js
deleted file mode 100644
index 27acfef61..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/webpack-config/webpack.development.config.js
+++ /dev/null
@@ -1,62 +0,0 @@
-const path = require('path');
-const webpack = require('webpack');
-
-module.exports = {
- mode: 'development',
- entry: path.resolve(__dirname, '..', 'test', 'test.js'),
- resolve: {
- alias: {
- templates: path.resolve(__dirname, '../src/templates'),
- assets: path.resolve(__dirname, '../src/facade/assets'),
- impl: path.resolve(__dirname, '../src/impl/ol/js'),
- facade: path.resolve(__dirname, '../src/facade/js'),
- },
- extensions: ['.wasm', '.mjs', '.js', '.json', '.css', '.hbs', '.html'],
- },
- module: {
- rules: [
- {
- test: /\.js$/,
- exclude: /(node_modules\/(?!ol)|bower_components)/,
- use: {
- loader: 'babel-loader',
- options: {
- presets: ['@babel/preset-env'],
- },
- },
- },
- {
- test: /\.js$/,
- loader: 'eslint-loader',
- exclude: [/node_modules/, /lib/, /test/, /dist/],
- },
- {
- test: [/\.hbs$/, /\.html$/],
- loader: 'html-loader',
- exclude: /node_modules/,
- },
- {
- test: /\.css$/,
- loader: 'style-loader!css-loader',
- exclude: [/node_modules/],
- },
- {
- test: /\.(woff|woff2|eot|ttf|svg)$/,
- exclude: /node_modules/,
- loader: 'url-loader?name=fonts/[name].[ext]',
- }],
- },
- plugins: [
- new webpack.HotModuleReplacementPlugin(),
- ],
- devServer: {
- hot: true,
- open: true,
- port: 6123,
- openPage: 'test/dev.html',
- watchOptions: {
- poll: 1000,
- },
- },
- devtool: 'eval-source-map',
-};
diff --git a/api-ign-js/src/plugins/printviewmanagement/webpack-config/webpack.production.config.js b/api-ign-js/src/plugins/printviewmanagement/webpack-config/webpack.production.config.js
deleted file mode 100644
index ca242c558..000000000
--- a/api-ign-js/src/plugins/printviewmanagement/webpack-config/webpack.production.config.js
+++ /dev/null
@@ -1,91 +0,0 @@
-const path = require('path');
-const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
-const TerserPlugin = require('terser-webpack-plugin');
-const GenerateVersionPlugin = require('./GenerateVersionPlugin');
-const MiniCssExtractPlugin = require('mini-css-extract-plugin');
-const CopywebpackPlugin = require('copy-webpack-plugin');
-
-const PJSON_PATH = path.resolve(__dirname, '..', 'package.json');
-const pjson = require(PJSON_PATH);
-
-module.exports = {
- mode: 'production',
- entry: {
- 'printviewmanagement.ol.min': path.resolve(__dirname, '..', 'src', 'index.js'),
- [`printviewmanagement-${pjson.version}.ol.min`]: path.resolve(__dirname, '..', 'src', 'index.js'),
- },
- output: {
- path: path.resolve(__dirname, '..', 'dist'),
- filename: '[name].js',
- },
- resolve: {
- alias: {
- templates: path.resolve(__dirname, '../src/templates'),
- assets: path.resolve(__dirname, '../src/facade/assets'),
- impl: path.resolve(__dirname, '../src/impl/ol/js'),
- facade: path.resolve(__dirname, '../src/facade/js'),
- },
- extensions: ['.wasm', '.mjs', '.js', '.json', '.css', '.hbs', '.html'],
- },
- module: {
- rules: [{
- test: /\.js$/,
- exclude: /(node_modules\/(?!ol)|bower_components)/,
- use: {
- loader: 'babel-loader',
- options: {
- presets: ['@babel/preset-env'],
- },
- },
- },
- {
- test: /\.js$/,
- loader: 'eslint-loader',
- exclude: /node_modules/,
- },
- {
- test: [/\.hbs$/, /\.html$/],
- loader: 'html-loader',
- exclude: /node_modules/,
- },
- {
- test: /\.css$/,
- loader: MiniCssExtractPlugin.loader,
- exclude: /node_modules/,
- }, {
- test: /\.css$/,
- loader: 'css-loader',
- exclude: /node_modules/,
-
- },
- {
- test: /\.(woff|woff2|eot|ttf|svg)$/,
- exclude: /node_modules/,
- loader: 'url-loader?name=fonts/[name].[ext]',
- },
- ],
- },
- optimization: {
- noEmitOnErrors: true,
- minimizer: [
- new OptimizeCssAssetsPlugin(),
- new TerserPlugin({
- sourceMap: true,
- }),
- ],
- },
- plugins: [
- // new GenerateVersionPlugin({
- // version: pjson.version,
- // regex: /([A-Za-z]+)(\..*)/,
- // }),
- new MiniCssExtractPlugin({
- filename: '[name].css',
- }),
- new CopywebpackPlugin([{
- from: 'src/api.json',
- to: 'api.json',
- }]),
- ],
- devtool: 'source-map',
-};
diff --git a/api-ign-rest/src/main/webapp/data/plugins.json b/api-ign-rest/src/main/webapp/data/plugins.json
index 31dbe3481..ed4ee0964 100644
--- a/api-ign-rest/src/main/webapp/data/plugins.json
+++ b/api-ign-rest/src/main/webapp/data/plugins.json
@@ -482,16 +482,5 @@
"image": "img/api-logo.png",
"description": "Plugin que muestra una historia en forma de carrusel. Esta compuesta por diferentes steps en los cuales se ejecurán animaciones preconfiguradas.",
"obsolete": false
- },
- {
- "name": "printviewmanagement",
- "plugin": "[printviewmanagement]",
- "version": "v1.0",
- "url_es": "printviewmanagement.jsp?language=es",
- "url_en": "printviewmanagement.jsp?language=en",
- "url_git": "https://github.com/IGN-CNIG/API-CNIG/tree/master/api-ign-js/src/plugins/printviewmanagement",
- "image": "img/api-logo.png",
- "description": "Plugin que permite utilizar diferentes herramientas de impresión.",
- "obsolete": false
}
]
diff --git a/api-ign-rest/src/main/webapp/printviewmanagement.jsp b/api-ign-rest/src/main/webapp/printviewmanagement.jsp
deleted file mode 100644
index 0787c4dab..000000000
--- a/api-ign-rest/src/main/webapp/printviewmanagement.jsp
+++ /dev/null
@@ -1,249 +0,0 @@
-<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
-<%@ page import="es.cnig.mapea.plugins.PluginsManager"%>
-<%@ page import="es.cnig.mapea.parameter.adapter.ParametersAdapterV3ToV4"%>
-<%@ page import="java.util.Map"%>
-
-
-
-
-
-
-
-
-
- Visor base
-
-
-
-
- <%
- Map parameterMap = request.getParameterMap();
- PluginsManager.init (getServletContext());
- Map adaptedParams = ParametersAdapterV3ToV4.adapt(parameterMap);
- String[] cssfiles = PluginsManager.getCSSFiles(adaptedParams);
- for (int i = 0; i < cssfiles.length; i++) {
- String cssfile = cssfiles[i];
- %>
-
-
- <%
- } %>
-
-
-
-
- Selector de posición del plugin
-
- Arriba Izquierda (TL)
- Arriba Derecha (TR)
- Abajo Derecha (BR)
- Abajo Izquierda (BL)
-
- Selector collapsed
-
- true
- false
-
- Selector collapsible
-
- true
- false
-
- Parámetro Tooltip
-
- Parámetro isDraggable
-
-
- true
- false
-
-
- Parámetro defaultOpenControl
-
-
- Parámetro useProxy
-
-
- true
- false
-
-
-
- Parámetro order
-
- Parámetro serverUrl
-
- Parámetro printStatusUrl
-
-
- Parámetro georefImageEpsg
-
- Parámetro georefImage
-
- Parámetro printermap
-
-
-
-
-
-
-
-
-
-
- <%
- String[] jsfiles = PluginsManager.getJSFiles(adaptedParams);
- for (int i = 0; i < jsfiles.length; i++) {
- String jsfile = jsfiles[i];
- %>
-
-
- <%
- }
- %>
-
-
-
-
-
-
-
-