Package org.openstreetmap.josm.data.osm

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


            TreePath [] selection = childTree.getSelectionPaths();
            if (selection == null || selection.length == 0) return;
            // do not launch more than 10 relation editors in parallel
            //
            for (int i=0; i < Math.min(selection.length,10);i++) {
                Relation r = (Relation)selection[i].getLastPathComponent();
                if (r.isIncomplete()) {
                    continue;
                }
                RelationEditor editor = RelationEditor.getEditor(getLayer(), r, null);
                editor.setVisible(true);
            }
View Full Code Here


            OsmApi.getOsmApi().cancel();
        }

        protected void refreshView(Relation relation){
            for (int i=0; i < childTree.getRowCount(); i++) {
                Relation reference = (Relation)childTree.getPathForRow(i).getLastPathComponent();
                if (reference == relation) {
                    model.refreshNode(childTree.getPathForRow(i));
                }
            }
        }
View Full Code Here

         */
        protected void rememberChildRelationsToDownload(Relation parent) {
            downloadedRelationIds.add(parent.getId());
            for (RelationMember member: parent.getMembers()) {
                if (member.isRelation()) {
                    Relation child = member.getRelation();
                    if (!downloadedRelationIds.contains(child.getId())) {
                        relationsToDownload.push(child);
                    }
                }
            }
        }
View Full Code Here

        @Override
        protected void realRun() throws SAXException, IOException, OsmTransferException {
            try {
                while(! relationsToDownload.isEmpty() && !canceled) {
                    Relation r = relationsToDownload.pop();
                    if (r.isNew()) {
                        continue;
                    }
                    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));
View Full Code Here

        @Override
        protected void realRun() throws SAXException, IOException, OsmTransferException {
            try {
                Iterator<Relation> it = relations.iterator();
                while(it.hasNext() && !canceled) {
                    Relation r = it.next();
                    if (r.isNew()) {
                        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);
View Full Code Here

        }

        @Override
        public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
            TreePath path  = event.getPath();
            Relation parent = (Relation)event.getPath().getLastPathComponent();
            if (! parent.isIncomplete() || parent.isNew())
                // we don't load complete  or new relations
                return;
            // launch the download task
            //
            Main.worker.submit(new RelationLoader(getParentDialog(),parent, path));
View Full Code Here

     *
     * @param members a list of members
     */
    public RelationTreeModel(List<RelationMember> members) {
        if (members == null) return;
        Relation root = new Relation();
        root.setMembers(members);
        this.root = root;
        listeners = new CopyOnWriteArrayList<>();
    }
View Full Code Here

     * @see #populate(List)
     *
     */
    public void populate(Relation root) {
        if (root == null) {
            root = new Relation();
        }
        this.root = root;
        fireRootReplacedEvent();
    }
View Full Code Here

     *
     * @param members the relation members
     */
    public void populate(List<RelationMember> members) {
        if (members == null) return;
        Relation r = new Relation();
        r.setMembers(members);
        this.root = r;
        fireRootReplacedEvent();
    }
View Full Code Here

        return root;
    }

    @Override
    public boolean isLeaf(Object node) {
        Relation r = (Relation)node;
        if (r.isIncomplete()) return false;
        return getNumRelationChildren(r) == 0;
    }
View Full Code Here

TOP

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

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.