MATSIM
ZoomEntry.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * ZoomEntry
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2010 by the members listed in the COPYING, *
8  * LICENSE and WARRANTY file. *
9  * email : info at matsim dot org *
10  * *
11  * *********************************************************************** *
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * See also COPYING, LICENSE and WARRANTY file *
18  * *
19  * *********************************************************************** */
20 package org.matsim.core.config.groups;
21 
22 import java.awt.geom.Rectangle2D;
23 import java.awt.image.BufferedImage;
24 import java.io.IOException;
25 import java.io.Serializable;
26 
27 import javax.imageio.ImageIO;
28 
29 public final class ZoomEntry implements Serializable {
30  private static final long serialVersionUID = 1L;
31 
32  private Rectangle2D zoomstart;
33  private BufferedImage snap;
34  private String name;
35 
36  public ZoomEntry() {
37 
38  }
39 
40  public ZoomEntry(BufferedImage snap, Rectangle2D zoomstore, String name) {
41  super();
42  this.snap = snap;
43  this.zoomstart = zoomstore;
44  this.name = name;
45  }
46 
47  private void writeObject( java.io.ObjectOutputStream s ) throws IOException {
48  s.writeUTF(this.name);
49  s.writeDouble(this.zoomstart.getX());
50  s.writeDouble(this.zoomstart.getY());
51  s.writeDouble(this.zoomstart.getWidth());
52  s.writeDouble(this.zoomstart.getHeight());
53  ImageIO.write(this.snap, "jpg", s);
54  }
55 
56 
57  private void readObject( java.io.ObjectInputStream s ) throws IOException {
58  this.name = s.readUTF();
59  this.zoomstart = new Rectangle2D.Double(s.readDouble(),s.readDouble(),s.readDouble(),s.readDouble());
60  this.snap = ImageIO.read(s);
61  }
62 
63  public Rectangle2D getZoomstart() {
64  return this.zoomstart;
65  }
66 
67  public BufferedImage getSnap() {
68  return this.snap;
69  }
70 
71  public String getName() {
72  return this.name;
73  }
74 
75 }
static final long serialVersionUID
Definition: ZoomEntry.java:30
Rectangle2D getZoomstart()
Definition: ZoomEntry.java:63
String getName()
Definition: ZoomEntry.java:71
String name
Definition: ZoomEntry.java:34
Rectangle2D zoomstart
Definition: ZoomEntry.java:32
BufferedImage getSnap()
Definition: ZoomEntry.java:67
void readObject(java.io.ObjectInputStream s)
Definition: ZoomEntry.java:57
void writeObject(java.io.ObjectOutputStream s)
Definition: ZoomEntry.java:47
ZoomEntry(BufferedImage snap, Rectangle2D zoomstore, String name)
Definition: ZoomEntry.java:40
Definition: ZoomEntry.java:29
ZoomEntry()
Definition: ZoomEntry.java:36
BufferedImage snap
Definition: ZoomEntry.java:33