Ignore:
Timestamp:
2014-03-20T21:59:08+01:00 (11 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/src/org/openstreetmap/josm/plugins/pointinfo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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.