Package org.openstreetmap.josm.data.osm

Examples of org.openstreetmap.josm.data.osm.DataSet


                    }
                    rememberChildRelationsToDownload(r);
                    progressMonitor.setCustomText(tr("Downloading relation {0}", r.getDisplayName(DefaultNameFormatter.getInstance())));
                    OsmServerObjectReader reader = new OsmServerObjectReader(r.getId(), OsmPrimitiveType.RELATION,
                            true);
                    DataSet dataSet = null;
                    try {
                        dataSet = reader.parseOsm(progressMonitor
                                .createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));
                    } catch(OsmApiException e) {
                        if (e.getResponseCode() == HttpURLConnection.HTTP_GONE) {
View Full Code Here


                        continue;
                    }
                    progressMonitor.setCustomText(tr("Downloading relation {0}", r.getDisplayName(DefaultNameFormatter.getInstance())));
                    OsmServerObjectReader reader = new OsmServerObjectReader(r.getId(), OsmPrimitiveType.RELATION,
                            true);
                    DataSet dataSet = reader.parseOsm(progressMonitor
                            .createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));
                    mergeDataSet(dataSet);
                    refreshView(r);
                }
            } catch (Exception e) {
View Full Code Here

    }

    @Override
    protected void realRun() throws SAXException, IOException, OsmTransferException {
        try {
            final DataSet allDownloads = new DataSet();
            int i=0;
            getProgressMonitor().setTicksCount(relations.size());
            for (Relation relation: relations) {
                i++;
                getProgressMonitor().setCustomText(tr("({0}/{1}): Downloading relation ''{2}''...", i,relations.size(),relation.getDisplayName(DefaultNameFormatter.getInstance())));
                synchronized (this) {
                    if (canceled) return;
                    objectReader = new OsmServerObjectReader(relation.getPrimitiveId(), true /* full download */);
                }
                DataSet dataSet = objectReader.parseOsm(
                        getProgressMonitor().createSubTaskMonitor(0, false)
                );
                if (dataSet == null)
                    return;
                synchronized (this) {
View Full Code Here

        if (!needsRepaint && !drawTargetHighlight)
            return false;

        // update selection to reflect which way being modified
        DataSet currentDataSet = getCurrentDataSet();
        if (currentBaseNode != null && currentDataSet != null && !currentDataSet.getSelected().isEmpty()) {
            Way continueFrom = getWayForNode(currentBaseNode);
            if (alt && continueFrom != null && (!currentBaseNode.isSelected() || continueFrom.isSelected())) {
                addRemoveSelection(currentDataSet, currentBaseNode, continueFrom);
                needsRepaint = true;
            } else if (!alt && continueFrom != null && !continueFrom.isSelected()) {
                currentDataSet.addSelected(continueFrom);
                needsRepaint = true;
            }
        }

        if(needsRepaint) {
View Full Code Here

        Main.map.keyDetector.removeModifierListener(this);

        // when exiting we let everybody know about the currently selected
        // primitives
        //
        DataSet ds = getCurrentDataSet();
        if(ds != null) {
            ds.fireSelectionChanged();
        }
    }
View Full Code Here

        // keyDetector didn't make it through the security manager. Unclear
        // if that can ever happen but better be safe.
        updateKeyModifiers(e);
        mousePos = e.getPoint();

        DataSet ds = getCurrentDataSet();
        Collection<OsmPrimitive> selection = new ArrayList<>(ds.getSelected());
        Collection<Command> cmds = new LinkedList<>();
        Collection<OsmPrimitive> newSelection = new LinkedList<>(ds.getSelected());

        List<Way> reuseWays = new ArrayList<>(),
                replacedWays = new ArrayList<>();
        boolean newNode = false;
        Node n = null;
View Full Code Here

     * For this case, this method returns the current way as selection,
     * to work around this issue.
     * Otherwise the normal selection of the current data layer is returned.
     */
    public Collection<OsmPrimitive> getInProgressSelection() {
        DataSet ds = getCurrentDataSet();
        if (ds == null) return null;
        if (currentBaseNode != null && !ds.getSelected().isEmpty()) {
            Way continueFrom = getWayForNode(currentBaseNode);
            if (continueFrom != null)
                return Collections.<OsmPrimitive>singleton(continueFrom);
        }
        return ds.getSelected();
    }
View Full Code Here

    /**
     * Slow method to import all currently highlighted primitives into this instance
     */
    public void findAllHighlighted() {
        DataSet ds = Main.main.getCurrentDataSet();
        if (ds!=null) {
            highlightedPrimitives.addAll( ds.allNonDeletedPrimitives() );
        }
    }
View Full Code Here

    /**
     * Slow method to remove highlights from all primitives
     */
    public static void clearAllHighlighted() {
        DataSet ds = Main.main.getCurrentDataSet();
        if (ds!=null) {
            for (OsmPrimitive p: ds.allNonDeletedPrimitives()) {
                p.setHighlighted(false);
            }
        }
    }
View Full Code Here

    }

    @Override
    public void showNotify() {
        DataSet.addSelectionListener(this);
        DataSet ds = Main.main.getCurrentDataSet();
        if (ds != null) {
            updateSelection(ds.getAllSelected());
        }
        MapView.addLayerChangeListener(this);
        Layer activeLayer = Main.map.mapView.getActiveLayer();
        if (activeLayer != null) {
            activeLayerChange(null, activeLayer);
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.data.osm.DataSet

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.