@Override public SortedMap<String, PrimitiveType> getConstituents() { SortedMap<String, PrimitiveType> result = new TreeMap<>(); result.put(KEY_LATITUDE, getLatitude()); result.put(KEY_LONGITUDE, getLongitude()); result.put(KEY_ALTITUDE, getAltitude()); return result; }
@Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof PointType)) { return false; } PointType other = (PointType) obj; if (!getLatitude().equals(other.getLatitude()) || !getLongitude().equals(other.getLongitude()) || !getAltitude().equals(other.getAltitude())) { return false; } return true; }
@Override public int hashCode() { int tmp = 10000 * getLatitude().hashCode(); tmp += 100 * getLongitude().hashCode(); tmp += getAltitude().hashCode(); return tmp; }
@Override public SortedMap<String, PrimitiveType> getConstituents() { SortedMap<String, PrimitiveType> result = new TreeMap<>(); result.put(KEY_LATITUDE, getLatitude()); result.put(KEY_LONGITUDE, getLongitude()); result.put(KEY_ALTITUDE, getAltitude()); return result; }
@Override public EList<Widget> renderWidget(Widget w, StringBuilder sb) throws RenderException { Mapview mapview = (Mapview) w; String snippet = getSnippet("mapview"); snippet = preprocessSnippet(snippet, mapview); 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) { height = 4; // set default height to something viewable } height = height * 36; snippet = StringUtils.replace(snippet, "%height%", Integer.toString(height)); sb.append(snippet); return null; } }
@Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof PointType)) { return false; } PointType other = (PointType) obj; if (!getLatitude().equals(other.getLatitude()) || !getLongitude().equals(other.getLongitude()) || !getAltitude().equals(other.getAltitude())) { return false; } return true; }
@Override public int hashCode() { int tmp = 10000 * getLatitude().hashCode(); tmp += 100 * getLongitude().hashCode(); tmp += getAltitude().hashCode(); return tmp; }