Changeset 33811 in osm


Ignore:
Timestamp:
2017-11-17T00:34:11+01:00 (7 years ago)
Author:
donvip
Message:

update to JOSM 12840

Location:
applications/editors/josm/plugins/CustomizePublicTransportStop
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/CustomizePublicTransportStop/build.properties

    r32441 r33811  
    1414# the lowest JOSM version the curent plugin version is compatible with
    1515#
    16 josm.required.version=10353
     16josm.required.version=12840
    1717
    1818# the full path to the JOSM jar against which this plugin is built
  • applications/editors/josm/plugins/CustomizePublicTransportStop/src/ru/rodsoft/openstreetmap/josm/plugins/customizepublictransportstop/CreateNewStopPointOperation.java

    r32840 r33811  
    1919import org.openstreetmap.josm.data.osm.Way;
    2020import org.openstreetmap.josm.data.osm.WaySegment;
    21 import org.openstreetmap.josm.data.projection.Projections;
     21import org.openstreetmap.josm.gui.MainApplication;
     22import org.openstreetmap.josm.gui.MapView;
    2223import org.openstreetmap.josm.tools.Geometry;
    23 
    24 import ru.rodsoft.openstreetmap.josm.plugins.customizepublictransportstop.OSMTags;
    2524
    2625/**
     
    6059
    6160            for (Node n : ds.searchNodes(getBBox(p, 200))) {
    62                 if ((dist = Main.map.mapView.getPoint2D(n).distanceSq(p)) < snapDistanceSq)
     61                if ((dist = MainApplication.getMap().mapView.getPoint2D(n).distanceSq(p)) < snapDistanceSq)
    6362                {
    6463                    List<Node> nlist;
     
    8483     */
    8584    private BBox getBBox(Point p, int snapDistance) {
    86         return new BBox(Main.map.mapView.getLatLon(p.x - snapDistance, p.y - snapDistance),
    87                         Main.map.mapView.getLatLon(p.x + snapDistance, p.y + snapDistance));
     85        MapView mapView = MainApplication.getMap().mapView;
     86        return new BBox(mapView.getLatLon(p.x - snapDistance, p.y - snapDistance),
     87                                mapView.getLatLon(p.x + snapDistance, p.y + snapDistance));
    8888    }
    8989
     
    9696    public AbstractMap.SimpleEntry<Double, Node> getNearestNode(LatLon platformCoord, StopArea stopArea)
    9797    {
    98         Point p = Main.map.mapView.getPoint(platformCoord);
     98        Point p = MainApplication.getMap().mapView.getPoint(platformCoord);
    9999        Map<Double, List<Node>> dist_nodes = getNearestNodesImpl(p);
    100100        Double[] distances = dist_nodes.keySet().toArray(new Double[0]);
     
    196196
    197197        if (ds != null) {
    198             double snapDistanceSq = Main.pref.getInteger("mappaint.segment.snap-distance", 200);
     198            double snapDistanceSq = Main.pref.getInt("mappaint.segment.snap-distance", 200);
    199199            snapDistanceSq *= snapDistanceSq;
    200200
    201             for (Way w : ds.searchWays(getBBox(p, Main.pref.getInteger("mappaint.segment.snap-distance", 200)))) {
     201            for (Way w : ds.searchWays(getBBox(p, Main.pref.getInt("mappaint.segment.snap-distance", 200)))) {
    202202                Node lastN = null;
    203203                int i = -2;
     
    212212                    }
    213213
    214                     Point2D A = Main.map.mapView.getPoint2D(lastN);
    215                     Point2D B = Main.map.mapView.getPoint2D(n);
     214                    Point2D A = MainApplication.getMap().mapView.getPoint2D(lastN);
     215                    Point2D B = MainApplication.getMap().mapView.getPoint2D(n);
    216216                    double c = A.distanceSq(B);
    217217                    double a = p.distanceSq(B);
     
    254254    protected NearestWaySegment getNearestWaySegment(LatLon platformCoord, StopArea stopArea)
    255255    {
    256        
    257         Point p = Main.map.mapView.getPoint(platformCoord);
     256        MapView mapView = MainApplication.getMap().mapView;
     257        Point p = mapView.getPoint(platformCoord);
    258258        Map<Double, List<WaySegment>> dist_waySegments = getNearestWaySegmentsImpl(p);
    259259        for(Map.Entry<Double, List<WaySegment>> entry : dist_waySegments.entrySet())
     
    267267               
    268268                        EastNorth newPosition = Geometry.closestPointToSegment(n.getEastNorth(),
    269                                  lastN.getEastNorth(), Projections.project(platformCoord));
    270                         LatLon newNodePosition = Projections.inverseProject(newPosition);
    271                         Point2D lastN2D = Main.map.mapView.getPoint2D(lastN);
    272                         Point2D n2D = Main.map.mapView.getPoint2D(n);
    273                         Point2D newNodePosition2D = Main.map.mapView.getPoint2D(newNodePosition);
     269                                 lastN.getEastNorth(), Main.getProjection().latlon2eastNorth(platformCoord));
     270                        LatLon newNodePosition = Main.getProjection().eastNorth2latlon(newPosition);
     271                        Point2D lastN2D = mapView.getPoint2D(lastN);
     272                        Point2D n2D = mapView.getPoint2D(n);
     273                        Point2D newNodePosition2D = mapView.getPoint2D(newNodePosition);
    274274                        Double distCurrenNodes =lastN2D.distance(n2D);
    275275                        if((newNodePosition2D.distance(lastN2D) < distCurrenNodes) && (newNodePosition2D.distance(n2D) < distCurrenNodes))
     
    291291    protected Node createNodeOnWay(Node newStopNode, WaySegment waySegment)
    292292    {
    293         Main.main.undoRedo.add(new AddCommand(newStopNode));
     293        Main.main.undoRedo.add(new AddCommand(MainApplication.getLayerManager().getEditDataSet(), newStopNode));
    294294        List<Node> wayNodes = waySegment.way.getNodes();
    295295        wayNodes.add(waySegment.lowerIndex + 1, newStopNode);
     
    321321                if(nearestNode != null && nearestWaySegment != null)
    322322                {
    323                         Double segmentDist = Main.map.mapView.getPoint2D(platformCoord).distanceSq(Main.map.mapView.getPoint2D(nearestWaySegment.newNode));
     323                    MapView mapView = MainApplication.getMap().mapView;
     324                        Double segmentDist = mapView.getPoint2D(platformCoord).distanceSq(mapView.getPoint2D(nearestWaySegment.newNode));
    324325                        Double nodeDistSq =  nearestNode.getKey();
    325326//                      nodeDistSq *= nodeDistSq - 2;
  • applications/editors/josm/plugins/CustomizePublicTransportStop/src/ru/rodsoft/openstreetmap/josm/plugins/customizepublictransportstop/CustomizePublicTransportStopPlugin.java

    r32048 r33811  
    11package ru.rodsoft.openstreetmap.josm.plugins.customizepublictransportstop;
    22
    3 import org.openstreetmap.josm.Main;
     3import org.openstreetmap.josm.gui.MainApplication;
    44import org.openstreetmap.josm.plugins.Plugin;
    55import org.openstreetmap.josm.plugins.PluginInformation;
     
    2525        super(info);
    2626        stopAreaCreatorAction = CustomizeStopAction.createCustomizeStopAction();
    27         Main.main.menu.toolsMenu.add(stopAreaCreatorAction);
    28         System.out.println(getPluginDir());
     27        MainApplication.getMenu().toolsMenu.add(stopAreaCreatorAction);
    2928    }
    3029   
  • applications/editors/josm/plugins/CustomizePublicTransportStop/src/ru/rodsoft/openstreetmap/josm/plugins/customizepublictransportstop/CustomizeStopAreaOperation.java

    r32840 r33811  
    1919import org.openstreetmap.josm.data.osm.RelationMember;
    2020import org.openstreetmap.josm.data.osm.Way;
     21import org.openstreetmap.josm.gui.MainApplication;
    2122
    2223/**
     
    274275                        newRelation.addMember(new RelationMember("", otherMember));
    275276                }
    276                 Main.main.undoRedo.add(new AddCommand(newRelation));
     277                Main.main.undoRedo.add(new AddCommand(MainApplication.getLayerManager().getEditDataSet(), newRelation));
    277278                commands = generalTagAssign(newRelation, commands, stopArea);
    278279                commands = assignTag(commands, newRelation, OSMTags.TYPE_TAG, OSMTags.PUBLIC_TRANSPORT_TAG);
     
    485486                                Node newNode =new Node();
    486487                                newNode.setCoor(centerOfPlatform);
    487                         Main.main.undoRedo.add(new AddCommand(newNode));
     488                        Main.main.undoRedo.add(new AddCommand(MainApplication.getLayerManager().getEditDataSet(), newNode));
    488489                        Main.main.undoRedo.add(new ChangePropertyCommand(newNode, tag, tagValue));
    489490                                commands = assignTag(commands, newNode, tag, tagValue);
Note: See TracChangeset for help on using the changeset viewer.