Ignore:
Timestamp:
2009-07-12T13:11:06+02:00 (17 years ago)
Author:
Gubaer
Message:

fixed #2911: Relation editor doesn't notice all members downloaded via Download members
fixed problems with references to Main.ds in IO subsystem
relation editor is now aware of layers. Deleting a layer will close open editors for relations in this layer.

Location:
trunk/src/org/openstreetmap/josm/io
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java

    r1670 r1772  
    101101                return null;
    102102            Main.pleaseWaitDlg.currentAction.setText(tr("Downloading OSM data..."));
    103             final DataSet data = OsmReader.parseDataSet(in, null, Main.pleaseWaitDlg);
     103            final DataSet data = OsmReader.parseDataSet(in,Main.pleaseWaitDlg);
    104104            in.close();
    105105            activeConnection = null;
  • trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

    r1690 r1772  
    319319        Main.pleaseWaitDlg.currentAction.setText(tr("Downloading OSM data..."));
    320320        try {
    321             final OsmReader osm = OsmReader.parseDataSetOsm(in, outputDataSet, Main.pleaseWaitDlg);
     321            final OsmReader osm = OsmReader.parseDataSetOsm(in, Main.pleaseWaitDlg);
    322322            skippedWayIds.addAll(osm.getSkippedWayIds());
    323323            merge(osm.getDs());
     
    345345        Main.pleaseWaitDlg.currentAction.setText(tr("Downloading OSM data..."));
    346346        try {
    347             final OsmReader osm = OsmReader.parseDataSetOsm(in, null, Main.pleaseWaitDlg);
     347            final OsmReader osm = OsmReader.parseDataSetOsm(in,Main.pleaseWaitDlg);
    348348            skippedWayIds.addAll(osm.getSkippedWayIds());
    349349            merge(osm.getDs());
  • trunk/src/org/openstreetmap/josm/io/OsmImporter.java

    r1696 r1772  
    4646
    4747    protected void importData(InputStream in, File associatedFile) throws SAXException, IOException {
    48         OsmReader osm = OsmReader.parseDataSetOsm(in, null, Main.pleaseWaitDlg);
     48        OsmReader osm = OsmReader.parseDataSetOsm(in,Main.pleaseWaitDlg);
    4949        DataSet dataSet = osm.getDs();
    5050        OsmDataLayer layer = new OsmDataLayer(dataSet, associatedFile.getName(), associatedFile);
     
    5555            String notes = osm.getParseNotes();
    5656            int j = 0;
    57             for (int i = 0; i < 5; i++)
     57            for (int i = 0; i < 5; i++) {
    5858                j = notes.indexOf('\n', j + 1);
     59            }
    5960            j = j >= 0 ? j : notes.length();
    6061            JOptionPane.showMessageDialog(Main.parent, notes.substring(0, j));
  • trunk/src/org/openstreetmap/josm/io/OsmReader.java

    r1690 r1772  
    5252
    5353    /**
    54      * This is used as (readonly) source for finding missing references when not transferred in the
    55      * file.
    56      */
    57     private DataSet references;
    58 
    59     /**
    6054     * The dataset to add parsed objects to.
    6155     */
     
    8882    private Map<Long, Node> nodes = new HashMap<Long, Node>();
    8983
     84
     85    /**
     86     * constructor (for private use only)
     87     *
     88     * @see #parseDataSet(InputStream, DataSet, PleaseWaitDialog)
     89     * @see #parseDataSetOsm(InputStream, DataSet, PleaseWaitDialog)
     90     */
     91    private OsmReader() {
     92    }
    9093
    9194    private static class OsmPrimitiveData {
     
    342345        if (n != null)
    343346            return n;
    344         for (Node node : references.nodes)
    345             if (node.id == id)
    346                 return node;
    347         // TODO: This has to be changed to support multiple layers.
    348         for (Node node : Main.ds.nodes)
    349             if (node.id == id)
    350                 return new Node(node);
    351347        return null;
    352348    }
     
    382378    /**
    383379     * Return the Way object with the given id, or null if it doesn't
    384      * exist yet. This method only looks at ways stored in the data set.
     380     * exist yet. This method only looks at ways stored in the already parsed
     381     * ways.
    385382     *
    386383     * @param id
     
    388385     */
    389386    private Way findWay(long id) {
    390         for (Way wy : Main.ds.ways)
    391             if (wy.id == id)
    392                 return wy;
     387        for (Way way : ds.ways)
     388            if (way.id == id)
     389                return way;
    393390        return null;
    394391    }
     
    396393    /**
    397394     * Return the Relation object with the given id, or null if it doesn't
    398      * exist yet. This method only looks at relations stored in the data set.
     395     * exist yet. This method only looks at relations in the already parsed
     396     * relations.
    399397     *
    400398     * @param id
     
    403401    private Relation findRelation(long id) {
    404402        for (Relation e : ds.relations)
    405             if (e.id == id)
    406                 return e;
    407         for (Relation e : Main.ds.relations)
    408403            if (e.id == id)
    409404                return e;
     
    476471     *  element found there is returned.
    477472     */
    478     public static DataSet parseDataSet(InputStream source, DataSet ref, PleaseWaitDialog pleaseWaitDlg) throws SAXException, IOException {
    479         return parseDataSetOsm(source, ref, pleaseWaitDlg).ds;
    480     }
    481 
    482     public static OsmReader parseDataSetOsm(InputStream source, DataSet ref, PleaseWaitDialog pleaseWaitDlg) throws SAXException, IOException {
     473    public static DataSet parseDataSet(InputStream source, PleaseWaitDialog pleaseWaitDlg) throws SAXException, IOException {
     474        return parseDataSetOsm(source, pleaseWaitDlg).ds;
     475    }
     476
     477    public static OsmReader parseDataSetOsm(InputStream source,PleaseWaitDialog pleaseWaitDlg) throws SAXException, IOException {
    483478        OsmReader osm = new OsmReader();
    484         osm.references = ref == null ? new DataSet() : ref;
    485479
    486480        // phase 1: Parse nodes and read in raw ways
  • trunk/src/org/openstreetmap/josm/io/OsmServerLocationReader.java

    r1670 r1772  
    3232                return null;
    3333            Main.pleaseWaitDlg.currentAction.setText(tr("Downloading OSM data..."));
    34             final DataSet data = OsmReader.parseDataSet(in, null, Main.pleaseWaitDlg);
     34            final DataSet data = OsmReader.parseDataSet(in, Main.pleaseWaitDlg);
    3535            in.close();
    3636            activeConnection = null;
  • trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java

    r1670 r1772  
    4848                return null;
    4949            Main.pleaseWaitDlg.currentAction.setText(tr("Downloading OSM data..."));
    50             final OsmReader osm = OsmReader.parseDataSetOsm(in, null, Main.pleaseWaitDlg);
     50            final OsmReader osm = OsmReader.parseDataSetOsm(in,Main.pleaseWaitDlg);
    5151            final DataSet data = osm.getDs();
    5252
Note: See TracChangeset for help on using the changeset viewer.