IndorMapView

Additional

Language
Java
Version
N/A
Created
Jul 9, 2016
Updated
Sep 16, 2016
Owner
Nine Patch (ninepatch)
Contributors
Raphaël Bussa (rebus007)
Rurio Luca (RurioLuca)
2
Activity
Badge
Generate
Download
Source code

Announcement

IndoorMapView

##BETA Version

Android indoor map work in progress...

Requirements

The library requires Android API Level 9+.

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);

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);