Ignore:
Timestamp:
2014-03-20T21:59:08+01:00 (10 years ago)
Author:
mkyral
Message:

PointInfo: Fix date format of start_date key. Add missing building:ruian:type key.

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

Legend:

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

    r30331 r30334  
    1515
    1616    <!-- enter the SVN commit message -->
    17     <property name="commit.message" value="PointInfo: Initial version"/>
     17    <property name="commit.message" value="PointInfo: Fix format of start_date key"/>
    1818    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    1919    <property name="plugin.main.version" value="6238"/>
     
    2727    <property name="plugin.author" value="Marian Kyral"/>
    2828    <property name="plugin.class" value="org.openstreetmap.josm.plugins.pointinfo.PointInfoPlugin"/>
    29     <property name="plugin.description" value="Shows an additional information about point on map. Currently only Czech Ruian module available."/>
     29    <property name="plugin.description" value="Shows an additional information about point on map. There is only a Czech RUIAN module available at this moment."/>
    3030    <property name="plugin.icon" value="images/mapmode/info-sml.png"/>
    3131    <property name="plugin.link" value="https://github.com/mkyral/josm-pointInfo"/>
  • applications/editors/josm/plugins/pointInfo/servers/RUIAN/index.php

    r30328 r30334  
    1515$query="
    1616  select s.kod,
    17         s.pocet_podlazi, a.nazev, s.plati_od, s.pocet_bytu, s.dokonceni,
    18         a.osmtag_k, a.osmtag_v
     17        s.pocet_podlazi, a.nazev zpusob_vyuziti, s.plati_od, s.pocet_bytu, s.dokonceni,
     18        s.zpusob_vyuziti_kod, a.osmtag_k, a.osmtag_v
    1919  from rn_stavebni_objekt s
    2020      left outer join osmtables.zpusob_vyuziti_objektu a on s.zpusob_vyuziti_kod = a.kod
     
    3333    array( "ruian_id" => $row["kod"],
    3434           "pocet_podlazi" => $row["pocet_podlazi"],
    35            "zpusob_vyuziti" => $row["nazev"],
     35           "zpusob_vyuziti" => $row["zpusob_vyuziti"],
     36           "zpusob_vyuziti_kod" => $row["zpusob_vyuziti_kod"],
    3637           "zpusob_vyuziti_key" => $row["osmtag_k"],
    3738           "zpusob_vyuziti_val" => $row["osmtag_v"],
  • applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java

    r30328 r30334  
    7474    @Override
    7575    public void enterMode() {
    76       System.out.println("enterMode() - start");
    7776        if (!isEnabled()) {
    7877            return;
     
    8180        Main.map.mapView.setCursor(getCursor());
    8281        Main.map.mapView.addMouseListener(this);
    83       System.out.println("enterMode() - end");
    8482
    8583    }
     
    8785    @Override
    8886    public void exitMode() {
    89       System.out.println("exitMode() - start");
    9087        super.exitMode();
    9188        Main.map.mapView.removeMouseListener(this);
    92       System.out.println("exitMode() - end");
    9389    }
    9490
  • applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/ruianModule.java

    r30328 r30334  
    201201    private int      m_objekt_byty;
    202202    private String   m_objekt_zpusob_vyuziti;
     203    private String   m_objekt_zpusob_vyuziti_kod;
    203204    private String   m_objekt_zpusob_vyuziti_key;
    204205    private String   m_objekt_zpusob_vyuziti_val;
     
    245246      m_objekt_byty = 0;
    246247      m_objekt_zpusob_vyuziti = "";
     248      m_objekt_zpusob_vyuziti_kod = "";
    247249      m_objekt_zpusob_vyuziti_key = "";
    248250      m_objekt_zpusob_vyuziti_val = "";
     
    317319        try {
    318320          m_objekt_zpusob_vyuziti = stavebniObjekt.getString("zpusob_vyuziti");
     321        } catch (Exception e) {
     322        }
     323
     324        try {
     325          m_objekt_zpusob_vyuziti_kod = stavebniObjekt.getString("zpusob_vyuziti_kod");
    319326        } catch (Exception e) {
    320327        }
     
    523530      r.append("<br/>");
    524531      if (m_objekt_ruian_id > 0) {
    525         r.append("<i><u>Informace o objektu</u></i>");
     532        r.append("<i><u>Informace o budově</u></i>");
    526533        r.append("&nbsp;&nbsp;<a href=file://tags.copy/building><img src="+getClass().getResource("/images/dialogs/copy-tags.png")+" border=0 alt=\"Vložit tagy do schránky\" ></a><br/>");
    527534        r.append("<b>RUIAN id: </b><a href=http://vdp.cuzk.cz/vdp/ruian/stavebniobjekty/" + m_objekt_ruian_id +">" + m_objekt_ruian_id + "</a><br/>");
     
    678685
    679686    /**
     687     * Convert date from Czech to OSM format
     688     * @param ruianDate Date in RUIAN (Czech) format DD.MM.YYYY
     689     * @return String with date converted to OSM data format YYYY-MM-DD
     690     */
     691    String convertDate (String ruianDate) {
     692      String r = new String();
     693      String[] parts = ruianDate.split("\\.");
     694      try {
     695        int day =   Integer.parseInt(parts[0]);
     696        int month = Integer.parseInt(parts[1]);
     697        int year =  Integer.parseInt(parts[2]);
     698        r = new Integer(year).toString() + "-" + String.format("%02d", month) + "-" + String.format("%02d", day);
     699      } catch (Exception e) {
     700      }
     701
     702      return r;
     703    }
     704
     705    /**
    680706     * Construct tag string for clipboard
    681707     * @param k OSM Key
     
    710736          c.append(tagToString("building:flats", Integer.toString(m_objekt_byty)));
    711737        }
    712         if (m_objekt_dokonceni.length() > 0) {
    713           c.append(tagToString("start_date", m_objekt_dokonceni));
     738        if (m_objekt_dokonceni.length() > 0 && convertDate(m_objekt_dokonceni).length() > 0) {
     739          c.append(tagToString("start_date", convertDate(m_objekt_dokonceni)));
     740        }
     741        if (m_objekt_zpusob_vyuziti_kod.length() > 0) {
     742          c.append(tagToString("building:ruian:type", m_objekt_zpusob_vyuziti_kod));
    714743        }
    715744        c.append(tagToString("source", "cuzk:ruian"));
Note: See TracChangeset for help on using the changeset viewer.