use of org.eclipse.smarthome.core.library.types.PointType in project smarthome by eclipse.
the class WeatherUndergroundDiscoveryService method startScan.
@Override
protected void startScan() {
logger.debug("Starting Weather Underground discovery scan");
PointType location = locationProvider.getLocation();
if (location == null) {
logger.debug("LocationProvider.getLocation() is not set -> Will not provide any discovery results");
return;
}
createResults(location);
}
use of org.eclipse.smarthome.core.library.types.PointType in project smarthome by eclipse.
the class MapviewRenderer method renderWidget.
@Override
public EList<Widget> renderWidget(Widget w, StringBuilder sb) throws RenderException {
Mapview mapview = (Mapview) w;
String snippet = getSnippet("mapview");
snippet = preprocessSnippet(snippet, mapview);
// Process the color tags
snippet = processColor(w, snippet);
State state = itemUIRegistry.getState(mapview);
if (state instanceof PointType) {
PointType pointState = (PointType) state;
double latitude = pointState.getLatitude().doubleValue();
double longitude = pointState.getLongitude().doubleValue();
snippet = StringUtils.replace(snippet, "%lat%", Double.toString(latitude));
snippet = StringUtils.replace(snippet, "%lon%", Double.toString(longitude));
snippet = StringUtils.replace(snippet, "%lonminus%", Double.toString(longitude - 0.01));
snippet = StringUtils.replace(snippet, "%lonplus%", Double.toString(longitude + 0.01));
snippet = StringUtils.replace(snippet, "%latminus%", Double.toString(latitude - 0.01));
snippet = StringUtils.replace(snippet, "%latplus%", Double.toString(latitude + 0.01));
}
int height = mapview.getHeight();
if (height == 0) {
// set default height to something viewable
height = 4;
}
height = height * 36;
snippet = StringUtils.replace(snippet, "%height%", Integer.toString(height));
sb.append(snippet);
return null;
}
Aggregations