diff --git a/Team 48 - Dead Souls - CumminsNavigator/.gitignore b/Team 48 - Dead Souls - CumminsNavigator/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/Team 48 - Dead Souls - CumminsNavigator/.idea/.gitignore b/Team 48 - Dead Souls - CumminsNavigator/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Team 48 - Dead Souls - CumminsNavigator/.idea/.name b/Team 48 - Dead Souls - CumminsNavigator/.idea/.name new file mode 100644 index 0000000..066af89 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/.idea/.name @@ -0,0 +1 @@ +Cummins Navigator \ No newline at end of file diff --git a/Team 48 - Dead Souls - CumminsNavigator/.idea/compiler.xml b/Team 48 - Dead Souls - CumminsNavigator/.idea/compiler.xml new file mode 100644 index 0000000..fb7f4a8 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Team 48 - Dead Souls - CumminsNavigator/.idea/gradle.xml b/Team 48 - Dead Souls - CumminsNavigator/.idea/gradle.xml new file mode 100644 index 0000000..a2d7c21 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/Team 48 - Dead Souls - CumminsNavigator/.idea/misc.xml b/Team 48 - Dead Souls - CumminsNavigator/.idea/misc.xml new file mode 100644 index 0000000..ada61b9 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/.idea/misc.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Team 48 - Dead Souls - CumminsNavigator/.idea/vcs.xml b/Team 48 - Dead Souls - CumminsNavigator/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Team 48 - Dead Souls - CumminsNavigator/CumminsNavigator.apk b/Team 48 - Dead Souls - CumminsNavigator/CumminsNavigator.apk new file mode 100644 index 0000000..ce974fc Binary files /dev/null and b/Team 48 - Dead Souls - CumminsNavigator/CumminsNavigator.apk differ diff --git a/Team 48 - Dead Souls - CumminsNavigator/README.md b/Team 48 - Dead Souls - CumminsNavigator/README.md new file mode 100644 index 0000000..492d059 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/README.md @@ -0,0 +1,44 @@ +# Cummins Navigator - Dead Souls + +**Pitch Video -** +https://drive.google.com/file/d/1fmMCCzIdJuc-SUyzhpi_hwAUeh1BdirK/view?usp=drivesdk + +**Introduction: -** + +Hello, we’re Team Dead Souls. This is a project to help navigate through our college and find the shortest routes between two places. +This is what our interface looks like: - + +**Front page: -** + +![image](https://user-images.githubusercontent.com/101361502/168479399-1179f7ff-a1f7-4974-bfdb-57ebfc8f4f22.png) + + +**Next page: -** + +![image](https://user-images.githubusercontent.com/101361502/168479408-9ba99f32-0cd8-4769-baa2-e6d31f8d5973.png) + + +**Why do we need a navigation system for Cummins?** + +It’s difficult to find classrooms and labs when you first enter our campus as a student or a guest. We also realized that we normally use a longer route to reach some places where we could have used a shorter alternative if we had already known about its existence. This project helped us find some very interesting paths to take and now it’ll help you too. + +**Instructions: -** + +* Path for java code: Buffer_3.0/app/src/main/java/com/example/cumminsnavigator/ +* The code is split into 3 java files. The ‘node’ file is used to store the buildings as vertices and creates a double dimensional arraylist of the rooms in that building, floor-wise. +* Class ‘map’ stores the main dijkstra’s algorithm to calculate the shortest distance and path. +* Class ‘MakeMap’ is used to create and store the graph. +* Frontend is created using Android Studio. +* Download the code as a zip file, extract the files, and you will be able to open it in your android studio software. +* You can see the working of our app on an emulator. +* Do not set the phone on dark mode. +* You can also install our app by downloading the CumminsNavigator.apk file. + +**Collaborators: -** +Shreyal Geddam +Aarushi Chopkar +Silvi Parlani +Arya Darvekar +Alefiya Dawasaz + + diff --git a/Team 48 - Dead Souls - CumminsNavigator/app/.gitignore b/Team 48 - Dead Souls - CumminsNavigator/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/Team 48 - Dead Souls - CumminsNavigator/app/build.gradle b/Team 48 - Dead Souls - CumminsNavigator/app/build.gradle new file mode 100644 index 0000000..d6eddd9 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/app/build.gradle @@ -0,0 +1,38 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 32 + + defaultConfig { + applicationId "com.example.cumminsnavigator" + minSdk 21 + targetSdk 32 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.4.1' + implementation 'com.google.android.material:material:1.6.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.3' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/Team 48 - Dead Souls - CumminsNavigator/app/proguard-rules.pro b/Team 48 - Dead Souls - CumminsNavigator/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/Team 48 - Dead Souls - CumminsNavigator/app/src/androidTest/java/com/example/cumminsnavigator/ExampleInstrumentedTest.java b/Team 48 - Dead Souls - CumminsNavigator/app/src/androidTest/java/com/example/cumminsnavigator/ExampleInstrumentedTest.java new file mode 100644 index 0000000..f504aa3 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/app/src/androidTest/java/com/example/cumminsnavigator/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.cumminsnavigator; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.example.cumminsnavigator", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/Team 48 - Dead Souls - CumminsNavigator/app/src/main/AndroidManifest.xml b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..837b583 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/AndroidManifest.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Team 48 - Dead Souls - CumminsNavigator/app/src/main/java/com/example/cumminsnavigator/MainActivity.java b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/java/com/example/cumminsnavigator/MainActivity.java new file mode 100644 index 0000000..9fa447b --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/java/com/example/cumminsnavigator/MainActivity.java @@ -0,0 +1,81 @@ +package com.example.cumminsnavigator; + +import androidx.annotation.RequiresApi; +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Spinner; + +import java.util.ArrayList; + +public class MainActivity extends AppCompatActivity { + + public static final String M1 = "com.example.DropDown.TRY"; + public static final String M2 = "com.example.DropDown.TRY1"; + String sourceValue, destValue, destRoomValue; + + ArrayList build = new ArrayList<>(); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + //Source Spinner + Spinner mySpinner1 = (Spinner) findViewById(R.id.spinner1); + ArrayAdapter myAdapter1 = new ArrayAdapter(MainActivity.this, + android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.BuildingList)); + myAdapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + mySpinner1.setAdapter(myAdapter1); + + mySpinner1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + sourceValue = String.valueOf(parent.getItemAtPosition(position)); + } + @Override + public void onNothingSelected(AdapterView parent) { + + } + }); + + //Destination Room Spinner + Spinner mySpinner3 = (Spinner) findViewById(R.id.spinnerRoom); + ArrayAdapter myAdapter3 = new ArrayAdapter(MainActivity.this, + android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.Roomlist)); + myAdapter3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + mySpinner3.setAdapter(myAdapter3); + + mySpinner3.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + destRoomValue = String.valueOf(parent.getItemAtPosition(position)); + } + @Override + public void onNothingSelected(AdapterView parent) { + } + }); + } + + @RequiresApi(api = Build.VERSION_CODES.N) + public void onClick(View view){ + Intent intent = new Intent(this, MainActivity2.class); + + MakeMap ob1 = new MakeMap(); + ob1.create(); + ob1.addRooms(); + + int snum = ob1.getBuildingNum(sourceValue); + ArrayList d_dest = ob1.getBuilding(destRoomValue); + String printPath = ob1.dijkstra(snum,(int)d_dest.get(2)); + String printFloor = "Room " + destRoomValue + " is in " + d_dest.get(0) + " Floor: " + d_dest.get(1); + intent.putExtra(M1,printFloor); + intent.putExtra(M2,printPath); + startActivity(intent); + } +} \ No newline at end of file diff --git a/Team 48 - Dead Souls - CumminsNavigator/app/src/main/java/com/example/cumminsnavigator/MainActivity2.java b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/java/com/example/cumminsnavigator/MainActivity2.java new file mode 100644 index 0000000..cce8859 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/java/com/example/cumminsnavigator/MainActivity2.java @@ -0,0 +1,27 @@ +package com.example.cumminsnavigator; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.widget.TextView; + +public class MainActivity2 extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main2); + + Intent intent = getIntent(); + String printFloor = intent.getStringExtra(MainActivity.M1); + + TextView textGetFloor = findViewById(R.id.getFloor); + textGetFloor .setText(printFloor); + + String printPath = intent.getStringExtra(MainActivity.M2); + + TextView textGetPath = findViewById(R.id.getPath); + textGetPath.setText(printPath); + } +} \ No newline at end of file diff --git a/Team 48 - Dead Souls - CumminsNavigator/app/src/main/java/com/example/cumminsnavigator/MakeMap.java b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/java/com/example/cumminsnavigator/MakeMap.java new file mode 100644 index 0000000..545e578 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/java/com/example/cumminsnavigator/MakeMap.java @@ -0,0 +1,372 @@ +package com.example.cumminsnavigator; + +import java.util.ArrayList; + +/** + * 6 + * 0: Comp and E&TC + * 1: IT + * 2: Mech + * 3: MBA + * 4: Canteen + * 5: Instru 1 ie near main gate + * 6: Instru 2 ie near canteen + * 7: Mechatronics + * 8: Main Gate + * 9: Back Gate to lane 1 + * 10: Back gate to lane 2 + */ +public class MakeMap extends map { // hardcoding data + + public void create() { + for (int i = 0; i < 11; i++) + graph.add(new ArrayList()); + + // adjacent nodes of vertex 0 ie comp building + graph.get(0).add(new node(1, 45));// IT + graph.get(0).add(new node(2, 90));// Mech + graph.get(0).add(new node(3, 60));// MBA + graph.get(0).add(new node(4, 70));// Canteen + graph.get(0).add(new node(5, 10));// Instru 1 + // graph.get(0).add(new node(6, 40));//Instru 2 + graph.get(0).add(new node(8, 40));// Main gate + + for (node n : graph.get(0)) { + n.name = "Main-Building"; + } + + // adjacent nodes of vertex 1 ie IT building + graph.get(1).add(new node(0, 45));// comp + graph.get(1).add(new node(2, 40));// mech + graph.get(1).add(new node(3, 50));// mba + graph.get(1).add(new node(4, 40));// canteen + // graph.get(1).add(new node(5, 50));//instru 1 + graph.get(1).add(new node(6, 60));// instru 2 + // graph.get(1).add(new node(8, 60));//main gate + + for (node n : graph.get(1)) { + n.name = "IT-Building"; + } + + // adjacent nodes of vertex 2 ie mech building + graph.get(2).add(new node(0, 90));// comp + graph.get(2).add(new node(1, 40));// it + graph.get(2).add(new node(3, 65));// mba + graph.get(2).add(new node(4, 100));// canteen + graph.get(2).add(new node(5, 100));// instru 1 + graph.get(2).add(new node(6, 90));// instru 2 + graph.get(2).add(new node(8, 110));// main gate + + for (node n : graph.get(2)) { + n.name = "Mechanical-Building"; + } + + // adjacent nodes of vertex 3 ie mba building + graph.get(3).add(new node(0, 60));// comp + graph.get(3).add(new node(1, 50));// it + graph.get(3).add(new node(2, 65));// mech + graph.get(3).add(new node(4, 10));// canteen + graph.get(3).add(new node(5, 60));// instru 1 + graph.get(3).add(new node(6, 20));// instru 2 + graph.get(3).add(new node(8, 90));// main gate + + for (node n : graph.get(3)) { + n.name = "MBA-Building"; + } + + // adjacent nodes of vertex 4 ie canteen + graph.get(4).add(new node(0, 70));// comp + graph.get(4).add(new node(1, 40));// it + graph.get(4).add(new node(2, 100));// mech + graph.get(4).add(new node(3, 10));// mba + graph.get(4).add(new node(5, 60));// instru 1 + graph.get(4).add(new node(6, 10));// instru 2 + graph.get(4).add(new node(8, 100));// main gate + + for (node n : graph.get(4)) { + n.name = "Canteen"; + } + + // adjacent nodes of vertex 5 ie instru front gate + graph.get(5).add(new node(0, 10));// comp + graph.get(5).add(new node(1, 50));// it + graph.get(5).add(new node(2, 100));// mech + graph.get(5).add(new node(3, 60));// mba + graph.get(5).add(new node(4, 60));// canteen + graph.get(5).add(new node(6, 10));// instru 2 + graph.get(5).add(new node(8, 40));// main gate + + for (node n : graph.get(5)) { + n.name = "Instrumentation-Building"; + } + // adjacent nodes of vertex 6 ie instru back gate + // graph.get(6).add(new node(0, 10));//comp + graph.get(6).add(new node(1, 60));// it + graph.get(6).add(new node(2, 90));// mech + graph.get(6).add(new node(3, 20));// mba + graph.get(6).add(new node(4, 10));// canteen + graph.get(6).add(new node(5, 10));// instru 1 + // graph.get(6).add(new node(5, 10));//main gate + for (node n : graph.get(6)) { + n.name = "Instrumentation-Building(Back-Gate)"; + } + + graph.get(7).add(new node(0, 0)); + graph.get(7).get(0).name = "Mechatronics"; + + // adjacent nodes of node 8 ie main gate + graph.get(8).add(new node(0, 40));// comp + // graph.get(8).add(new node(1, 60));//it + graph.get(8).add(new node(2, 110));// mech + graph.get(8).add(new node(3, 90));// mba + graph.get(8).add(new node(4, 100));// canteen + graph.get(8).add(new node(5, 40));// instru 1 + // graph.get(8).add(new node(0, 40));//instru 2 + + for (node n : graph.get(8)) { + n.name = "Main-Gate"; + } + // adjacent nodes for node 9 ie back gate to lane 1 + graph.get(9).add(new node(0, 110));// comp + graph.get(9).add(new node(2, 40));// mech back gate + + for (node n : graph.get(9)) { + n.name = "Lane1-Gate"; + } + + // adjacent nodes to vertex 10 ie back gate to lane 2 + graph.get(10).add(new node(2, 100));// mech + graph.get(10).add(new node(3, 70));// mba + graph.get(10).add(new node(4, 70));// canteen + graph.get(10).add(new node(0, 160));// comp + graph.get(10).add(new node(1, 100));// it + + for (node n : graph.get(10)) { + n.name = "Lane2-Gate"; + } + } + + public void addRooms() { + + for (node n : graph.get(0)) { + // ground floor + n.rooms.get(0).add("OOP Lab"); + n.rooms.get(0).add("Software Lab 2"); + n.rooms.get(0).add("Software Lab 5"); + + // 1st floor + n.rooms.get(1).add("Accounts and Admin Section"); + n.rooms.get(1).add("Reception"); + n.rooms.get(1).add("Principals Cabin"); + n.rooms.get(1).add("Classroom 7"); + n.rooms.get(1).add("Classroom 6"); + n.rooms.get(1).add("Classroom 5"); + n.rooms.get(1).add("Classroom 4"); + n.rooms.get(1).add("Classroom 3"); + n.rooms.get(1).add("Classroom 2"); + n.rooms.get(1).add("Classroom 1"); + n.rooms.get(1).add("Dean academics"); + + // 2nd floor + + n.rooms.get(2).add("Classroom 9"); + n.rooms.get(2).add("Classroom 8"); + n.rooms.get(2).add("CT Lab"); + n.rooms.get(2).add("Classroom 10"); + n.rooms.get(2).add("Classroom 11"); + n.rooms.get(2).add("Classroom 12"); + n.rooms.get(2).add("Classroom 13"); + n.rooms.get(2).add("Classroom 14"); + + // 3rd floor + n.rooms.get(3).add("Stationary"); + n.rooms.get(3).add("Reading Hall"); + n.rooms.get(3).add("Discussion Zone"); + n.rooms.get(3).add("Hardware Laboratory 1"); + n.rooms.get(3).add("Computer Networks Laboratory"); + n.rooms.get(3).add("Library"); + + // 4th floor + n.rooms.get(4).add("Computer lab 1"); + n.rooms.get(4).add("Computer lab 2"); + n.rooms.get(4).add("Computer lab 3"); + n.rooms.get(4).add("Computer lab 4"); + n.rooms.get(4).add("Project Lab"); + n.rooms.get(4).add("Basic Electronics Lab"); + n.rooms.get(4).add("Analog Electronics Lab"); + n.rooms.get(4).add("Power Electronics Lab"); + n.rooms.get(4).add("Communication Lab"); + n.rooms.get(4).add("Fibre Optic Communication Lab"); + + //5th floor + n.rooms.get(5).add("Software Lab 4"); + n.rooms.get(5).add("Multimedia Lab"); + n.rooms.get(5).add("Hardware Lab 2"); + n.rooms.get(5).add("Software Lab 3"); + n.rooms.get(5).add("Data Structures Lab"); + n.rooms.get(5).add("Software Lab 1"); + } + + // IT building + for (node n : graph.get(1)) { + // ground floor` + n.rooms.get(0).add("Room 23"); + n.rooms.get(0).add("Career Guidance Cell"); + n.rooms.get(0).add("Lab IX-FPL Lab"); + n.rooms.get(0).add("KB Joshi Auditorium"); + + // first floor + n.rooms.get(1).add("Training and Placement Cell"); + + // second floor + n.rooms.get(2).add("Examination Department"); + n.rooms.get(2).add("Geoinformatics Lab"); + n.rooms.get(2).add("Room 19"); + n.rooms.get(2).add("Room 20"); + + // third floor + n.rooms.get(3).add("Room 21"); + n.rooms.get(3).add("Lab 1"); + n.rooms.get(3).add("Lab 2"); + n.rooms.get(3).add("Lab 3"); + n.rooms.get(3).add("Lab 4"); + n.rooms.get(3).add("Department Library IT"); + + // fourth floor + n.rooms.get(4).add("Lab 5"); + n.rooms.get(4).add("Lab 6"); + n.rooms.get(4).add("Lab 7"); + n.rooms.get(4).add("Lab 8"); + n.rooms.get(4).add("Room 24"); + n.rooms.get(4).add("Room 25"); + + } + + // mech building + for (node n : graph.get(2)) { + // ground floor + n.rooms.get(0).add("Workshop"); + + // first floor + n.rooms.get(1).add("Tut Room 7"); + n.rooms.get(1).add("Metrology and Quality Control Lab"); + n.rooms.get(1).add("Fluid Mechanics Lab"); + n.rooms.get(1).add("Center of Research and Intellectual Entrepreneurship"); + n.rooms.get(1).add("Turbomachines Lab"); + n.rooms.get(1).add("Refrigeration and AC Lab"); + + // second floor + n.rooms.get(2).add("M1"); + n.rooms.get(2).add("M2"); + n.rooms.get(2).add("M3"); + n.rooms.get(2).add("M4"); + n.rooms.get(2).add("M5"); + n.rooms.get(2).add("Student Common Room"); + n.rooms.get(2).add("Department of Mechanical Engineering and office and library"); + + // third floor + n.rooms.get(3).add("Conference Hall"); + n.rooms.get(3).add("LME-13 Project Centre"); + n.rooms.get(3).add("Mech Auditorium"); + n.rooms.get(3).add("M6"); + n.rooms.get(3).add("M7"); + n.rooms.get(3).add("M8"); + + // fourth floor + n.rooms.get(4).add("Chemistry Lab"); + n.rooms.get(4).add("Physics Lab"); + n.rooms.get(4).add("Mechanical Vibrations Lab"); + n.rooms.get(4).add("Computer Center"); + + // fifth floor + n.rooms.get(5).add("Engineering Graphics Lab"); + n.rooms.get(5).add("Heat Transfer and Thermodynamics Lab"); + + } + + // instru 1 ie near main gate + for (node n : graph.get(5)) { + // groound floor + n.rooms.get(0).add("Administration Student Section"); + n.rooms.get(0).add("Administration Personnel Section"); + n.rooms.get(0).add("Instru Auditorium"); + n.rooms.get(0).add("Seminar Hall"); + + // first floor + n.rooms.get(1).add("Instrumentation Projects Lab"); + n.rooms.get(1).add("Tut Room 9"); + n.rooms.get(1).add("PG Lab 1"); + n.rooms.get(1).add("Classroom 1"); + + // second floor + n.rooms.get(2).add("Bhaskaracharya Lab or Bio Medical Instrumentation Lab"); + n.rooms.get(2).add("Tut Room 10"); + n.rooms.get(2).add("Language Lab"); + n.rooms.get(2).add("Classroom 2"); + + // third floor + n.rooms.get(3).add("Project Engineering and Management Lab"); + n.rooms.get(3).add("Automation and Control Lab"); + n.rooms.get(3).add("Rigid Body Dynamics or Analysis and Synthesis of Mechanisms Lab"); + n.rooms.get(3).add("Robocon Room"); + } + + // instru 2 ie near canteen + for (node n : graph.get(6)) { + // ground floor + n.rooms.get(0).add("Process Instrumentation Labs"); + n.rooms.get(0).add("Automation Center"); + n.rooms.get(0).add("Sports Office"); + n.rooms.get(0).add("NSS Program Office"); + n.rooms.get(0).add("Alumnae Association Office"); + + // first floor + n.rooms.get(1).add("Heinrich Hertz Lab"); + n.rooms.get(1).add("CV Raman Lab"); + n.rooms.get(1).add("Dark Room"); + n.rooms.get(1).add("Embedded Systems Lab"); + n.rooms.get(1).add("DSP Lab"); + n.rooms.get(1).add("Department Library Instru"); + } + + // mechatronics + for (node n : graph.get(7)) { + n.rooms.get(0).add("Mechatronics Garage"); + } + } + + public ArrayList getBuilding(String room) { + + int reqDest = 0; + ArrayList al = new ArrayList(); + for (int i = 0; i < 10; i++) { + node n1 = graph.get(i).get(0); + for (ArrayList floor : n1.rooms) { + for (String r1 : floor) { + if (r1.equals(room)) { + String buildingName = n1.name; + int floorNum = n1.rooms.indexOf(floor); + int buildingNum = graph.indexOf(graph.get(i)); + al.add(buildingName); + al.add(floorNum); + al.add(buildingNum); + break; + } + } + } + } + return al; + } + + public int getBuildingNum(String b){ + int buildingNum=0; + for (int i = 0; i < 11; i++) { + if (graph.get(i).get(0).name.equals(b)) { + buildingNum = i; + } + } + return buildingNum; + } +} + + diff --git a/Team 48 - Dead Souls - CumminsNavigator/app/src/main/java/com/example/cumminsnavigator/map.java b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/java/com/example/cumminsnavigator/map.java new file mode 100644 index 0000000..82fbb47 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/java/com/example/cumminsnavigator/map.java @@ -0,0 +1,99 @@ +package com.example.cumminsnavigator; + +import android.os.Build; + +import androidx.annotation.RequiresApi; + +import java.util.*; + +/** + * 0: Comp and E&TC + * 1: IT + * 2: Mech + * 3: MBA + * 4: Canteen + * 5: Instru 1 ie near main gate + * 6: Instru 2 ie near canteen + * 7: Mechatronics + * 8: Main Gate + * 9: Back Gate to lane 1 + * 10: Back gate to lane 2 + */ + +public class map { + + // graph class/driver class + + int n = 11; + ArrayList> graph = new ArrayList<>(11); // adjacency list + + public void display() { + + for (int i = 0; i < 11; i++) { + System.out.print(i); + for (int j = 0; j < graph.get(i).size(); j++) + System.out.print(" -" + graph.get(i).get(j).weight + "-> " + graph.get(i).get(j).vertex); + System.out.println(); + } + } + + @RequiresApi(api = Build.VERSION_CODES.N) + public String dijkstra(int source, int target) { + int distance[] = new int[11]; + int prev[] = new int[11]; // stores the node previously visited + + for (int i = 0; i < 11; i++) { + distance[i] = Integer.MAX_VALUE;// setting initial distances to infinity + prev[i] = Integer.MIN_VALUE; + } + + PriorityQueue pq = new PriorityQueue<>((v1, v2) -> v1.weight - v2.weight); // priority queue + // that adds elements + // based on weights + distance[source] = 0; + pq.add(new node(source, 0));// adding source node + + while (pq.size() > 0) { + node current = pq.poll(); + for (node n : graph.get(current.vertex)) + { + if (distance[current.vertex] + n.weight < distance[n.vertex]) // dijkstra condition + { + distance[n.vertex] = n.weight + distance[current.vertex]; + pq.add(new node(n.vertex, distance[n.vertex])); // replacing distances + prev[n.vertex] = current.vertex; + } + } + } + + String printPath = path(prev, source, target); + return printPath; + } + + public String path(int[] prev, int source, int target) { + // on following the prev[] array from target vertex until we reach the source + // vertex, we get the path + /** + * we add the target vertex to the stack, then we check the previously visited + * vertex of target + * we add that vertex to the stack and check its previously visited vertex + * we keep going until we reach the source + */ + String printPath = ""; + Stack s = new Stack<>(); + s.push(target); + while (target != source) { + target = prev[target]; + s.push(target); + } + while (!s.isEmpty()) { + int ele = s.pop(); + printPath = printPath + graph.get(ele).get(0).name + "-->\n"; + + } + printPath = printPath + "Destination Reached"; + return printPath; + } +} + + diff --git a/Team 48 - Dead Souls - CumminsNavigator/app/src/main/java/com/example/cumminsnavigator/node.java b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/java/com/example/cumminsnavigator/node.java new file mode 100644 index 0000000..b2cfe95 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/java/com/example/cumminsnavigator/node.java @@ -0,0 +1,21 @@ +package com.example.cumminsnavigator; + +import java.util.ArrayList; + +// node class +public class node { + int vertex; + int weight; + String name; + + ArrayList> rooms = new ArrayList<>(6); + + node(int v, int w) { + vertex = v; + weight = w; + for (int i = 0; i < 6; i++) + rooms.add(new ArrayList()); + } + +}// end of node class + diff --git a/Team 48 - Dead Souls - CumminsNavigator/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Team 48 - Dead Souls - CumminsNavigator/app/src/main/res/drawable-v24/mapsfinal.jpg b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/res/drawable-v24/mapsfinal.jpg new file mode 100644 index 0000000..534fdfd Binary files /dev/null and b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/res/drawable-v24/mapsfinal.jpg differ diff --git a/Team 48 - Dead Souls - CumminsNavigator/app/src/main/res/drawable/ic_launcher_background.xml b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Team 48 - Dead Souls - CumminsNavigator/app/src/main/res/layout/activity_main.xml b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..f896b88 --- /dev/null +++ b/Team 48 - Dead Souls - CumminsNavigator/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,101 @@ + + + +