Search in sources :

Example 1 with Map

use of delta.games.lotro.maps.data.Map in project lotro-tools by dmorcellet.

the class LinkCreationInterator method doLink.

private void doLink(MapBundle bundle, int x, int y) {
    MapBundle currentMap = _canvas.getCurrentMap();
    Map map = currentMap.getMap();
    String target = bundle.getKey();
    GeoPoint hotPoint = map.getGeoReference().pixel2geo(new Dimension(x, y));
    MapLink link = new MapLink(target, hotPoint);
    map.addLink(link);
    _manager.saveMap(map.getKey());
    _canvas.repaint();
}
Also used : GeoPoint(delta.games.lotro.maps.data.GeoPoint) MapLink(delta.games.lotro.maps.data.MapLink) MapBundle(delta.games.lotro.maps.data.MapBundle) Dimension(java.awt.Dimension) Map(delta.games.lotro.maps.data.Map)

Example 2 with Map

use of delta.games.lotro.maps.data.Map in project lotro-tools by dmorcellet.

the class MapPageParser method parse.

/**
 * Parse map data.
 * @param mapBundle Storage for extracted data.
 * @param js Input file.
 */
public void parse(MapBundle mapBundle, File js) {
    List<String> lines = TextUtils.readAsLines(js);
    Float startX = null;
    Float startY = null;
    Float scale = null;
    Date date = null;
    MarkersManager markers = mapBundle.getData();
    int markerId = 1;
    for (String line : lines) {
        if (line.startsWith(STARTX_SEED)) {
            // map.StartX = -42.8;
            startX = getValue(STARTX_SEED, line);
        } else if (line.startsWith(STARTY_SEED)) {
            // map.StartY = 14.7;
            startY = getValue(STARTY_SEED, line);
        } else if (line.startsWith(SCALE2MAP_SEED)) {
            // map.ScaleToMap = 3.498879;
            scale = getValue(SCALE2MAP_SEED, line);
        } else // map.ScaleToIg = 0.285807;
        if (line.startsWith(MODIFIED_SEED)) {
            // map.Modified = "07/12/2015";
            date = getDate(MODIFIED_SEED, line);
        } else if (line.startsWith("[")) {
            Marker marker = parseItemLine(line);
            if (marker != null) {
                marker.setId(markerId);
                markerId++;
                markers.addMarker(marker);
            }
        }
    }
    Map map = mapBundle.getMap();
    if ((startX != null) && (startY != null) && (scale != null)) {
        GeoPoint start = new GeoPoint(startX.floatValue(), startY.floatValue());
        GeoReference reference = new GeoReference(start, scale.floatValue());
        map.setGeoReference(reference);
    }
    map.setLastUpdate(date);
}
Also used : GeoPoint(delta.games.lotro.maps.data.GeoPoint) Marker(delta.games.lotro.maps.data.Marker) MarkersManager(delta.games.lotro.maps.data.MarkersManager) Map(delta.games.lotro.maps.data.Map) Date(java.util.Date) GeoPoint(delta.games.lotro.maps.data.GeoPoint) GeoReference(delta.games.lotro.maps.data.GeoReference)

Aggregations

GeoPoint (delta.games.lotro.maps.data.GeoPoint)2 Map (delta.games.lotro.maps.data.Map)2 GeoReference (delta.games.lotro.maps.data.GeoReference)1 MapBundle (delta.games.lotro.maps.data.MapBundle)1 MapLink (delta.games.lotro.maps.data.MapLink)1 Marker (delta.games.lotro.maps.data.Marker)1 MarkersManager (delta.games.lotro.maps.data.MarkersManager)1 Dimension (java.awt.Dimension)1 Date (java.util.Date)1