Changeset 29491 in osm for applications/editors/josm


Ignore:
Timestamp:
2013-04-09T18:25:26+02:00 (11 years ago)
Author:
malcolmh
Message:

save

Location:
applications/editors/josm/plugins/smed
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed/build.xml

    r29438 r29491  
    11<?xml version="1.0" encoding="utf-8"?>
    2 <!--
    3 ** This is a template build file for a JOSM  plugin.
    4 **
    5 ** Maintaining versions
    6 ** ====================
    7 ** See README.template
    8 **
    9 ** Usage
    10 ** =====
    11 ** Call "ant help" to get possible build targets.
    12 **
    13 -->
    14 <project name="SeaMapEditor" default="dist" basedir=".">
     2<project name="SeaMapEditor" basedir=".">
    153    <!-- enter the SVN commit message -->
    164    <property name="commit.message" value="New release"/>
     
    186    <property name="plugin.main.version" value="4394"/>
    197    <!-- should not be necessary to change the following properties -->
    20 
    21     <property name="plugin.author" value="Werner, Malcolm"/>
    22     <property name="plugin.class" value="smed.Smed"/>
    23     <property name="plugin.description" value="Create and edit seamaps for OpenSeaMap"/>
    24     <property name="plugin.icon" value="images/Smed.png"/>
    25     <property name="plugin.link" value="http://openseamap.org/"/>
    26 
    27     <!-- ** include targets that all plugins have in common ** -->
    28     <import file="../build-common.xml"/>
    29 
    30     <target name="setup-dist">
    31         <antcall target="setup-dist-default" />
     8    <property name="josm" location="../../core/dist/josm-custom.jar"/>
     9    <property name="plugin.build.dir" value="build/"/>
     10    <property name="plugin.src.dir" value="src/"/>
     11    <property name="smed.dist.dir" value="dist/"/>
     12    <!-- this is the directory where the plugin jar is copied to -->
     13    <property name="plugin.dist.dir" value="../../dist/"/>
     14    <property name="smed_core.dist.dir" value="core/dist/"/>
     15    <property name="ant.build.javac.target" value="1.5"/>
     16    <property name="plugin.jar" value="${plugin.dist.dir}${ant.project.name}.jar"/>
     17    <!--
     18    **********************************************************
     19    ** init - initializes the build
     20    **********************************************************
     21    -->
     22    <target name="init">
     23        <mkdir dir="${plugin.build.dir}"/>
     24        <mkdir dir="${smed_core.dist.dir}"/>
     25        <mkdir dir="${smed.dist.dir}"/>
     26    </target>
     27    <!--
     28    **********************************************************
     29    ** compile - complies the source tree
     30    **********************************************************
     31    -->
     32    <target name="compile" depends="init">
     33        <echo message="compiling sources for  ${plugin.jar} ... "/>
     34        <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
     35            <compilerarg value="-Xlint:deprecation"/>
     36            <compilerarg value="-Xlint:unchecked"/>
     37        </javac>
     38    </target>
     39    <!--
     40    **********************************************************
     41    ** dist - creates the plugin jar
     42    **********************************************************
     43    -->
     44    <target name="dist" depends="compile, revision">
     45        <echo message="creating ${ant.project.name}.jar ... "/>
     46        <copy todir="${plugin.build.dir}/images">
     47            <fileset dir="images"/>
     48        </copy>
     49        <copy todir="${plugin.build.dir}/data">
     50            <fileset dir="data"/>
     51        </copy>
    3252        <copy todir="${plugin.build.dir}/smed/msg">
    3353            <fileset dir="${plugin.src.dir}/smed/msg"/>
    3454        </copy>
    35     </target>
    36 
     55        <copy todir="${plugin.build.dir}">
     56            <fileset dir="${smed.dist.dir}"/>
     57        </copy>
     58        <copy todir="${plugin.build.dir}">
     59            <fileset dir=".">
     60                <include name="*.txt"/>
     61            </fileset>
     62        </copy>
     63        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
     64            <!--
     65        ************************************************
     66        ** configure these properties. Most of them will be copied to the plugins
     67        ** manifest file. Property values will also show up in the list available
     68        ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
     69        **
     70        ************************************************
     71    -->
     72            <manifest>
     73                <attribute name="Author" value="Werner, Malcolm"/>
     74                <attribute name="Plugin-Class" value="smed.Smed"/>
     75                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
     76                <attribute name="Plugin-Description" value="Create and edit seamaps for OpenSeaMap"/>
     77                <attribute name="Plugin-Icon" value="images/Smed.png"/>
     78                <attribute name="Plugin-Link" value="http://openseamap.org/"/>
     79                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
     80                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
     81            </manifest>
     82        </jar>
     83        <!-- install interface -->
     84        <copy file="${plugin.jar}" todir="${smed_core.dist.dir}"/>
     85    </target>
     86    <!--
     87    **********************************************************
     88    ** revision - extracts the current revision number for the
     89    **    file build.number and stores it in the XML property
     90    **    version.*
     91    **********************************************************
     92    -->
     93    <target name="revision">
     94        <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
     95            <env key="LANG" value="C"/>
     96            <arg value="info"/>
     97            <arg value="--xml"/>
     98            <arg value="."/>
     99        </exec>
     100        <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
     101        <delete file="REVISION"/>
     102    </target>
     103    <!--
     104    **********************************************************
     105    ** clean - clean up the build environment
     106    **********************************************************
     107    -->
     108    <target name="clean">
     109        <delete dir="${plugin.build.dir}"/>
     110        <delete file="${plugin.jar}"/>
     111    </target>
     112    <!--
     113    **********************************************************
     114    ** install - install the plugin in your local JOSM installation
     115    **********************************************************
     116    -->
     117    <target name="install" depends="dist">
     118        <property environment="env"/>
     119        <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
     120            <and>
     121                <os family="windows"/>
     122            </and>
     123        </condition>
     124        <delete dir="${josm.plugins.dir}/splug"/>
     125        <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
     126    </target>
     127    <!--
     128    ************************** Publishing the plugin ***********************************
     129    -->
     130    <!--
     131    ** extracts the JOSM release for the JOSM version in ../core and saves it in the
     132    ** property ${coreversion.info.entry.revision}
     133    -->
     134    <target name="core-info">
     135        <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
     136            <env key="LANG" value="C"/>
     137            <arg value="info"/>
     138            <arg value="--xml"/>
     139            <arg value="../../core"/>
     140        </exec>
     141        <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
     142        <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
     143        <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
     144        <delete file="core.info.xml"/>
     145    </target>
     146    <!-- commits the source tree for this plugin -->
     147    <target name="commit-current">
     148        <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
     149        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     150            <env key="LANG" value="C"/>
     151            <arg value="commit"/>
     152            <arg value="-m '${commit.message}'"/>
     153            <arg value="."/>
     154        </exec>
     155    </target>
     156    <!-- updates (svn up) the source tree for this plugin -->
     157    <target name="update-current">
     158        <echo>Updating plugin source ...</echo>
     159        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     160            <env key="LANG" value="C"/>
     161            <arg value="up"/>
     162            <arg value="."/>
     163        </exec>
     164        <echo>Updating ${plugin.jar} ...</echo>
     165        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     166            <env key="LANG" value="C"/>
     167            <arg value="up"/>
     168            <arg value="../dist/${plugin.jar}"/>
     169        </exec>
     170    </target>
     171    <!-- commits the plugin.jar -->
     172    <target name="commit-dist">
     173        <echo>
     174    ***** Properties of published ${plugin.jar} *****
     175    Commit message    : '${commit.message}'                   
     176    Plugin-Mainversion: ${plugin.main.version}
     177    JOSM build version: ${coreversion.info.entry.revision}
     178    Plugin-Version    : ${version.entry.commit.revision}
     179    ***** / Properties of published ${plugin.jar} *****                   
     180                       
     181    Now commiting ${plugin.jar} ...
     182    </echo>
     183        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     184            <env key="LANG" value="C"/>
     185            <arg value="-m '${commit.message}'"/>
     186            <arg value="commit"/>
     187            <arg value="${plugin.jar}"/>
     188        </exec>
     189    </target>
     190    <!-- make sure svn is present as a command line tool -->
     191    <target name="ensure-svn-present">
     192        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
     193            <env key="LANG" value="C"/>
     194            <arg value="--version"/>
     195        </exec>
     196        <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
     197            <!-- return code not set at all? Most likely svn isn't installed -->
     198            <condition>
     199                <not>
     200                    <isset property="svn.exit.code"/>
     201                </not>
     202            </condition>
     203        </fail>
     204        <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
     205            <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
     206            <condition>
     207                <isfailure code="${svn.exit.code}"/>
     208            </condition>
     209        </fail>
     210    </target>
     211    <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
     212    </target>
    37213</project>
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelRadar.java

    r27955 r29491  
    1515
    1616        private OSeaMAction dlg;
     17        private JToggleButton aisButton = new JToggleButton(new ImageIcon(getClass().getResource("/images/AISButton.png")));
     18        private ActionListener alAis = new ActionListener() {
     19                public void actionPerformed(java.awt.event.ActionEvent e) {
     20                        if (aisButton.isSelected()) {
     21                                radioCatBox.setVisible(true);
     22                                aisButton.setBorderPainted(true);
     23                        } else {
     24                                radioCatBox.setSelectedIndex(0);
     25                                radioCatBox.setVisible(false);
     26                                aisButton.setBorderPainted(false);
     27                        }
     28                }
     29        };
     30        private JComboBox radioCatBox;
     31        private EnumMap<Cat, Integer> radioCats = new EnumMap<Cat, Integer>(Cat.class);
     32        private ActionListener alRadioCatBox = new ActionListener() {
     33                public void actionPerformed(java.awt.event.ActionEvent e) {
     34                        for (Cat cat : radioCats.keySet()) {
     35                                int idx = radioCats.get(cat);
     36                                if (dlg.node != null && (idx == radioCatBox.getSelectedIndex())) {
     37                                        dlg.panelMain.mark.setRadio(cat);
     38                                }
     39                        }
     40                }
     41        };
    1742        private ButtonGroup radarButtons = new ButtonGroup();
    1843        public JRadioButton noRadButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/OffButton.png")));
     
    85110                add(getRadButton(raconButton, 0, 93, 27, 27, "Racon", Rtb.RACON));
    86111                add(getRadButton(leadingButton, 0, 123, 27, 27, "LeadingRacon", Rtb.LEADING));
    87 
     112               
    88113                groupLabel = new JLabel(Messages.getString("Group"), SwingConstants.CENTER);
    89114                groupLabel.setBounds(new Rectangle(30, 0, 100, 20));
     
    143168                add(sector2Box);
    144169                sector2Box.addFocusListener(flSector2);
     170
     171                aisButton.setBounds(new Rectangle(270, 3, 27, 27));
     172                aisButton.setBorder(BorderFactory.createLoweredBevelBorder());
     173                aisButton.setToolTipText("AIS");
     174                aisButton.addActionListener(alAis);
     175                add(aisButton);
     176
     177                radioCatBox = new JComboBox();
     178                radioCatBox.setBounds(new Rectangle(210, 40, 150, 20));
     179                add(radioCatBox);
     180                radioCatBox.addActionListener(alRadioCatBox);
     181                addROItem("", Cat.NOROS);
     182                addROItem(Messages.getString("CircularBeacon"), Cat.ROS_OMNI);
     183                addROItem(Messages.getString("DirectionalBeacon"), Cat.ROS_DIRL);
     184                addROItem(Messages.getString("RotatingBeacon"), Cat.ROS_ROTP);
     185                addROItem(Messages.getString("ConsolBeacon"), Cat.ROS_CNSL);
     186                addROItem(Messages.getString("DirectionFinding"), Cat.ROS_RDF);
     187                addROItem(Messages.getString("QTGService"), Cat.ROS_QTG);
     188                addROItem(Messages.getString("AeronaticalBeacon"), Cat.ROS_AERO);
     189                addROItem(Messages.getString("Decca"), Cat.ROS_DECA);
     190                addROItem(Messages.getString("LoranC"), Cat.ROS_LORN);
     191                addROItem(Messages.getString("DGPS"), Cat.ROS_DGPS);
     192                addROItem(Messages.getString("Toran"), Cat.ROS_TORN);
     193                addROItem(Messages.getString("Omega"), Cat.ROS_OMGA);
     194                addROItem(Messages.getString("Syledis"), Cat.ROS_SYLD);
     195                addROItem(Messages.getString("Chiaka"), Cat.ROS_CHKA);
     196                addROItem(Messages.getString("PublicCommunication"), Cat.ROS_PCOM);
     197                addROItem(Messages.getString("CommercialBroadcast"), Cat.ROS_COMB);
     198                addROItem(Messages.getString("Facsimile"), Cat.ROS_FACS);
     199                addROItem(Messages.getString("TimeSignal"), Cat.ROS_TIME);
     200                addROItem(Messages.getString("AIS"), Cat.ROS_PAIS);
     201                addROItem(Messages.getString("S-AIS"), Cat.ROS_SAIS);
     202                radioCatBox.setVisible(false);
    145203        }
    146204
     
    169227                sector1Box.setText(dlg.panelMain.mark.getRaconSector1());
    170228                sector2Box.setText(dlg.panelMain.mark.getRaconSector2());
     229                aisButton.setSelected(dlg.panelMain.mark.getRadio() != Cat.NOROS);
     230                aisButton.setBorderPainted(aisButton.isSelected());
     231                radioCatBox.setVisible(dlg.panelMain.mark.getRadio() != Cat.NOROS);
    171232        }
    172233
     
    181242        }
    182243
     244        private void addROItem(String str, Cat cat) {
     245                radioCats.put(cat, radioCatBox.getItemCount());
     246                radioCatBox.addItem(str);
     247        }
    183248}
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java

    r29489 r29491  
    348348                CatSTR.put(Cat.ROS_OMGA, "omega");
    349349                CatSTR.put(Cat.ROS_SYLD, "syledis");
    350                 CatSTR.put(Cat.ROS_CHKA, "chaika");
     350                CatSTR.put(Cat.ROS_CHKA, "chiaka");
    351351                CatSTR.put(Cat.ROS_PCOM, "public_communication");
    352352                CatSTR.put(Cat.ROS_COMB, "commercial_broadcast");
     
    25722572                        }
    25732573                }
     2574
     2575                if (RoType != Cat.NOROS) {
     2576                        g2.drawImage(new ImageIcon(getClass().getResource("/images/Radar_Station.png")).getImage(), 7, -15, null);
     2577                        g2.drawString("AIS", 0, 30);
     2578                }
    25742579        }
    25752580
Note: See TracChangeset for help on using the changeset viewer.