maplib

this project provides a map library

License

License

GroupId

GroupId

com.github.martinfrank
ArtifactId

ArtifactId

maplib
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

maplib
this project provides a map library
Project URL

Project URL

https://github.com/martinFrank/map-library
Project Organization

Project Organization

Martin Frank
Source Code Management

Source Code Management

https://github.com/martinFrank/map-library/tree/master

Download maplib

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.martinfrank/maplib/ -->
<dependency>
    <groupId>com.github.martinfrank</groupId>
    <artifactId>maplib</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.martinfrank/maplib/
implementation 'com.github.martinfrank:maplib:0.2.0'
// https://jarcasting.com/artifacts/com.github.martinfrank/maplib/
implementation ("com.github.martinfrank:maplib:0.2.0")
'com.github.martinfrank:maplib:jar:0.2.0'
<dependency org="com.github.martinfrank" name="maplib" rev="0.2.0">
  <artifact name="maplib" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.martinfrank', module='maplib', version='0.2.0')
)
libraryDependencies += "com.github.martinfrank" % "maplib" % "0.2.0"
[com.github.martinfrank/maplib "0.2.0"]

Dependencies

compile (2)

Group / Artifact Type Version
com.github.martinfrank : drawlib jar 0.4.1
com.github.martinfrank : geolib jar 0.1.0

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

map-library

a map is a geographical 2D representation of fields that are connected to each other. The concept of a map originates mainly from 2D-games. Hence the map is rastered.

the major reason for using this library is that it is platform independ and uses only java basic functionality (only java.lang and java.util)

Map Types

there are 3 different types of maps implemented:

  • hexagonal (vertical or horizontal)
  • squared map (squares, diamonds, isometric)
  • triangle map (vertical or horizontal)

Data Types

the map is build up from fields: F, edges E and nodes N, they all together form the map.

A Map has:
  • all fields:
    List<F> fields = getFields();
    
  • an aggregation - a set of shape that form the map.
    the aggreagtion is the graphical representation of the map
    Aggregation aggregation = getAggregation();
    double widthOfMap = aggregation.getWidth(); //real size after scale
    double heightOfMap = aggregation.getHeight(); //real size after scale
    
A field has:
  • neighbors (other map fields)
    List<F> nbgs = MapField.getFields();
    
  • edges (around the field)
    List<E> edges = mapField.getEdges();
    
  • points (outline and center)
    List<N> points = mapField.getNodes();
    
  • a Shape that represents the graphic:
    this shape should be used for any drawing tasks
    Shape shape = getShape();
    
Edges have:
  • A List of Nodes - always of size 2, these are start and end nodes
    N a = mapEdge.getNodes().get(0);
    N a = mapEdge.getNodes().get(1);
    
  • fields, the two field adjected to the edge (or only one if it is on the border)
    List<F> fields = mapEdge.getFields();
    
  • edges, whom they are connected to
    List<E> edges = mapEdge.getEdges();
    
  • a Line that represents the graphic:
    this line should be used for any drawing tasks
    Line line = getLine();
    
Nodes have:
  • MapEdges to which they are connected
    List<E> edges = mapPoint.getEdges();
    
  • Fields to which they are connected
    List<F> fields = mapPoint.getFields();
    
  • a Point that represents the graphic:
    this point should be used for any drawing tasks
    Point point = getPoint();
    
Nodes have:

all data types can be parametrized and have getters/setters for the customizable objects

API

the map library provides expected basic functionality

  • access to all data fields
  • access to Data Types on x/y - position (either field, edge or point) - very helpful for GUIs, see example implementaion
  • A* (aStar) search on a field-based path (edge-based is planned for further releases)

Example / Tutorial

this screen shot is taken from the example of the map-library:

screenshot

Requirements:

Versions

Version
0.2.0
0.1.0