Package org.openstreetmap.josm.data.osm.history

Examples of org.openstreetmap.josm.data.osm.history.HistoryDataSet


        HistoryDataSet.getInstance().mergeInto(loadedData);
    }

    @Override
    protected void realRun() throws SAXException, IOException, OsmTransferException {
        loadedData = new HistoryDataSet();
        try {
            progressMonitor.setTicksCount(toLoad.size());
            for(PrimitiveId pid: toLoad) {
                if (canceled) {
                    break;
                }
                String msg = "";
                switch(pid.getType()) {
                case NODE: msg = marktr("Loading history for node {0}"); break;
                case WAY: msg = marktr("Loading history for way {0}"); break;
                case RELATION: msg = marktr("Loading history for relation {0}"); break;
                }
                progressMonitor.indeterminateSubTask(tr(msg,
                        Long.toString(pid.getUniqueId())));
                reader = null;
                HistoryDataSet ds = null;
                try {
                    reader = new OsmServerHistoryReader(pid.getType(), pid.getUniqueId());
                    ds = reader.parseHistory(progressMonitor.createSubTaskMonitor(1, false));
                    // load corresponding changesets (mostly for changeset comment)
                    for (final Changeset i : new OsmServerChangesetReader().queryChangesets(
                            new ChangesetQuery().forChangesetIds(ds.getChangesetIds()), progressMonitor.createSubTaskMonitor(1, false))) {
                        ds.putChangeset(i);
                    }
                } catch(OsmTransferException e) {
                    if (canceled)
                        return;
                    throw e;
View Full Code Here


     * @throws IllegalArgumentException if source is {@code null}.
     */
    public OsmHistoryReader(InputStream source) {
        CheckParameterUtil.ensureParameterNotNull(source, "source");
        this.in = source;
        this.data = new HistoryDataSet();
    }
View Full Code Here

        getContentPane().add(browser, BorderLayout.CENTER);
    }

    protected void populate(OsmPrimitiveType type, long id) {
        OsmServerHistoryReader reader = new OsmServerHistoryReader(type, id);
        HistoryDataSet ds = null;
        try {
            ds = reader.parseHistory(NullProgressMonitor.INSTANCE);
        } catch(OsmTransferException e) {
            Main.error(e);
            return;
        }
        History h = ds.getHistory(new SimplePrimitiveId(id, type));
        browser.populate(h);
    }
View Full Code Here

     * @throws OsmTransferException if any error occurs
     */
    @Test
    public void testNode() throws OsmTransferException {
        OsmServerHistoryReader reader = new OsmServerHistoryReader(OsmPrimitiveType.NODE, 266187);
        HistoryDataSet ds = reader.parseHistory(NullProgressMonitor.INSTANCE);
        History h = ds.getHistory(266187, OsmPrimitiveType.NODE);
        assertTrue("NumVersions", h.getNumVersions() >= 4);
    }
View Full Code Here

     * @throws OsmTransferException if any error occurs
     */
    @Test
    public void testWay() throws OsmTransferException {
        OsmServerHistoryReader reader = new OsmServerHistoryReader(OsmPrimitiveType.WAY, 3058844);
        HistoryDataSet ds = reader.parseHistory(NullProgressMonitor.INSTANCE);
        History h = ds.getHistory(3058844, OsmPrimitiveType.WAY);
        assertTrue("NumVersions", h.getNumVersions() >= 13);
    }
View Full Code Here

     * @throws OsmTransferException if any error occurs
     */
    @Test
    public void testRelation() throws OsmTransferException {
        OsmServerHistoryReader reader = new OsmServerHistoryReader(OsmPrimitiveType.RELATION, 49);
        HistoryDataSet ds = reader.parseHistory(NullProgressMonitor.INSTANCE);
        History h = ds.getHistory(49, OsmPrimitiveType.RELATION);
        assertTrue("NumVersions", h.getNumVersions() >= 3);
    }
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.data.osm.history.HistoryDataSet

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.