1
0
forked from MTSR/mapserver

mapobject config type

This commit is contained in:
NatureFreshMilk 2019-02-12 13:40:33 +01:00
parent 0b3d7c46ab
commit 35e34ad74e
3 changed files with 27 additions and 11 deletions

View File

@ -10,15 +10,20 @@ import (
)
type Config struct {
Port int `json:"port"`
EnablePrometheus bool `json:"enableprometheus"`
EnableRendering bool `json:"enablerendering"`
Webdev bool `json:"webdev"`
WebApi *WebApiConfig `json:"webapi"`
Layers []layer.Layer `json:"layers"`
RenderingFetchLimit int `json:"renderingfetchlimit"`
RenderingJobs int `json:"renderingjobs"`
RenderingQueue int `json:"renderingqueue"`
Port int `json:"port"`
EnablePrometheus bool `json:"enableprometheus"`
EnableRendering bool `json:"enablerendering"`
Webdev bool `json:"webdev"`
WebApi *WebApiConfig `json:"webapi"`
Layers []layer.Layer `json:"layers"`
RenderingFetchLimit int `json:"renderingfetchlimit"`
RenderingJobs int `json:"renderingjobs"`
RenderingQueue int `json:"renderingqueue"`
MapObjects *MapObjectConfig `json:"mapobjects"`
}
type MapObjectConfig struct {
Bones bool `json:"bones"`
}
type WebApiConfig struct {
@ -73,6 +78,10 @@ func ParseConfig(filename string) (*Config, error) {
},
}
mapobjs := MapObjectConfig{
Bones: true,
}
cfg := Config{
Port: 8080,
EnableRendering: true,
@ -83,6 +92,7 @@ func ParseConfig(filename string) (*Config, error) {
RenderingFetchLimit: 1000,
RenderingJobs: runtime.NumCPU(),
RenderingQueue: 100,
MapObjects: &mapobjs,
}
info, err := os.Stat(filename)

View File

@ -33,7 +33,11 @@ api.getConfig().then(function(cfg){
overlays["POI"] = new PoiOverlay(wsChannel, layerMgr);
overlays["Labels"] = new LabelOverlay(wsChannel, layerMgr);
overlays["Travelnet"] = new TravelnetOverlay(wsChannel, layerMgr);
overlays["Bones"] = new BonesOverlay(wsChannel, layerMgr);
if (cfg.mapobjects.bones) {
overlays["Bones"] = new BonesOverlay(wsChannel, layerMgr);
}
overlays["Digilines LCD"] = new LcdOverlay(wsChannel, layerMgr);
overlays["Digiterms"] = new DigitermOverlay(wsChannel, layerMgr);
overlays["Lua Controller"] = new LuacontrollerOverlay(wsChannel, layerMgr);

View File

@ -9,7 +9,8 @@ import (
//Public facing config
type PublicConfig struct {
Layers []layer.Layer `json:"layers"`
Layers []layer.Layer `json:"layers"`
MapObjects *app.MapObjectConfig `json:"mapobjects"`
}
type ConfigHandler struct {
@ -21,6 +22,7 @@ func (h *ConfigHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
webcfg := PublicConfig{}
webcfg.Layers = h.ctx.Config.Layers
webcfg.MapObjects = h.ctx.Config.MapObjects
json.NewEncoder(resp).Encode(webcfg)
}