]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.maps/src/org/simantics/maps/tile/ITileProvider.java
Share some projects for Simantics District
[simantics/district.git] / org.simantics.district.maps / src / org / simantics / maps / tile / ITileProvider.java
diff --git a/org.simantics.district.maps/src/org/simantics/maps/tile/ITileProvider.java b/org.simantics.district.maps/src/org/simantics/maps/tile/ITileProvider.java
new file mode 100644 (file)
index 0000000..f88b8ab
--- /dev/null
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.maps.tile;
+
+import java.awt.Image;
+import java.awt.geom.Rectangle2D;
+import java.net.URI;
+
+import org.simantics.maps.ProvisionException;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public interface ITileProvider {
+
+    /**
+     * @return an identifier for the tile provider connection. May represent any
+     *         protocol, not necessarily a web service at all.
+     */
+    URI getSource();
+
+    /**
+     * @return the bounding box of tiles served by this tile provider in degrees
+     *         [(-180,-90) x (180,90)]
+     */
+    Rectangle2D getExtent();
+
+    /**
+     * A synchronous method for requesting the specified map tile as a raster
+     * image.
+     * 
+     * @param key the requested tile
+     * @return the tile as an image
+     * @throws ProvisionException if any failure occurs while procuring the
+     *         image
+     */
+    Image get(TileKey key) throws ProvisionException;
+
+}