Changeset 34477 in osm


Ignore:
Timestamp:
2018-08-15T13:48:45+02:00 (6 years ago)
Author:
donvip
Message:

cleanup routes plugin

Location:
applications/editors/josm/plugins/routes
Files:
9 added
7 deleted
13 edited
2 moved

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/routes

    • Property svn:ignore
      •  

        old new  
        11build
        2 
        32bin
         3javadoc
  • applications/editors/josm/plugins/routes/.classpath

    r32680 r34477  
    22<classpath>
    33        <classpathentry kind="src" path="src"/>
     4        <classpathentry kind="src" path="resources"/>
    45        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
    56        <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
  • applications/editors/josm/plugins/routes/.project

    r32286 r34477  
    1616                        </arguments>
    1717                </buildCommand>
     18                <buildCommand>
     19                        <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
     20                        <arguments>
     21                        </arguments>
     22                </buildCommand>
    1823        </buildSpec>
    1924        <natures>
    2025                <nature>org.eclipse.jdt.core.javanature</nature>
     26                <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
    2127        </natures>
    2228</projectDescription>
  • applications/editors/josm/plugins/routes/build.xml

    r34038 r34477  
    11<?xml version="1.0" encoding="utf-8"?>
    22<project name="routes" default="dist" basedir=".">
     3    <!-- enter the SVN commit message -->
    34    <property name="commit.message" value="Changed the constructor signature of the plugin main class"/>
    4     <property name="plugin.main.version" value="13007"/>
    5     <property name="josm" location="../../core/dist/josm-custom.jar"/>
    6     <property name="plugin.dist.dir" value="../../dist"/>
    7     <property name="plugin.build.dir" value="build"/>
    8     <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
    9     <property name="ant.build.javac.target" value="1.8"/>
    10     <target name="init">
    11         <mkdir dir="${plugin.build.dir}"/>
    12     </target>
    13     <target name="compile" depends="init">
    14         <echo message="creating ${plugin.jar}"/>
    15         <javac srcdir="src" debug="true" destdir="${plugin.build.dir}" includeantruntime="false">
    16             <compilerarg value="-Xlint:deprecation"/>
    17             <compilerarg value="-Xlint:unchecked"/>
    18             <classpath>
    19                 <pathelement location="${josm}"/>
    20                 <fileset dir="lib">
    21                     <include name="**/*.jar"/>
    22                 </fileset>
    23             </classpath>
    24         </javac>
    25         <copy file="src/org/openstreetmap/josm/plugins/routes/xml/routes.xml" todir="${plugin.build.dir}/org/openstreetmap/josm/plugins/routes/xml"/>
    26         <copy file="src/org/openstreetmap/josm/plugins/routes/xml/routes.xsd" todir="${plugin.build.dir}/org/openstreetmap/josm/plugins/routes/xml"/>
    27     </target>
    28     <target name="dist" depends="compile,revision">
    29         <copy todir="${plugin.build.dir}/data">
    30             <fileset dir="data"/>
    31         </copy>
    32         <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}" manifestencoding="UTF-8">
    33             <manifest>
    34                 <attribute name="Author" value="Jiri Klement"/>
    35                 <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.routes.RoutesPlugin"/>
    36                 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    37                 <attribute name="Plugin-Description" value="Renders routes (bus, hiking trails, bicycle routes, ..). Route types must be defined in routes.xml file in plugin directory"/>
    38                 <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
    39                 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    40             </manifest>
    41         </jar>
    42     </target>
    43     <target name="test"/>
    44     <target name="checkstyle"/>
    45     <target name="spotbugs"/>
    46     <target name="javadoc"/>
    47     <target name="revision">
    48         <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
    49             <env key="LANG" value="C"/>
    50             <arg value="info"/>
    51             <arg value="--xml"/>
    52             <arg value="."/>
    53         </exec>
    54         <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
    55         <delete file="REVISION"/>
    56     </target>
    57     <target name="clean">
    58         <delete dir="${plugin.build.dir}"/>
    59         <delete file="${plugin.jar}"/>
    60     </target>
    61     <target name="install" depends="dist">
    62         <property environment="env"/>
    63         <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
    64             <and>
    65                 <os family="windows"/>
    66             </and>
    67         </condition>
    68         <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
    69     </target>
    70     <!--
    71          ************************** Publishing the plugin ***********************************
    72         -->
    73     <!--
    74         ** extracts the JOSM release for the JOSM version in ../core and saves it in the
    75         ** property ${coreversion.info.entry.revision}
    76         **
    77         -->
    78     <target name="core-info">
    79         <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
    80             <env key="LANG" value="C"/>
    81             <arg value="info"/>
    82             <arg value="--xml"/>
    83             <arg value="../../core"/>
    84         </exec>
    85         <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
    86         <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
    87         <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
    88         <delete file="core.info.xml"/>
    89     </target>
    90     <!--
    91         ** commits the source tree for this plugin
    92         -->
    93     <target name="commit-current">
    94         <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
    95         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    96             <env key="LANG" value="C"/>
    97             <arg value="commit"/>
    98             <arg value="-m '${commit.message}'"/>
    99             <arg value="."/>
     5    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
     6    <property name="plugin.main.version" value="14153"/>
     7
     8    <!-- Configure these properties (replace "..." accordingly).
     9         See https://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
     10    -->
     11    <property name="plugin.author" value="Jiri Klement"/>
     12    <property name="plugin.class" value="org.openstreetmap.josm.plugins.routes.RoutesPlugin"/>
     13    <property name="plugin.description" value="Renders routes (bus, hiking trails, bicycle routes, ..). Route types must be defined in routes.xml file in plugin directory"/>
     14    <!--<property name="plugin.icon" value="..."/>-->
     15    <!--<property name="plugin.link" value="..."/>-->
     16    <!--<property name="plugin.early" value="..."/>-->
     17    <property name="plugin.requires" value="jaxb"/>
     18    <!--<property name="plugin.stage" value="..."/>-->
     19
     20    <!-- ** include targets that all plugins have in common ** -->
     21    <import file="../build-common.xml"/>
     22
     23    <target name="pre-compile" depends="-jaxb_linux, -jaxb_windows" unless="jaxb.notRequired">
     24        <exec executable="${xjc}" failonerror="true">
     25            <arg value="-d"/>
     26            <arg value="src"/>
     27            <arg value="-p"/>
     28            <arg value="org.openstreetmap.josm.plugins.routes.xml"/>
     29            <arg value="-encoding"/>
     30            <arg value="UTF-8"/>
     31            <arg value="resources/org/openstreetmap/josm/plugins/routes/xml/routes.xsd"/>
    10032        </exec>
    10133    </target>
    102     <!--
    103         ** updates (svn up) the source tree for this plugin
    104         -->
    105     <target name="update-current">
    106         <echo>Updating plugin source ...</echo>
    107         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    108             <env key="LANG" value="C"/>
    109             <arg value="up"/>
    110             <arg value="."/>
    111         </exec>
    112         <echo>Updating ${plugin.jar} ...</echo>
    113         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    114             <env key="LANG" value="C"/>
    115             <arg value="up"/>
    116             <arg value="../dist/${plugin.jar}"/>
    117         </exec>
    118     </target>
    119     <!--
    120         ** commits the plugin.jar
    121         -->
    122     <target name="commit-dist">
    123         <echo>
    124     ***** Properties of published ${plugin.jar} *****
    125     Commit message    : '${commit.message}'
    126     Plugin-Mainversion: ${plugin.main.version}
    127     JOSM build version: ${coreversion.info.entry.revision}
    128     Plugin-Version    : ${version.entry.commit.revision}
    129     ***** / Properties of published ${plugin.jar} *****
    13034
    131     Now commiting ${plugin.jar} ...
    132     </echo>
    133         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    134             <env key="LANG" value="C"/>
    135             <arg value="-m '${commit.message}'"/>
    136             <arg value="commit"/>
    137             <arg value="${plugin.jar}"/>
    138         </exec>
    139     </target>
    140     <!-- ** make sure svn is present as a command line tool ** -->
    141     <target name="ensure-svn-present">
    142         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
    143             <env key="LANG" value="C"/>
    144             <arg value="--version"/>
    145         </exec>
    146         <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
    147             <!-- return code not set at all? Most likely svn isn't installed -->
    148             <condition>
    149                 <not>
    150                     <isset property="svn.exit.code"/>
    151                 </not>
    152             </condition>
    153         </fail>
    154         <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
    155             <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
    156             <condition>
    157                 <isfailure code="${svn.exit.code}"/>
    158             </condition>
    159         </fail>
    160     </target>
    161     <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
    162     </target>
    16335</project>
  • applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/ConvertedWay.java

    r30737 r34477  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.routes;
    23
     
    89import org.openstreetmap.josm.data.osm.Node;
    910import org.openstreetmap.josm.data.osm.Way;
    10 
    1111
    1212public class ConvertedWay {
     
    2222        public boolean equals(Object o) {
    2323            if (o instanceof WayEnd) {
    24                 WayEnd otherEnd = (WayEnd)o;
     24                WayEnd otherEnd = (WayEnd) o;
    2525                return end.equals(otherEnd.end) && routes.equals(otherEnd.getRoutes());
    2626            } else {
     
    6161    /**
    6262     * Connects way to this way. Other ways internal representation is destroyed!!!
    63      * @param way
     63     * @param way way
    6464     */
    6565    public void connect(ConvertedWay way) {
    66         for (int i=0; i<2; i++) {
     66        for (int i = 0; i < 2; i++) {
    6767            if (way.nodes.get(0).equals(nodes.get(nodes.size() - 1))) {
    6868                way.nodes.remove(0);
     
    8888        return routes;
    8989    }
    90 
    91 
    9290}
  • applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/PathBuilder.java

    r30737 r34477  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.routes;
    23
     
    67import java.util.HashSet;
    78import java.util.Map;
     9import java.util.Map.Entry;
    810import java.util.Set;
    9 import java.util.Map.Entry;
    1011
    1112import org.openstreetmap.josm.data.osm.Way;
  • applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RouteDefinition.java

    r33532 r34477  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.routes;
    23
     
    45
    56import org.openstreetmap.josm.data.osm.OsmPrimitive;
    6 import org.openstreetmap.josm.data.osm.search.SearchParseError;
    77import org.openstreetmap.josm.data.osm.search.SearchCompiler;
    88import org.openstreetmap.josm.data.osm.search.SearchCompiler.Match;
     9import org.openstreetmap.josm.data.osm.search.SearchParseError;
    910
    1011public class RouteDefinition {
  • applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RouteLayer.java

    r33532 r34477  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.routes;
    23
     
    1011import javax.swing.Icon;
    1112
    12 import org.openstreetmap.josm.Main;
    1313import org.openstreetmap.josm.data.Bounds;
    1414import org.openstreetmap.josm.data.osm.DataSet;
     
    2929import org.openstreetmap.josm.plugins.routes.xml.RoutesXMLLayer;
    3030import org.openstreetmap.josm.plugins.routes.xml.RoutesXMLRoute;
     31import org.openstreetmap.josm.spi.preferences.Config;
    3132import org.openstreetmap.josm.tools.ColorHelper;
    3233import org.openstreetmap.josm.tools.ImageProvider;
     
    3435public class RouteLayer extends Layer implements DataSetListenerAdapter.Listener {
    3536
    36         private final PathPainter pathPainter;
    37         private final PathBuilder pathBuilder = new PathBuilder();
    38         private final List<RouteDefinition> routes = new ArrayList<>();
    39         private volatile boolean datasetChanged = true;
     37    private final PathPainter pathPainter;
     38    private final PathBuilder pathBuilder = new PathBuilder();
     39    private final List<RouteDefinition> routes = new ArrayList<>();
     40    private volatile boolean datasetChanged = true;
    4041
    41         public RouteLayer(RoutesXMLLayer xmlLayer) {
    42                 super(xmlLayer.getName());
     42    public RouteLayer(RoutesXMLLayer xmlLayer) {
     43        super(xmlLayer.getName());
    4344
    44                 int index = 0;
    45                 for (RoutesXMLRoute route:xmlLayer.getRoute()) {
    46                         if (route.isEnabled()) {
    47                                 Color color = ColorHelper.html2color(route.getColor());
    48                                 if (color == null) {
    49                                         color = Color.RED;
    50                                         System.err.printf("Routes plugin - unable to convert color (%s)\n", route.getColor());
    51                                 }
    52                                 routes.add(new RouteDefinition(index++, color, route.getPattern()));
    53                         }
    54                 }
     45        int index = 0;
     46        for (RoutesXMLRoute route:xmlLayer.getRoute()) {
     47            if (route.isEnabled()) {
     48                Color color = ColorHelper.html2color(route.getColor());
     49                if (color == null) {
     50                    color = Color.RED;
     51                    System.err.printf("Routes plugin - unable to convert color (%s)\n", route.getColor());
     52                }
     53                routes.add(new RouteDefinition(index++, color, route.getPattern()));
     54            }
     55        }
    5556
    56                 if ("wide".equals(Main.pref.get("routes.painter"))) {
    57                         pathPainter = new WideLinePainter(this);
    58                 } else {
    59                         pathPainter = new NarrowLinePainter(this);
    60                 }
     57        if ("wide".equals(Config.getPref().get("routes.painter"))) {
     58            pathPainter = new WideLinePainter(this);
     59        } else {
     60            pathPainter = new NarrowLinePainter(this);
     61        }
    6162
    62                 DatasetEventManager.getInstance().addDatasetListener(new DataSetListenerAdapter(this), FireMode.IMMEDIATELY);
    63         }
     63        DatasetEventManager.getInstance().addDatasetListener(new DataSetListenerAdapter(this), FireMode.IMMEDIATELY);
     64    }
    6465
    65         @Override
    66         public Icon getIcon() {
    67                 return ImageProvider.get("layer", "osmdata_small");
    68         }
     66    @Override
     67    public Icon getIcon() {
     68        return ImageProvider.get("layer", "osmdata_small");
     69    }
    6970
    70         @Override
    71         public Object getInfoComponent() {
    72                 return null;
    73         }
     71    @Override
     72    public Object getInfoComponent() {
     73        return null;
     74    }
    7475
    75         @Override
    76         public Action[] getMenuEntries() {
    77                 return new Action[0];
    78         }
     76    @Override
     77    public Action[] getMenuEntries() {
     78        return new Action[0];
     79    }
    7980
    80         @Override
    81         public String getToolTipText() {
    82                 return "Hiking routes";
    83         }
     81    @Override
     82    public String getToolTipText() {
     83        return "Hiking routes";
     84    }
    8485
    85         @Override
    86         public boolean isMergable(Layer other) {
    87                 return false;
    88         }
     86    @Override
     87    public boolean isMergable(Layer other) {
     88        return false;
     89    }
    8990
    90         @Override
    91         public void mergeFrom(Layer from) {
    92                 // Merging is not supported
    93         }
     91    @Override
     92    public void mergeFrom(Layer from) {
     93        // Merging is not supported
     94    }
    9495
    95         private void addRelation(Relation relation, RouteDefinition route) {
    96                 for (RelationMember member:relation.getMembers()) {
    97                         if (member.getMember() instanceof Way) {
    98                                 Way way = (Way)member.getMember();
    99                                 pathBuilder.addWay(way, route);
    100                         }
    101                 }
    102         }
     96    private void addRelation(Relation relation, RouteDefinition route) {
     97        for (RelationMember member:relation.getMembers()) {
     98            if (member.getMember() instanceof Way) {
     99                Way way = (Way) member.getMember();
     100                pathBuilder.addWay(way, route);
     101            }
     102        }
     103    }
    103104
    104         @Override
    105         public void paint(Graphics2D g, MapView mv, Bounds bounds) {
     105    @Override
     106    public void paint(Graphics2D g, MapView mv, Bounds bounds) {
    106107
    107                 DataSet dataset = MainApplication.getLayerManager().getEditDataSet();
     108        DataSet dataset = MainApplication.getLayerManager().getEditDataSet();
    108109
    109                 if (dataset == null) {
    110                         return;
    111                 }
     110        if (dataset == null) {
     111            return;
     112        }
    112113
    113                 if (datasetChanged) {
    114                         datasetChanged = false;
    115                         pathBuilder.clear();
     114        if (datasetChanged) {
     115            datasetChanged = false;
     116            pathBuilder.clear();
    116117
    117                         for (Relation relation:dataset.getRelations()) {
    118                                 for (RouteDefinition route:routes) {
    119                                         if (route.matches(relation)) {
    120                                                 addRelation(relation, route);
    121                                         }
    122                                 }
    123                         }
     118            for (Relation relation:dataset.getRelations()) {
     119                for (RouteDefinition route:routes) {
     120                    if (route.matches(relation)) {
     121                        addRelation(relation, route);
     122                    }
     123                }
     124            }
    124125
    125                         for (Way way:dataset.getWays()) {
    126                                 for (RouteDefinition route:routes) {
    127                                         if (route.matches(way)) {
    128                                                 pathBuilder.addWay(way, route);
    129                                         }
    130                                 }
    131                         }
    132                 }
     126            for (Way way:dataset.getWays()) {
     127                for (RouteDefinition route:routes) {
     128                    if (route.matches(way)) {
     129                        pathBuilder.addWay(way, route);
     130                    }
     131                }
     132            }
     133        }
    133134
    134                 Stroke stroke = g.getStroke();
    135                 Color color  = g.getColor();
    136                 for (ConvertedWay way:pathBuilder.getConvertedWays()) {
    137                         pathPainter.drawWay(way, mv, g);
    138                 }
    139                 g.setStroke(stroke);
    140                 g.setColor(color);
     135        Stroke stroke = g.getStroke();
     136        Color color = g.getColor();
     137        for (ConvertedWay way:pathBuilder.getConvertedWays()) {
     138            pathPainter.drawWay(way, mv, g);
     139        }
     140        g.setStroke(stroke);
     141        g.setColor(color);
    141142
    142         }
     143    }
    143144
    144         @Override
    145         public void visitBoundingBox(BoundingXYVisitor v) {
     145    @Override
     146    public void visitBoundingBox(BoundingXYVisitor v) {
    146147
    147         }
     148    }
    148149
    149         public List<RouteDefinition> getRoutes() {
    150                 return routes;
    151         }
     150    public List<RouteDefinition> getRoutes() {
     151        return routes;
     152    }
    152153
    153         @Override
    154         public void processDatasetEvent(AbstractDatasetChangedEvent event) {
    155                 datasetChanged = true;
    156         }
     154    @Override
     155    public void processDatasetEvent(AbstractDatasetChangedEvent event) {
     156        datasetChanged = true;
     157    }
    157158
    158         @Override
    159         public synchronized void destroy() {
    160                 /* layer is reused, don't destroy it at all */
    161         }
     159    @Override
     160    public synchronized void destroy() {
     161        /* layer is reused, don't destroy it at all */
     162    }
    162163}
  • applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RoutesPlugin.java

    r33896 r34477  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.routes;
    23
     
    6162                    Routes.class.getPackage().getName(), Routes.class.getClassLoader());
    6263            Unmarshaller unmarshaller = context.createUnmarshaller();
    63             Routes routes = (Routes)unmarshaller.unmarshal(
     64            Routes routes = (Routes) unmarshaller.unmarshal(
    6465                    new FileInputStream(getPluginDirs().getUserDataDirectory(false) + File.separator + "routes.xml"));
    6566            for (RoutesXMLLayer layer:routes.getLayer()) {
     
    6970            }
    7071        } catch (Exception e) {
    71             e.printStackTrace();
     72            Logging.error(e);
    7273        }
    7374    }
     
    9798    public void layerRemoving(LayerRemoveEvent e) {
    9899        for (Layer layer : e.getSource().getLayers()) {
    99             if (layer instanceof OsmDataLayer)  {
     100            if (layer instanceof OsmDataLayer) {
    100101                return; /* at least one OSM layer left, do nothing */
    101102            }
    102103        }
    103         if(!e.isLastLayer()) {
     104        if (!e.isLastLayer()) {
    104105            SwingUtilities.invokeLater(() -> {
    105106                for (RouteLayer routeLayer : routeLayers) {
  • applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/paint/AbstractLinePainter.java

    r32842 r34477  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.routes.paint;
    23
     
    1718    protected boolean getLineLineIntersection(Line2D.Double l1,
    1819            Line2D.Double l2,
    19             Point intersection)
    20     {
     20            Point intersection) {
    2121        double x1 = l1.getX1(), y1 = l1.getY1(),
    22                x2 = l1.getX2(), y2 = l1.getY2(),
    23                x3 = l2.getX1(), y3 = l2.getY1(),
    24                x4 = l2.getX2(), y4 = l2.getY2();
     22                x2 = l1.getX2(), y2 = l1.getY2(),
     23                x3 = l2.getX1(), y3 = l2.getY1(),
     24                x4 = l2.getX2(), y4 = l2.getY2();
    2525        double dx1 = x2 - x1;
    2626        double dx2 = x4 - x3;
     
    3131
    3232        if (Math.abs(dy2 * dx1 - dx2 * dy1) < 0.0001) {
    33             intersection.x = (int)l1.x2;
    34             intersection.y = (int)l1.y2;
     33            intersection.x = (int) l1.x2;
     34            intersection.y = (int) l1.y2;
    3535            return false;
    3636        } else {
    37             intersection.x = (int)(x1 + ua * (x2 - x1));
    38             intersection.y = (int)(y1 + ua * (y2 - y1));
     37            intersection.x = (int) (x1 + ua * (x2 - x1));
     38            intersection.y = (int) (y1 + ua * (y2 - y1));
    3939        }
    4040
     
    4242    }
    4343
    44     protected double det(double a, double b, double c, double d)
    45     {
     44    protected double det(double a, double b, double c, double d) {
    4645        return a * d - b * c;
    4746    }
     
    6059        ndy = ndy / length;
    6160
    62         return new Point((int)(p1.getX() + shift * ndx), (int)(p1.getY() + shift * ndy));
     61        return new Point((int) (p1.getX() + shift * ndx), (int) (p1.getY() + shift * ndy));
    6362    }
    6463
     
    117116                        int dx = p.x - p2.x;
    118117                        int dy = p.y - p2.y;
    119                         int distance = (int)Math.sqrt(dx * dx + dy * dy);
     118                        int distance = (int) Math.sqrt(dx * dx + dy * dy);
    120119                        if (distance > 10) {
    121120                            p.x = p2.x + dx / (distance / 10);
  • applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/paint/NarrowLinePainter.java

    r23189 r34477  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.routes.paint;
    23
     
    2122    }
    2223
     24    @Override
    2325    public void drawWay(ConvertedWay way, MapView mapView, Graphics2D g) {
    2426        List<Node> nodes = way.getNodes();
     
    3335        //double shift = -totalWidth / 2 + width / 2;
    3436        double width = LINE_WIDTH;
    35         double shift = - (LINE_WIDTH * routes.cardinality()) / 2 + width / 2;
     37        double shift = -(LINE_WIDTH * routes.cardinality()) / 2 + width / 2;
    3638
    37         for (int k=0; k<routes.length(); k++) {
     39        for (int k = 0; k < routes.length(); k++) {
    3840
    3941            if (!routes.get(k)) {
  • applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/paint/PathPainter.java

    r23189 r34477  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.routes.paint;
    23
     
    89public interface PathPainter {
    910
    10     public void drawWay(ConvertedWay way, MapView mapView, Graphics2D g);
     11    void drawWay(ConvertedWay way, MapView mapView, Graphics2D g);
    1112
    1213}
  • applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/paint/WideLinePainter.java

    r23189 r34477  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.routes.paint;
    23
     
    2223    }
    2324
     25    @Override
    2426    public void drawWay(ConvertedWay way, MapView mapView, Graphics2D g) {
    2527        List<Node> nodes = way.getNodes();
     
    3436        double shift = -totalWidth / 2 + width / 2;
    3537
    36         for (int k=0; k<routes.length(); k++) {
     38        for (int k = 0; k < routes.length(); k++) {
    3739
    3840            if (!routes.get(k)) {
Note: See TracChangeset for help on using the changeset viewer.