detail maps
This commit is contained in:
parent
15bec5967e
commit
41d54dd5f3
|
@ -61,7 +61,7 @@ var AddMapRegion = func(w *DfWorld, id int) template.HTML {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
var AddMapSite = func(w *DfWorld, id int) template.HTML {
|
var AddMapSite = func(w *DfWorld, id int, color bool) template.HTML {
|
||||||
if site, ok := w.Sites[id]; ok {
|
if site, ok := w.Sites[id]; ok {
|
||||||
coords := strings.Split(site.Rectangle, ":")
|
coords := strings.Split(site.Rectangle, ":")
|
||||||
c1 := strings.Split(coords[0], ",")
|
c1 := strings.Split(coords[0], ",")
|
||||||
|
@ -77,18 +77,25 @@ var AddMapSite = func(w *DfWorld, id int) template.HTML {
|
||||||
if site.Ruin {
|
if site.Ruin {
|
||||||
c = "#aaa"
|
c = "#aaa"
|
||||||
}
|
}
|
||||||
|
if !color {
|
||||||
|
c = "#fff"
|
||||||
|
}
|
||||||
return template.HTML(fmt.Sprintf(`<script>addSite(%d, %f, %f, %f, %f, "%s", "")</script>`, site.Id_, x1/16.0, y1/16.0-1, x2/16.0, y2/16.0-1, c))
|
return template.HTML(fmt.Sprintf(`<script>addSite(%d, %f, %f, %f, %f, "%s", "")</script>`, site.Id_, x1/16.0, y1/16.0-1, x2/16.0, y2/16.0-1, c))
|
||||||
} else {
|
} else {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var AddMapMountain = func(w *DfWorld, id int) template.HTML {
|
var AddMapMountain = func(w *DfWorld, id int, color bool) template.HTML {
|
||||||
if m, ok := w.MountainPeaks[id]; ok {
|
if m, ok := w.MountainPeaks[id]; ok {
|
||||||
c1 := strings.Split(m.Coords, ",")
|
c1 := strings.Split(m.Coords, ",")
|
||||||
x, _ := strconv.Atoi(c1[0])
|
x, _ := strconv.Atoi(c1[0])
|
||||||
y, _ := strconv.Atoi(c1[1])
|
y, _ := strconv.Atoi(c1[1])
|
||||||
return template.HTML(fmt.Sprintf(`<script>addMountain(%d, %d, %d, '#666')</script>`, m.Id_, x, y))
|
c := "#666"
|
||||||
|
if !color {
|
||||||
|
c = "#fff"
|
||||||
|
}
|
||||||
|
return template.HTML(fmt.Sprintf(`<script>addMountain(%d, %d, %d, '%s')</script>`, m.Id_, x, y, c))
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,8 +64,8 @@ func (srv *DfServer) LoadTemplates() {
|
||||||
|
|
||||||
"addLandmass": func(id int) template.HTML { return model.AddMapLandmass(srv.context.world, id) },
|
"addLandmass": func(id int) template.HTML { return model.AddMapLandmass(srv.context.world, id) },
|
||||||
"addRegion": func(id int) template.HTML { return model.AddMapRegion(srv.context.world, id) },
|
"addRegion": func(id int) template.HTML { return model.AddMapRegion(srv.context.world, id) },
|
||||||
"addSite": func(id int) template.HTML { return model.AddMapSite(srv.context.world, id) },
|
"addSite": func(id int, color bool) template.HTML { return model.AddMapSite(srv.context.world, id, color) },
|
||||||
"addMountain": func(id int) template.HTML { return model.AddMapMountain(srv.context.world, id) },
|
"addMountain": func(id int, color bool) template.HTML { return model.AddMapMountain(srv.context.world, id, color) },
|
||||||
"addWorldConstruction": func(id int) template.HTML { return model.AddMapWorldConstruction(srv.context.world, id) },
|
"addWorldConstruction": func(id int) template.HTML { return model.AddMapWorldConstruction(srv.context.world, id) },
|
||||||
"addRiver": func(id int) template.HTML { return model.AddMapRiver(srv.context.world, id) },
|
"addRiver": func(id int) template.HTML { return model.AddMapRiver(srv.context.world, id) },
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,6 @@ var overlayMaps = {
|
||||||
"Evilness": evilnessLayer,
|
"Evilness": evilnessLayer,
|
||||||
};
|
};
|
||||||
|
|
||||||
L.control.layers(null, overlayMaps).addTo(map);
|
|
||||||
|
|
||||||
var imageLayer = L.imageOverlay(imageUrl, imageBounds, { opacity: 0.5 });
|
var imageLayer = L.imageOverlay(imageUrl, imageBounds, { opacity: 0.5 });
|
||||||
imageLayer.addTo(map);
|
imageLayer.addTo(map);
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,17 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
{{- if gt (len .Sites) 0 }}
|
||||||
|
<div class="object-map">
|
||||||
|
<div id="map" style="width: 300px; height: 300px"></div>
|
||||||
|
<!-- <img class="site-map" src="$suburi/sitemap/$site.id" width="300" /> -->
|
||||||
|
</div>
|
||||||
|
{{initMap}}
|
||||||
|
{{- range .Sites }}
|
||||||
|
{{ addSite . false }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<div class="nav nav-tabs" id="nav-tab" role="tablist">
|
<div class="nav nav-tabs" id="nav-tab" role="tablist">
|
||||||
{{ $active := " active"}}
|
{{ $active := " active"}}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
{{- range $race, $civs := .Civilizations }}
|
{{- range $race, $civs := .Civilizations }}
|
||||||
{{- range $civs }}
|
{{- range $civs }}
|
||||||
{{- range .Sites }}
|
{{- range .Sites }}
|
||||||
{{ addSite . }}
|
{{ addSite . true }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -6,5 +6,12 @@
|
||||||
<h1>{{ title .Name }}</h1>
|
<h1>{{ title .Name }}</h1>
|
||||||
<p>landmass</p>
|
<p>landmass</p>
|
||||||
|
|
||||||
|
<div class="object-map">
|
||||||
|
<div id="map" style="width: 300px; height: 300px"></div>
|
||||||
|
</div>
|
||||||
|
{{initMap}}
|
||||||
|
{{ addLandmass .Id }}
|
||||||
|
<script>map.addLayer(landmassesLayer);</script>
|
||||||
|
|
||||||
<p>{{ json . }}</p>
|
<p>{{ json . }}</p>
|
||||||
{{- end }}
|
{{- end }}
|
|
@ -6,6 +6,12 @@
|
||||||
<h3>{{ title .Name }}</h3>
|
<h3>{{ title .Name }}</h3>
|
||||||
<p>{{ if .IsVolcano }}volcano{{else}}mountain{{end}}</p>
|
<p>{{ if .IsVolcano }}volcano{{else}}mountain{{end}}</p>
|
||||||
|
|
||||||
|
<div class="object-map">
|
||||||
|
<div id="map" style="width: 300px; height: 300px"></div>
|
||||||
|
</div>
|
||||||
|
{{initMap}}
|
||||||
|
{{ addMountain .Id false }}
|
||||||
|
|
||||||
<dl class="row">
|
<dl class="row">
|
||||||
<dt class="col-2 col-lg-1">Height</dt>
|
<dt class="col-2 col-lg-1">Height</dt>
|
||||||
<dd class="col-10 col-lg-11">{{ .Height }}</dd>
|
<dd class="col-10 col-lg-11">{{ .Height }}</dd>
|
||||||
|
|
|
@ -6,6 +6,13 @@
|
||||||
<h3>{{ title .Name }}</h3>
|
<h3>{{ title .Name }}</h3>
|
||||||
<p>{{ .Type }}</p>
|
<p>{{ .Type }}</p>
|
||||||
|
|
||||||
|
<div class="object-map">
|
||||||
|
<div id="map" style="width: 300px; height: 300px"></div>
|
||||||
|
</div>
|
||||||
|
{{initMap}}
|
||||||
|
{{ addRegion .Id }}
|
||||||
|
<script>map.addLayer(regionsLayer);</script>
|
||||||
|
|
||||||
{{- if ne .ForceId -1 -}}
|
{{- if ne .ForceId -1 -}}
|
||||||
<dl class="row">
|
<dl class="row">
|
||||||
<dt class="col-2 col-lg-1">Force</dt>
|
<dt class="col-2 col-lg-1">Force</dt>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<!-- <img class="site-map" src="$suburi/sitemap/$site.id" width="300" /> -->
|
<!-- <img class="site-map" src="$suburi/sitemap/$site.id" width="300" /> -->
|
||||||
</div>
|
</div>
|
||||||
{{initMap}}
|
{{initMap}}
|
||||||
{{ addSite .Id }}
|
{{ addSite .Id false }}
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<div class="nav nav-tabs" id="nav-tab" role="tablist">
|
<div class="nav nav-tabs" id="nav-tab" role="tablist">
|
||||||
|
|
|
@ -6,6 +6,12 @@
|
||||||
<h3>{{ title .Name }}</h3>
|
<h3>{{ title .Name }}</h3>
|
||||||
{{ .Type_ }} in {{ site .SiteId }}
|
{{ .Type_ }} in {{ site .SiteId }}
|
||||||
|
|
||||||
|
<div class="object-map">
|
||||||
|
<div id="map" style="width: 300px; height: 300px"></div>
|
||||||
|
</div>
|
||||||
|
{{initMap}}
|
||||||
|
{{ addSite .SiteId false }}
|
||||||
|
|
||||||
<h5 class="mt-3">Events</h5>
|
<h5 class="mt-3">Events</h5>
|
||||||
{{ template "events.html" events . }}
|
{{ template "events.html" events . }}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<div id="map" style="width: 100%; height: 1000px"></div>
|
<div id="map" style="width: 100%; height: 1000px"></div>
|
||||||
{{initMap}}
|
{{initMap}}
|
||||||
|
<script>L.control.layers(null, overlayMaps).addTo(map);</script>
|
||||||
{{- range .Landmasses }}
|
{{- range .Landmasses }}
|
||||||
{{ addLandmass .Id }}
|
{{ addLandmass .Id }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -16,11 +16,11 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- range .Sites }}
|
{{- range .Sites }}
|
||||||
{{ addSite .Id }}
|
{{ addSite .Id true }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- range .MountainPeaks }}
|
{{- range .MountainPeaks }}
|
||||||
{{ addMountain .Id }}
|
{{ addMountain .Id true }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- range .WorldConstructions }}
|
{{- range .WorldConstructions }}
|
||||||
|
|
|
@ -6,6 +6,12 @@
|
||||||
<h3>{{ title .Name }}</h3>
|
<h3>{{ title .Name }}</h3>
|
||||||
<p>{{ .Type }}</p>
|
<p>{{ .Type }}</p>
|
||||||
|
|
||||||
|
<div class="object-map">
|
||||||
|
<div id="map" style="width: 300px; height: 300px"></div>
|
||||||
|
</div>
|
||||||
|
{{initMap}}
|
||||||
|
{{ addWorldConstruction .Id }}
|
||||||
|
|
||||||
{{- if gt (len .Parts) 0 }}
|
{{- if gt (len .Parts) 0 }}
|
||||||
<h5>Parts</h5>
|
<h5>Parts</h5>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
Loading…
Reference in New Issue