Package org.openstreetmap.josm.data.imagery

Examples of org.openstreetmap.josm.data.imagery.ImageryInfo$ImageryPreferenceEntry


                    newState = State.IMAGERY;
                }
                break;
            case IMAGERY:
                if ("entry".equals(qName)) {
                    entry = new ImageryInfo();
                    skipEntry = false;
                    newState = State.ENTRY;
                }
                break;
            case ENTRY:
View Full Code Here


    @Override
    public void actionPerformed(ActionEvent e) {
        if (!isEnabled()) return;
        try {
            final ImageryInfo infoToAdd = ImageryType.WMS_ENDPOINT.equals(info.getImageryType())
                    ? getWMSLayerInfo() : info;
            if (infoToAdd != null) {
                Main.main.addLayer(ImageryLayer.create(infoToAdd));
                AlignImageryPanel.addNagPanelIfNeeded();
            }
View Full Code Here

                return null;
            }

            final String url = wms.buildGetMapUrl(
                    tree.getSelectedLayers(), (String) formats.getSelectedItem());
            return new ImageryInfo(info.getName(), url, "wms", info.getEulaAcceptanceRequired(), info.getCookies());
        } // exception handling from AddWMSLayerPanel.java
        catch (MalformedURLException ex) {
            JOptionPane.showMessageDialog(Main.parent, tr("Invalid service URL."),
                    tr("WMS Error"), JOptionPane.ERROR_MESSAGE);
        } catch (IOException ex) {
View Full Code Here

        return format != null && (format.startsWith("image/png") || format.startsWith("image/gif")
                || format.startsWith("image/svg") || format.startsWith("image/tiff"));
    }

    public ImageryInfo toImageryInfo(String name, Collection<LayerDetails> selectedLayers) {
        ImageryInfo i = new ImageryInfo(name, buildGetMapUrl(selectedLayers));
        if (selectedLayers != null) {
            HashSet<String> proj = new HashSet<>();
            for (WMSImagery.LayerDetails l : selectedLayers) {
                proj.addAll(l.getProjections());
            }
            i.setServerProjections(proj);
        }
        return i;
    }
View Full Code Here

                Element e = (Element) node;
                attributes.put(e.getTagName(), e.getTextContent());
            }
        }
        ImageryPreferenceEntry prefEntry = Preferences.deserializeStruct(attributes, ImageryPreferenceEntry.class);
        ImageryInfo i = new ImageryInfo(prefEntry);
        return ImageryLayer.create(i);
    }
View Full Code Here

        String type = args.get("type");
        if ((title == null) || (title.isEmpty())) {
            title = tr("Remote imagery");
        }
        String cookies = args.get("cookies");
        final ImageryInfo imgInfo = new ImageryInfo(title, url, type, null, cookies);
        String min_zoom = args.get("min_zoom");
        if (min_zoom != null && !min_zoom.isEmpty()) {
            try {
                imgInfo.setDefaultMinZoom(Integer.parseInt(min_zoom));
            } catch (NumberFormatException e) {
                Main.error(e);
            }
        }
        String max_zoom = args.get("max_zoom");
        if (max_zoom != null && !max_zoom.isEmpty()) {
            try {
                imgInfo.setDefaultMaxZoom(Integer.parseInt(max_zoom));
            } catch (NumberFormatException e) {
                Main.error(e);
            }
        }
        GuiHelper.runInEDT(new Runnable() {
View Full Code Here

    @Override
    protected void validateRequest() throws RequestHandlerBadRequestException {
        String url = args.get("url");
        String type = args.get("type");
        try {
            ImageryLayer.create(new ImageryInfo(null, url, type, null, null));
        } catch (IllegalArgumentException e) {
            throw new RequestHandlerBadRequestException(e.getMessage(), e);
        }
    }
View Full Code Here

                Set<String> acceptedEulas = new HashSet<>();

                outer:
                for (int line : lines) {
                    ImageryInfo info = defaultModel.getRow(line);

                    // Check if an entry with exactly the same values already exists
                    for (int j = 0; j < activeModel.getRowCount(); j++) {
                        if (info.equalsBaseValues(activeModel.getRow(j))) {
                            // Select the already existing row so the user has
                            // some feedback in case an entry exists
                            activeTable.getSelectionModel().setSelectionInterval(j, j);
                            activeTable.scrollRectToVisible(activeTable.getCellRect(j, 0, true));
                            continue outer;
                        }
                    }

                    String eulaURL = info.getEulaAcceptanceRequired();
                    // If set and not already accepted, ask for EULA acceptance
                    if (eulaURL != null && !acceptedEulas.contains(eulaURL)) {
                        if (confirmEulaAcceptance(gui, eulaURL)) {
                            acceptedEulas.add(eulaURL);
                        } else {
                            continue outer;
                        }
                    }

                    activeModel.addRow(new ImageryInfo(info));
                    int lastLine = activeModel.getRowCount() - 1;
                    activeTable.getSelectionModel().setSelectionInterval(lastLine, lastLine);
                    activeTable.scrollRectToVisible(activeTable.getCellRect(lastLine, 0, true));
                }
            }
View Full Code Here

                return layerInfo.getLayers().size();
            }

            @Override
            public Object getValueAt(int row, int column) {
                ImageryInfo info = layerInfo.getLayers().get(row);
                switch (column) {
                case 0:
                    return info.getName();
                case 1:
                    return info.getExtendedUrl();
                default:
                    throw new ArrayIndexOutOfBoundsException();
                }
            }
View Full Code Here

            }

            @Override
            public void setValueAt(Object o, int row, int column) {
                if (layerInfo.getLayers().size() <= row) return;
                ImageryInfo info = layerInfo.getLayers().get(row);
                switch (column) {
                case 0:
                    info.setName((String) o);
                    info.clearId();
                    break;
                case 1:
                    info.setExtendedUrl((String)o);
                    info.clearId();
                    break;
                default:
                    throw new ArrayIndexOutOfBoundsException();
                }
            }
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.data.imagery.ImageryInfo$ImageryPreferenceEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.