removed awesome icons and added Fira font to project

This commit is contained in:
frosch95
2013-09-27 20:28:44 +02:00
parent b081fa2743
commit bdddf8c82a
23 changed files with 25 additions and 933 deletions

View File

@@ -27,7 +27,6 @@ package de.frosch95.geofrogger.fx;
import de.frosch95.geofrogger.application.SessionContext;
import de.frosch95.geofrogger.application.SessionContextListener;
import de.frosch95.geofrogger.fx.components.AwesomeIcons;
import de.frosch95.geofrogger.fx.components.CacheListCell;
import de.frosch95.geofrogger.model.Cache;
import javafx.application.Platform;
@@ -37,8 +36,6 @@ import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.util.Callback;
import java.net.URL;
@@ -54,7 +51,6 @@ import static de.frosch95.geofrogger.fx.JavaFXUtils.addClasses;
*/
public class CacheListController implements Initializable, SessionContextListener {
private static final String FONT_AWESOME = "FontAwesome";
private static final String CACHE_LIST_ACTION_ICONS = "cache-list-action-icons";
private final SessionContext sessionContext = SessionContext.getInstance();
@@ -83,17 +79,10 @@ public class CacheListController implements Initializable, SessionContextListene
cacheListView.getSelectionModel().selectedItemProperty().addListener(
(ChangeListener<Cache>) (ObservableValue<? extends Cache> ov, Cache oldValue, Cache newValue) ->
{
sessionContext.setData("current-cache", newValue);
}
sessionContext.setData("current-cache", newValue)
);
filterIcon.setFont(Font.font(FONT_AWESOME, FontWeight.NORMAL, 16));
filterIcon.setText(AwesomeIcons.ICON_FILTER.toString());
addClasses(filterIcon, CACHE_LIST_ACTION_ICONS);
sortIcon.setFont(Font.font(FONT_AWESOME, FontWeight.NORMAL, 16));
sortIcon.setText(AwesomeIcons.ICON_SORT.toString());
addClasses(sortIcon, CACHE_LIST_ACTION_ICONS);
}
@@ -109,7 +98,7 @@ public class CacheListController implements Initializable, SessionContextListene
private void setCellFactory() {
cacheListView.setCellFactory(
(Callback<ListView<Cache>, CacheListCell>)
(ListView<Cache> p) -> new CacheListCell());
(ListView<Cache> p) -> new CacheListCell());
}
private void setSessionListener() {

View File

@@ -45,7 +45,7 @@ public class GeoFroggerFXMain extends Application {
@Override
public void start(Stage stage) throws Exception {
Font.loadFont(GeoFroggerFXMain.class.getResource("/fonts/fontawesome-webfont.ttf").toExternalForm(), 12);
loadCustomFonts();
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("geofrogger.fxml"), ResourceBundle.getBundle("de.frosch95.geofrogger.fx.geofrogger"));
Parent root = (Parent)fxmlLoader.load();
Scene scene = new Scene(root);
@@ -53,13 +53,23 @@ public class GeoFroggerFXMain extends Application {
stage.show();
}
private void loadCustomFonts() {
Font.loadFont(GeoFroggerFXMain.class.getResource("/fonts/FiraMonoOT-Bold.otf").toExternalForm(), 12);
Font.loadFont(GeoFroggerFXMain.class.getResource("/fonts/FiraMonoOT-Regular.otf").toExternalForm(), 12);
Font.loadFont(GeoFroggerFXMain.class.getResource("/fonts/FiraSansOT-Bold.otf").toExternalForm(), 12);
Font.loadFont(GeoFroggerFXMain.class.getResource("/fonts/FiraSansOT-BoldItalic.otf").toExternalForm(), 12);
Font.loadFont(GeoFroggerFXMain.class.getResource("/fonts/FiraSansOT-Light.otf").toExternalForm(), 12);
Font.loadFont(GeoFroggerFXMain.class.getResource("/fonts/FiraSansOT-LightItalic.otf").toExternalForm(), 12);
Font.loadFont(GeoFroggerFXMain.class.getResource("/fonts/FiraSansOT-Medium.otf").toExternalForm(), 12);
Font.loadFont(GeoFroggerFXMain.class.getResource("/fonts/FiraSansOT-MediumItalic.otf").toExternalForm(), 12);
Font.loadFont(GeoFroggerFXMain.class.getResource("/fonts/FiraSansOT-Regular.otf").toExternalForm(), 12);
Font.loadFont(GeoFroggerFXMain.class.getResource("/fonts/FiraSansOT-RegularItalic.otf").toExternalForm(), 12);
}
@Override
public void stop() throws Exception {
try {
ServiceManager.getInstance().getDatabaseService().getConnection().close();
} catch (SQLException ex) {
Logger.getLogger(GeofroggerController.class.getName()).log(Level.SEVERE, null, ex);
}
System.out.println("stop");
ServiceManager.getInstance().getDatabaseService().getEntityManager().close();
super.stop();
}

View File

@@ -94,7 +94,6 @@ public class GeofroggerController implements Initializable {
+ "\t- ControlsFX 8.0.2 developer preview 1\n"
+ "\t- jdom 2.x\n"
+ "\t- H2 1.3.173\n"
+ "\t- Font Awesome by Dave Gandy\n"
+ "\t- Icons by http://iconmonstr.com/\n";
private final SessionContext sessionContext = SessionContext.getInstance();
@@ -154,11 +153,6 @@ public class GeofroggerController implements Initializable {
@FXML
public void exit(ActionEvent actionEvent) {
try {
ServiceManager.getInstance().getDatabaseService().getConnection().close();
} catch (SQLException ex) {
Logger.getLogger(GeofroggerController.class.getName()).log(Level.SEVERE, null, ex);
}
Platform.exit();
}

View File

@@ -1,84 +0,0 @@
/*
* Copyright (c) 2013, Andreas Billmann <abi@geofroggerfx.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package de.frosch95.geofrogger.fx.components;
import de.frosch95.geofrogger.model.Cache;
/**
* @author Andreas
*/
public class AwesomeGeocachingIcons {
public static AwesomeIcons getIcon(Cache cache) {
AwesomeIcons icon = AwesomeIcons.ICON_TAG;
switch (cache.getType()) {
case "Multi-cache":
icon = AwesomeIcons.ICON_TAGS;
break;
case "Traditional Cache":
icon = AwesomeIcons.ICON_TAG;
break;
case "Unknown Cache":
icon = AwesomeIcons.ICON_QUESTION_SIGN;
break;
case "Earthcache":
icon = AwesomeIcons.ICON_GLOBE;
break;
case "Letterbox Hybrid":
icon = AwesomeIcons.ICON_INBOX;
break;
case "Event Cache":
icon = AwesomeIcons.ICON_CALENDAR;
break;
case "Whereigo Cache":
icon = AwesomeIcons.ICON_PLAY_SIGN;
break;
case "Webcam Cache":
icon = AwesomeIcons.ICON_CAMERA;
break;
case "Virtual Cache":
icon = AwesomeIcons.ICON_LAPTOP;
break;
default:
System.out.println(cache.getType());
}
return icon;
}
}

View File

@@ -1,299 +0,0 @@
/*
* Copyright (c) 2013, Andreas Billmann <abi@geofroggerfx.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package de.frosch95.geofrogger.fx.components;
/**
* @author Andreas
*/
public enum AwesomeIcons {
ICON_GLASS('\uf000'),
ICON_MUSIC('\uf001'),
ICON_SEARCH('\uf002'),
ICON_ENVELOPE('\uf003'),
ICON_HEART('\uf004'),
ICON_STAR('\uf005'),
ICON_STAR_EMPTY('\uf006'),
ICON_USER('\uf007'),
ICON_FILM('\uf008'),
ICON_TH_LARGE('\uf009'),
ICON_TH('\uf00a'),
ICON_TH_LIST('\uf00b'),
ICON_OK('\uf00c'),
ICON_REMOVE('\uf00d'),
ICON_ZOOM_IN('\uf00e'),
ICON_ZOOM_OUT('\uf010'),
ICON_OFF('\uf011'),
ICON_SIGNAL('\uf012'),
ICON_COG('\uf013'),
ICON_TRASH('\uf014'),
ICON_HOME('\uf015'),
ICON_FILE('\uf016'),
ICON_TIME('\uf017'),
ICON_ROAD('\uf018'),
ICON_DOWNLOAD_ALT('\uf019'),
ICON_DOWNLOAD('\uf01a'),
ICON_UPLOAD('\uf01b'),
ICON_INBOX('\uf01c'),
ICON_PLAY_CIRCLE('\uf01d'),
ICON_PLAY_SIGN('\uf144'),
ICON_REPEAT('\uf01e'),
ICON_REFRESH('\uf021'),
ICON_LIST_ALT('\uf022'),
ICON_LOCK('\uf023'),
ICON_FLAG('\uf024'),
ICON_HEADPHONES('\uf025'),
ICON_VOLUME_OFF('\uf026'),
ICON_VOLUME_DOWN('\uf027'),
ICON_VOLUME_UP('\uf028'),
ICON_QRCODE('\uf029'),
ICON_BARCODE('\uf02a'),
ICON_TAG('\uf02b'),
ICON_TAGS('\uf02c'),
ICON_BOOK('\uf02d'),
ICON_BOOKMARK('\uf02e'),
ICON_PRINT('\uf02f'),
ICON_CAMERA('\uf030'),
ICON_FONT('\uf031'),
ICON_BOLD('\uf032'),
ICON_ITALIC('\uf033'),
ICON_TEXT_HEIGHT('\uf034'),
ICON_TEXT_WIDTH('\uf035'),
ICON_ALIGN_LEFT('\uf036'),
ICON_ALIGN_CENTER('\uf037'),
ICON_ALIGN_RIGHT('\uf038'),
ICON_ALIGN_JUSTIFY('\uf039'),
ICON_LIST('\uf03a'),
ICON_INDENT_LEFT('\uf03b'),
ICON_INDENT_RIGHT('\uf03c'),
ICON_FACETIME_VIDEO('\uf03d'),
ICON_PICTURE('\uf03e'),
ICON_PENCIL('\uf040'),
ICON_MAP_MARKER('\uf041'),
ICON_ADJUST('\uf042'),
ICON_TINT('\uf043'),
ICON_EDIT('\uf044'),
ICON_SHARE('\uf045'),
ICON_CHECK('\uf046'),
ICON_MOVE('\uf047'),
ICON_STEP_BACKWARD('\uf048'),
ICON_FAST_BACKWARD('\uf049'),
ICON_BACKWARD('\uf04a'),
ICON_PLAY('\uf04b'),
ICON_PAUSE('\uf04c'),
ICON_STOP('\uf04d'),
ICON_FORWARD('\uf04e'),
ICON_FAST_FORWARD('\uf050'),
ICON_STEP_FORWARD('\uf051'),
ICON_EJECT('\uf052'),
ICON_CHEVRON_LEFT('\uf053'),
ICON_CHEVRON_RIGHT('\uf054'),
ICON_PLUS_SIGN('\uf055'),
ICON_MINUS_SIGN('\uf056'),
ICON_REMOVE_SIGN('\uf057'),
ICON_OK_SIGN('\uf058'),
ICON_QUESTION_SIGN('\uf059'),
ICON_QUESTION('\uf128'),
ICON_INFO_SIGN('\uf05a'),
ICON_SCREENSHOT('\uf05b'),
ICON_REMOVE_CIRCLE('\uf05c'),
ICON_OK_CIRCLE('\uf05d'),
ICON_BAN_CIRCLE('\uf05e'),
ICON_ARROW_LEFT('\uf060'),
ICON_ARROW_RIGHT('\uf061'),
ICON_ARROW_UP('\uf062'),
ICON_ARROW_DOWN('\uf063'),
ICON_SHARE_ALT('\uf064'),
ICON_RESIZE_FULL('\uf065'),
ICON_RESIZE_SMALL('\uf066'),
ICON_PLUS('\uf067'),
ICON_MINUS('\uf068'),
ICON_ASTERISK('\uf069'),
ICON_EXCLAMATION_SIGN('\uf06a'),
ICON_GIFT('\uf06b'),
ICON_LEAF('\uf06c'),
ICON_FIRE('\uf06d'),
ICON_EYE_OPEN('\uf06e'),
ICON_EYE_CLOSE('\uf070'),
ICON_WARNING_SIGN('\uf071'),
ICON_PLANE('\uf072'),
ICON_CALENDAR('\uf073'),
ICON_RANDOM('\uf074'),
ICON_COMMENT('\uf075'),
ICON_MAGNET('\uf076'),
ICON_CHEVRON_UP('\uf077'),
ICON_CHEVRON_DOWN('\uf078'),
ICON_RETWEET('\uf079'),
ICON_SHOPPING_CART('\uf07a'),
ICON_FOLDER_CLOSE('\uf07b'),
ICON_FOLDER_OPEN('\uf07c'),
ICON_RESIZE_VERTICAL('\uf07d'),
ICON_RESIZE_HORIZONTAL('\uf07e'),
ICON_BAR_CHART('\uf080'),
ICON_TWITTER_SIGN('\uf081'),
ICON_FACEBOOK_SIGN('\uf082'),
ICON_CAMERA_RETRO('\uf083'),
ICON_KEY('\uf084'),
ICON_COGS('\uf085'),
ICON_COMMENTS('\uf086'),
ICON_THUMBS_UP('\uf087'),
ICON_THUMBS_DOWN('\uf088'),
ICON_STAR_HALF('\uf089'),
ICON_HEART_EMPTY('\uf08a'),
ICON_SIGNOUT('\uf08b'),
ICON_LINKEDIN_SIGN('\uf08c'),
ICON_PUSHPIN('\uf08d'),
ICON_EXTERNAL_LINK('\uf08e'),
ICON_SIGNIN('\uf090'),
ICON_TROPHY('\uf091'),
ICON_GITHUB_SIGN('\uf092'),
ICON_UPLOAD_ALT('\uf093'),
ICON_LEMON('\uf094'),
ICON_PHONE('\uf095'),
ICON_CHECK_EMPTY('\uf096'),
ICON_BOOKMARK_EMPTY('\uf097'),
ICON_PHONE_SIGN('\uf098'),
ICON_TWITTER('\uf099'),
ICON_FACEBOOK('\uf09a'),
ICON_GITHUB('\uf09b'),
ICON_UNLOCK('\uf09c'),
ICON_CREDIT_CARD('\uf09d'),
ICON_RSS('\uf09e'),
ICON_HDD('\uf0a0'),
ICON_BULLHORN('\uf0a1'),
ICON_BELL('\uf0a2'),
ICON_CERTIFICATE('\uf0a3'),
ICON_HAND_RIGHT('\uf0a4'),
ICON_HAND_LEFT('\uf0a5'),
ICON_HAND_UP('\uf0a6'),
ICON_HAND_DOWN('\uf0a7'),
ICON_CIRCLE_ARROW_LEFT('\uf0a8'),
ICON_CIRCLE_ARROW_RIGHT('\uf0a9'),
ICON_CIRCLE_ARROW_UP('\uf0aa'),
ICON_CIRCLE_ARROW_DOWN('\uf0ab'),
ICON_GLOBE('\uf0ac'),
ICON_WRENCH('\uf0ad'),
ICON_TASKS('\uf0ae'),
ICON_FILTER('\uf0b0'),
ICON_BRIEFCASE('\uf0b1'),
ICON_FULLSCREEN('\uf0b2'),
ICON_GROUP('\uf0c0'),
ICON_LINK('\uf0c1'),
ICON_CLOUD('\uf0c2'),
ICON_BEAKER('\uf0c3'),
ICON_CUT('\uf0c4'),
ICON_COPY('\uf0c5'),
ICON_PAPER_CLIP('\uf0c6'),
ICON_SAVE('\uf0c7'),
ICON_SIGN_BLANK('\uf0c8'),
ICON_REORDER('\uf0c9'),
ICON_LIST_UL('\uf0ca'),
ICON_LIST_OL('\uf0cb'),
ICON_STRIKETHROUGH('\uf0cc'),
ICON_UNDERLINE('\uf0cd'),
ICON_TABLE('\uf0ce'),
ICON_MAGIC('\uf0d0'),
ICON_TRUCK('\uf0d1'),
ICON_PINTEREST('\uf0d2'),
ICON_PINTEREST_SIGN('\uf0d3'),
ICON_GOOGLE_PLUS_SIGN('\uf0d4'),
ICON_GOOGLE_PLUS('\uf0d5'),
ICON_MONEY('\uf0d6'),
ICON_CARET_DOWN('\uf0d7'),
ICON_CARET_UP('\uf0d8'),
ICON_CARET_LEFT('\uf0d9'),
ICON_CARET_RIGHT('\uf0da'),
ICON_COLUMNS('\uf0db'),
ICON_SORT('\uf0dc'),
ICON_SORT_DOWN('\uf0dd'),
ICON_SORT_UP('\uf0de'),
ICON_ENVELOPE_ALT('\uf0e0'),
ICON_LINKEDIN('\uf0e1'),
ICON_UNDO('\uf0e2'),
ICON_LEGAL('\uf0e3'),
ICON_DASHBOARD('\uf0e4'),
ICON_COMMENT_ALT('\uf0e5'),
ICON_COMMENTS_ALT('\uf0e6'),
ICON_BOLT('\uf0e7'),
ICON_SITEMAP('\uf0e8'),
ICON_UMBRELLA('\uf0e9'),
ICON_PASTE('\uf0ea'),
ICON_LIGHTBULB('\uf0eb'),
ICON_EXCHANGE('\uf0ec'),
ICON_CLOUD_DOWNLOAD('\uf0ed'),
ICON_CLOUD_UPLOAD('\uf0ee'),
ICON_USER_MD('\uf0f0'),
ICON_STETHOSCOPE('\uf0f1'),
ICON_SUITCASE('\uf0f2'),
ICON_BELL_ALT('\uf0f3'),
ICON_COFFEE('\uf0f4'),
ICON_FOOD('\uf0f5'),
ICON_FILE_ALT('\uf0f6'),
ICON_BUILDING('\uf0f7'),
ICON_HOSPITAL('\uf0f8'),
ICON_AMBULANCE('\uf0f9'),
ICON_MEDKIT('\uf0fa'),
ICON_FIGHTER_JET('\uf0fb'),
ICON_BEER('\uf0fc'),
ICON_H_SIGN('\uf0fd'),
ICON_PLUS_SIGN_ALT('\uf0fe'),
ICON_DOUBLE_ANGLE_LEFT('\uf100'),
ICON_DOUBLE_ANGLE_RIGHT('\uf101'),
ICON_DOUBLE_ANGLE_UP('\uf102'),
ICON_DOUBLE_ANGLE_DOWN('\uf103'),
ICON_ANGLE_LEFT('\uf104'),
ICON_ANGLE_RIGHT('\uf105'),
ICON_ANGLE_UP('\uf106'),
ICON_ANGLE_DOWN('\uf107'),
ICON_DESKTOP('\uf108'),
ICON_LAPTOP('\uf109'),
ICON_TABLET('\uf10a'),
ICON_MOBILE_PHONE('\uf10b'),
ICON_CIRCLE_BLANK('\uf10c'),
ICON_QUOTE_LEFT('\uf10d'),
ICON_QUOTE_RIGHT('\uf10e'),
ICON_SPINNER('\uf110'),
ICON_CIRCLE('\uf111'),
ICON_REPLY('\uf112'),
ICON_GITHUB_ALT('\uf113'),
ICON_FOLDER_CLOSE_ALT('\uf114'),
ICON_FOLDER_OPEN_ALT('\uf115');
private final Character character;
private AwesomeIcons(Character character) {
this.character = character;
}
public Character character() {
return character;
}
@Override
public String toString() {
return character.toString();
}
}

View File

@@ -1,101 +0,0 @@
/*
* Copyright (c) 2013, Andreas Billmann <abi@geofroggerfx.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package de.frosch95.geofrogger.fx.components;
import de.frosch95.geofrogger.model.Cache;
import javafx.collections.ObservableList;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import jfxtras.labs.map.MapControlable;
import jfxtras.labs.map.render.MapMarkable;
import java.awt.*;
import java.util.Collections;
import java.util.List;
/**
* @author Andreas
*/
public class GeocachingMapMarker implements MapMarkable {
private double lat;
private double lon;
private Label iconLabel;
private Cache cache;
public GeocachingMapMarker(Cache cache, double lat, double lon) {
this.lat = lat;
this.lon = lon;
this.cache = cache;
this.iconLabel = new Label();
iconLabel.setFont(Font.font("FontAwesome", FontWeight.BOLD, 24));
iconLabel.setText(AwesomeGeocachingIcons.getIcon(cache).toString());
}
@Override
public double getLat() {
return lat;
}
@Override
public double getLon() {
return lon;
}
@Override
public void render(MapControlable mapController) {
Point postion = mapController.getMapPoint(lat, lon, true);
if (postion != null) {
Group tilesGroup = mapController.getTilesGroup();
ObservableList<Node> children = tilesGroup.getChildren();
List<? extends Node> nodes = createChildren(postion);
for (Node node : nodes) {
if (!children.contains(node)) {
children.add(node);
}
}
}
}
List<? extends Node> createChildren(Point position) {
iconLabel.setTranslateX(position.x);
iconLabel.setTranslateY(position.y);
return Collections.singletonList(iconLabel);
}
@Override
public Node getNode() {
return iconLabel;
}
}

View File

@@ -197,6 +197,7 @@ public class GroundspeakGPXReader implements GPXReader {
setType(waypointElement, mainWaypoint);
final Element cacheElement = waypointElement.getChild(CACHE, groundspeakNamespace);
setId(cacheElement, mainWaypoint);
parseCacheElement(cacheElement, cache);
} catch (DataConversionException | MalformedURLException e) {
// TODO: do some batch error handling
@@ -361,7 +362,7 @@ public class GroundspeakGPXReader implements GPXReader {
}
private void setId(Element attributeElement, Attribute attribute) throws DataConversionException {
attribute.setId(attributeElement.getAttribute(ID).getIntValue());
attribute.setId(attributeElement.getAttribute(ID).getLongValue());
}
private void setContainer(Element cacheElement, Cache cache) {
@@ -369,7 +370,7 @@ public class GroundspeakGPXReader implements GPXReader {
}
private void setType(Element cacheElement, Cache cache) {
cache.setType(cacheElement.getChild(TYPE, groundspeakNamespace).getTextTrim());
cache.setType(Type.groundspeakStringToType(cacheElement.getChild(TYPE, groundspeakNamespace).getTextTrim()));
}
private void setOwner(Element cacheElement, Cache cache) throws DataConversionException {
@@ -449,6 +450,10 @@ public class GroundspeakGPXReader implements GPXReader {
cache.setName(cacheElement.getChild(NAME, groundspeakNamespace).getTextTrim());
}
private void setId(Element cacheElement, Waypoint waypoint) throws DataConversionException {
waypoint.setId(cacheElement.getAttribute(ID).getLongValue());
}
private void fireEvent(ProgressEvent event) {
listeners.stream().forEach((l) -> {
l.progress(event);