Commit a3e8f366 authored by Nick Whitelegg's avatar Nick Whitelegg

Initial commit for the kotlin branch

parent 1f63b253
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
This diff is collapsed.
The new 'kotlin branch' of Hikar.
This branch will:
- implement all new code in Kotlin (and slowly re-write old code);
- use pure-XYZ tile sources for both OSM and elevation data (as a result of
the availablility of XYZ tile sources via Nextzen and the AWS publication of
Mapzen elevation data)
- no longer use graphhopper for routing, to avoid hard-to-maintain
pre-generation of static routing files. Intention now is to generate routing
from the XYZ OSM vector tiles first time they load, and cache on the device.
A hacked GpsMid fork will be used for this.
- remove dependency on andromaps.
- finally update to Camera2 (partly implemented already).
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":andromaps" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":andromaps" />
</configuration>
</facet>
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
configurations.maybeCreate("default")
artifacts.add("default", file('andromaps.aar'))
\ No newline at end of file
This diff is collapsed.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "freemap.hikar"
minSdkVersion 16
targetSdkVersion 22
versionCode 6
versionName "0.2-SNAPSHOT"
multiDexEnabled true // fix random crash relating to no more than 65536 methods,
applicationId "freemap.hikarkotlin"
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
......@@ -18,28 +20,15 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support:design:27.0.2'
compile 'freemap:freemaplib:20180413'
compile 'freemap:freemaplibProj:20180424'
compile 'com.jhlabs:javaproj:1.0.6-noawt-r3'
compile 'com.graphhopper:graphhopper-core:0.10.0'
compile 'com.graphhopper:graphhopper-reader-osm:0.10.0'
compile project(":andromaps")
}
// this will include the *.aar files as long as they are in "libs"
repositories{
flatDir {
dirs 'libs'
}
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'freemap:freemaplib:20180413'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/android-sdk-linux/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
# 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
# Add any project specific keep options here:
# 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
package com.example.hikar
import android.support.test.InstrumentationRegistry
import android.support.test.runner.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getTargetContext()
assertEquals("com.example.hikar_kotlin", appContext.packageName)
}
}
package freemap.hikar;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="freemap.hikar">
package="freemap.hikar">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<application
android:allowBackup="true"
android:label="@string/app_name"
android:theme="@style/AppTheme"
tools:replace="android:icon"
android:icon="@mipmap/appicon">
<activity
android:name="freemap.hikar.Hikar"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden|screenSize">
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="freemap.hikar.MainActivity"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name="freemap.hikar.Preferences"
android:label="Preferences" />
<activity
android:name="freemap.hikar.LocationEntryActivity"
android:label="Enter location"
android:screenOrientation="landscape" />
<activity android:name="freemap.hikar.ModeSelector"
android:label="@string/app_name"
android:screenOrientation="portrait" />
<activity android:name="freemap.hikar.UserGuide"
android:label="@string/userguide"
android:screenOrientation="landscape" />
</application>
</manifest>
\ No newline at end of file
This diff is collapsed.
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 11.07.2018 08:36:42
#
# object metal_post_arm
#
v -0.3419 41.1360 41.1898
v 0.3418 41.1360 41.1898
v 0.3418 45.8435 45.7753
v -0.3419 45.8435 45.7753
v -0.3418 41.1360 1.9386
v 0.3418 41.1360 1.9386
v 0.1297 41.6954 2.4980
v 0.1297 45.8435 2.4980
v 0.1297 45.8435 44.9943
v 0.1297 41.6954 40.9538
v 0.3418 50.5509 1.9386
v -0.3418 50.5509 1.9386
v -0.3419 50.5509 41.1898
v 0.3418 50.5509 41.1898
v -0.1297 49.9915 2.4980
v -0.1297 45.8435 2.4980
v -0.1297 45.8435 44.9943
v -0.1297 49.9915 40.9538
v 0.1297 49.9915 2.4980
v 0.1297 49.9915 40.9538
v -0.1297 41.6954 2.4980
v -0.1297 41.6954 40.9538
v 0.3418 45.8435 1.9386
v 0.3418 45.8435 2.4980
v 0.3418 41.6954 2.4980
v 0.3418 49.9915 2.4980
v 0.3418 49.9915 40.9538
v 0.3418 45.8435 44.9943
v 0.3418 41.6954 40.9538
v -0.3418 45.8435 1.9386
v -0.3418 45.8435 2.4980
v -0.3418 49.9915 2.4980
v -0.3418 41.6954 2.4980
v -0.3419 41.6954 40.9538
v -0.3419 45.8435 44.9943
v -0.3419 49.9915 40.9538
# 36 vertices
vn -0.6292 -0.7161 0.3021
vn 0.6292 -0.7161 0.3021
vn 0.5787 0.0000 0.8155
vn -0.5787 0.0000 0.8155
vn -0.5774 -0.5774 -0.5774
vn 0.5774 -0.5774 -0.5773
vn 0.5773 0.5774 0.5774
vn 0.7071 0.0000 0.7071
vn 0.5787 0.0000 -0.8155
vn 0.6292 0.7161 -0.3021
vn 0.5774 0.5774 -0.5773
vn -0.5774 0.5774 -0.5774
vn -0.6292 0.7161 0.3021
vn 0.6292 0.7161 0.3021
vn -0.5774 -0.5774 0.5773
vn -0.7071 0.0000 0.7071
vn -0.5787 0.0000 -0.8155
vn -0.6292 -0.7161 -0.3021
vn 0.5773 -0.5774 0.5774
vn 0.6292 -0.7161 -0.3021
vn -0.5774 0.5774 0.5773
vn -0.6292 0.7161 -0.3021
vn 0.7071 -0.0000 -0.7071
vn 0.9045 0.3015 0.3015
vn 0.9045 -0.3015 0.3015
vn 0.8059 -0.5455 -0.2301
vn 0.9014 -0.0000 -0.4329
vn 0.8059 0.5455 -0.2301
vn -0.7071 -0.0000 -0.7071
vn -0.9045 -0.3015 0.3015
vn -0.9045 0.3015 0.3015
vn -0.8059 0.5455 -0.2301
vn -0.9014 -0.0000 -0.4329
vn -0.8059 -0.5455 -0.2301
# 34 vertex normals
vt 0.8504 0.8365 0.0000
vt 0.8422 0.8321 0.0000
vt 0.8869 0.7825 0.0000
vt 0.8933 0.7925 0.0000
vt 0.4126 0.8414 0.0000
vt 0.4126 0.8339 0.0000
vt 0.8404 0.8414 0.0000
vt 0.5410 0.0021 0.0000
vt 0.6010 0.0021 0.0000
vt 0.6003 0.6133 0.0000
vt 0.5432 0.5602 0.0000
vt 0.4126 0.7313 0.0000
vt 0.4126 0.7238 0.0000
vt 0.8404 0.7238 0.0000
vt 0.8422 0.7332 0.0000
vt 0.4117 0.0021 0.0000
vt 0.4717 0.0021 0.0000
vt 0.4709 0.6133 0.0000
vt 0.4138 0.5602 0.0000
vt 0.8505 0.7291 0.0000
vt 0.8918 0.7746 0.0000
vt 0.6610 0.0021 0.0000
vt 0.6596 0.5594 0.0000
vt 0.5316 0.0021 0.0000
vt 0.5303 0.5594 0.0000
vt 0.4126 0.7826 0.0000
vt 0.4187 0.7826 0.0000
vt 0.4187 0.8278 0.0000
vt 0.4187 0.7374 0.0000
vt 0.8379 0.7374 0.0000
vt 0.8819 0.7826 0.0000
vt 0.8379 0.8278 0.0000
vt 0.4126 0.6725 0.0000
vt 0.4187 0.6725 0.0000
vt 0.4187 0.7177 0.0000
vt 0.4126 0.6212 0.0000
vt 0.4187 0.6273 0.0000
vt 0.8404 0.6212 0.0000
vt 0.8379 0.6273 0.0000
vt 0.8904 0.6725 0.0000
vt 0.8819 0.6725 0.0000
vt 0.8379 0.7177 0.0000
vt 0.4117 -0.0010 0.0000
vt 0.4717 -0.0010 0.0000
vt 0.5316 -0.0010 0.0000
vt 0.5347 0.0021 0.0000
vt 0.5347 0.5582 0.0000
vt 0.5316 0.5637 0.0000
vt 0.4726 0.6172 0.0000
vt 0.4648 0.6151 0.0000
vt 0.4134 0.5649 0.0000
vt 0.4086 0.5582 0.0000
vt 0.4086 0.0021 0.0000
vt 0.5410 -0.0010 0.0000
vt 0.6010 -0.0010 0.0000
vt 0.6610 -0.0010 0.0000
vt 0.6641 0.0021 0.0000
vt 0.6641 0.5582 0.0000
vt 0.6610 0.5637 0.0000
vt 0.6020 0.6172 0.0000
vt 0.5942 0.6151 0.0000
vt 0.5427 0.5649 0.0000
vt 0.5380 0.5582 0.0000
vt 0.5380 0.0021 0.0000
vt 0.4051 0.7826 0.0000
vt 0.4051 0.7313 0.0000
vt 0.4051 0.8339 0.0000
# 67 texture coords
o metal_post_arm
g metal_post_arm
f 1/1/1 2/2/2 3/3/3 4/4/4
f 5/5/5 6/6/6 2/2/2 1/7/1
f 7/8/7 8/9/8 9/10/9 10/11/10
f 11/12/11 12/13/12 13/14/13 14/15/14
f 15/16/15 16/17/16 17/18/17 18/19/18
f 3/3/3 14/15/14 13/20/13 4/21/4
f 8/9/8 19/22/19 20/23/20 9/10/9
f 16/17/16 21/24/21 22/25/22 17/18/17
f 6/6/6 23/26/23 24/27/8 25/28/24
f 23/26/23 11/12/11 26/29/25 24/27/8
f 11/12/11 14/15/14 27/30/26 26/29/25
f 14/15/14 3/3/3 28/31/27 27/30/26
f 3/3/3 2/2/2 29/32/28 28/31/27
f 2/2/2 6/6/6 25/28/24 29/32/28
f 12/13/12 30/33/29 31/34/16 32/35/30
f 30/33/29 5/36/5 33/37/31 31/34/16
f 5/36/5 1/38/1 34/39/32 33/37/31
f 1/38/1 4/40/4 35/41/33 34/39/32
f 4/40/4 13/14/13 36/42/34 35/41/33
f 13/14/13 12/13/12 32/35/30 36/42/34
f 32/43/30 31/44/16 16/17/16 15/16/15
f 31/44/16 33/45/31 21/24/21 16/17/16
f 33/46/31 34/47/32 22/25/22 21/24/21
f 34/48/32 35/49/33 17/18/17 22/25/22
f 35/50/33 36/51/34 18/19/18 17/18/17
f 36/52/34 32/53/30 15/16/15 18/19/18
f 25/54/24 24/55/8 8/9/8 7/8/7
f 24/55/8 26/56/25 19/22/19 8/9/8
f 26/57/25 27/58/26 20/23/20 19/22/19
f 27/59/26 28/60/27 9/10/9 20/23/20
f 28/61/27 29/62/28 10/11/10 9/10/9
f 29/63/28 25/64/24 7/8/7 10/11/10
f 11/12/11 23/26/23 30/65/29 12/66/12
f 5/67/5 30/65/29 23/26/23 6/6/6
# 34 polygons
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 11.07.2018 08:35:53
#
# object wooden_post
#
v 2.9459 0.0000 -2.9459
v 2.9459 0.0000 2.9459
v -2.9459 0.0000 2.9459
v -2.9459 0.0000 -2.9459
v 2.9459 92.9512 2.9459
v 2.9459 92.9512 -2.9459
v -2.9459 92.9512 -2.9459
v -2.9459 92.9512 2.9459
# 8 vertices
vn 0.5774 -0.5774 -0.5774
vn 0.5774 -0.5774 0.5774
vn -0.5774 -0.5774 0.5774
vn -0.5774 -0.5774 -0.5774
vn 0.5774 0.5774 0.5774
vn 0.5774 0.5774 -0.5774
vn -0.5774 0.5774 -0.5774
vn -0.5774 0.5774 0.5774
# 8 vertex normals
vt 0.5952 0.9848 0.0000
vt 0.5952 0.9035 0.0000
vt 0.5139 0.9035 0.0000
vt 0.5139 0.9848 0.0000
vt 0.1271 0.0005 0.0000
vt 0.1905 0.0005 0.0000
vt 0.1905 0.9995 0.0000
vt 0.1271 0.9995 0.0000
vt 0.0005 0.0005 0.0000
vt 0.0638 0.0005 0.0000
vt 0.0638 0.9995 0.0000
vt 0.0005 0.9995 0.0000
vt 0.2538 0.0005 0.0000
vt 0.2538 0.9995 0.0000
# 14 texture coords
o wooden_post
g wooden_post
f 1/1/1 2/2/2 3/3/3 4/4/4
f 5/2/5 6/1/6 7/4/7 8/3/8
f 2/5/2 1/6/1 6/7/6 5/8/5
f 4/9/4 3/10/3 8/11/8 7/12/7
f 1/6/1 4/13/4 7/14/7 6/7/6
f 5/8/5 8/11/8 3/10/3 2/5/2
# 6 polygons
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 11.07.2018 08:36:09
#
# object wooden_post_arm
#
v 0.9820 89.7949 37.1230
v -0.9820 89.7949 37.1230
v -0.9820 84.1239 43.5728
v 0.9820 84.1239 43.5728
v -0.9820 78.4529 2.9459
v 0.9820 78.4529 2.9459
v 0.9820 78.4529 37.1230
v -0.9820 78.4529 37.1230
v 0.9820 84.1238 2.9459
v 0.9820 89.7948 2.9459
v -0.9820 89.7948 2.9459
v -0.9820 84.1238 2.9459
# 12 vertices
vn 0.6356 0.7223 0.2724
vn -0.6356 0.7223 0.2724
vn -0.5709 -0.0000 0.8210
vn 0.5709 -0.0000 0.8210
vn -0.5774 -0.5774 -0.5773
vn 0.5774 -0.5774 -0.5773
vn 0.6356 -0.7223 0.2724
vn -0.6356 -0.7223 0.2724
vn 0.7071 -0.0000 -0.7071
vn 0.5774 0.5774 -0.5774
vn -0.5774 0.5774 -0.5774
vn -0.7071 -0.0000 -0.7071
# 12 vertex normals
vt 0.8060 0.4598 0.0000
vt 0.8249 0.4820 0.0000
vt 0.7600 0.5513 0.0000
vt 0.7366 0.5340 0.0000
vt 0.9767 0.0248 0.0000
vt 1.0016 0.0248 0.0000
vt 1.0016 0.4574 0.0000
vt 0.9756 0.4586 0.0000
vt 0.6648 0.0248 0.0000
vt 0.7365 0.0248 0.0000
vt 0.6670 0.4599 0.0000
vt 0.8083 0.0248 0.0000
vt 0.8332 0.0248 0.0000
vt 0.8332 0.4574 0.0000
vt 0.9049 0.0248 0.0000
vt 0.9061 0.5377 0.0000
vt 1.0002 0.4777 0.0000
vt 0.9310 0.5618 0.0000
vt 0.6648 -0.0001 0.0000
vt 0.7365 -0.0001 0.0000
vt 0.8083 -0.0001 0.0000
# 21 texture coords
o wooden_post_arm
g wooden_post_arm
f 1/1/1 2/2/2 3/3/3 4/4/4
f 5/5/5 6/6/6 7/7/7 8/8/8
f 6/9/6 9/10/9 4/4/4 7/11/7
f 10/12/10 11/13/11 2/14/2 1/1/1
f 11/13/11 12/15/12 3/16/3 2/14/2
f 3/16/3 8/8/8 7/17/7 4/18/4
f 9/10/9 10/12/10 1/1/1 4/4/4
f 12/15/12 5/5/5 8/8/8 3/16/3
f 9/10/9 6/9/6 5/19/5 12/20/12
f 10/12/10 9/10/9 12/20/12 11/21/11
# 10 polygons
This diff is collapsed.
package freemap.hikar;
import android.hardware.Camera;
import android.graphics.SurfaceTexture;
import java.io.IOException;
public class CameraCapturer {
Camera camera;
OpenGLView.DataRenderer glRenderer;
public CameraCapturer(OpenGLView.DataRenderer renderer) {
glRenderer = renderer;
}
public void openCamera() {
try {
camera = Camera.open();
} catch (Exception e) {
}
}
public void startPreview(SurfaceTexture surfaceTexture) throws IOException {
camera.setPreviewTexture(surfaceTexture);
camera.startPreview();
Camera.Parameters params = camera.getParameters();
android.util.Log.d("hikar", "hfov=" + params.getHorizontalViewAngle() +
" vfov=" + params.getVerticalViewAngle());
}
public void releaseCamera() {
if (camera != null) {
camera.release();
camera = null;
}
}
public float getHFOV() {
if (camera != null) {
Camera.Parameters params = camera.getParameters();
if (params != null)
return params.getHorizontalViewAngle();
}
return -1.0f;
}
public boolean isActive() {
return camera != null;
}
}
package freemap.hikar;
/**
* Created by nick on 04/07/15.
*/
import java.util.ArrayList;
import freemap.data.Point;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
public class County {
String name;
ArrayList<Point> polygon;
Point sw,ne;
class Segment
{
Point north, south;
}
public County(String name)
{
polygon = new ArrayList<Point>(); this.name=name;
sw=new Point(181, 91);
ne=new Point(-181, -91);
}
public void read(String filename) throws IOException
{
BufferedReader in = new BufferedReader(new FileReader(filename));
String line;
int nPolygons=0;
while((line = in.readLine())!=null)
{
if(name==null)
name = line;
else if (line.matches("^\\d+$"))
{