1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.preferences.imagery;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import javax.swing.JLabel;
|
---|
7 |
|
---|
8 | import org.openstreetmap.josm.data.imagery.ImageryInfo;
|
---|
9 | import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
|
---|
10 | import org.openstreetmap.josm.tools.GBC;
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * Panel for adding WMTS imagery sources
|
---|
14 | * @author Wiktor Niesiobędzki
|
---|
15 | *
|
---|
16 | */
|
---|
17 | public class AddWMTSLayerPanel extends AddImageryPanel {
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * default constructor
|
---|
21 | */
|
---|
22 | public AddWMTSLayerPanel() {
|
---|
23 | add(new JLabel(tr("1. Enter getCapabilities URL")), GBC.eol());
|
---|
24 | add(rawUrl, GBC.eop().fill());
|
---|
25 | rawUrl.setLineWrap(true);
|
---|
26 | rawUrl.setAlignmentY(TOP_ALIGNMENT);
|
---|
27 | add(new JLabel(tr("2. Enter name for this layer")), GBC.eol());
|
---|
28 | add(name, GBC.eol().fill(GBC.HORIZONTAL));
|
---|
29 | registerValidableComponent(rawUrl);
|
---|
30 | }
|
---|
31 |
|
---|
32 | @Override
|
---|
33 | protected ImageryInfo getImageryInfo() {
|
---|
34 | return new ImageryInfo(getImageryName(), "wmts:" + sanitize(getImageryRawUrl(), ImageryType.WMTS));
|
---|
35 | }
|
---|
36 |
|
---|
37 | @Override
|
---|
38 | protected boolean isImageryValid() {
|
---|
39 | return !getImageryName().isEmpty() && !getImageryRawUrl().isEmpty();
|
---|
40 | }
|
---|
41 |
|
---|
42 | }
|
---|