Class SquaremapMarker

java.lang.Object
io.github.emcw.squaremap.entities.SquaremapMarker

public class SquaremapMarker extends Object
Represents a map marker from the Squaremap API. When constructed, its values are set by parsing info from its respective object (the passed argument) in the response data.

It is responsible for extracting relevent info from the tooltip and popup HTML strings and then storing the semi-raw data which should be fully parsed later.

You could look at this class as being somewhere between a raw JsonObject marker and a fully fledged SquaremapTown or SquaremapNation.
See Also:
  • JsonObject
  • Field Details

    • townName

      public final String townName
    • nationName

      public final String nationName
    • color

      public final String color
    • fillColor

      public final String fillColor
    • residents

      public final String residents
    • councillors

      public final String councillors
    • townWiki

      public final String townWiki
    • nationWiki

      public final String nationWiki
    • mayor

      public final String mayor
    • founded

      public final String founded
    • board

      public final String board
    • isCapital

      public final boolean isCapital
    • PVP

      public final boolean PVP
    • PUBLIC

      public final boolean PUBLIC
    • points

      public final com.google.gson.JsonArray points
    • bounds

      public final kotlin.Pair<int[],int[]> bounds
    • location

      public final SquaremapLocation location
    • area

      public final int area
  • Constructor Details

    • SquaremapMarker

      public SquaremapMarker(com.google.gson.JsonObject rawMarkerObj)
  • Method Details

    • getBounds

      public static kotlin.Pair<int[],int[]> getBounds(com.google.gson.JsonArray points)
      Parses points into two seperate arrays, which we call bounds for the sake of simplicity.

      For example:
      [{ "x": 500, z": -200 }, { "x": 7000, "z: "80" }]

      Would become:
      Pairinvalid input: '<'[500, 7000], [-200, 80]>
      Returns:
      New pair of int arrays. First = all points on the X axis. Second = all points on the Z axis.
    • getNamesFromString

      public static Set<String> getNamesFromString(String names)
    • getResidentNames

      public Set<String> getResidentNames()
    • getCouncillorNames

      public Set<String> getCouncillorNames()
    • parseTooltip

      public static com.google.gson.JsonObject parseTooltip(String tooltipStr)
    • parsePopup

      public static com.google.gson.JsonObject parsePopup(String popupStr)