- Timestamp:
- 2024-04-05T14:58:43+02:00 (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmPbfReader.java
r19024 r19033 16 16 import java.util.Set; 17 17 18 import jakarta.annotation.Nonnull;19 import jakarta.annotation.Nullable;20 21 18 import org.apache.commons.compress.utils.CountingInputStream; 22 19 import org.openstreetmap.josm.data.Bounds; … … 31 28 import org.openstreetmap.josm.data.osm.RelationMemberData; 32 29 import org.openstreetmap.josm.data.osm.Tagged; 30 import org.openstreetmap.josm.data.osm.UploadPolicy; 33 31 import org.openstreetmap.josm.data.osm.User; 34 32 import org.openstreetmap.josm.data.osm.WayData; … … 44 42 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 45 43 import org.openstreetmap.josm.tools.Utils; 44 45 import jakarta.annotation.Nonnull; 46 import jakarta.annotation.Nullable; 46 47 47 48 /** … … 523 524 if (info != null) { 524 525 setOsmPrimitiveData(primitiveBlockRecord, node, info); 526 } else { 527 ds.setUploadPolicy(UploadPolicy.DISCOURAGED); 525 528 } 526 529 buildPrimitive(node); … … 572 575 } 573 576 } 577 574 578 int keyValIndex = 0; // This index must not reset between nodes, and must always increment 575 579 if (ids.length == lats.length && lats.length == lons.length && (denseInfo == null || denseInfo.length == lons.length)) { … … 579 583 for (int i = 0; i < ids.length; i++) { 580 584 final NodeData node; 585 id += ids[i]; 586 node = new NodeData(id); 581 587 if (denseInfo != null) { 582 588 Info info = denseInfo[i]; 583 id += ids[i];584 node = new NodeData(id);585 589 setOsmPrimitiveData(primitiveBlockRecord, node, info); 586 590 } else { 587 node = new NodeData(ids[i]);591 ds.setUploadPolicy(UploadPolicy.DISCOURAGED); 588 592 } 589 593 lat += lats[i]; … … 679 683 if (info != null) { 680 684 setOsmPrimitiveData(primitiveBlockRecord, wayData, info); 685 } else { 686 ds.setUploadPolicy(UploadPolicy.DISCOURAGED); 681 687 } 682 688 buildPrimitive(wayData); … … 744 750 if (info != null) { 745 751 setOsmPrimitiveData(primitiveBlockRecord, data, info); 752 } else { 753 ds.setUploadPolicy(UploadPolicy.DISCOURAGED); 746 754 } 747 755 addTags(data, keys, values); … … 796 804 break; 797 805 case 6: 798 visible = protobufRecord.asUnsignedVarInt().byteValue() == 0;806 visible = protobufRecord.asUnsignedVarInt().byteValue() == 1; 799 807 break; 800 808 default: // Fall through, since the PBF format could be extended … … 947 955 } 948 956 } 949 if (version.length == timestamp.length && timestamp.length == changeset.length && changeset.length == uid.length && 950 uid.length == userSid.length && (visible == EMPTY_LONG || visible.length == userSid.length)) { 957 if (version.length > 0) { 951 958 Info[] infos = new Info[version.length]; 952 959 long lastTimestamp = 0; // delta encoded … … 955 962 long lastUserSid = 0; // delta encoded, string id for username 956 963 for (int i = 0; i < version.length; i++) { 957 lastTimestamp += timestamp[i]; 958 lastChangeset += changeset[i]; 959 lastUid += uid[i]; 960 lastUserSid += userSid[i]; 964 if (timestamp.length > i) 965 lastTimestamp += timestamp[i]; 966 if (changeset.length > i) 967 lastChangeset += changeset[i]; 968 if (uid.length > i && userSid.length > i) { 969 lastUid += uid[i]; 970 lastUserSid += userSid[i]; 971 } 961 972 infos[i] = new Info((int) version[i], lastTimestamp, lastChangeset, (int) lastUid, (int) lastUserSid, 962 973 visible == EMPTY_LONG || visible[i] == 1);
Note:
See TracChangeset
for help on using the changeset viewer.