block info layer
This commit is contained in:
parent
b86d9754e8
commit
20b2262508
@ -18,10 +18,7 @@ import io.rudin.minetest.tileserver.module.DBModule;
|
|||||||
import io.rudin.minetest.tileserver.module.ServiceModule;
|
import io.rudin.minetest.tileserver.module.ServiceModule;
|
||||||
import io.rudin.minetest.tileserver.listener.PoiMapBlockListener;
|
import io.rudin.minetest.tileserver.listener.PoiMapBlockListener;
|
||||||
import io.rudin.minetest.tileserver.listener.TravelNetBlockListener;
|
import io.rudin.minetest.tileserver.listener.TravelNetBlockListener;
|
||||||
import io.rudin.minetest.tileserver.route.ConfigRoute;
|
import io.rudin.minetest.tileserver.route.*;
|
||||||
import io.rudin.minetest.tileserver.route.PlayerRoute;
|
|
||||||
import io.rudin.minetest.tileserver.route.PoiRoute;
|
|
||||||
import io.rudin.minetest.tileserver.route.TileRoute;
|
|
||||||
import io.rudin.minetest.tileserver.transformer.JsonTransformer;
|
import io.rudin.minetest.tileserver.transformer.JsonTransformer;
|
||||||
import io.rudin.minetest.tileserver.ws.WebSocketHandler;
|
import io.rudin.minetest.tileserver.ws.WebSocketHandler;
|
||||||
import io.rudin.minetest.tileserver.ws.WebSocketUpdater;
|
import io.rudin.minetest.tileserver.ws.WebSocketUpdater;
|
||||||
@ -55,7 +52,9 @@ public class TileServer {
|
|||||||
get("/tiles/:z/:x/:y", injector.getInstance(TileRoute.class));
|
get("/tiles/:z/:x/:y", injector.getInstance(TileRoute.class));
|
||||||
get("/player", injector.getInstance(PlayerRoute.class), json);
|
get("/player", injector.getInstance(PlayerRoute.class), json);
|
||||||
get("/config", injector.getInstance(ConfigRoute.class), json);
|
get("/config", injector.getInstance(ConfigRoute.class), json);
|
||||||
get("/listener", injector.getInstance(PoiRoute.class), json);
|
|
||||||
|
get("/travelnet", injector.getInstance(TravelnetRoute.class), json);
|
||||||
|
get("/poi", injector.getInstance(PoiRoute.class), json);
|
||||||
|
|
||||||
//Initialize web server
|
//Initialize web server
|
||||||
init();
|
init();
|
||||||
|
@ -82,7 +82,7 @@ public class DefaultSchema extends SchemaImpl {
|
|||||||
public final PlayerMetadata PLAYER_METADATA = io.rudin.minetest.tileserver.blockdb.tables.PlayerMetadata.PLAYER_METADATA;
|
public final PlayerMetadata PLAYER_METADATA = io.rudin.minetest.tileserver.blockdb.tables.PlayerMetadata.PLAYER_METADATA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>listener</code>.
|
* The table <code>poi</code>.
|
||||||
*/
|
*/
|
||||||
public final Poi POI = io.rudin.minetest.tileserver.blockdb.tables.Poi.POI;
|
public final Poi POI = io.rudin.minetest.tileserver.blockdb.tables.Poi.POI;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public class Tables {
|
|||||||
public static final PlayerMetadata PLAYER_METADATA = io.rudin.minetest.tileserver.blockdb.tables.PlayerMetadata.PLAYER_METADATA;
|
public static final PlayerMetadata PLAYER_METADATA = io.rudin.minetest.tileserver.blockdb.tables.PlayerMetadata.PLAYER_METADATA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>listener</code>.
|
* The table <code>poi</code>.
|
||||||
*/
|
*/
|
||||||
public static final Poi POI = io.rudin.minetest.tileserver.blockdb.tables.Poi.POI;
|
public static final Poi POI = io.rudin.minetest.tileserver.blockdb.tables.Poi.POI;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public class Poi extends TableImpl<PoiRecord> {
|
|||||||
private static final long serialVersionUID = -1911319382;
|
private static final long serialVersionUID = -1911319382;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reference instance of <code>listener</code>
|
* The reference instance of <code>poi</code>
|
||||||
*/
|
*/
|
||||||
public static final Poi POI = new Poi();
|
public static final Poi POI = new Poi();
|
||||||
|
|
||||||
@ -54,81 +54,81 @@ public class Poi extends TableImpl<PoiRecord> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The column <code>listener.id</code>.
|
* The column <code>poi.id</code>.
|
||||||
*/
|
*/
|
||||||
public final TableField<PoiRecord, Integer> ID = createField("id", org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.field("nextval('poi_id_seq'::regclass)", org.jooq.impl.SQLDataType.INTEGER)), this, "");
|
public final TableField<PoiRecord, Integer> ID = createField("id", org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.field("nextval('poi_id_seq'::regclass)", org.jooq.impl.SQLDataType.INTEGER)), this, "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The column <code>listener.name</code>.
|
* The column <code>poi.name</code>.
|
||||||
*/
|
*/
|
||||||
public final TableField<PoiRecord, String> NAME = createField("name", org.jooq.impl.SQLDataType.VARCHAR.nullable(false), this, "");
|
public final TableField<PoiRecord, String> NAME = createField("name", org.jooq.impl.SQLDataType.VARCHAR.nullable(false), this, "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The column <code>listener.category</code>.
|
* The column <code>poi.category</code>.
|
||||||
*/
|
*/
|
||||||
public final TableField<PoiRecord, String> CATEGORY = createField("category", org.jooq.impl.SQLDataType.VARCHAR.nullable(false), this, "");
|
public final TableField<PoiRecord, String> CATEGORY = createField("category", org.jooq.impl.SQLDataType.VARCHAR.nullable(false), this, "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The column <code>listener.owner</code>.
|
* The column <code>poi.owner</code>.
|
||||||
*/
|
*/
|
||||||
public final TableField<PoiRecord, String> OWNER = createField("owner", org.jooq.impl.SQLDataType.VARCHAR.nullable(false), this, "");
|
public final TableField<PoiRecord, String> OWNER = createField("owner", org.jooq.impl.SQLDataType.VARCHAR.nullable(false), this, "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The column <code>listener.active</code>.
|
* The column <code>poi.active</code>.
|
||||||
*/
|
*/
|
||||||
public final TableField<PoiRecord, Boolean> ACTIVE = createField("active", org.jooq.impl.SQLDataType.BOOLEAN.nullable(false), this, "");
|
public final TableField<PoiRecord, Boolean> ACTIVE = createField("active", org.jooq.impl.SQLDataType.BOOLEAN.nullable(false), this, "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The column <code>listener.x</code>.
|
* The column <code>poi.x</code>.
|
||||||
*/
|
*/
|
||||||
public final TableField<PoiRecord, Integer> X = createField("x", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
|
public final TableField<PoiRecord, Integer> X = createField("x", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The column <code>listener.y</code>.
|
* The column <code>poi.y</code>.
|
||||||
*/
|
*/
|
||||||
public final TableField<PoiRecord, Integer> Y = createField("y", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
|
public final TableField<PoiRecord, Integer> Y = createField("y", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The column <code>listener.z</code>.
|
* The column <code>poi.z</code>.
|
||||||
*/
|
*/
|
||||||
public final TableField<PoiRecord, Integer> Z = createField("z", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
|
public final TableField<PoiRecord, Integer> Z = createField("z", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The column <code>listener.posx</code>.
|
* The column <code>poi.posx</code>.
|
||||||
*/
|
*/
|
||||||
public final TableField<PoiRecord, Integer> POSX = createField("posx", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
|
public final TableField<PoiRecord, Integer> POSX = createField("posx", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The column <code>listener.posy</code>.
|
* The column <code>poi.posy</code>.
|
||||||
*/
|
*/
|
||||||
public final TableField<PoiRecord, Integer> POSY = createField("posy", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
|
public final TableField<PoiRecord, Integer> POSY = createField("posy", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The column <code>listener.posz</code>.
|
* The column <code>poi.posz</code>.
|
||||||
*/
|
*/
|
||||||
public final TableField<PoiRecord, Integer> POSZ = createField("posz", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
|
public final TableField<PoiRecord, Integer> POSZ = createField("posz", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The column <code>listener.mtime</code>.
|
* The column <code>poi.mtime</code>.
|
||||||
*/
|
*/
|
||||||
public final TableField<PoiRecord, Long> MTIME = createField("mtime", org.jooq.impl.SQLDataType.BIGINT.nullable(false), this, "");
|
public final TableField<PoiRecord, Long> MTIME = createField("mtime", org.jooq.impl.SQLDataType.BIGINT.nullable(false), this, "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>listener</code> table reference
|
* Create a <code>poi</code> table reference
|
||||||
*/
|
*/
|
||||||
public Poi() {
|
public Poi() {
|
||||||
this(DSL.name("listener"), null);
|
this(DSL.name("poi"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an aliased <code>listener</code> table reference
|
* Create an aliased <code>poi</code> table reference
|
||||||
*/
|
*/
|
||||||
public Poi(String alias) {
|
public Poi(String alias) {
|
||||||
this(DSL.name(alias), POI);
|
this(DSL.name(alias), POI);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an aliased <code>listener</code> table reference
|
* Create an aliased <code>poi</code> table reference
|
||||||
*/
|
*/
|
||||||
public Poi(Name alias) {
|
public Poi(Name alias) {
|
||||||
this(alias, POI);
|
this(alias, POI);
|
||||||
|
@ -30,168 +30,168 @@ public class PoiRecord extends TableRecordImpl<PoiRecord> implements Record12<In
|
|||||||
private static final long serialVersionUID = 587275238;
|
private static final long serialVersionUID = 587275238;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for <code>listener.id</code>.
|
* Setter for <code>poi.id</code>.
|
||||||
*/
|
*/
|
||||||
public void setId(Integer value) {
|
public void setId(Integer value) {
|
||||||
set(0, value);
|
set(0, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>listener.id</code>.
|
* Getter for <code>poi.id</code>.
|
||||||
*/
|
*/
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
return (Integer) get(0);
|
return (Integer) get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for <code>listener.name</code>.
|
* Setter for <code>poi.name</code>.
|
||||||
*/
|
*/
|
||||||
public void setName(String value) {
|
public void setName(String value) {
|
||||||
set(1, value);
|
set(1, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>listener.name</code>.
|
* Getter for <code>poi.name</code>.
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return (String) get(1);
|
return (String) get(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for <code>listener.category</code>.
|
* Setter for <code>poi.category</code>.
|
||||||
*/
|
*/
|
||||||
public void setCategory(String value) {
|
public void setCategory(String value) {
|
||||||
set(2, value);
|
set(2, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>listener.category</code>.
|
* Getter for <code>poi.category</code>.
|
||||||
*/
|
*/
|
||||||
public String getCategory() {
|
public String getCategory() {
|
||||||
return (String) get(2);
|
return (String) get(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for <code>listener.owner</code>.
|
* Setter for <code>poi.owner</code>.
|
||||||
*/
|
*/
|
||||||
public void setOwner(String value) {
|
public void setOwner(String value) {
|
||||||
set(3, value);
|
set(3, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>listener.owner</code>.
|
* Getter for <code>poi.owner</code>.
|
||||||
*/
|
*/
|
||||||
public String getOwner() {
|
public String getOwner() {
|
||||||
return (String) get(3);
|
return (String) get(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for <code>listener.active</code>.
|
* Setter for <code>poi.active</code>.
|
||||||
*/
|
*/
|
||||||
public void setActive(Boolean value) {
|
public void setActive(Boolean value) {
|
||||||
set(4, value);
|
set(4, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>listener.active</code>.
|
* Getter for <code>poi.active</code>.
|
||||||
*/
|
*/
|
||||||
public Boolean getActive() {
|
public Boolean getActive() {
|
||||||
return (Boolean) get(4);
|
return (Boolean) get(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for <code>listener.x</code>.
|
* Setter for <code>poi.x</code>.
|
||||||
*/
|
*/
|
||||||
public void setX(Integer value) {
|
public void setX(Integer value) {
|
||||||
set(5, value);
|
set(5, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>listener.x</code>.
|
* Getter for <code>poi.x</code>.
|
||||||
*/
|
*/
|
||||||
public Integer getX() {
|
public Integer getX() {
|
||||||
return (Integer) get(5);
|
return (Integer) get(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for <code>listener.y</code>.
|
* Setter for <code>poi.y</code>.
|
||||||
*/
|
*/
|
||||||
public void setY(Integer value) {
|
public void setY(Integer value) {
|
||||||
set(6, value);
|
set(6, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>listener.y</code>.
|
* Getter for <code>poi.y</code>.
|
||||||
*/
|
*/
|
||||||
public Integer getY() {
|
public Integer getY() {
|
||||||
return (Integer) get(6);
|
return (Integer) get(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for <code>listener.z</code>.
|
* Setter for <code>poi.z</code>.
|
||||||
*/
|
*/
|
||||||
public void setZ(Integer value) {
|
public void setZ(Integer value) {
|
||||||
set(7, value);
|
set(7, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>listener.z</code>.
|
* Getter for <code>poi.z</code>.
|
||||||
*/
|
*/
|
||||||
public Integer getZ() {
|
public Integer getZ() {
|
||||||
return (Integer) get(7);
|
return (Integer) get(7);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for <code>listener.posx</code>.
|
* Setter for <code>poi.posx</code>.
|
||||||
*/
|
*/
|
||||||
public void setPosx(Integer value) {
|
public void setPosx(Integer value) {
|
||||||
set(8, value);
|
set(8, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>listener.posx</code>.
|
* Getter for <code>poi.posx</code>.
|
||||||
*/
|
*/
|
||||||
public Integer getPosx() {
|
public Integer getPosx() {
|
||||||
return (Integer) get(8);
|
return (Integer) get(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for <code>listener.posy</code>.
|
* Setter for <code>poi.posy</code>.
|
||||||
*/
|
*/
|
||||||
public void setPosy(Integer value) {
|
public void setPosy(Integer value) {
|
||||||
set(9, value);
|
set(9, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>listener.posy</code>.
|
* Getter for <code>poi.posy</code>.
|
||||||
*/
|
*/
|
||||||
public Integer getPosy() {
|
public Integer getPosy() {
|
||||||
return (Integer) get(9);
|
return (Integer) get(9);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for <code>listener.posz</code>.
|
* Setter for <code>poi.posz</code>.
|
||||||
*/
|
*/
|
||||||
public void setPosz(Integer value) {
|
public void setPosz(Integer value) {
|
||||||
set(10, value);
|
set(10, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>listener.posz</code>.
|
* Getter for <code>poi.posz</code>.
|
||||||
*/
|
*/
|
||||||
public Integer getPosz() {
|
public Integer getPosz() {
|
||||||
return (Integer) get(10);
|
return (Integer) get(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for <code>listener.mtime</code>.
|
* Setter for <code>poi.mtime</code>.
|
||||||
*/
|
*/
|
||||||
public void setMtime(Long value) {
|
public void setMtime(Long value) {
|
||||||
set(11, value);
|
set(11, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>listener.mtime</code>.
|
* Getter for <code>poi.mtime</code>.
|
||||||
*/
|
*/
|
||||||
public Long getMtime() {
|
public Long getMtime() {
|
||||||
return (Long) get(11);
|
return (Long) get(11);
|
||||||
|
@ -67,11 +67,11 @@ public interface TileServerConfig extends Config {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Key("block.parser.poi.enable")
|
@Key("block.parser.poi.enable")
|
||||||
@DefaultValue("false")
|
@DefaultValue("true")
|
||||||
boolean parserPoiEnable();
|
boolean parserPoiEnable();
|
||||||
|
|
||||||
@Key("block.parser.travelnet.enable")
|
@Key("block.parser.travelnet.enable")
|
||||||
@DefaultValue("false")
|
@DefaultValue("true")
|
||||||
boolean parserTravelnetEnable();
|
boolean parserTravelnetEnable();
|
||||||
|
|
||||||
@Key("block.parser.smartshop.enable")
|
@Key("block.parser.smartshop.enable")
|
||||||
|
@ -17,7 +17,7 @@ import static io.rudin.minetest.tileserver.blockdb.tables.Poi.POI;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class PoiMapBlockListener {
|
public class PoiMapBlockListener {
|
||||||
|
|
||||||
private static final String POIBLOCK_NAME = "tileserver:listener";
|
private static final String POIBLOCK_NAME = "tileserver:poi";
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public PoiMapBlockListener(EventBus eventBus, DSLContext ctx){
|
public PoiMapBlockListener(EventBus eventBus, DSLContext ctx){
|
||||||
|
@ -27,6 +27,8 @@ public class ConfigRoute implements Route {
|
|||||||
public ConfigRoute(TileServerConfig cfg){
|
public ConfigRoute(TileServerConfig cfg){
|
||||||
config.put("matomo.id", cfg.matomoTrackerId());
|
config.put("matomo.id", cfg.matomoTrackerId());
|
||||||
config.put("matomo.url", cfg.matomoTrackerUrl());
|
config.put("matomo.url", cfg.matomoTrackerUrl());
|
||||||
|
config.put("parser.poi", cfg.parserPoiEnable());
|
||||||
|
config.put("parser.travelnet", cfg.parserTravelnetEnable());
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Map<String, Object> config = new HashMap<>();
|
private final Map<String, Object> config = new HashMap<>();
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package io.rudin.minetest.tileserver.route;
|
||||||
|
|
||||||
|
import io.rudin.minetest.tileserver.blockdb.tables.pojos.Travelnet;
|
||||||
|
import org.jooq.DSLContext;
|
||||||
|
import spark.Request;
|
||||||
|
import spark.Response;
|
||||||
|
import spark.Route;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import static io.rudin.minetest.tileserver.blockdb.tables.Travelnet.TRAVELNET;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class TravelnetRoute implements Route {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public TravelnetRoute(DSLContext ctx) {
|
||||||
|
this.ctx = ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final DSLContext ctx;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object handle(Request request, Response response) throws Exception {
|
||||||
|
response.header("Content-Type", "application/json");
|
||||||
|
|
||||||
|
return ctx
|
||||||
|
.selectFrom(TRAVELNET)
|
||||||
|
.fetch()
|
||||||
|
.into(Travelnet.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -23,7 +23,9 @@
|
|||||||
<script src="js/lib/mithril.min.js"></script>
|
<script src="js/lib/mithril.min.js"></script>
|
||||||
<script src="js/main.js"></script>
|
<script src="js/main.js"></script>
|
||||||
<script src="js/map.js"></script>
|
<script src="js/map.js"></script>
|
||||||
<script src="js/player.js"></script>
|
<script src="js/layer.poi.js"></script>
|
||||||
|
<script src="js/layer.player.js"></script>
|
||||||
|
<script src="js/layer.travelnet.js"></script>
|
||||||
<script src="js/websocket.js"></script>
|
<script src="js/websocket.js"></script>
|
||||||
<script src="js/tracker.js"></script>
|
<script src="js/tracker.js"></script>
|
||||||
|
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
|
|
||||||
(function(tileserver){
|
(function(tileserver){
|
||||||
|
|
||||||
|
var PlayerIcon = L.icon({
|
||||||
|
iconUrl: 'pics/sam.png',
|
||||||
|
|
||||||
|
iconSize: [16, 32],
|
||||||
|
iconAnchor: [8, 16],
|
||||||
|
popupAnchor: [0, -16]
|
||||||
|
});
|
||||||
|
|
||||||
var playerMarkers = {}; // name -> L.Marker
|
var playerMarkers = {}; // name -> L.Marker
|
||||||
|
|
||||||
@ -30,8 +37,8 @@
|
|||||||
|
|
||||||
if (!marker){
|
if (!marker){
|
||||||
//Create marker
|
//Create marker
|
||||||
marker = L.marker(latLng);
|
marker = L.marker(latLng, {icon: PlayerIcon});
|
||||||
marker.bindPopup(popup).addTo(tileserver.map);
|
marker.bindPopup(popup).addTo(tileserver.playerLayer);
|
||||||
playerMarkers[player.name] = marker;
|
playerMarkers[player.name] = marker;
|
||||||
|
|
||||||
} else {
|
} else {
|
34
src/main/resources/public/js/layer.poi.js
Normal file
34
src/main/resources/public/js/layer.poi.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
(function(tileserver){
|
||||||
|
|
||||||
|
|
||||||
|
var playerMarkers = {}; // name -> L.Marker
|
||||||
|
|
||||||
|
function updatePoi(poi) {
|
||||||
|
if (!poi.active)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var marker = L.marker([poi.z - 15, poi.x]);
|
||||||
|
|
||||||
|
var popup = "<h4>" + poi.name + "</h4><hr>" +
|
||||||
|
"<b>X: </b> " + poi.x + "<br>" +
|
||||||
|
"<b>Y: </b> " + poi.y + "<br>" +
|
||||||
|
"<b>Z: </b> " + poi.z + "<br>" +
|
||||||
|
"<b>Category: </b> " + poi.category + "<br>" +
|
||||||
|
"<b>Owner: </b> " + poi.owner + "<br>";
|
||||||
|
|
||||||
|
marker.bindPopup(popup).addTo(tileserver.poiLayer);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function update(){
|
||||||
|
m.request({ url: "poi" })
|
||||||
|
.then(function(list){
|
||||||
|
list.forEach(updatePoi);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//initial update
|
||||||
|
update();
|
||||||
|
|
||||||
|
})(window.tileserver);
|
37
src/main/resources/public/js/layer.travelnet.js
Normal file
37
src/main/resources/public/js/layer.travelnet.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
(function(tileserver){
|
||||||
|
|
||||||
|
|
||||||
|
var TravelnetIcon = L.icon({
|
||||||
|
iconUrl: 'pics/travelnet_inv.png',
|
||||||
|
|
||||||
|
iconSize: [64, 64],
|
||||||
|
iconAnchor: [32, 32],
|
||||||
|
popupAnchor: [0, -32]
|
||||||
|
});
|
||||||
|
|
||||||
|
function updateTravelnet(travelnet) {
|
||||||
|
var marker = L.marker([travelnet.z - 16, travelnet.x], {icon: TravelnetIcon});
|
||||||
|
|
||||||
|
var popup = "<h4>" + travelnet.name + "</h4><hr>" +
|
||||||
|
"<b>X: </b> " + travelnet.x + "<br>" +
|
||||||
|
"<b>Y: </b> " + travelnet.y + "<br>" +
|
||||||
|
"<b>Z: </b> " + travelnet.z + "<br>" +
|
||||||
|
"<b>Network: </b> " + travelnet.network + "<br>" +
|
||||||
|
"<b>Owner: </b> " + travelnet.owner + "<br>";
|
||||||
|
|
||||||
|
marker.bindPopup(popup).addTo(tileserver.travelnetLayer);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function update(){
|
||||||
|
m.request({ url: "travelnet" })
|
||||||
|
.then(function(list){
|
||||||
|
list.forEach(updateTravelnet);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//initial update
|
||||||
|
update();
|
||||||
|
|
||||||
|
})(window.tileserver);
|
@ -55,12 +55,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var tileLayer = new RealtimeTileLayer();
|
|
||||||
tileLayer.addTo(map);
|
|
||||||
|
|
||||||
//L.tileLayer('tiles/{z}/{x}/{y}').addTo(map);
|
|
||||||
//L.marker([-207, 7]).bindPopup("Spawn").addTo(map);
|
|
||||||
|
|
||||||
|
|
||||||
function updateTile(data){
|
function updateTile(data){
|
||||||
var id = getImageId(data.x, data.y, data.zoom);
|
var id = getImageId(data.x, data.y, data.zoom);
|
||||||
@ -72,8 +66,31 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var tileLayer = new RealtimeTileLayer();
|
||||||
|
tileLayer.addTo(map);
|
||||||
|
|
||||||
|
var playerLayer = L.layerGroup();
|
||||||
|
var poiLayer = L.layerGroup();
|
||||||
|
var travelnetLayer = L.layerGroup();
|
||||||
|
|
||||||
|
L.control.layers({
|
||||||
|
"Base": tileLayer
|
||||||
|
}, {
|
||||||
|
"Player": playerLayer,
|
||||||
|
"POI": poiLayer,
|
||||||
|
"Travelnet": travelnetLayer
|
||||||
|
}).addTo(map);
|
||||||
|
|
||||||
|
map.addLayer(poiLayer);
|
||||||
|
map.addLayer(travelnetLayer);
|
||||||
|
map.addLayer(playerLayer);
|
||||||
|
|
||||||
//Export
|
//Export
|
||||||
tileserver.map = map;
|
tileserver.map = map;
|
||||||
|
tileserver.poiLayer = poiLayer;
|
||||||
|
tileserver.travelnetLayer = travelnetLayer;
|
||||||
|
tileserver.playerLayer = playerLayer;
|
||||||
tileserver.updateTile = updateTile;
|
tileserver.updateTile = updateTile;
|
||||||
|
|
||||||
})(window.tileserver);
|
})(window.tileserver);
|
BIN
src/main/resources/public/pics/sam.png
Normal file
BIN
src/main/resources/public/pics/sam.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 982 B |
BIN
src/main/resources/public/pics/travelnet_elevator_inv.png
Normal file
BIN
src/main/resources/public/pics/travelnet_elevator_inv.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
BIN
src/main/resources/public/pics/travelnet_inv.png
Normal file
BIN
src/main/resources/public/pics/travelnet_inv.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
@ -1,10 +1,5 @@
|
|||||||
#tilerenderer.initialrendering.enable=true
|
#tilerenderer.initialrendering.enable=true
|
||||||
|
|
||||||
#log.tile.updatetimings=true
|
#log.tile.updatetimings=true
|
||||||
tilerenderer.updateinterval=1500
|
tilerenderer.updateinterval=30
|
||||||
#log.query.performance=true
|
#log.query.performance=true
|
||||||
block.parser.poi.enable=true
|
|
||||||
block.parser.travelnet.enable=true
|
|
||||||
debug.mapblock.dumpinvalid=true
|
|
||||||
block.parser.smartshop.enable=true
|
|
||||||
block.parser.fancyvend.enable=true
|
|
Loading…
x
Reference in New Issue
Block a user