~ubuntu-branches/ubuntu/oneiric/mkgmap/oneiric

« back to all changes in this revision

Viewing changes to src/uk/me/parabola/imgfmt/app/trergn/Point.java

  • Committer: Bazaar Package Importer
  • Author(s): Francesco Paolo Lovergine, Andreas Putzo, Francesco Paolo Lovergine
  • Date: 2009-07-16 11:10:16 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090716111016-yycxqya1f26xmti7
Tags: 0.0.0+svn1067-1
[ Andreas Putzo ]
* New upstream snapshot.
* Added ${misc:Depends} among dependencies to fix a lintian warning.
* Bumped debhelper compatibility level to 7.
* Updated long description.
* Updated Homepage in debian/control, debian/copyright, debian/watch.
* Added numerous files from /doc to debian/docs.
* Mentioned Bernhard Heibler in debian/copyright and updated copyright
  year of software and packaging.
* Bumped policy to 3.8.2, without changes.
* Added DM-Upload-Allowed to debian/control.

[ Francesco Paolo Lovergine ]
* Added me as Uploader to avoid possible inappropriate NMU notices.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 */
17
17
package uk.me.parabola.imgfmt.app.trergn;
18
18
 
19
 
import uk.me.parabola.imgfmt.app.WriteStrategy;
20
 
import uk.me.parabola.log.Logger;
 
19
import uk.me.parabola.imgfmt.app.ImgFileWriter;
21
20
import uk.me.parabola.imgfmt.app.lbl.POIRecord;
22
21
 
23
22
/**
30
29
 * @author Steve Ratcliffe
31
30
 */
32
31
public class Point extends MapObject {
33
 
        private static final Logger log = Logger.getLogger(Point.class);
34
 
 
35
 
        // Points can have a subtype, eg for restaurant the subtype might be the
36
 
        // kind of food served.
37
 
        private int subtype;
38
 
 
39
32
        // Points can link to a POIRecord
40
33
        private POIRecord poi;
41
34
 
49
42
         *
50
43
         * @param file A reference to the file that should be written to.
51
44
         */
52
 
        public void write(WriteStrategy file) {
53
 
                byte b = (byte) getType();
54
 
                file.put(b);
55
 
                log.debug("writing point: " + b);
 
45
        public void write(ImgFileWriter file) {
 
46
                boolean hasSubtype = false;
 
47
                int type = getType();
 
48
                byte subtype = 0;
 
49
                if (type > 0xff) {
 
50
                        if((type & 0xff) != 0) {
 
51
                            hasSubtype = true;
 
52
                            subtype = (byte) type;
 
53
                        }
 
54
                        type >>= 8;
 
55
                }
 
56
 
 
57
                file.put((byte) type);
56
58
 
57
59
                int off = getLabel().getOffset();
58
60
                if (poi != null) {
59
61
                        off = poi.getOffset();
60
62
                        off |= 0x400000;
61
63
                }
62
 
                if (subtype != 0)
 
64
                if (hasSubtype)
63
65
                        off |= 0x800000;
64
66
 
65
67
                file.put3(off);
66
68
                file.putChar((char) getDeltaLong());
67
69
                file.putChar((char) getDeltaLat());
68
 
                if (subtype != 0)
69
 
                        file.put((byte) subtype);
70
 
        }
71
 
 
72
 
        public void setSubtype(int subtype) {
73
 
                this.subtype = subtype;
 
70
                if (hasSubtype)
 
71
                        file.put(subtype);
74
72
        }
75
73
 
76
74
        public void setPOIRecord(POIRecord poirecord) {