IndorMapView

Additional

Language
Java
Version
N/A
Created
Jul 9, 2016
Updated
Apr 3, 2020 (Retired)
Owner
Nine Patch (ninepatch)
Contributors
Rurio Luca (RurioLuca)
Raphaël Bussa (raphaelbussa)
quwepiro
Felix Hollederer (asdoi)
4
Activity
Badge
Generate
Download
Source code

IndoorMapView

BETA Version

Android indoor map work in progress...

Installation

Add it in your root build.gradle at the end of repositories:

allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
}

Add the dependency

dependencies {
            implementation 'com.github.ninepatch:IndoorMapView:Tag'
}

Requirements

The library requires Android API Level 14+.

How to use

activity_main.xml

      <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:fitsSystemWindows="true"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <indoormaps.ninepatch.com.library.IndoorMapsView
        android:id="@+id/indorMaps"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>

MainActivity.class

public class MainActivity extends AppCompatActivity {

 private IndoorMapsView indoorMapsView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        indoorMapsView = (IndoorMapsView) findViewById(R.id.indorMaps);

        indoorMapsView.getIndoorViewListener().setOnMapViewInizializate(new OnMapViewInizializate() {
            @Override
            public void onMapLoading() {
          
            }

            @Override
            public void onMapinizializate() {
                 
                 indoorMapsView.init("mappa2.png", ZOOM.LEVEL4); //image from assets or put link
                 indoorMapsView.setBackgroundColorRes(R.color.colorPrimary);
                      
                       }

        });

   
    }
}

Add marker

                Marker marker = new Marker(MainActivity.this);
                marker.setId(1);
                marker.setLat(36.8271);
                marker.setLon(32.9731);
                marker.setName(getString(R.string.marker_name));
                marker.setImageLink("pointer.png");//from assets or put link
                
                //set Marker Style
                Style style = new Style(MainActivity.this);
                style.setLabelColor(R.color.colorAccent);
                style.setLabelPx(22);
                style.setShowLabel(true);
                marker.setStyle(style);
                
                indoorMapsView.addMarker(marker);

remove marker

                  indoorMapsView.removeMarker(marker.getId());
                  // OR
                  indoorMapsView.removeMarker(marker);

Listner

  indoorMapsView.getIndoorViewListener().setOnMarkerTapListener(new OnMarkerTapListener() {
            @Override
            public void onMarkerTap(Marker marker) {
         
            }
        });

        indoorMapsView.getIndoorViewListener().setOnTapListener(new OnTapListener() {
            @Override
            public void onTap(double lat, double lon) {
                
            }
        });

Center Map

    indoorMapsView.setCenter(lat, lng);

Animation

ANIMATION type: PAN, FLY ,SPIRAL

center map to point or marker whit animation

  indoorMapsView.goToAnimate(marker, ANIMATION.PAN);