Changeset 32435 in osm for applications/editors/josm


Ignore:
Timestamp:
2016-06-29T03:06:46+02:00 (8 years ago)
Author:
darya
Message:

revert bad commit

Location:
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/actions/FixTask.java

    r32434 r32435  
    7373                                @Override
    7474                                public void run() {
    75                                         Main.main.getCurrentDataSet().beginUpdate();
     75                                        Main.getLayerManager().getEditDataSet().beginUpdate();
    7676                                }
    7777                        });
     
    8989                                        @Override
    9090                                        public void run() {
    91                                                 Main.main.getCurrentDataSet().endUpdate();
     91                                                Main.getLayerManager().getEditDataSet().endUpdate();
    9292                                        }
    9393                                });
     
    100100                                        Main.map.repaint();
    101101                                        // tree.resetErrors();
    102                                         Main.main.getCurrentDataSet().fireSelectionChanged();
     102                                        Main.getLayerManager().getEditDataSet().fireSelectionChanged();
    103103                                }
    104104                        });
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/gui/PTAssistantLayer.java

    r32434 r32435  
    11package org.openstreetmap.josm.plugins.pt_assistant.gui;
    22
    3 import java.awt.Graphics;
    43import java.awt.Graphics2D;
    54import java.awt.KeyboardFocusManager;
     
    3332
    3433        private List<OsmPrimitive> primitives = new ArrayList<>();
    35         private PTAssistantPaintVisitor paintVisitor;
    3634
    3735        public PTAssistantLayer() {
    3836                super("pt_assistant layer");
     37
    3938                 KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener(this);
    4039
     
    5251        public void paint(final Graphics2D g, final MapView mv, Bounds bounds) {
    5352
    54                 paintVisitor = new PTAssistantPaintVisitor(g, mv);
     53                PTAssistantPaintVisitor paintVisitor = new PTAssistantPaintVisitor(g, mv);
    5554                for (OsmPrimitive primitive : primitives) {
    5655                        paintVisitor.visit(primitive);
     
    104103        }
    105104
    106         /**
    107          * Listens to a selection change
    108          */
    109105        @Override
    110106        public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
     
    151147                               
    152148                                if (RouteUtils.isTwoDirectionRoute(relation)) {
    153 
    154149                                        this.primitives.clear();
    155150                                        this.primitives.add(relation);
     
    157152                                                Main.getLayerManager().addLayer(this);
    158153                                        }
    159                                         Graphics g = paintVisitor.getGraphics();
    160                                         paintVisitor = new PTAssistantPaintVisitor(g, Main.map.mapView);
    161                                         for (OsmPrimitive primitive : primitives) {
    162                                                 paintVisitor.visit(primitive);
    163 
    164                                         }
    165                                         Main.map.repaint();
     154//                                      Main.map.repaint();
    166155                                }
    167156
    168157                        }
     158
     159//                      System.out.println("focusedWindow: ");
     160//                      System.out.println("GET NEW VALUE: " + evt.getNewValue().getClass());
     161//                      System.out.println("");
    169162                }
    170163        }
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/gui/PTAssistantPaintVisitor.java

    r32434 r32435  
    22
    33import java.awt.Color;
    4 import java.awt.Font;
    54import java.awt.Graphics;
    65import java.awt.Point;
     
    3534                for (RelationMember rm : r.getMembers()) {
    3635                        if (RouteUtils.isPTStop(rm)) {
    37                                 String label = "";
    38                                 if (r.hasKey("ref")) {
    39                                         label = label + r.get("ref");
    40                                 } else if (r.hasKey("name")) {
    41                                         label = label + r.get("name");
    42                                 }
    43                                 label = label + "." + stopCount;
    44                                 drawStop(rm.getMember(), Color.BLUE, Color.BLACK,  label);
     36                                drawStop(rm.getMember(), Color.BLUE, Color.BLACK, (new Integer(stopCount)).toString());
    4537                                stopCount++;
    4638                        } else if (RouteUtils.isPTWay(rm)) {
     
    7062                                continue;
    7163                        }
    72                         drawSegment(lastN, n, new Color(208, 80, 208, 179));
     64                        drawSegment(lastN, n, Color.BLUE);
    7365                        lastN = n;
    7466                }
     
    10193
    10294                double t = Math.atan2((double) p2.x - p1.x, (double) p2.y - p1.y);
    103                 double cosT = 8 * Math.cos(t);
    104                 double sinT = 8 * Math.sin(t);
    105                
    106                
    107                 int[] xPoints = {(int)(p1.x+cosT), (int)(p2.x+cosT), (int)(p2.x-cosT), (int)(p1.x-cosT)};
    108                 int[] yPoints = {(int)(p1.y-sinT), (int)(p2.y-sinT), (int)(p2.y+sinT), (int)(p1.y+sinT)};
     95                double cosT = 5 * Math.cos(t);
     96                double sinT = 5 * Math.sin(t);
     97
    10998                g.setColor(color);
    110                 g.fillPolygon(xPoints, yPoints, 4);
    111                 g.fillOval((int)(p1.x-8), (int)(p1.y-8), 16, 16);
    112                 g.fillOval((int)(p2.x-8), (int)(p2.y-8), 16, 16);
    113                
    114 
    115 //              g.drawLine((int) (p1.x - cosT), (int) (p1.y - sinT), (int) (p2.x + cosT), (int) (p2.y - sinT));
    116 //              g.drawLine((int) (p1.x - cosT), (int) (p1.y + sinT), (int) (p2.x - cosT), (int) (p2.y + sinT));
     99                g.drawLine((int) (p1.x + cosT), (int) (p1.y - sinT), (int) (p2.x + cosT), (int) (p2.y - sinT));
     100                g.drawLine((int) (p1.x - cosT), (int) (p1.y + sinT), (int) (p2.x - cosT), (int) (p2.y + sinT));
    117101
    118102        }
     
    143127
    144128                g.setColor(fillColor);
     129                // g.drawRect(p.x-10, p.y-10, 20, 20);
    145130                g.fillOval(p.x - 5, p.y - 5, 10, 10);
    146131                g.setColor(outlineColor);
     
    148133
    149134                g.setColor(Color.WHITE);
    150                 Font stringFont = new Font( "SansSerif", Font.PLAIN, 18 );
    151                 g.setFont(stringFont);
    152135                g.drawString(label, p.x - 20, p.y - 20);
    153136        }
    154        
    155         protected Graphics getGraphics() {
    156                 return this.g;
    157         }
    158        
    159137}
Note: See TracChangeset for help on using the changeset viewer.