Package org.openstreetmap.josm.data.osm

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


        return setHighlight(p, flag, new HashSet<Relation>());
    }

    private boolean setHighlight(OsmPrimitive p, boolean flag, Set<Relation> seenRelations) {
        if (p instanceof Relation) {
            Relation r = (Relation) p;
            seenRelations.add(r);
            boolean needRepaint = false;
            for (OsmPrimitive m : r.getMemberPrimitives()) {
                if (!(m instanceof Relation) || !seenRelations.contains(m)) {
                    needRepaint |= setHighlight(m, flag, seenRelations);
                }
            }
            return needRepaint;
View Full Code Here


        return embeddInScrollPane(theirEntriesTable);
    }

    @Override
    public void populate(Conflict<? extends OsmPrimitive> conflict) {
        Relation myRel = (Relation)conflict.getMy();
        Relation theirRel = (Relation)conflict.getTheir();
        ((RelationMemberListMergeModel)model).populate(myRel, theirRel, conflict.getMergedMap());
        myEntriesTable.setLayer(findLayerFor(myRel));
        theirEntriesTable.setLayer(findLayerFor(theirRel));
    }
View Full Code Here

    @Override
    public void actionPerformed(ActionEvent e) {
        if (!isEnabled() || relations.isEmpty())
            return;
        Relation r = relations.iterator().next();
        duplicateRelationAndLaunchEditor(r);
    }
View Full Code Here

        final Map<Relation, Integer> numberOfKeepResolutions = new HashMap<>();
        final MultiMap<OsmPrimitive, Relation> resolvedRelationsPerPrimitive = new MultiMap<>();

        for (int i = 0; i < model.getNumDecisions(); i++) {
            final RelationMemberConflictDecision decision = model.getDecision(i);
            final Relation r = decision.getRelation();
            final OsmPrimitive p = decision.getOriginalPrimitive();
            if (!numberOfKeepResolutions.containsKey(r)) {
                decision.decide(RelationMemberConflictDecisionType.KEEP);
                numberOfKeepResolutions.put(r, 1);
                resolvedRelationsPerPrimitive.put(p, r);
View Full Code Here

            updateEnabledState();
        }

        @Override
        public void run() {
            Relation relation = new Relation();
            model.applyToPrimitive(relation);
           
            String buf = Utils.getClipboardContent();
            if (buf == null || buf.isEmpty() || buf.matches(CopyAction.CLIPBOARD_REGEXP)) {
                List<PrimitiveData> directlyAdded = Main.pasteBuffer.getDirectlyAdded();
View Full Code Here

        }
        return null;
    }

    protected Command buildResolveCommand(Relation relation, OsmPrimitive newPrimitive) {
        final Relation modifiedRelation = new Relation(relation);
        modifiedRelation.setMembers(null);
        boolean isChanged = false;
        for (int i=0; i < relation.getMembersCount(); i++) {
            final RelationMember member = relation.getMember(i);
            RelationMemberConflictDecision decision = getDecision(relation, i);
            if (decision == null) {
                modifiedRelation.addMember(member);
            } else {
                switch(decision.getDecision()) {
                case KEEP:
                    final RelationMember newMember = new RelationMember(decision.getRole(),newPrimitive);
                    modifiedRelation.addMember(newMember);
                    isChanged |= ! member.equals(newMember);
                    break;
                case REMOVE:
                    isChanged = true;
                    // do nothing
View Full Code Here

     * state of the relation. See {@link #getRelationSnapshot()}
     *
     * @param relation the relation
     */
    protected void setRelation(Relation relation) {
        setRelationSnapshot((relation == null) ? null : new Relation(relation));
        Relation oldValue = this.relation;
        this.relation = relation;
        if (this.relation != oldValue) {
            support.firePropertyChange(RELATION_PROP, oldValue, this.relation);
        }
        updateTitle();
View Full Code Here

    protected Relation getRelationSnapshot() {
        return relationSnapshot;
    }

    protected void setRelationSnapshot(Relation snapshot) {
        Relation oldValue = relationSnapshot;
        relationSnapshot = snapshot;
        if (relationSnapshot != oldValue) {
            support.firePropertyChange(RELATION_SNAPSHOT_PROP, oldValue, relationSnapshot);
        }
    }
View Full Code Here

     * @param relation the relation
     * @param editor the editor
     */
    public void register(OsmDataLayer layer, Relation relation, RelationEditor editor) {
        if (relation == null) {
            relation = new Relation();
        }
        DialogContext context = new DialogContext(layer, relation);
        openDialogs.put(context, editor);
        editor.addWindowListener(this);
    }
View Full Code Here

        }
    }

    @Override
    public void relationMembersChanged(RelationMembersChangedEvent event) {
        Relation r = event.getRelation();
        if (!r.isNew() && r.getId() == history.getId()) {
            setLatest(new HistoryPrimitiveBuilder().build(r));
        }
    }
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.