crawl
This commit is contained in:
Binary file not shown.
@@ -1,4 +1,4 @@
|
|||||||
#VisualForecast 1000 Properties file. Functional provider must be set for successful boot!
|
#VisualForecast 1000 Properties file. Functional provider must be set for successful boot!
|
||||||
#Thu Mar 07 14:12:25 PST 2024
|
#Thu Mar 07 16:27:03 PST 2024
|
||||||
towns-by-code=
|
towns-by-code=
|
||||||
towns-by-name-and-province=Vancouver,BC;Kamloops,BC;Kelowna,BC
|
towns-by-name-and-province=Vancouver,BC;Kamloops,BC;Kelowna,BC
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
#VisualForecast 1000 Properties file. Functional provider must be set for successful boot!
|
|
||||||
#Thu Mar 07 14:12:28 PST 2024
|
|
||||||
towns-by-code=
|
|
||||||
towns-by-name-and-province=Vancouver,BC;Kamloops,BC;Kelowna,BC
|
|
||||||
1
crawl.txt
Normal file
1
crawl.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Datamart information retrieved from ECCC and from TMSC. Information displayed on short-form forecasts may be formatted to fit on screen, however intent was kept as accurate as possible. Weather warnings and alerts displayed are as provided.
|
||||||
@@ -12,12 +12,19 @@ import java.awt.event.ComponentEvent;
|
|||||||
import java.awt.event.ComponentListener;
|
import java.awt.event.ComponentListener;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.VolatileImage;
|
import java.awt.image.VolatileImage;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
import static com.flaremicro.visualforecast.graphics.RenderConstants.*;
|
import static com.flaremicro.visualforecast.graphics.RenderConstants.*;
|
||||||
|
|
||||||
|
import com.flaremicro.util.Util;
|
||||||
import com.flaremicro.visualforecast.api.ForecastProvider;
|
import com.flaremicro.visualforecast.api.ForecastProvider;
|
||||||
import com.flaremicro.visualforecast.displays.BootupDisplay;
|
import com.flaremicro.visualforecast.displays.BootupDisplay;
|
||||||
import com.flaremicro.visualforecast.displays.DayForecastDisplay;
|
import com.flaremicro.visualforecast.displays.DayForecastDisplay;
|
||||||
@@ -45,6 +52,7 @@ public class RenderPanel extends JPanel implements Tickable, ComponentListener {
|
|||||||
|
|
||||||
private Rectangle redrawBound = new Rectangle(0, 0, 1, 1);
|
private Rectangle redrawBound = new Rectangle(0, 0, 1, 1);
|
||||||
private Rectangle exclusiveRedrawBound = null;
|
private Rectangle exclusiveRedrawBound = null;
|
||||||
|
private Rectangle crawlBound = null;
|
||||||
|
|
||||||
private String currentTown = "";
|
private String currentTown = "";
|
||||||
private String currentForecast = "";
|
private String currentForecast = "";
|
||||||
@@ -53,7 +61,14 @@ public class RenderPanel extends JPanel implements Tickable, ComponentListener {
|
|||||||
|
|
||||||
private PropertyManager propManager;
|
private PropertyManager propManager;
|
||||||
|
|
||||||
|
private String[] crawlStrings = new String[0];
|
||||||
|
String currentCrawlString = null;
|
||||||
|
private int crawlPosition = 0;
|
||||||
|
private int stringIndex = -1;
|
||||||
|
private int currentCrawlStringWidth = 0;
|
||||||
|
|
||||||
public RenderPanel(PropertyManager propManager) {
|
public RenderPanel(PropertyManager propManager) {
|
||||||
|
loadCrawlStrings();
|
||||||
this.addComponentListener(this);
|
this.addComponentListener(this);
|
||||||
this.setDoubleBuffered(true);
|
this.setDoubleBuffered(true);
|
||||||
this.propManager = propManager;
|
this.propManager = propManager;
|
||||||
@@ -95,7 +110,29 @@ public class RenderPanel extends JPanel implements Tickable, ComponentListener {
|
|||||||
super.paintComponent(g);
|
super.paintComponent(g);
|
||||||
Graphics2D g2d = prepareFrameBuffer();
|
Graphics2D g2d = prepareFrameBuffer();
|
||||||
|
|
||||||
|
|
||||||
|
if(g.getClipBounds().equals(this.crawlBound))
|
||||||
|
{
|
||||||
|
g2d.setColor(BG_BLUE);
|
||||||
|
g2d.fillRect(0, H - INFOBAR_HEIGHT, W, INFOBAR_HEIGHT);
|
||||||
|
|
||||||
|
g2d.setColor(Color.DARK_GRAY);
|
||||||
|
g2d.drawLine(0, H - INFOBAR_HEIGHT + STROKE_OFFSET, W, H - INFOBAR_HEIGHT + STROKE_OFFSET);
|
||||||
|
|
||||||
|
g2d.setColor(Color.WHITE);
|
||||||
|
g2d.drawLine(0, H - INFOBAR_HEIGHT + STROKE_WIDTH + STROKE_OFFSET, W, H - INFOBAR_HEIGHT + STROKE_WIDTH + STROKE_OFFSET);
|
||||||
|
if (this.currentCrawlString != null)
|
||||||
|
{
|
||||||
|
g2d.setFont(font.deriveFont(26F));
|
||||||
|
DrawingUtil.drawOutlinedString(g2d, this.crawlPosition, H - INFOBAR_HEIGHT + 30, this.currentCrawlString, Color.WHITE, Color.BLACK, 2);
|
||||||
|
}
|
||||||
|
g2d.dispose();
|
||||||
|
g.drawImage(frameBuffer, 0, 0, getWidth(), getHeight(), this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
drawMainRegion(g2d);
|
drawMainRegion(g2d);
|
||||||
|
|
||||||
if (currentFlavour != null)
|
if (currentFlavour != null)
|
||||||
{
|
{
|
||||||
if (this.getBounds().equals(g.getClipBounds()))
|
if (this.getBounds().equals(g.getClipBounds()))
|
||||||
@@ -127,16 +164,6 @@ public class RenderPanel extends JPanel implements Tickable, ComponentListener {
|
|||||||
g2d.fillRect(0, TOPBAR_HEIGHT, W, MAINBAR_HEIGHT);
|
g2d.fillRect(0, TOPBAR_HEIGHT, W, MAINBAR_HEIGHT);
|
||||||
|
|
||||||
g2d.fillRect(0, TOPBAR_HEIGHT, W, MAINBAR_HEIGHT);
|
g2d.fillRect(0, TOPBAR_HEIGHT, W, MAINBAR_HEIGHT);
|
||||||
|
|
||||||
g2d.setColor(BG_BLUE);
|
|
||||||
g2d.fillRect(0, H - INFOBAR_HEIGHT, W, INFOBAR_HEIGHT);
|
|
||||||
|
|
||||||
g2d.setColor(Color.DARK_GRAY);
|
|
||||||
g2d.drawLine(0, H - INFOBAR_HEIGHT + STROKE_OFFSET, W, H - INFOBAR_HEIGHT + STROKE_OFFSET);
|
|
||||||
|
|
||||||
g2d.setColor(Color.WHITE);
|
|
||||||
g2d.drawLine(0, H - INFOBAR_HEIGHT + STROKE_WIDTH + STROKE_OFFSET, W, H - INFOBAR_HEIGHT + STROKE_WIDTH + STROKE_OFFSET);
|
|
||||||
|
|
||||||
// g2d.setColor(Color.GRAY);
|
// g2d.setColor(Color.GRAY);
|
||||||
// g2d.drawRect(60, TOPBAR_HEIGHT+2, W-120, MAINBAR_HEIGHT-4);
|
// g2d.drawRect(60, TOPBAR_HEIGHT+2, W-120, MAINBAR_HEIGHT-4);
|
||||||
|
|
||||||
@@ -151,8 +178,19 @@ public class RenderPanel extends JPanel implements Tickable, ComponentListener {
|
|||||||
g2d.setFont(font.deriveFont(36F));
|
g2d.setFont(font.deriveFont(36F));
|
||||||
DrawingUtil.drawOutlinedString(g2d, 60, HEADERBAR_Y + 52, currentTown, Color.YELLOW, Color.BLACK, 2);
|
DrawingUtil.drawOutlinedString(g2d, 60, HEADERBAR_Y + 52, currentTown, Color.YELLOW, Color.BLACK, 2);
|
||||||
|
|
||||||
g2d.setFont(font.deriveFont(26F));
|
g2d.setColor(BG_BLUE);
|
||||||
DrawingUtil.drawOutlinedString(g2d, -20, H - INFOBAR_HEIGHT + 30, "Welcome to WeatherBC! Stay tuned for your long range forcast", Color.WHITE, Color.BLACK, 2);
|
g2d.fillRect(0, H - INFOBAR_HEIGHT, W, INFOBAR_HEIGHT);
|
||||||
|
|
||||||
|
g2d.setColor(Color.DARK_GRAY);
|
||||||
|
g2d.drawLine(0, H - INFOBAR_HEIGHT + STROKE_OFFSET, W, H - INFOBAR_HEIGHT + STROKE_OFFSET);
|
||||||
|
|
||||||
|
g2d.setColor(Color.WHITE);
|
||||||
|
g2d.drawLine(0, H - INFOBAR_HEIGHT + STROKE_WIDTH + STROKE_OFFSET, W, H - INFOBAR_HEIGHT + STROKE_WIDTH + STROKE_OFFSET);
|
||||||
|
if (this.currentCrawlString != null)
|
||||||
|
{
|
||||||
|
g2d.setFont(font.deriveFont(26F));
|
||||||
|
DrawingUtil.drawOutlinedString(g2d, this.crawlPosition, H - INFOBAR_HEIGHT + 30, this.currentCrawlString, Color.WHITE, Color.BLACK, 2);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +206,23 @@ public class RenderPanel extends JPanel implements Tickable, ComponentListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.currentFlavour != null)
|
if (this.currentFlavour != null)
|
||||||
|
{
|
||||||
this.currentFlavour.tick(this, ticks, iconAnimationTicks);
|
this.currentFlavour.tick(this, ticks, iconAnimationTicks);
|
||||||
|
}
|
||||||
|
if (this.crawlStrings != null && this.crawlStrings.length > 0 && this.crawlPosition + this.currentCrawlStringWidth <= 0)
|
||||||
|
{
|
||||||
|
stringIndex = ((stringIndex + 1) % this.crawlStrings.length);
|
||||||
|
this.currentCrawlString = this.crawlStrings[stringIndex];
|
||||||
|
this.crawlPosition = W;
|
||||||
|
Graphics g = this.getGraphics();
|
||||||
|
this.currentCrawlStringWidth = g.getFontMetrics(font.deriveFont(26F)).stringWidth(currentCrawlString);
|
||||||
|
g.dispose();
|
||||||
|
}
|
||||||
|
else if (this.currentCrawlString != null)
|
||||||
|
{
|
||||||
|
this.crawlPosition-=2;
|
||||||
|
repaint(0, this.crawlBound.x, this.crawlBound.y, this.crawlBound.width, this.crawlBound.height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BufferedImage getSnapshot() {
|
public BufferedImage getSnapshot() {
|
||||||
@@ -199,6 +253,10 @@ public class RenderPanel extends JPanel implements Tickable, ComponentListener {
|
|||||||
public void loseRedrawRegion() {
|
public void loseRedrawRegion() {
|
||||||
this.redrawBound = null;
|
this.redrawBound = null;
|
||||||
addRedrawBound(W - TIMEBAR_WIDTH + TIMEBAR_OFFSET, TIMEBAR_Y, TIMEBAR_WIDTH, TIMEBAR_HEIGHT, false);
|
addRedrawBound(W - TIMEBAR_WIDTH + TIMEBAR_OFFSET, TIMEBAR_Y, TIMEBAR_WIDTH, TIMEBAR_HEIGHT, false);
|
||||||
|
float wScale = getWidth() / (float) W;
|
||||||
|
float hScale = getHeight() / (float) H;
|
||||||
|
this.crawlBound = new Rectangle((int) 0, (int) ((H - INFOBAR_HEIGHT + 8) * hScale), (int) (W * wScale), (int) (30 * hScale));
|
||||||
|
|
||||||
if (this.currentFlavour != null)
|
if (this.currentFlavour != null)
|
||||||
this.currentFlavour.redrawRegionlost(this);
|
this.currentFlavour.redrawRegionlost(this);
|
||||||
}
|
}
|
||||||
@@ -226,8 +284,7 @@ public class RenderPanel extends JPanel implements Tickable, ComponentListener {
|
|||||||
this.currentFlavour.notifyForecastProviderUpdate(this, forecastProvider);
|
this.currentFlavour.notifyForecastProviderUpdate(this, forecastProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyForecastProviderUpdate()
|
public void notifyForecastProviderUpdate() {
|
||||||
{
|
|
||||||
this.currentFlavour.notifyForecastProviderUpdate(this, forecastProvider);
|
this.currentFlavour.notifyForecastProviderUpdate(this, forecastProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,6 +319,33 @@ public class RenderPanel extends JPanel implements Tickable, ComponentListener {
|
|||||||
repaint(exclusiveRedrawBound);
|
repaint(exclusiveRedrawBound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadCrawlStrings() {
|
||||||
|
File crawl = new File("./crawl.txt");
|
||||||
|
ArrayList<String> strings = new ArrayList<String>();
|
||||||
|
if (crawl != null)
|
||||||
|
{
|
||||||
|
BufferedReader br = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
br = new BufferedReader(new FileReader(crawl));
|
||||||
|
String line;
|
||||||
|
while ((line = br.readLine()) != null)
|
||||||
|
{
|
||||||
|
strings.add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Util.cleanClose(br);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.crawlStrings = strings.toArray(new String[strings.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
/*@Override
|
/*@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while (true)
|
while (true)
|
||||||
|
|||||||
@@ -217,13 +217,21 @@ public class DayForecastDisplay implements Display {
|
|||||||
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + (131 * i) + (127 / 2) - (metrics.stringWidth(statLine1) / 2), RenderConstants.TOPBAR_HEIGHT + 170, statLine1, Color.WHITE, Color.BLACK, 2);
|
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + (131 * i) + (127 / 2) - (metrics.stringWidth(statLine1) / 2), RenderConstants.TOPBAR_HEIGHT + 170, statLine1, Color.WHITE, Color.BLACK, 2);
|
||||||
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + (131 * i) + (127 / 2) - (metrics.stringWidth(statLine2) / 2), RenderConstants.TOPBAR_HEIGHT + 200, statLine2, Color.WHITE, Color.BLACK, 2);
|
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + (131 * i) + (127 / 2) - (metrics.stringWidth(statLine2) / 2), RenderConstants.TOPBAR_HEIGHT + 200, statLine2, Color.WHITE, Color.BLACK, 2);
|
||||||
|
|
||||||
if (!ValueCheck.valueNoData(forecast.hiTemp) && !ValueCheck.valueNoData(forecast.loTemp))
|
if (!ValueCheck.valueNoData(forecast.hiTemp))
|
||||||
{
|
{
|
||||||
|
g2d.setFont(font.deriveFont(26F));
|
||||||
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + (131 * i) + 30 - (metrics.stringWidth(String.valueOf(forecast.hiTemp)) >> 1), RenderConstants.TOPBAR_HEIGHT + 295, String.valueOf(forecast.hiTemp), Color.WHITE, Color.BLACK, 2);
|
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + (131 * i) + 30 - (metrics.stringWidth(String.valueOf(forecast.hiTemp)) >> 1), RenderConstants.TOPBAR_HEIGHT + 295, String.valueOf(forecast.hiTemp), Color.WHITE, Color.BLACK, 2);
|
||||||
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + (131 * i) + 92 - (metrics.stringWidth(String.valueOf(forecast.loTemp)) >> 1), RenderConstants.TOPBAR_HEIGHT + 295, String.valueOf(forecast.loTemp), Color.WHITE, Color.BLACK, 2);
|
|
||||||
|
|
||||||
g2d.setFont(smallFont.deriveFont(24F));
|
g2d.setFont(smallFont.deriveFont(24F));
|
||||||
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + (131 * i) + 20, RenderConstants.TOPBAR_HEIGHT + 270, "Hi", Color.RED, Color.BLACK, 2);
|
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + (131 * i) + 20, RenderConstants.TOPBAR_HEIGHT + 270, "Hi", Color.RED, Color.BLACK, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ValueCheck.valueNoData(forecast.loTemp))
|
||||||
|
{
|
||||||
|
g2d.setFont(font.deriveFont(26F));
|
||||||
|
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + (131 * i) + 92 - (metrics.stringWidth(String.valueOf(forecast.loTemp)) >> 1), RenderConstants.TOPBAR_HEIGHT + 295, String.valueOf(forecast.loTemp), Color.WHITE, Color.BLACK, 2);
|
||||||
|
|
||||||
|
g2d.setFont(smallFont.deriveFont(24F));
|
||||||
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + (131 * i) + 82, RenderConstants.TOPBAR_HEIGHT + 270, "Lo", Color.CYAN, Color.BLACK, 2);
|
DrawingUtil.drawOutlinedString(g2d, RenderConstants.SIDE_OFFSET + (131 * i) + 82, RenderConstants.TOPBAR_HEIGHT + 270, "Lo", Color.CYAN, Color.BLACK, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#VisualForecast 1000 Properties file. Functional provider must be set for successful boot!
|
#VisualForecast 1000 Properties file. Functional provider must be set for successful boot!
|
||||||
#Thu Mar 07 14:12:28 PST 2024
|
#Thu Mar 07 16:27:03 PST 2024
|
||||||
forecast-provider-jar=EnvironmentCanadaProvider.jar
|
forecast-provider-jar=CanadaDatamartProvider.jar
|
||||||
|
|||||||
Reference in New Issue
Block a user