Ignore:
Timestamp:
2014-05-21T22:41:44+02:00 (10 years ago)
Author:
mkyral
Message:

PointInfo: Add support for ghost buildings.

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

    r30372 r30466  
    103103                @Override
    104104                protected void realRun() throws SAXException {
    105                     infoSync(pos, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));
     105                    infoSync(pos, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, true));
    106106                }
    107107
  • applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/ruianModule.java

    r30373 r30466  
    3737import java.io.InputStream;
    3838import java.io.ByteArrayInputStream;
     39
     40import java.text.DecimalFormat;
     41import java.text.DecimalFormatSymbols;
    3942
    4043import javax.json.Json;
     
    7477    private String  m_kraj;
    7578    private String  m_psc;
     79    private float   m_vzdalenost;
    7680
    7781    public addrPlaces () {
     
    99103      m_kraj = "";
    100104      m_psc = "";
     105      m_vzdalenost = 0;
    101106    }
    102107
     
    177182    }
    178183
     184    public void setVzdalenost (float v) {
     185      m_vzdalenost = v;
     186    }
     187
    179188    public long getRuianID () {
    180189      return m_ruian_id;
     
    253262    }
    254263
     264    public String getVzdalenost () {
     265      DecimalFormat df = new DecimalFormat("0.00");
     266      return df.format(m_vzdalenost) + "m";
     267    }
     268
     269}
     270
     271class objectWithoutGeometry {
     272    private long     m_ruian_id;
     273    private int      m_podlazi;
     274    private int      m_byty;
     275    private String   m_zpusob_vyuziti;
     276    private String   m_zpusob_vyuziti_kod;
     277    private String   m_zpusob_vyuziti_key;
     278    private String   m_zpusob_vyuziti_val;
     279    private String   m_dokonceni;
     280    private String   m_plati_od;
     281    private float    m_vzdalenost;
     282
     283    public objectWithoutGeometry () {
     284      init();
     285    }
     286
     287    private void init () {
     288      m_ruian_id = 0;
     289      m_podlazi = 0;
     290      m_byty = 0;
     291      m_zpusob_vyuziti = "";
     292      m_zpusob_vyuziti_kod = "";
     293      m_zpusob_vyuziti_key = "";
     294      m_zpusob_vyuziti_val = "";
     295      m_dokonceni = "";
     296      m_plati_od = "";
     297      m_vzdalenost = 0;
     298    }
     299
     300    public void setRuianID (long v) {
     301      m_ruian_id = v;
     302    }
     303
     304    public void setPodlazi (int v) {
     305      m_podlazi = v;
     306    }
     307
     308    public void setByty (int v) {
     309      m_byty = v;
     310    }
     311
     312    public void setZpusobVyuziti (String v) {
     313      m_zpusob_vyuziti = v;
     314    }
     315
     316    public void setZpusobVyuzitiKod (String v) {
     317      m_zpusob_vyuziti_kod = v;
     318    }
     319
     320    public void setZpusobVyuzitiKey (String v) {
     321      m_zpusob_vyuziti_key = v;
     322    }
     323
     324    public void setZpusobVyuzitiVal (String v) {
     325      m_zpusob_vyuziti_val = v;
     326    }
     327
     328    public void setDokonceni (String v) {
     329      m_dokonceni = v;
     330    }
     331
     332    public void setPlatiOd (String v) {
     333      m_plati_od = v;
     334    }
     335
     336    public void setVzdalenost (float v) {
     337      m_vzdalenost = v;
     338    }
     339
     340    public long getRuianID () {
     341      return m_ruian_id;
     342    }
     343
     344    public int getPodlazi () {
     345      return m_podlazi;
     346    }
     347
     348    public int getByty () {
     349      return m_byty;
     350    }
     351
     352    public String getZpusobVyuziti () {
     353      return m_zpusob_vyuziti;
     354    }
     355
     356    public String getZpusobVyuzitiKod () {
     357      return m_zpusob_vyuziti_kod;
     358    }
     359
     360    public String getZpusobVyuzitiKey () {
     361      return m_zpusob_vyuziti_key;
     362    }
     363
     364    public String getZpusobVyuzitiVal () {
     365      return m_zpusob_vyuziti_val;
     366    }
     367
     368    public String getDokonceni () {
     369      return m_dokonceni;
     370    }
     371
     372    public String getPlatiOd () {
     373      return m_plati_od;
     374    }
     375
     376    public String getVzdalenost () {
     377      DecimalFormat df = new DecimalFormat("0.00");
     378      return df.format(m_vzdalenost) + "m";
     379    }
    255380}
    256381
     
    275400    private String   m_objekt_plati_od;
    276401
     402    private ArrayList <objectWithoutGeometry> m_so_bez_geometrie;
     403
    277404    private ArrayList <addrPlaces> m_adresni_mista;
    278405
     
    323450      m_objekt_plati_od = "";
    324451
     452      m_so_bez_geometrie = new ArrayList<objectWithoutGeometry> ();
    325453      m_adresni_mista = new ArrayList<addrPlaces> ();
    326454
     
    446574// =========================================================================
    447575      try {
     576        JsonArray arr = obj.getJsonArray("so_bez_geometrie");
     577
     578        for(int i = 0; i < arr.size(); i++)
     579        {
     580          JsonObject soBezGeom = arr.getJsonObject(i);
     581          objectWithoutGeometry so = new objectWithoutGeometry();
     582
     583          try {
     584            so.setRuianID(Long.parseLong(soBezGeom.getString("ruian_id")));
     585          } catch (Exception e) {
     586            System.out.println("so_bez_geometrie.ruian_id: " + e.getMessage());
     587          }
     588
     589          try {
     590            so.setPodlazi(Integer.parseInt(soBezGeom.getString("pocet_podlazi")));
     591          } catch (Exception e) {
     592            System.out.println("so_bez_geometrie.pocet_podlazi: " + e.getMessage());
     593          }
     594
     595          try {
     596            so.setByty(Integer.parseInt(soBezGeom.getString("pocet_bytu")));
     597          } catch (Exception e) {
     598            System.out.println("so_bez_geometrie.pocet_bytu: " + e.getMessage());
     599          }
     600
     601          try {
     602            so.setZpusobVyuziti(soBezGeom.getString("zpusob_vyuziti"));
     603          } catch (Exception e) {
     604            System.out.println("so_bez_geometrie.zpusob_vyuziti: " + e.getMessage());
     605          }
     606
     607          try {
     608            so.setZpusobVyuzitiKod(soBezGeom.getString("zpusob_vyuziti_kod"));
     609          } catch (Exception e) {
     610            System.out.println("so_bez_geometrie.zpusob_vyuziti_kod: " + e.getMessage());
     611          }
     612
     613          try {
     614            so.setZpusobVyuzitiKey(soBezGeom.getString("zpusob_vyuziti_key"));
     615          } catch (Exception e) {
     616            System.out.println("so_bez_geometrie.zpusob_vyuziti_key: " + e.getMessage());
     617          }
     618
     619          try {
     620            so.setZpusobVyuzitiVal(soBezGeom.getString("zpusob_vyuziti_val"));
     621          } catch (Exception e) {
     622            System.out.println("so_bez_geometrie.zpusob_vyuziti_val: " + e.getMessage());
     623          }
     624
     625          try {
     626            so.setDokonceni(soBezGeom.getString("dokonceni"));
     627          } catch (Exception e) {
     628            System.out.println("so_bez_geometrie.dokonceni: " + e.getMessage());
     629          }
     630
     631          try {
     632            so.setPlatiOd(soBezGeom.getString("plati_od"));
     633          } catch (Exception e) {
     634            System.out.println("so_bez_geometrie.plati_od: " + e.getMessage());
     635          }
     636
     637          try {
     638            so.setVzdalenost(Float.parseFloat(soBezGeom.getString("vzdalenost")));
     639          } catch (Exception e) {
     640            System.out.println("so_bez_geometrie.vzdalenost: " + e.getMessage());
     641          }
     642
     643          m_so_bez_geometrie.add(so);
     644        }
     645      } catch (Exception e) {
     646        System.out.println("so_bez_geometrie: " + e.getMessage());
     647      }
     648
     649// =========================================================================
     650      try {
    448651        JsonArray arr = obj.getJsonArray("adresni_mista");
    449652
     
    569772          } catch (Exception e) {
    570773            System.out.println("adresni_mista.psc: " + e.getMessage());
     774          }
     775
     776          try {
     777            am.setVzdalenost(Float.parseFloat(adresniMisto.getString("vzdalenost")));
     778          } catch (Exception e) {
     779            System.out.println("adresni_mista.vzdalenost: " + e.getMessage());
    571780          }
    572781
     
    8791088          r.append("<tr><td bgcolor=#e5e5ff>");
    8801089          if (!m_adresni_mista.get(i).getUlice().isEmpty()) {
     1090            r.append(m_adresni_mista.get(i).getVzdalenost());
     1091            r.append("</td><td valign=\"top\"  bgcolor=#e5e5ff>");
    8811092            r.append(m_adresni_mista.get(i).getUlice() + " " + x);
    8821093            r.append("<br/><u>" + m_adresni_mista.get(i).getObec() + "</u>");
     
    8871098            r.append("&nbsp;&nbsp;<a href=file://tags.create-on-place/address:"+i+">"+ icon_create_addr_ruian +"</a>");
    8881099          } else {
     1100            r.append(m_adresni_mista.get(i).getVzdalenost());
     1101            r.append("</td><td valign=\"top\"  bgcolor=#e5e5ff>");
    8891102            r.append(m_adresni_mista.get(i).getCastObce() + " " + x + "&nbsp;");
    8901103            if (!m_adresni_mista.get(i).getCastObce().equals(m_adresni_mista.get(i).getObec())) {
     
    9011114        r.append("</table><br/>");
    9021115      }
     1116
     1117      if (m_so_bez_geometrie.size() > 0) {
     1118        r.append("<i><u>Budovy bez geometrie v okolí</u></i><br/>");
     1119        r.append("<table>");
     1120        for (int i=0; i<m_so_bez_geometrie.size(); i++) {
     1121          r.append("<tr><td bgcolor=#e5e5ff>");
     1122          r.append(m_so_bez_geometrie.get(i).getVzdalenost());
     1123          r.append("</td><td valign=\"top\"  bgcolor=#e5e5ff>");
     1124          r.append(m_so_bez_geometrie.get(i).getRuianID());
     1125          if (m_so_bez_geometrie.get(i).getZpusobVyuziti().length() > 0) {
     1126            r.append(" - " + m_so_bez_geometrie.get(i).getZpusobVyuziti());
     1127          }
     1128          r.append("</td><td valign=\"top\"  bgcolor=#e5e5ff>");
     1129          r.append("&nbsp;&nbsp;<a href="+ url_stavebni_objekt + m_so_bez_geometrie.get(i).getRuianID() + ">"+ icon_ext_link +"</a> ");
     1130          r.append("&nbsp;&nbsp;<a href=file://tags.copy/building>"+ icon_copy_tags +"</a></br>");
     1131          r.append("</td></tr>");
     1132        }
     1133        r.append("</table><br/>");
     1134        r.append("<br/>");
     1135      }
     1136
    9031137      r.append("<hr/>");
    9041138      r.append("<center><i><small>Zdroj: <a href=\"http://www.ruian.cz/\">" + m_source + "</a></small></i></center>");
     
    11301364
    11311365    private String m_text = "";
    1132     private String URL = "http://josm.poloha.net/pointInfo/v2/index.php";
     1366    private String URL = "http://josm.poloha.net/pointInfo/v3/index.php";
    11331367    protected PointInfoServer server = new PointInfoServer();
    11341368
Note: See TracChangeset for help on using the changeset viewer.