~ubuntu-branches/ubuntu/vivid/mkgmap/vivid

« back to all changes in this revision

Viewing changes to src/uk/me/parabola/imgfmt/app/mdr/Mdr2x.java

  • Committer: Package Import Robot
  • Author(s): Andreas Tille
  • Date: 2014-08-13 22:13:41 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20140813221341-i9dzzjuto2o7hfh6
Tags: 0.0.0+svn3333-1
* New upstream version
  Closes: #745097
* add debian/classpath (thanks for the patch to Manfred Stock
  <manfred.stock+debian@gmail.com>)
  Closes: #741596
* d/copyright: DEP5

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 * @author Steve Ratcliffe
26
26
 */
27
27
public abstract class Mdr2x extends MdrMapSection implements HasHeaderFlags {
28
 
        protected List<Mdr7Record> streets = new ArrayList<Mdr7Record>();
 
28
        protected List<Mdr7Record> streets = new ArrayList<>();
29
29
 
30
30
        /**
31
31
         * Write out the contents of this section.
34
34
         */
35
35
        public void writeSectData(ImgFileWriter writer) {
36
36
                String lastName = null;
 
37
                Mdr7Record prev = null;
37
38
 
38
39
                int size = getSizes().getStreetSizeFlagged();
39
40
 
47
48
                        String name = Label.stripGarminCodes(street.getName());
48
49
                        
49
50
                        int flag = 1;
50
 
                        if (name.equals(lastName)) {
 
51
                        if (name.equals(lastName) && sameGroup(street, prev))
51
52
                                flag = 0;
52
 
                        } else {
53
 
                                lastName = name;
54
 
                        }
 
53
                        lastName = name;
 
54
                        prev = street;
55
55
 
56
56
                        if (hasLabel) {
57
57
                                putMapIndex(writer, street.getMapIndex());
98
98
        protected void releaseMemory() {
99
99
                streets = null;
100
100
        }
 
101
 
 
102
        /**
 
103
         * These sections are divided into groups based on city, region or country. This routine is
 
104
         * implemented to return true if the two streets are in the same group.
 
105
         *
 
106
         * It is not clear if this is needed for region or country.
 
107
         * @param street1 The first street.
 
108
         * @param street2 The street to compare against.
 
109
         * @return True if the streets are in the same group (city, region etc).
 
110
         */
 
111
        protected abstract boolean sameGroup(Mdr7Record street1, Mdr7Record street2);
 
112
 
 
113
        public void relabelMaps(Mdr1 maps) {
 
114
                // Nothing to do, since all streets are re-labeled in their own section.
 
115
        }
101
116
}