MATSIM
MatsimKMLLogo.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * MatsimKMLLogo.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2007 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 
21 package org.matsim.vis.kml;
22 
23 import java.io.IOException;
24 
26 
27 import net.opengis.kml.v_2_2_0.LinkType;
28 import net.opengis.kml.v_2_2_0.ObjectFactory;
29 import net.opengis.kml.v_2_2_0.ScreenOverlayType;
30 import net.opengis.kml.v_2_2_0.UnitsEnumType;
31 import net.opengis.kml.v_2_2_0.Vec2Type;
32 
38 public class MatsimKMLLogo {
45  public static ScreenOverlayType writeMatsimKMLLogo(final KMZWriter writer) throws IOException {
46 
47  writer.addNonKMLFile(MatsimResource.getAsInputStream("matsim_logo_transparent.png"), "matsimLogo.png");
48 
49  ObjectFactory kmlObjectFactory = new ObjectFactory();
50 
51  ScreenOverlayType matsimLogo = kmlObjectFactory.createScreenOverlayType();
52 
53  LinkType icon = kmlObjectFactory.createLinkType();
54  icon.setHref("./matsimLogo.png");
55  matsimLogo.setIcon(icon);
56  matsimLogo.setName("Matsim Logo");
57  Vec2Type overlayXY = kmlObjectFactory.createVec2Type();
58  overlayXY.setX(1.0);
59  overlayXY.setY(-0.7);
60  overlayXY.setXunits(UnitsEnumType.FRACTION);
61  overlayXY.setYunits(UnitsEnumType.FRACTION);
62  matsimLogo.setOverlayXY(overlayXY);
63  Vec2Type screenXY = kmlObjectFactory.createVec2Type();
64  screenXY.setX(0.85);
65  screenXY.setY(25.0);
66  screenXY.setXunits(UnitsEnumType.FRACTION);
67  screenXY.setYunits(UnitsEnumType.PIXELS);
68  matsimLogo.setScreenXY(screenXY);
69  Vec2Type sizeXY = kmlObjectFactory.createVec2Type();
70  sizeXY.setX(0.14);
71  sizeXY.setY(0.0);
72  sizeXY.setXunits(UnitsEnumType.FRACTION);
73  sizeXY.setYunits(UnitsEnumType.FRACTION);
74  matsimLogo.setSize(sizeXY);
75  matsimLogo.setDrawOrder(Integer.MAX_VALUE);
76 
77  return matsimLogo;
78  }
79 
80 }
static final InputStream getAsInputStream(final String filename)
static ScreenOverlayType writeMatsimKMLLogo(final KMZWriter writer)