You are not logged in.

Announcement

*** NOTICE: forum.openstreetmap.org is being retired. Please request a category for your community in the new ones as soon as possible using this process, which will allow you to propose your community moderators.
Please create new topics on the new site at community.openstreetmap.org. We expect the migration of data will take a few weeks, you can follow its progress here.***

#1 2013-10-30 19:53:22

erwin6330
Member
From: A-Kufstein
Registered: 2011-08-18
Posts: 395

Suche bestimmte Funktion in SourceCode

Guten Abend,

zuerst nochmals vielen Dank für die Hilfe in diesem Post

http://forum.openstreetmap.org/viewtopic.php?id=23053

Ich suche eine bestimmte Codepassage in der festgestellt wird, ob ein way beendet wird, entweder per Doppelclick im Zeichenmodus auf den selben Node oder durch das Schließen eines Kreises/Area auf einen bereits vorhandenen Node im way.

Ich weiß, es gibt die Codepassagen, aber ich kann sie nicht mehr finden.

Ich habe ant inzwischen zum laufen gebracht, dank Eurer Hilfe im obigen Post und mein erstes josm-custom.jar kompiliert, bin mächtig stolz. big_smile
Subversion habe ich mir auch besorgt, läuft einwandfrei, aber eben finde ich den Code nicht mehr, ich hatte ihn schon. sad

Wer kann mir da bitte helfen, sitze nun seit fast 2 Stunden und gebe für´s erst Mal auf, hoffe auf Hilfe.

Danke im voraus, bisher habe ich immer kompetente Antworten erhalten.


Erwin6330 aus Kufstein - Happy Mapping

Offline

#2 2013-10-30 21:03:47

couchmapper
Member
Registered: 2013-02-17
Posts: 462

Re: Suche bestimmte Funktion in SourceCode

Hallo,

wie wär's denn mit org.openstreetmap.josm.actions.mapmode.DrawAction, dort steht was von

        if(e.getClickCount() > 1 && mousePos != null && mousePos.equals(oldMouse
Pos)) {
            // A double click equals "user clicked last node again, finish way"
            // Change draw tool only if mouse position is nearly the same, as
            // otherwise fast clicks will count as a double click
            finishDrawing();
            return;
        }

Offline

#3 2013-10-31 08:03:27

erwin6330
Member
From: A-Kufstein
Registered: 2011-08-18
Posts: 395

Re: Suche bestimmte Funktion in SourceCode

Morgen,

ich habe es wieder zusammengefunden big_smile

Einmal wird, wie von couchmapper genannt, org.openstreetmap.josm.actions.mapmode.DrawAction benötigt, siehe Zeile 595 ff, hier wird beim zeichnen überprüft, ob der Weg beendet wird:

 // Connected to a node that's already in the way
              if(way.containsNode(n)) {
                  wayIsFinished = true;
                  selection.clear();
              }

Jetzt brauche ich noch die Überprüfung, ob es eine Area ist, gefunden in org.openstreetmap.josm.data.osm.Way, siehe Zeile 497 ff

    /**
     * Determines if this way denotes an area (closed way with at least three distinct nodes).
     * @return {@code true} if this way is closed and contains at least three distinct nodes
     * @see #isClosed
     * @since 5490
     */
    public boolean isArea() {
        if (this.nodes.length >= 4 && isClosed()) {
            Node distinctNode = null;
            for (int i=1; i<nodes.length-1; i++) {
                if (distinctNode == null && nodes[i] != nodes[0]) {
                    distinctNode = nodes[i];
                } else if (distinctNode != null && nodes[i] != nodes[0] && nodes[i] != distinctNode) {
                    return true;
                }
            }
        }
        return false;
    }

Wunderbar, jetzt kann ich weitermachen.

Schönen Feiertag und schönes Wochenende


Erwin6330 aus Kufstein - Happy Mapping

Offline

Board footer

Powered by FluxBB