change map quality

This commit is contained in:
Dawid Wysokiński 2020-12-27 14:20:59 +01:00
parent 6d5e47c74a
commit def2bc1356

View File

@ -50,13 +50,16 @@ func (h *handler) mapHandler(c *gin.Context) {
return return
} }
showBarbarian := c.Query("showBarbarian")
largerMarkers := c.Query("largerMarkers")
markersOnly := c.Query("markersOnly")
markers, err := h.mapUsecase.GetMarkers(c.Request.Context(), servermap.GetMarkersConfig{ markers, err := h.mapUsecase.GetMarkers(c.Request.Context(), servermap.GetMarkersConfig{
Server: server.Key, Server: server.Key,
Tribes: c.Request.URL.Query()["tribe"], Tribes: c.Request.URL.Query()["tribe"],
Players: c.Request.URL.Query()["player"], Players: c.Request.URL.Query()["player"],
ShowBarbarianVillages: c.Query("showBarbarian") == "true", ShowBarbarianVillages: showBarbarian == "true" || showBarbarian == "1",
LargerMarkers: c.Query("largerMarkers") == "true", LargerMarkers: largerMarkers == "true" || largerMarkers == "1",
ShowOtherPlayerVillages: !(c.Query("markersOnly") == "true"), ShowOtherPlayerVillages: !(markersOnly == "true" || markersOnly == "1"),
}) })
if err != nil { if err != nil {
c.JSON(http.StatusBadRequest, &gqlerror.Error{ c.JSON(http.StatusBadRequest, &gqlerror.Error{
@ -71,11 +74,13 @@ func (h *handler) mapHandler(c *gin.Context) {
if scale > maxScale { if scale > maxScale {
scale = maxScale scale = maxScale
} }
showGrid := c.Query("showGrid")
showContinentNumbers := c.Query("showContinentNumbers")
if err := generator.Generate(generator.Config{ if err := generator.Generate(generator.Config{
Markers: markers, Markers: markers,
Destination: c.Writer, Destination: c.Writer,
ContinentGrid: c.Query("showGrid") == "true", ContinentGrid: showGrid == "true" || showGrid == "1",
ContinentNumbers: c.Query("showContinentNumbers") == "true", ContinentNumbers: showContinentNumbers == "true" || showContinentNumbers == "1",
BackgroundColor: c.Query("backgroundColor"), BackgroundColor: c.Query("backgroundColor"),
GridLineColor: c.Query("gridLineColor"), GridLineColor: c.Query("gridLineColor"),
ContinentNumberColor: c.Query("continentNumberColor"), ContinentNumberColor: c.Query("continentNumberColor"),
@ -83,7 +88,7 @@ func (h *handler) mapHandler(c *gin.Context) {
CenterX: centerX, CenterX: centerX,
CenterY: centerY, CenterY: centerY,
Scale: float32(scale), Scale: float32(scale),
Quality: 60, Quality: 90,
}); err != nil { }); err != nil {
c.JSON(http.StatusBadRequest, &gqlerror.Error{ c.JSON(http.StatusBadRequest, &gqlerror.Error{
Message: err.Error(), Message: err.Error(),