Index: applications/editors/josm/plugins/NanoLog/build.xml
===================================================================
--- applications/editors/josm/plugins/NanoLog/build.xml	(revision 27939)
+++ applications/editors/josm/plugins/NanoLog/build.xml	(revision 27939)
@@ -0,0 +1,246 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+** This is a template build file for a JOSM  plugin.
+**
+** Maintaining versions
+** ====================
+** see README.template
+**
+** Usage
+** =====
+** To build it run
+**
+**    > ant  dist
+**
+** To install the generated plugin locally (in you default plugin directory) run
+**
+**    > ant  install
+**
+** The generated plugin jar is not automatically available in JOSMs plugin configuration
+** dialog. You have to check it in first.
+**
+** Use the ant target 'publish' to check in the plugin and make it available to other
+** JOSM users:
+**    set the properties commit.message and plugin.main.version
+** and run
+**    > ant  publish
+**
+**
+-->
+<project name="NanoLog" default="dist" basedir=".">
+    <!-- enter the SVN commit message -->
+    <property name="commit.message" value="NanoLog"/>
+    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
+    <property name="plugin.main.version" value="4800"/>
+    <!--
+      ************************************************
+      ** should not be necessary to change the following properties
+     -->
+    <property name="josm" location="../../core/dist/josm-custom.jar"/>
+    <property name="plugin.build.dir" value="build"/>
+    <property name="plugin.src.dir" value="src"/>
+    <!-- this is the directory where the plugin jar is copied to -->
+    <property name="plugin.dist.dir" value="../../dist"/>
+    <!--property name="plugin.dist.dir"        value="/Users/Zverik/AppData/Roaming/JOSM/plugins"/-->
+    <property name="ant.build.javac.target" value="1.5"/>
+    <property name="ant.build.javac.source" value="1.5"/>
+    <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
+    <!--
+    **********************************************************
+    ** init - initializes the build
+    **********************************************************
+    -->
+    <target name="init">
+        <mkdir dir="${plugin.build.dir}"/>
+    </target>
+    <!--
+    **********************************************************
+    ** compile - complies the source tree
+    **********************************************************
+    -->
+    <target name="compile" depends="init">
+        <echo message="compiling sources for  ${plugin.jar} ... "/>
+        <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
+            <compilerarg value="-Xlint:deprecation"/>
+            <compilerarg value="-Xlint:unchecked"/>
+        </javac>
+    </target>
+    <!--
+    **********************************************************
+    ** dist - creates the plugin jar
+    **********************************************************
+    -->
+    <target name="dist" depends="compile,revision">
+        <echo message="creating ${ant.project.name}.jar ... "/>
+        <copy todir="${plugin.build.dir}/images">
+            <fileset dir="images"/>
+        </copy>
+        <copy todir="${plugin.build.dir}/data">
+            <fileset dir="data"/>
+        </copy>
+        <copy todir="${plugin.build.dir}">
+            <fileset dir="src" includes="**/*.txt"/>
+        </copy>
+        <copy todir="${plugin.build.dir}">
+            <fileset dir=".">
+                <include name="README"/>
+                <include name="LICENSE"/>
+            </fileset>
+        </copy>
+        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
+            <!--
+        ************************************************
+        ** configure these properties. Most of them will be copied to the plugins
+        ** manifest file. Property values will also show up in the list available
+        ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
+        **
+        ************************************************
+    -->
+            <manifest>
+                <attribute name="Author" value="Ilya Zverev"/>
+                <attribute name="Plugin-Class" value="nanolog.NanoLogPlugin"/>
+                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
+                <attribute name="Plugin-Description" value="NanoLog adjustment and browsing layer"/>
+                <attribute name="ru_Plugin-Description" value="Загрузчик слоя NanoLog"/>
+                <attribute name="Plugin-Icon" value="images/nanolog.png"/>
+		<attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/NanoLog"/>
+		<attribute name="ru_Plugin-Link" value="http://wiki.openstreetmap.org/wiki/RU:NanoLog"/>
+                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
+                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
+            </manifest>
+        </jar>
+    </target>
+    <!--
+    **********************************************************
+    ** revision - extracts the current revision number for the
+    **    file build.number and stores it in the XML property
+    **    version.*
+    **********************************************************
+    -->
+    <target name="revision">
+        <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
+            <env key="LANG" value="C"/>
+            <arg value="info"/>
+            <arg value="--xml"/>
+            <arg value="."/>
+        </exec>
+        <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
+        <delete file="REVISION"/>
+    </target>
+    <!--
+    **********************************************************
+    ** clean - clean up the build environment
+    **********************************************************
+    -->
+    <target name="clean">
+        <delete dir="${plugin.build.dir}"/>
+        <delete file="${plugin.jar}"/>
+    </target>
+    <!--
+    **********************************************************
+    ** install - install the plugin in your local JOSM installation
+    **********************************************************
+    -->
+    <target name="install" depends="dist">
+        <property environment="env"/>
+        <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
+            <and>
+                <os family="windows"/>
+            </and>
+        </condition>
+        <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
+    </target>
+    <!--
+    ************************** Publishing the plugin *********************************** 
+    -->
+    <!--
+        ** extracts the JOSM release for the JOSM version in ../core and saves it in the 
+        ** property ${coreversion.info.entry.revision}
+        **
+        -->
+    <target name="core-info">
+        <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
+            <env key="LANG" value="C"/>
+            <arg value="info"/>
+            <arg value="--xml"/>
+            <arg value="../../core"/>
+        </exec>
+        <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
+        <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
+        <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
+        <delete file="core.info.xml"/>
+    </target>
+    <!--
+        ** commits the source tree for this plugin
+        -->
+    <target name="commit-current">
+        <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
+        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
+            <env key="LANG" value="C"/>
+            <arg value="commit"/>
+            <arg value="-m '${commit.message}'"/>
+            <arg value="."/>
+        </exec>
+    </target>
+    <!--
+        ** updates (svn up) the source tree for this plugin
+        -->
+    <target name="update-current">
+        <echo>Updating plugin source ...</echo>
+        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
+            <env key="LANG" value="C"/>
+            <arg value="up"/>
+            <arg value="."/>
+        </exec>
+        <echo>Updating ${plugin.jar} ...</echo>
+        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
+            <env key="LANG" value="C"/>
+            <arg value="up"/>
+            <arg value="../dist/${plugin.jar}"/>
+        </exec>
+    </target>
+    <!--
+        ** commits the plugin.jar 
+        -->
+    <target name="commit-dist">
+        <echo>
+    ***** Properties of published ${plugin.jar} *****
+    Commit message    : '${commit.message}'                    
+    Plugin-Mainversion: ${plugin.main.version}
+    JOSM build version: ${coreversion.info.entry.revision}
+    Plugin-Version    : ${version.entry.commit.revision}
+    ***** / Properties of published ${plugin.jar} *****                    
+                        
+    Now commiting ${plugin.jar} ...
+    </echo>
+        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
+            <env key="LANG" value="C"/>
+            <arg value="-m '${commit.message}'"/>
+            <arg value="commit"/>
+            <arg value="${plugin.jar}"/>
+        </exec>
+    </target>
+    <!-- ** make sure svn is present as a command line tool ** -->
+    <target name="ensure-svn-present">
+        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
+            <env key="LANG" value="C"/>
+            <arg value="--version"/>
+        </exec>
+        <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
+            <!-- return code not set at all? Most likely svn isn't installed -->
+            <condition>
+                <not>
+                    <isset property="svn.exit.code"/>
+                </not>
+            </condition>
+        </fail>
+        <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
+            <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
+            <condition>
+                <isfailure code="${svn.exit.code}"/>
+            </condition>
+        </fail>
+    </target>
+    <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
+    </target>
+</project>
Index: applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogEntry.java
===================================================================
--- applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogEntry.java	(revision 27939)
+++ applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogEntry.java	(revision 27939)
@@ -0,0 +1,33 @@
+package nanolog;
+
+import java.util.Date;
+import org.openstreetmap.josm.data.coor.LatLon;
+
+/**
+ * This holds one NanoLog entry.
+ * 
+ * @author zverik
+ */
+public class NanoLogEntry {
+    private LatLon pos;
+    private Date time;
+    private String message;
+    private int direction;
+    private LatLon tmpPos;
+
+    public int getDirection() {
+        return direction;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public LatLon getPos() {
+        return tmpPos == null ? pos : tmpPos;
+    }
+
+    public Date getTime() {
+        return time;
+    }
+}
Index: applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogLayer.java
===================================================================
--- applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogLayer.java	(revision 27939)
+++ applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogLayer.java	(revision 27939)
@@ -0,0 +1,160 @@
+package nanolog;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.beans.PropertyChangeListener;
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.Icon;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.actions.RenameLayerAction;
+import org.openstreetmap.josm.actions.SaveAction;
+import org.openstreetmap.josm.data.Bounds;
+import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
+import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
+import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
+import org.openstreetmap.josm.gui.layer.JumpToMarkerActions;
+import org.openstreetmap.josm.gui.layer.Layer;
+import static org.openstreetmap.josm.tools.I18n.tr;
+import static org.openstreetmap.josm.tools.I18n.trn;
+import org.openstreetmap.josm.tools.ImageProvider;
+
+/**
+ *
+ * @author zverik
+ */
+public class NanoLogLayer extends Layer implements JumpToMarkerActions.JumpToMarkerLayer {
+
+    private List<NanoLogEntry> log;
+    private int selectedEntry;
+    
+    public NanoLogLayer( File file ) throws IOException {
+        super(tr("NanoLog"));
+        log = readNanoLog(file);
+        selectedEntry = -1;
+    }
+    
+    public static List<NanoLogEntry> readNanoLog( File file ) throws IOException {
+        List<NanoLogEntry> result = new ArrayList<NanoLogEntry>();
+        BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF8"));
+        while( r.ready() ) {
+            String line = r.readLine();
+            if( line != null ) {
+                // parse it
+            }
+        }
+        r.close();
+        return result;
+    }
+
+    @Override
+    public void paint( Graphics2D g, MapView mv, Bounds box ) {
+        // todo
+        int radius = 4;
+        int width = Main.map.mapView.getWidth();
+        int height = Main.map.mapView.getHeight();
+        Rectangle clip = g.getClipBounds();
+        for( NanoLogEntry entry : log ) {
+            if( entry.getPos() != null ) {
+                Point p = mv.getPoint(entry.getPos());
+                g.setColor(Color.green);
+                g.fillOval(p.x - radius, p.y - radius, radius * 2, radius * 2);
+            }
+        }
+        if( selectedEntry >= 0 && selectedEntry < log.size() ) {
+            Point p = mv.getPoint(log.get(selectedEntry).getPos());
+            g.setColor(Color.red);
+            g.fillOval(p.x - radius, p.y - radius, radius * 2, radius * 2);
+        }
+    }
+
+    @Override
+    public Icon getIcon() {
+        return ImageProvider.get("nanolog.png");
+    }
+
+    @Override
+    public String getToolTipText() {
+        return tr("NanoLog of {0} entries", log.size());
+    }
+
+    @Override
+    public void mergeFrom( Layer from ) {
+        // todo
+    }
+
+    @Override
+    public boolean isMergable( Layer other ) {
+        return other instanceof NanoLogLayer;
+    }
+
+    @Override
+    public void visitBoundingBox( BoundingXYVisitor v ) {
+        for( NanoLogEntry entry : log )
+            v.visit(entry.getPos());
+    }
+
+    @Override
+    public Object getInfoComponent() {
+        StringBuilder b = new StringBuilder();
+        int cnt = 0;
+        for( NanoLogEntry e : log )
+            if( e.getPos() != null )
+                cnt++;
+        b.append(tr("NanoLog of {0} lines, {1} of them with coordinates.", log.size(), cnt));
+        return b.toString();
+    }
+
+    @Override
+    public Action[] getMenuEntries() {
+        return new Action[] {
+            LayerListDialog.getInstance().createShowHideLayerAction(),
+            LayerListDialog.getInstance().createDeleteLayerAction(),
+            new RenameLayerAction(null, this),
+            SeparatorLayerAction.INSTANCE,
+            new CorrelateEntries(),
+            new SaveLayer(),
+            SeparatorLayerAction.INSTANCE,
+            new LayerListPopup.InfoAction(this)
+        };
+    }
+
+    public void jumpToNextMarker() {
+        selectedEntry++;
+        if( selectedEntry < 0 )
+            selectedEntry = 0;
+        else if( selectedEntry >= log.size() )
+            selectedEntry = log.size() - 1;
+        Main.map.repaint();
+    }
+
+    public void jumpToPreviousMarker() {
+        selectedEntry--;
+        if( selectedEntry < 0 )
+            selectedEntry = 0;
+        else if( selectedEntry >= log.size() )
+            selectedEntry = log.size() - 1;
+        Main.map.repaint();
+    }
+    
+    private class CorrelateEntries extends AbstractAction {
+
+        public void actionPerformed( ActionEvent e ) {
+            // todo
+        }
+    }
+    
+    private class SaveLayer extends AbstractAction {
+
+        public void actionPerformed( ActionEvent e ) {
+            // todo
+        }
+    }
+}
Index: applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPanel.java
===================================================================
--- applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPanel.java	(revision 27939)
+++ applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPanel.java	(revision 27939)
@@ -0,0 +1,35 @@
+package nanolog;
+
+import javax.swing.*;
+import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
+import static org.openstreetmap.josm.tools.I18n.tr;
+import org.openstreetmap.josm.tools.Shortcut;
+
+/**
+ * NanoLog Panel. Displays the selected log item, along with surrounding 30-50 lines.
+ * 
+ * @author zverik
+ */
+public class NanoLogPanel extends ToggleDialog {
+    private JList logPanel;
+    private LogListModel listModel;
+    
+    public NanoLogPanel() {
+        super(tr("NanoLog"), "nanolog", tr("Open NanoLog panel"), null, 150, true);
+        
+        listModel = new LogListModel();
+        logPanel = new JList<String>(listModel);
+        createLayout(logPanel, true, null);
+    }
+    
+    private class LogListModel extends AbstractListModel<String> {
+
+        public int getSize() {
+            return 0;
+        }
+
+        public String getElementAt( int index ) {
+            return ""; // todo
+        }
+    }
+}
Index: applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPlugin.java
===================================================================
--- applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPlugin.java	(revision 27939)
+++ applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPlugin.java	(revision 27939)
@@ -0,0 +1,43 @@
+package nanolog;
+
+import java.awt.event.ActionEvent;
+import javax.swing.JFileChooser;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.actions.JosmAction;
+import org.openstreetmap.josm.gui.MapFrame;
+import org.openstreetmap.josm.plugins.Plugin;
+import org.openstreetmap.josm.plugins.PluginInformation;
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+/**
+ * Add NanoLog opening menu item and the panel.
+ * 
+ * @author zverik
+ */
+public class NanoLogPlugin extends Plugin {
+    public NanoLogPlugin( PluginInformation info ) {
+        super(info);
+        Main.main.menu.fileMenu.add(new OpenNanoLogLayerAction());
+    }
+    
+    @Override
+    public void mapFrameInitialized( MapFrame oldFrame, MapFrame newFrame ) {
+        if( oldFrame == null && newFrame != null ) {
+            newFrame.addToggleDialog(new NanoLogPanel());
+        }
+    }
+    
+    private class OpenNanoLogLayerAction extends JosmAction {
+
+        public OpenNanoLogLayerAction() {
+            super(tr("Open NanoLog file..."), "nanolog.png", tr("Open NanoLog file..."), null, false);
+        }
+
+        public void actionPerformed( ActionEvent e ) {
+            JFileChooser fc = new JFileChooser();
+            if( fc.showOpenDialog(Main.parent) == JFileChooser.APPROVE_OPTION ) {
+                // open layer, ok
+            }
+        }        
+    }
+}
