Autopsy  4.21.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
MBTilesTile.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2019 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.geolocation;
20 
21 import java.awt.image.BufferedImage;
22 import java.lang.ref.SoftReference;
23 
24 import org.jxmapviewer.viewer.Tile;
25 
31 final class MBTilesTile extends Tile {
32 
33  private SoftReference<BufferedImage> image = new SoftReference<>(null);
34  private Priority priority = Priority.High;
35  private boolean loaded = false;
36  private final String tileID;
37 
45  MBTilesTile(int x, int y, int zoom) {
46  super(x, y, zoom);
47  tileID = null;
48  }
49 
59  MBTilesTile(int x, int y, int zoom, String tileID, Priority priority) {
60  super(x, y, zoom);
61  this.priority = priority;
62  this.tileID = tileID;
63  }
64 
70  void setImage(BufferedImage image) {
71  this.image = new SoftReference<>(image);
72  setLoaded(true);
73  }
74 
81  @Override
82  public synchronized boolean isLoaded() {
83  return loaded;
84  }
85 
86  synchronized void setLoaded(boolean loaded) {
87  boolean old = isLoaded();
88  this.loaded = loaded;
89  firePropertyChange("loaded", old, isLoaded());
90  }
91 
92  @Override
93  public BufferedImage getImage() {
94  BufferedImage img = image.get();
95  if (img == null) {
96  setLoaded(false);
97  }
98  return img;
99  }
100 
101  @Override
102  public Priority getPriority() {
103  return priority;
104  }
105 
106  @Override
107  public void setPriority(Priority priority) {
108  this.priority = priority;
109  }
110 
117  @Override
118  public String getURL() {
119  return tileID;
120  }
121 
122 }

Copyright © 2012-2022 Basis Technology. Generated on: Tue Feb 6 2024
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.