initial commit

This commit is contained in:
2025-06-13 11:41:47 +08:00
commit b384446fc6
54 changed files with 1689 additions and 0 deletions

11
.gitignore vendored Normal file
View File

@@ -0,0 +1,11 @@
*.iml
.gradle
/local.properties
/.idea
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
/.kotlin

1
app/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

45
app/build.gradle.kts Normal file
View File

@@ -0,0 +1,45 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
}
android {
namespace = "com.icegps.maps"
compileSdk = 35
defaultConfig {
applicationId = "com.icegps.maps"
minSdk = 24
targetSdk = 35
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(project(":maps-view"))
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}

21
app/proguard-rules.pro vendored Normal file
View File

@@ -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

View File

@@ -0,0 +1,24 @@
package com.icegps.maps
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.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.getInstrumentation().targetContext
assertEquals("com.icegps.maps", appContext.packageName)
}
}

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Maps"
tools:targetApi="31" />
</manifest>

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View File

@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Maps" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>

View File

@@ -0,0 +1,3 @@
<resources>
<string name="app_name">maps</string>
</resources>

View File

@@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Maps" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older than API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

View File

@@ -0,0 +1,17 @@
package com.icegps.maps
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

7
build.gradle.kts Normal file
View File

@@ -0,0 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.android.library) apply false
}

23
gradle.properties Normal file
View File

@@ -0,0 +1,23 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. For more details, visit
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

24
gradle/libs.versions.toml Normal file
View File

@@ -0,0 +1,24 @@
[versions]
agp = "8.10.1"
kotlin = "2.1.21"
coreKtx = "1.16.0"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
appcompat = "1.7.1"
material = "1.12.0"
jetbrainsKotlinJvm = "2.0.21"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
android-library = { id = "com.android.library", version.ref = "agp" }

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#Fri Jun 13 11:06:47 CST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
gradlew vendored Normal file
View File

@@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

89
gradlew.bat vendored Normal file
View File

@@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

1
maps-view/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,40 @@
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
}
android {
namespace = "com.icegps.maps"
compileSdk = 35
defaultConfig {
minSdk = 24
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}

View File

21
maps-view/proguard-rules.pro vendored Normal file
View File

@@ -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

View File

@@ -0,0 +1,24 @@
package com.icegps.maps
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.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.getInstrumentation().targetContext
assertEquals("com.icegps.maps.test", appContext.packageName)
}
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>

View File

@@ -0,0 +1,110 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="722dp"
android:height="722dp"
android:viewportWidth="722"
android:viewportHeight="722">
<path
android:pathData="M359.12,71.89C347.38,74.25 336.62,80.07 328.21,88.6L239.12,179.05C233.39,184.86 231.21,193.3 233.4,201.17L240.19,225.53L415.22,188.33L415.08,176.17C415.08,176.11 415.08,176.06 415.09,176L421.11,129.39L421.11,128.68C421.12,105.34 412.99,88.49 396.71,78.12C385.73,71.13 373.2,69.05 359.12,71.89ZM363.54,101.12C375.86,98.5 387.98,106.37 390.6,118.69C393.22,131.01 385.35,143.13 373.02,145.75C360.7,148.37 348.58,140.5 345.96,128.18C343.34,115.86 351.21,103.74 363.54,101.12Z"
android:strokeLineJoin="round"
android:strokeWidth="4"
android:fillColor="#EBC53D"
android:strokeColor="#333333"
android:fillType="evenOdd"/>
<path
android:pathData="M413.04,114.53a45.02,45.04 78,1 1,-88.1 18.73a45.02,45.04 78,1 1,88.1 -18.73z"
android:strokeLineJoin="round"
android:strokeWidth="3"
android:fillColor="#00000000"
android:strokeColor="#333333"
android:fillType="evenOdd"/>
<path
android:pathData="M555.37,581.98L533.11,586.82L493.61,595.21L484.9,589.56L254.7,589.94C225.55,589.99 197.62,578.26 177.26,557.41L134.75,513.9L134.75,513.9L100.75,455.02C75.43,411.18 83.56,355.69 120.39,320.95L259.82,189.47C267.75,181.98 279.74,180.8 289,186.57L328.32,211.14C333.45,214.33 338.09,218.25 342.1,222.75L614.5,528.24L614.5,528.24L555.37,581.98Z"
android:strokeLineJoin="round"
android:strokeWidth="4"
android:fillColor="#EBC53D"
android:strokeColor="#333333"
android:fillType="evenOdd"
android:strokeLineCap="round"/>
<path
android:pathData="M286.16,186.58L256.07,197.02C243.54,201.36 236.91,215.03 241.25,227.55C242.13,230.08 243.42,232.45 245.08,234.55L520.06,583.35L520.06,583.35L611.69,563.87L334.65,201.17C323.33,186.36 303.78,180.47 286.16,186.58Z"
android:strokeWidth="1"
android:fillColor="#C19E2C"
android:fillType="evenOdd"
android:strokeColor="#00000000"/>
<path
android:pathData="M292.39,175.44L262.29,185.87C249.77,190.22 243.14,203.89 247.48,216.41C248.36,218.94 249.65,221.31 251.31,223.41L526.29,572.21L526.29,572.21L617.91,552.73L340.87,190.03C329.55,175.21 310.01,169.33 292.39,175.44Z"
android:strokeLineJoin="round"
android:strokeWidth="4"
android:fillColor="#EBC53D"
android:strokeColor="#333333"
android:fillType="evenOdd"/>
<path
android:pathData="M380.99,241.02l-30.38,-38.96l64.61,-13.73z"
android:strokeLineJoin="round"
android:strokeWidth="4"
android:fillColor="#BD9C2A"
android:strokeColor="#333333"
android:fillType="evenOdd"/>
<path
android:pathData="M505.36,496.87L495.88,452.25C494.5,445.76 498.64,439.39 505.12,438.01L540.37,430.52L540.37,430.52L628.04,513.76L645.78,539.44L635.14,535.57L608.12,541.31L562.47,505.6L505.36,496.87Z"
android:strokeLineJoin="round"
android:strokeWidth="4"
android:fillColor="#EBC53D"
android:strokeColor="#333333"
android:fillType="evenOdd"
android:strokeLineCap="round"/>
<path
android:pathData="M526.63,484.27L517.8,486.14C509.37,487.93 503.99,496.22 505.79,504.64L507.68,513.57C509.47,522 517.76,527.38 526.19,525.59L553.73,519.73C558.82,518.65 562.32,513.97 561.92,508.79L561.89,508.39C561.47,502.96 558.44,498.07 553.76,495.27L538.75,486.28C535.11,484.1 530.78,483.38 526.63,484.27Z"
android:strokeWidth="3"
android:fillColor="#EBC53D"
android:strokeColor="#333333"
android:fillType="evenOdd"/>
<path
android:pathData="M538.5,502.61a12.01,12.01 78.01,1 1,-23.49 4.99a12.01,12.01 78.01,1 1,23.49 -4.99z"
android:strokeLineJoin="round"
android:strokeWidth="3"
android:fillColor="#EBC53D"
android:strokeColor="#333333"
android:fillType="evenOdd"/>
<path
android:pathData="M659.1,554.9l47.96,19.66l-152.44,0.76l-6,-9.6z"
android:strokeLineJoin="round"
android:strokeWidth="4"
android:fillColor="#EBC53D"
android:strokeColor="#333333"
android:fillType="evenOdd"
android:strokeLineCap="round"/>
<path
android:pathData="M524.33,586.12l137.44,-29.21l-2.25,-10.57l-24.39,-10.77l-116.3,24.72z"
android:strokeLineJoin="round"
android:strokeWidth="4"
android:fillColor="#EBC53D"
android:strokeColor="#333333"
android:fillType="evenOdd"
android:strokeLineCap="round"/>
<path
android:pathData="M460.75,489.17L134.6,514.32"
android:strokeLineJoin="round"
android:strokeWidth="3"
android:fillColor="#00000000"
android:strokeColor="#333333"
android:fillType="evenOdd"/>
<path
android:pathData="M252.95,268.23a19.21,19.22 78,1 1,-37.59 7.99a19.21,19.22 78,1 1,37.59 -7.99z"
android:strokeWidth="1"
android:fillColor="#C19E2C"
android:fillType="evenOdd"
android:strokeColor="#00000000"/>
<path
android:pathData="M253.38,264.46a18.01,18.01 77.99,1 1,-35.24 7.49a18.01,18.01 77.99,1 1,35.24 -7.49z"
android:strokeWidth="3"
android:fillColor="#EBC53D"
android:strokeColor="#333333"
android:fillType="evenOdd"/>
<path
android:pathData="M563.72,507.78l41.98,32.61l-19.97,4.24l-22.86,-29.31z"
android:strokeWidth="1"
android:fillColor="#C19E2C"
android:fillType="evenOdd"
android:strokeColor="#00000000"/>
</vector>

View File

@@ -0,0 +1,145 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="722dp"
android:height="722dp"
android:viewportWidth="722"
android:viewportHeight="722">
<path
android:pathData="M206.75,67.31C203.98,68.74 203.04,70.67 202.35,76.45C202.01,79.22 201.41,83.17 201.02,85.74C200.62,88.31 198.75,101.31 196.87,114.55C194.55,131.1 192.72,139.6 192.18,140.39C191,142.17 189.02,142.57 183.15,142.57C175.49,142.57 173.57,142.87 171.89,136.14C170.51,130.41 169.17,127.99 164.19,128.34C160.49,128.58 159.35,129.77 158.26,132.98C157.52,135.3 157.52,135.7 158.36,139.85C160.73,151.37 160.39,163.67 158.36,182.84C156.78,198.31 155.8,202.76 153.03,207.7C151.25,211.01 151.35,213.73 153.57,218.13C154.56,220.15 155.4,222.43 155.4,223.22C155.4,227.76 148.49,277.03 144,304.66C143.21,309.7 141.23,321.8 139.6,331.59C130.02,390.39 128.05,410.51 128,449.69C128,480.28 129.09,499.8 132.2,523.57C139.4,579.11 152.09,618.7 170.11,642.07C174.06,647.21 178.21,650.67 183.29,653.14C190.75,656.7 197.27,656.95 203.49,653.83L207.14,652.05L248.66,652.05C289.24,652.05 290.23,652.05 292.01,653.04C294.43,654.33 298.57,654.33 301.49,653.04C303.56,652.05 304.89,652.05 358.9,652.05C409.02,652.05 414.3,652.15 415.73,652.84C418.3,654.18 422.79,654.28 425.95,653.09C428.62,652.05 429.16,652.05 471.37,652.05L514.08,652.05L517.53,653.83C525.33,657.74 534.51,656.35 543.75,649.78C553.62,642.76 565.08,622.06 573.71,595.47C577.42,584.15 583,562.02 584.68,552.18C584.82,551.24 585.51,547.39 586.16,543.58C589.61,523.42 592.03,503.56 593.41,483.05C594.2,471.14 594.2,427.65 593.36,414.85C592.43,399.78 590.4,378.83 588.58,365.78C585.81,345.23 583.29,327.93 579.74,304.66C574.8,272.09 569.86,235.37 569.27,226.77L568.98,222.28L571.05,218.52C573.76,213.58 573.81,211.46 571.39,206.32C569.42,202.12 568.98,200.19 567.64,189.76C565.12,169.5 564.78,154.33 566.65,144.3C568.28,135.7 568.38,132.78 567.25,130.76C566.01,128.53 563.59,127.25 560.48,127.25C555.84,127.25 553.03,129.82 551.89,135.16C550.61,141.14 549.08,142.07 540.74,142.07C531.5,142.07 530.71,142.32 528.2,124.78C527.11,117.32 525.53,106.84 524.74,101.55C523.9,96.27 522.57,87.17 521.73,81.34C519.41,65.03 521.68,65.87 499.51,66.07C484.35,66.22 484.9,66.27 483.42,67.31C482.58,67.9 481.59,69.14 481.24,69.98C480.5,71.71 480.5,72.1 483.96,107.73C485.14,119.94 486.28,131.8 486.48,134.02C487.12,142.12 486.97,142.17 472.11,141.98C459.57,141.83 457.25,141.83 456.51,137.97C455.92,134.76 452.71,104.07 449.84,74.37C449.45,70.12 448.61,68.2 446.59,67.11C445.15,66.32 444.86,66.22 432.61,66.07C415.98,65.87 416.47,65.97 414.2,68.25C412.69,69.76 412.22,74.9 412.82,83.66C412.97,91.18 413.56,106.4 414.05,117.42C414.55,128.44 414.89,138.07 414.74,138.76C414.59,139.46 414.05,140.44 413.51,140.94C412.62,141.73 411.29,141.83 401.36,141.98C389.86,142.12 384.92,141.88 383.98,140.1C383.15,138.47 383.19,139.41 381.32,87.62C380.63,69.09 380.63,69.04 377.71,67.11C376.53,66.32 376.18,66.22 362.81,66.07C346.12,65.92 345.18,66.17 343.8,68.84C343.3,69.83 342.96,74.87 342.56,88.71C341.58,120.88 341.03,136.84 340.74,138.47C340.59,139.36 339.95,140.49 339.21,141.09C338.02,142.03 337.28,142.07 326.22,142.07C315.11,142.07 312.94,142.03 311.71,141.04C310.13,139.75 309.14,140.25 310.42,115.83C310.92,105.65 311.61,91.57 311.85,84.5C312.35,72.74 312.3,71.56 311.51,69.98C311.07,69.04 310.03,67.8 309.29,67.26C307.95,66.27 308.15,66.22 293.09,66.07C271.08,65.87 273.84,65.43 272.9,79.12C272.61,83.47 271.82,94.64 271.17,104.02C268.75,138.17 267.67,139.16 265.99,140.84C265.05,141.78 263.77,141.83 252.76,141.98C241.4,142.12 239.48,142.07 238.19,141.09C236.47,139.7 236.47,139.41 238.29,119.24C239.82,102.74 241.55,82.97 242.05,76.1C242.39,71.61 241.65,69.58 239.18,67.75C237.85,66.76 238.54,66.71 223.38,66.57C208.97,66.47 208.33,66.52 206.75,67.31Z"
android:strokeWidth="1"
android:fillColor="#333333"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
<path
android:pathData="M236.81,71.56C237.36,72.25 237.11,77.14 235.13,98.34C234.79,102.39 233.95,111.58 233.36,118.7L232.22,131.7L215.98,131.7L199.74,131.7L200.03,130.31C200.18,129.57 200.87,124.88 201.56,119.84C202.2,114.8 203.19,107.58 203.73,103.78C204.28,99.97 205.41,90.39 206.25,84.26C207.09,78.13 207.98,72.64 208.23,72L208.72,70.92L222.49,70.92C233.36,70.92 236.37,71.06 236.81,71.56Z"
android:strokeLineJoin="round"
android:strokeWidth="1.97665886"
android:fillColor="#EBC53D"
android:strokeColor="#EBC53D"
android:fillType="nonZero"/>
<path
android:pathData="M306.87,75.12C306.97,77.29 306.67,88.66 306.23,98.59C305.73,108.52 305.24,119.94 305.04,124.04L304.75,131.45L289.44,131.6L274.09,131.7L274.43,127.65C274.63,125.37 275.62,112.33 276.6,98.59C277.59,84.85 278.48,71.85 278.58,71.51C278.78,71.01 281.84,70.92 292.75,71.01L306.72,71.16L306.87,75.12Z"
android:strokeLineJoin="round"
android:strokeWidth="1.97665886"
android:fillColor="#EBC53D"
android:strokeColor="#EBC53D"
android:fillType="nonZero"/>
<path
android:pathData="M375.54,71.8C375.94,72.55 377.57,118.36 377.57,128.34L377.57,131.7L362.16,131.7L346.71,131.7L347.06,122.7C347.25,117.71 347.65,103.09 347.9,92.02C348.19,80.95 348.54,71.66 348.69,71.41C348.88,71.11 354.26,70.92 362.02,70.92C374.01,70.92 375.1,70.96 375.54,71.8Z"
android:strokeLineJoin="round"
android:strokeWidth="1.97665886"
android:fillColor="#EBC53D"
android:strokeColor="#EBC53D"
android:fillType="nonZero"/>
<path
android:pathData="M444.66,72C444.91,72.64 445.8,80.9 446.69,90.43C447.52,99.92 448.66,113.51 449.2,118.8C449.7,124.09 450.14,129.18 450.14,130.07L450.14,131.7L435.13,131.7L420.12,131.7L419.83,128.34C419.53,125.12 418.35,99.82 417.8,85.99C417.66,82.18 417.41,77.59 417.26,75.81C416.82,70.72 416.22,70.92 431.43,70.92L444.22,70.92L444.66,72Z"
android:strokeLineJoin="round"
android:strokeWidth="1.97665886"
android:fillColor="#EBC53D"
android:strokeColor="#EBC53D"
android:fillType="nonZero"/>
<path
android:pathData="M514.82,72C515.06,72.64 515.7,76.25 516.25,80.06C517.88,91.37 521.14,114.6 522.47,122.95C523.16,127.25 523.7,131.01 523.7,131.25C523.7,131.55 517.38,131.65 507.81,131.6L491.86,131.45L490.82,121.81C489.59,110.79 488.6,99.23 487.12,83.07C486.23,73.53 486.13,71.71 486.72,71.36C487.12,71.11 493.49,70.92 500.89,70.92L514.32,70.92L514.82,72Z"
android:strokeLineJoin="round"
android:strokeWidth="1.97665886"
android:fillColor="#EBC53D"
android:strokeColor="#EBC53D"
android:fillType="nonZero"/>
<path
android:pathData="M165.82,134.42C167.05,136.54 168.29,142.96 168.58,148.99C169.22,160.8 165.82,201.08 163.5,208.69C162.61,211.7 162.61,213.19 163.6,215.46C164.58,217.88 164.53,221.54 163.3,232.51C160.04,261.27 155.55,293.04 150.17,324.92C148.64,333.76 147.21,342.41 146.96,344.19C146.66,345.97 145.82,351.6 145.03,356.79C136.79,409.66 134.71,452.46 138.42,494.41C142.32,539.43 150.32,578.72 160.98,605.6C168.38,624.38 176.78,637.33 185.96,644.1C189.61,646.81 195.14,649.58 196.97,649.58C198.01,649.63 198.01,649.68 197.22,650.13C196.62,650.47 195.04,650.47 192.13,650.13C180.97,648.74 172.24,639.9 162.26,619.93C151.4,598.09 142.96,566.36 137.43,526.78C131.55,484.63 130.67,443.86 134.66,402.01C134.91,399.44 135.26,395.88 135.41,394.1C136.49,382.34 140.89,352.44 145.77,323.43C153.03,280.44 159.84,232.75 159.99,223.56C160.09,219.86 159.94,218.97 158.71,216.35L157.28,213.43L158.81,209.82C160.68,205.43 161.47,201.18 163,187.29C165.62,163.92 165.72,150.48 163.45,138.67C163,136.24 162.81,133.92 162.95,133.48C163.45,132.24 164.83,132.69 165.82,134.42Z"
android:strokeLineJoin="round"
android:strokeWidth="2.96498829"
android:fillColor="#EBC53D"
android:strokeColor="#EBC53D"
android:fillType="nonZero"/>
<path
android:pathData="M561.92,132.98C562.95,133.38 562.9,134.42 561.62,140.59C560.68,145.19 560.53,148.3 560.53,160.36C560.53,172.02 560.73,175.53 561.87,185.31C563.89,202.31 564.48,205.67 566.16,208.89C567,210.42 567.64,212.05 567.64,212.44C567.64,212.89 566.95,214.57 566.06,216.2C565.08,218.13 564.43,220.15 564.29,221.88C564.09,224.5 564.68,232.11 565.67,239.18C565.91,241.06 566.61,246.54 567.2,251.29C567.74,256.03 568.63,262.8 569.12,266.36C569.67,269.87 570.51,276.34 571.1,280.69C572.04,288 573.17,295.51 577.81,325.41C586.11,379.22 588.77,405.22 589.66,441.04C590.95,493.67 581.17,561.77 566.51,602.19C562.26,613.8 556.34,626.11 550.96,634.26C549.47,636.59 546.36,640.29 544.14,642.52C538.86,647.7 534.47,650.03 529.03,650.42C526.52,650.62 525.23,650.52 524.99,650.13C524.79,649.83 524.94,649.58 525.43,649.58C526.76,649.58 531.95,646.77 534.96,644.44C549.13,633.42 560.88,609.95 569.86,574.72C576.13,550.11 579.44,530.04 583.19,494.66C585.42,473.91 585.51,434.92 583.44,407.44C581.96,387.92 578.95,363.07 574.75,336.28C573.52,328.52 572.23,319.88 571.84,317.06C571.44,314.24 570.9,310.59 570.6,308.9C570.36,307.22 569.47,300.9 568.63,294.77C566.01,275.7 565.62,272.93 564.93,267.84C564.19,262.8 560.53,230.38 559.94,223.46C559.64,219.96 559.74,219.36 560.98,216.4L562.36,213.14L561.32,207.65C558.11,190.85 555.74,152.9 557.23,143.06C557.92,138.62 559.1,134.76 560.14,133.53C560.98,132.54 560.88,132.59 561.92,132.98Z"
android:strokeLineJoin="round"
android:strokeWidth="2.96498829"
android:fillColor="#EBC53D"
android:strokeColor="#EBC53D"
android:fillType="nonZero"/>
<path
android:pathData="M231.28,139.21C231.09,140.94 230.54,146.67 230,151.96C226.39,187.29 226.54,186.06 224.86,187.88C223.88,189.02 223.73,189.02 209.86,189.02C201.12,189.02 195.44,188.82 194.85,188.53C193.61,187.83 193.61,185.61 194.9,173.45C195.44,168.27 196.23,160.56 196.62,156.31C197.71,144.2 198.45,137.43 198.65,136.74C198.8,136.29 202.5,136.14 215.19,136.14L231.58,136.14L231.28,139.21Z"
android:strokeLineJoin="round"
android:strokeWidth="1.97665886"
android:fillColor="#EBC53D"
android:strokeColor="#EBC53D"
android:fillType="nonZero"/>
<path
android:pathData="M304.15,138.12C304.05,139.06 303.46,149.73 302.77,161.84C302.08,173.95 301.29,184.67 301.04,185.66C300.1,189.12 300.55,189.02 285.05,189.02C274.88,189.02 270.98,188.87 270.53,188.43C269.69,187.59 269.79,183.73 271.12,164.07C271.82,154.53 272.51,144.4 272.7,141.43L273,136.14L288.65,136.24L304.25,136.39L304.15,138.12Z"
android:strokeLineJoin="round"
android:strokeWidth="1.97665886"
android:fillColor="#EBC53D"
android:strokeColor="#EBC53D"
android:fillType="nonZero"/>
<path
android:pathData="M378.26,144.15C378.95,164.36 379.1,187.59 378.55,188.33C378.06,188.92 375.35,189.02 362.71,189.02C347.9,189.02 347.4,188.97 346.41,187.98C345.38,186.95 345.38,186.8 345.67,166.63C345.87,155.42 346.12,144 346.27,141.19L346.56,136.14L362.26,136.14L377.96,136.14L378.26,144.15Z"
android:strokeLineJoin="round"
android:strokeWidth="1.97665886"
android:fillColor="#EBC53D"
android:strokeColor="#EBC53D"
android:fillType="nonZero"/>
<path
android:pathData="M451.87,136.74C452.02,137.28 453.15,150.33 455.67,181.21C456.07,186.15 456.07,187.69 455.57,188.28C455.03,188.92 452.81,189.02 440.27,189.02C423.68,189.02 424.47,189.22 423.53,185.07C423.28,183.83 422.79,178.49 422.49,173.21C422.2,167.92 421.65,158.23 421.26,151.71C420.86,145.19 420.52,139.01 420.52,138.02L420.52,136.14L436.07,136.14C448.12,136.14 451.72,136.29 451.87,136.74Z"
android:strokeLineJoin="round"
android:strokeWidth="1.97665886"
android:fillColor="#EBC53D"
android:strokeColor="#EBC53D"
android:fillType="nonZero"/>
<path
android:pathData="M525.43,137.23C525.68,138.32 529.48,170.88 530.66,182.05C531.26,187.34 531.21,187.69 530.37,188.33C528.94,189.37 502.13,189.32 500.65,188.28C499.07,187.19 498.72,185.56 497.09,171.72C495.61,159.62 493.09,137.28 493.09,136.49C493.09,136.29 500.3,136.14 509.14,136.14L525.18,136.14L525.43,137.23Z"
android:strokeLineJoin="round"
android:strokeWidth="1.97665886"
android:fillColor="#EBC53D"
android:strokeColor="#EBC53D"
android:fillType="nonZero"/>
<path
android:pathData="M182.31,146.92C185.32,147.02 188.73,146.87 189.96,146.57C191.14,146.32 192.23,146.18 192.33,146.23C192.58,146.47 191.1,162.19 189.66,174.44C188.28,186.35 188.33,188.67 189.91,190.9C191.98,193.86 194.01,194.21 209.21,194.21C223.78,194.21 225.16,194.01 228.02,191.64C230.49,189.56 231.33,187.19 232.12,180.27C233.16,171.43 234.49,158.23 235.18,150.23C235.33,148.05 235.58,146.13 235.68,145.98C235.73,145.83 237.45,145.98 239.43,146.32C243.58,147.07 258.19,147.21 263.27,146.52C265.15,146.28 266.83,146.18 266.93,146.32C267.03,146.42 266.78,151.81 266.34,158.23C265.84,164.71 265.25,173.65 264.9,178.15C264.61,182.65 264.51,187.14 264.71,188.13C265.2,190.8 267.03,192.73 269.79,193.52C273.05,194.46 297.49,194.51 300.15,193.57C302.43,192.73 305.24,189.66 305.98,187.19C306.28,186.15 306.97,177.65 307.51,168.27C308.84,145.29 308.74,145.83 310.08,146.28C311.85,146.87 333.08,147.12 337.08,146.62C339.11,146.37 340.88,146.23 340.98,146.32C341.08,146.42 340.88,155.22 340.54,165.89C339.9,186.5 340,188.08 342.07,190.7C342.61,191.44 344.04,192.53 345.13,193.12C347.15,194.16 347.65,194.21 362.26,194.21L377.32,194.21L379.79,192.97C384.18,190.75 384.23,190.45 384.13,174.94C384.08,167.57 383.94,158.04 383.74,153.74C383.44,146.28 383.44,145.93 384.33,146.28C385.91,146.92 405.71,147.16 410.6,146.57C413.16,146.28 415.33,146.13 415.43,146.23C415.53,146.32 416.03,153.24 416.57,161.64C418,183.63 418.35,186.8 419.63,189.17C422.3,193.91 425.26,194.6 442.19,194.36C455.62,194.11 456.71,193.96 459.18,191.59C461.5,189.42 461.59,187.88 460.51,175.13C458.98,157.64 458.09,146.32 458.19,146.23C458.24,146.18 459.97,146.37 461.99,146.62C466.58,147.21 484.85,146.82 487.12,146.08C488.06,145.78 488.9,145.63 489,145.73C489.09,145.83 489.74,150.87 490.43,156.95C492.25,174.1 493.59,184.62 494.13,186.7C494.72,189.02 497.09,191.74 499.71,193.12C501.63,194.16 502.28,194.21 515.56,194.21C530.66,194.21 531.9,194.01 534.37,191.44C536.39,189.32 536.44,185.91 534.61,170.74C531.8,147.26 531.7,145.93 532.54,146.32C532.98,146.47 535.65,146.72 538.51,146.87C543.2,147.12 546.96,146.72 549.52,145.78C550.26,145.44 550.36,145.88 550.36,150.77C550.36,162.24 552.58,189.51 554.61,202.46L554.9,204.34L362.71,204.34L170.56,204.34L170.9,201.47C172.88,183.98 174.26,166.73 174.51,157.05C174.8,145.58 174.8,145.58 175.84,146.13C176.43,146.47 179.35,146.82 182.31,146.92Z"
android:strokeLineJoin="round"
android:strokeWidth="2.96498829"
android:fillColor="#EBC53D"
android:strokeColor="#EBC53D"
android:fillType="nonZero"/>
<path
android:pathData="M554.02,210.37C555.55,211.01 556.04,212.35 555.3,213.73L554.76,214.72L363.1,214.82C208.67,214.96 171.25,214.87 170.36,214.32C168.83,213.48 168.93,212.05 170.51,210.81L171.84,209.78L362.31,209.78C504.99,209.78 553.08,209.92 554.02,210.37Z"
android:strokeLineJoin="round"
android:strokeWidth="1.97665886"
android:fillColor="#C19E2C"
android:strokeColor="#C19E2C"
android:fillType="nonZero"/>
<path
android:pathData="M287.52,221.73C287.32,222.92 286.87,229.84 286.48,237.2C285.19,259.93 281.74,313.25 281.05,320.72C280.11,331.34 277.15,376.46 275.86,400.52C272.56,462.29 273.4,516.45 278.63,576.45C281.2,606.34 285.1,633.42 288.5,645.48L288.8,646.62L245.7,646.62L202.55,646.57L199.29,645.48C194.45,643.85 190.8,641.43 185.76,636.49C179.15,630.06 173.03,620.38 167.84,608.07C163.15,597 158.12,580.45 154.71,564.88C145.33,522.14 141.03,477.71 142.47,438.23C142.81,429.58 143.26,420.14 143.5,417.32C143.8,414.46 144.24,409.12 144.54,405.46C145.33,395.48 146.32,387.43 148.49,372.11C151.2,353.03 151.6,350.41 154.41,333.56C157.82,313.4 158.51,308.9 163.6,274.26C165.72,259.44 167.94,242.49 169.22,230.28C169.77,225.09 170.36,220.6 170.46,220.25C170.61,219.81 182.85,219.66 229.21,219.66L287.76,219.66L287.52,221.73Z"
android:strokeLineJoin="round"
android:strokeWidth="2.47082358"
android:fillColor="#EBC53D"
android:strokeColor="#EBC53D"
android:fillType="nonZero"/>
<path
android:pathData="M297.09,222.57C297.09,226.53 295.86,247.13 292.9,293.04C292.01,306.34 290.58,326.45 289.44,340.23C288.8,348.49 288.26,356.59 286.73,380.76C285.15,405.86 284.16,438.82 284.06,469.21C284.01,497.82 284.41,521.99 285,530.24C285.15,531.87 285.34,536.22 285.49,539.88C285.89,549.27 286.63,561.87 287.27,568.54C290.43,603.58 293.59,626.85 296.95,639.7C297.93,643.36 298.72,647.01 298.77,647.85C298.82,649.24 298.72,649.34 296.8,649.48L294.77,649.63L293.49,644.79C283.76,608.32 277.1,518.48 278.78,446.97C279.07,434.87 279.42,423.3 279.57,421.28C279.67,419.25 279.91,414.56 280.06,410.9C280.36,404.67 281.94,376.11 282.53,366.18C282.78,362.13 283.27,355.75 284.75,335.05C285.44,326 287.56,295.66 288.21,285.88C288.8,276.83 292.16,221.49 292.16,220.4C292.16,219.86 292.75,219.66 294.62,219.66L297.09,219.66L297.09,222.57Z"
android:strokeLineJoin="round"
android:strokeWidth="1.97665886"
android:fillColor="#C19E2C"
android:strokeColor="#C19E2C"
android:fillType="nonZero"/>
<path
android:pathData="M419.24,225.93C419.38,229.44 419.88,239.03 420.27,247.33C421.51,272.09 422.44,291.21 423.23,306.38C424.37,327.98 426.34,371.81 426.94,387.43C429.41,456.91 428.62,518.43 424.47,572.74C423.97,578.82 423.68,582.43 422.44,594.73C420.67,612.67 417.11,634.31 414.3,644L413.56,646.62L358.81,646.62L304.05,646.62L302.82,642.56C299.22,630.61 294.97,602.83 292.65,575.7C291.46,562.07 291.12,557.42 290.43,544.42C288.6,509.78 287.86,469.41 288.7,444.75C289.69,414.51 291.76,375.27 293.64,349.87C295.71,321.8 300.3,252.67 301.59,230.14L302.18,219.66L360.53,219.66L418.89,219.66L419.24,225.93Z"
android:strokeLineJoin="round"
android:strokeWidth="2.47082358"
android:fillColor="#EBC53D"
android:strokeColor="#EBC53D"
android:fillType="nonZero"/>
<path
android:pathData="M429.85,232.61C430.15,239.77 430.64,249.36 430.89,254C431.18,258.6 431.73,270.31 432.12,279.95C432.52,289.58 433.55,310.73 434.34,326.89C437.3,386.59 438.54,435.46 438.09,476.13C437.85,501.73 436.86,534.34 436.12,544.32C435.97,546.1 435.72,549.41 435.58,551.74C434.19,574.81 431.68,600.12 428.91,618.94C427.04,631.64 423.78,647.85 422.84,648.99C422.54,649.38 421.61,649.58 420.57,649.48C418.4,649.29 418.4,649.14 420.17,641.08C424.76,620.57 428.42,588.5 430.64,549.76C432.27,520.8 432.57,505.43 432.57,461.06C432.57,410.65 431.97,386.59 429.41,335.54C428.07,308.86 426.99,287.06 426.44,274.51C426.2,268.68 425.51,254.99 424.96,244.12C424.02,224.9 423.83,220.8 423.93,220C423.97,219.81 425.16,219.66 426.59,219.66L429.26,219.66L429.85,232.61Z"
android:strokeLineJoin="round"
android:strokeWidth="1.97665886"
android:fillColor="#C19E2C"
android:strokeColor="#C19E2C"
android:fillType="nonZero"/>
<path
android:pathData="M553.82,219.81C557.54,253.08 560.19,275.09 561.77,285.83C562.31,289.48 563.3,296.35 563.94,301.15C565.47,312.22 568.43,332.28 569.37,337.76C571.74,351.9 576.08,385.55 577.22,399.04C579.05,420.09 579.24,425.48 579.24,450.93C579.24,482.06 578.65,490.91 574.5,520.85C567.89,568.79 556.68,606.94 543.55,626.6C537.28,635.99 528.69,643.5 521.93,645.63C518.77,646.57 517.48,646.62 473.79,646.62C438.19,646.62 428.91,646.47 428.91,645.97C428.91,645.68 429.26,644 429.65,642.32C431.53,634.26 435.08,610.84 436.51,596.46C439.28,569.63 440.66,549.91 441.85,521.1C442.64,501.33 442.64,418.16 441.85,394.35C441.01,369.54 439.87,342.51 439.28,332.82C438.74,323.68 437.7,301.54 436.56,275.75C435.72,256.67 434.54,231.32 434.1,224.21L433.8,219.66L493.78,219.66C515.8,219.66 535.81,219.71 553.82,219.81Z"
android:strokeLineJoin="round"
android:strokeWidth="2.47082358"
android:fillColor="#EBC53D"
android:strokeColor="#EBC53D"
android:fillType="nonZero"/>
</vector>

View File

@@ -0,0 +1,17 @@
package com.icegps.maps
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

1
math/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

12
math/build.gradle.kts Normal file
View File

@@ -0,0 +1,12 @@
plugins {
alias(libs.plugins.kotlin.jvm)
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
}
}

View File

@@ -0,0 +1,14 @@
package com.icegps.math
import kotlin.math.absoluteValue
interface IsAlmostEquals<T> {
fun isAlmostEquals(other: T, epsilon: Double = 0.000001): Boolean
}
interface IsAlmostEqualsF<T> {
fun isAlmostEquals(other: T, epsilon: Float = 0.0001f): Boolean
}
fun Float.isAlmostEquals(other: Float, epsilon: Float = 0.000001f): Boolean = (this - other).absoluteValue < epsilon
fun Double.isAlmostEquals(other: Double, epsilon: Double = 0.000001): Boolean = (this - other).absoluteValue < epsilon

View File

@@ -0,0 +1,5 @@
package com.icegps.math.geometry
typealias Line = Line2F
data class Line2F(val a: Vector2F, val b: Vector2F)

View File

@@ -0,0 +1,3 @@
package com.icegps.math.geometry
data class Scale(val scaleX: Float, val scaleY: Float)

View File

@@ -0,0 +1,32 @@
package com.icegps.math.geometry
data class Size2F(val width: Float, val height: Float)
data class SizeInt(val width: Int, val height: Int) {
constructor() : this(0, 0)
fun avgComponent(): Int = (width + height) / 2
fun minComponent(): Int = kotlin.math.min(width, height)
fun maxComponent(): Int = kotlin.math.max(width, height)
val area: Int get() = width * height
val perimeter: Int get() = width * 2 + height * 2
operator fun unaryMinus(): SizeInt = SizeInt(-width, -height)
operator fun unaryPlus(): SizeInt = this
operator fun minus(other: SizeInt): SizeInt = SizeInt(width - other.width, height - other.height)
operator fun plus(other: SizeInt): SizeInt = SizeInt(width + other.width, height + other.height)
operator fun times(s: Float): SizeInt = SizeInt((width * s).toInt(), (height * s).toInt())
operator fun times(s: Double): SizeInt = times(s.toFloat())
operator fun times(s: Int): SizeInt = times(s.toFloat())
operator fun times(scale: Vector2F): SizeInt = SizeInt((width * scale.x).toInt(), (height * scale.y).toInt())
operator fun times(scale: Scale): SizeInt = SizeInt((width * scale.scaleX).toInt(), (height * scale.scaleY).toInt())
operator fun div(other: SizeInt): SizeInt = SizeInt(width / other.width, height / other.height)
operator fun div(s: Float): SizeInt = SizeInt((width / s).toInt(), (height / s).toInt())
operator fun div(s: Double): SizeInt = div(s.toFloat())
operator fun div(s: Int): SizeInt = div(s.toFloat())
override fun toString(): String = "${width}x${height}"
}

View File

@@ -0,0 +1,191 @@
package com.icegps.math.geometry
import com.icegps.math.IsAlmostEquals
import com.icegps.math.isAlmostEquals
import kotlin.math.abs
import kotlin.math.ceil
import kotlin.math.floor
import kotlin.math.hypot
import kotlin.math.max
import kotlin.math.min
import kotlin.math.round
data class Vector2D(val x: Double, val y: Double) : IsAlmostEquals<Vector2D> {
//constructor(x: Float, y: Float) : this(float2PackOf(x, y))
constructor(x: Float, y: Float) : this(x.toDouble(), y.toDouble())
constructor(x: Int, y: Int) : this(x.toDouble(), y.toDouble())
constructor(x: Double, y: Int) : this(x.toDouble(), y.toDouble())
constructor(x: Int, y: Double) : this(x.toDouble(), y.toDouble())
constructor(x: Float, y: Int) : this(x.toDouble(), y.toDouble())
constructor(x: Int, y: Float) : this(x.toDouble(), y.toDouble())
//constructor(p: Vector2) : this(p.raw)
constructor() : this(0.0, 0.0)
//constructor(x: Int, y: Int) : this(x.toDouble(), y.toDouble())
//constructor(x: Float, y: Float) : this(x.toDouble(), y.toDouble())
fun copy(x: Float = this.x.toFloat(), y: Float = this.y.toFloat()): Vector2D = Vector2D(x, y)
inline operator fun unaryMinus(): Vector2D = Vector2D(-x, -y)
inline operator fun unaryPlus(): Vector2D = this
inline operator fun plus(that: Vector2D): Vector2D = Vector2D(x + that.x, y + that.y)
inline operator fun minus(that: Vector2D): Vector2D = Vector2D(x - that.x, y - that.y)
inline operator fun times(that: Vector2D): Vector2D = Vector2D(x * that.x, y * that.y)
inline operator fun div(that: Vector2D): Vector2D = Vector2D(x / that.x, y / that.y)
inline operator fun rem(that: Vector2D): Vector2D = Vector2D(x % that.x, y % that.y)
inline operator fun times(scale: Double): Vector2D = Vector2D(x * scale, y * scale)
inline operator fun times(scale: Float): Vector2D = this * scale.toDouble()
inline operator fun times(scale: Int): Vector2D = this * scale.toDouble()
inline operator fun div(scale: Double): Vector2D = Vector2D(x / scale, y / scale)
inline operator fun div(scale: Float): Vector2D = this / scale.toDouble()
inline operator fun div(scale: Int): Vector2D = this / scale.toDouble()
inline operator fun rem(scale: Double): Vector2D = Vector2D(x % scale, y % scale)
inline operator fun rem(scale: Float): Vector2D = this % scale.toDouble()
inline operator fun rem(scale: Int): Vector2D = this % scale.toDouble()
fun avgComponent(): Double = x * 0.5 + y * 0.5
fun minComponent(): Double = min(x, y)
fun maxComponent(): Double = max(x, y)
fun distanceTo(x: Double, y: Double): Double = hypot(x - this.x, y - this.y)
fun distanceTo(x: Float, y: Float): Double = distanceTo(x.toDouble(), y.toDouble())
fun distanceTo(x: Int, y: Int): Double = this.distanceTo(x.toDouble(), y.toDouble())
fun distanceTo(that: Vector2D): Double = distanceTo(that.x, that.y)
infix fun cross(that: Vector2D): Double = crossProduct(this, that)
infix fun dot(that: Vector2D): Double = ((this.x * that.x) + (this.y * that.y))
operator fun get(component: Int): Double = when (component) {
0 -> x; 1 -> y
else -> throw IndexOutOfBoundsException("Point doesn't have $component component")
}
val length: Double get() = hypot(x, y)
val lengthSquared: Double
get() {
val x = x
val y = y
return x * x + y * y
}
val magnitude: Double get() = hypot(x, y)
val normalized: Vector2D get() = this * (1f / magnitude)
val unit: Vector2D get() = this / length
/** Normal vector. Rotates the vector/point -90 degrees (not normalizing it) */
fun toNormal(): Vector2D = Vector2D(-this.y, this.x)
fun round(): Vector2D = Vector2D(round(x), round(y))
fun ceil(): Vector2D = Vector2D(ceil(x), ceil(y))
fun floor(): Vector2D = Vector2D(floor(x), floor(y))
//fun copy(x: Double = this.x, y: Double = this.y): Vector2 = Vector2D(x, y)
override fun isAlmostEquals(other: Vector2D, epsilon: Double): Boolean =
this.x.isAlmostEquals(other.x, epsilon) && this.y.isAlmostEquals(other.y, epsilon)
/** Vector2 with inverted (1f / v) components to this */
fun inv(): Vector2D = Vector2D(1.0 / x, 1.0 / y)
fun isNaN(): Boolean = this.x.isNaN() && this.y.isNaN()
val absoluteValue: Vector2D get() = Vector2D(abs(x), abs(y))
companion object {
val ZERO = Vector2D(0.0, 0.0)
val NaN = Vector2D(Double.NaN, Double.NaN)
/** Mathematically typical LEFT, matching screen coordinates (-1, 0) */
val LEFT = Vector2D(-1.0, 0.0)
/** Mathematically typical RIGHT, matching screen coordinates (+1, 0) */
val RIGHT = Vector2D(+1.0, 0.0)
/** Mathematically typical UP (0, +1) */
val UP = Vector2D(0.0, +1.0)
/** UP using screen coordinates as reference (0, -1) */
val UP_SCREEN = Vector2D(0.0, -1.0)
/** Mathematically typical DOWN (0, -1) */
val DOWN = Vector2D(0.0, -1.0)
/** DOWN using screen coordinates as reference (0, +1) */
val DOWN_SCREEN = Vector2D(0.0, +1.0)
inline operator fun invoke(x: Number, y: Number): Vector2D = Vector2D(x.toDouble(), y.toDouble())
//inline operator fun invoke(x: Float, y: Float): Vector2D = Vector2D(x.toDouble(), y.toDouble())
//fun fromRaw(raw: Float2Pack) = Vector2D(raw)
inline fun middle(a: Vector2D, b: Vector2D): Vector2D = (a + b) * 0.5
fun distance(a: Double, b: Double): Double = abs(a - b)
fun distance(x1: Double, y1: Double, x2: Double, y2: Double): Double = hypot(x1 - x2, y1 - y2)
fun distance(x1: Float, y1: Float, x2: Float, y2: Float): Double = hypot(x1 - x2, y1 - y2).toDouble()
fun distance(x1: Int, y1: Int, x2: Int, y2: Int): Double = hypot(x1.toDouble() - x2.toDouble(), y1.toDouble() - y2.toDouble())
fun distance(a: Vector2D, b: Vector2D): Double = distance(a.x, a.y, b.x, b.y)
fun distanceSquared(a: Vector2D, b: Vector2D): Double = distanceSquared(a.x, a.y, b.x, b.y)
fun distanceSquared(x1: Double, y1: Double, x2: Double, y2: Double): Double = square(x1 - x2) + square(y1 - y2)
fun distanceSquared(x1: Float, y1: Float, x2: Float, y2: Float): Float = square(x1 - x2) + square(y1 - y2)
fun distanceSquared(x1: Int, y1: Int, x2: Int, y2: Int): Int = square(x1 - x2) + square(y1 - y2)
@Deprecated("Likely searching for orientation")
inline fun direction(a: Vector2D, b: Vector2D): Vector2D = b - a
fun compare(l: Vector2D, r: Vector2D): Int = compare(l.x, l.y, r.x, r.y)
fun compare(lx: Float, ly: Float, rx: Float, ry: Float): Int = ly.compareTo(ry).let { ret -> if (ret == 0) lx.compareTo(rx) else ret }
fun compare(lx: Double, ly: Double, rx: Double, ry: Double): Int = ly.compareTo(ry).let { ret -> if (ret == 0) lx.compareTo(rx) else ret }
private fun square(x: Double): Double = x * x
private fun square(x: Float): Float = x * x
private fun square(x: Int): Int = x * x
fun dot(aX: Double, aY: Double, bX: Double, bY: Double): Double = (aX * bX) + (aY * bY)
fun dot(aX: Float, aY: Float, bX: Float, bY: Float): Float = (aX * bX) + (aY * bY)
fun dot(a: Vector2D, b: Vector2D): Double = dot(a.x, a.y, b.x, b.y)
fun crossProduct(ax: Float, ay: Float, bx: Float, by: Float): Float = (ax * by) - (bx * ay)
fun crossProduct(ax: Double, ay: Double, bx: Double, by: Double): Double = (ax * by) - (bx * ay)
fun crossProduct(p1: Vector2D, p2: Vector2D): Double = crossProduct(p1.x, p1.y, p2.x, p2.y)
fun minComponents(p1: Vector2D, p2: Vector2D): Vector2D = Vector2D(min(p1.x, p2.x), min(p1.y, p2.y))
fun minComponents(p1: Vector2D, p2: Vector2D, p3: Vector2D): Vector2D = Vector2D(
minOf(p1.x, p2.x, p3.x),
minOf(p1.y, p2.y, p3.y)
)
fun minComponents(p1: Vector2D, p2: Vector2D, p3: Vector2D, p4: Vector2D): Vector2D = Vector2D(
minOf(
p1.x,
p2.x,
p3.x,
p4.x
), minOf(p1.y, p2.y, p3.y, p4.y)
)
fun maxComponents(p1: Vector2D, p2: Vector2D): Vector2D = Vector2D(max(p1.x, p2.x), max(p1.y, p2.y))
fun maxComponents(p1: Vector2D, p2: Vector2D, p3: Vector2D): Vector2D = Vector2D(
maxOf(p1.x, p2.x, p3.x),
maxOf(p1.y, p2.y, p3.y)
)
fun maxComponents(p1: Vector2D, p2: Vector2D, p3: Vector2D, p4: Vector2D): Vector2D = Vector2D(
maxOf(
p1.x,
p2.x,
p3.x,
p4.x
), maxOf(p1.y, p2.y, p3.y, p4.y)
)
}
}
fun Vector2D.toVector2F(): Vector2F = Vector2F(x, y)

View File

@@ -0,0 +1,176 @@
package com.icegps.math.geometry
import com.icegps.math.isAlmostEquals
import kotlin.math.abs
import kotlin.math.hypot
import kotlin.math.max
import kotlin.math.min
data class Vector2F(val x: Float, val y: Float) {
constructor(x: Double, y: Double) : this(x.toFloat(), y.toFloat())
constructor(x: Int, y: Int) : this(x.toFloat(), y.toFloat())
constructor(x: Double, y: Int) : this(x.toFloat(), y.toFloat())
constructor(x: Int, y: Double) : this(x.toFloat(), y.toFloat())
constructor(x: Float, y: Int) : this(x.toFloat(), y.toFloat())
constructor(x: Int, y: Float) : this(x.toFloat(), y.toFloat())
//constructor(p: Vector2) : this(p.raw)
constructor() : this(0f, 0f)
//constructor(x: Int, y: Int) : this(x.toDouble(), y.toDouble())
//constructor(x: Float, y: Float) : this(x.toDouble(), y.toDouble())
fun copy(x: Double = this.x.toDouble(), y: Double = this.y.toDouble()): Vector2F = Vector2F(x, y)
inline operator fun unaryMinus(): Vector2F = Vector2F(-x, -y)
inline operator fun unaryPlus(): Vector2F = this
inline operator fun plus(that: Vector2F): Vector2F = Vector2F(x + that.x, y + that.y)
inline operator fun minus(that: Vector2F): Vector2F = Vector2F(x - that.x, y - that.y)
inline operator fun times(that: Vector2F): Vector2F = Vector2F(x * that.x, y * that.y)
inline operator fun div(that: Vector2F): Vector2F = Vector2F(x / that.x, y / that.y)
inline operator fun rem(that: Vector2F): Vector2F = Vector2F(x % that.x, y % that.y)
inline operator fun times(scale: Float): Vector2F = Vector2F(x * scale, y * scale)
inline operator fun times(scale: Double): Vector2F = this * scale.toFloat()
inline operator fun times(scale: Int): Vector2F = this * scale.toDouble()
inline operator fun div(scale: Float): Vector2F = Vector2F(x / scale, y / scale)
inline operator fun div(scale: Double): Vector2F = this / scale.toFloat()
inline operator fun div(scale: Int): Vector2F = this / scale.toDouble()
inline operator fun rem(scale: Float): Vector2F = Vector2F(x % scale, y % scale)
inline operator fun rem(scale: Double): Vector2F = this % scale.toFloat()
inline operator fun rem(scale: Int): Vector2F = this % scale.toDouble()
fun avgComponent(): Float = x * 0.5f + y * 0.5f
fun minComponent(): Float = min(x, y)
fun maxComponent(): Float = max(x, y)
fun distanceTo(x: Float, y: Float): Float = hypot(x - this.x, y - this.y)
fun distanceTo(x: Double, y: Double): Float = this.distanceTo(x.toFloat(), y.toFloat())
fun distanceTo(x: Int, y: Int): Float = this.distanceTo(x.toDouble(), y.toDouble())
fun distanceTo(that: Vector2F): Float = distanceTo(that.x, that.y)
infix fun cross(that: Vector2F): Float = crossProduct(this, that)
infix fun dot(that: Vector2F): Float = ((this.x * that.x) + (this.y * that.y))
operator fun get(component: Int) = when (component) {
0 -> x; 1 -> y
else -> throw IndexOutOfBoundsException("Point doesn't have $component component")
}
val length: Float get() = hypot(x, y)
val lengthSquared: Float
get() {
val x = x
val y = y
return x * x + y * y
}
val magnitude: Float get() = hypot(x, y)
val normalized: Vector2F get() = this * (1f / magnitude)
val unit: Vector2F get() = this / length
/** Normal vector. Rotates the vector/point -90 degrees (not normalizing it) */
fun toNormal(): Vector2F = Vector2F(-this.y, this.x)
fun round(): Vector2F = Vector2F(kotlin.math.round(x), kotlin.math.round(y))
fun ceil(): Vector2F = Vector2F(kotlin.math.ceil(x), kotlin.math.ceil(y))
fun floor(): Vector2F = Vector2F(kotlin.math.floor(x), kotlin.math.floor(y))
//fun copy(x: Double = this.x, y: Double = this.y): Vector2 = Point(x, y)
fun isAlmostEquals(other: Vector2F, epsilon: Float = 0.00001f): Boolean =
this.x.isAlmostEquals(other.x, epsilon) && this.y.isAlmostEquals(other.y, epsilon)
/** Vector2 with inverted (1f / v) components to this */
fun inv(): Vector2F = Vector2F(1f / x, 1f / y)
fun isNaN(): Boolean = this.x.isNaN() && this.y.isNaN()
val absoluteValue: Vector2F get() = Vector2F(abs(x), abs(y))
companion object {
val ZERO = Vector2F(0f, 0f)
val NaN = Vector2F(Float.NaN, Float.NaN)
/** Mathematically typical LEFT, matching screen coordinates (-1, 0) */
val LEFT = Vector2F(-1f, 0f)
/** Mathematically typical RIGHT, matching screen coordinates (+1, 0) */
val RIGHT = Vector2F(+1f, 0f)
/** Mathematically typical UP (0, +1) */
val UP = Vector2F(0f, +1f)
/** UP using 2D screen coordinates as reference (0, -1) */
val UP_SCREEN = Vector2F(0f, -1f)
/** Mathematically typical DOWN (0, -1) */
val DOWN = Vector2F(0f, -1f)
/** DOWN using 2D screen coordinates as reference (0, +1) */
val DOWN_SCREEN = Vector2F(0f, +1f)
fun distance(a: Double, b: Double): Double = abs(a - b)
fun distance(x1: Double, y1: Double, x2: Double, y2: Double): Double = hypot(x1 - x2, y1 - y2)
fun distance(x1: Float, y1: Float, x2: Float, y2: Float): Float = hypot(x1 - x2, y1 - y2)
fun distance(x1: Int, y1: Int, x2: Int, y2: Int): Float = distance(x1.toFloat(), y1.toFloat(), x2.toFloat(), y2.toFloat())
fun distance(a: Vector2F, b: Vector2F): Float = distance(a.x, a.y, b.x, b.y)
fun distanceSquared(a: Vector2F, b: Vector2F): Float = distanceSquared(a.x, a.y, b.x, b.y)
fun distanceSquared(x1: Double, y1: Double, x2: Double, y2: Double): Double = square(x1 - x2) + square(y1 - y2)
fun distanceSquared(x1: Float, y1: Float, x2: Float, y2: Float): Float = square(x1 - x2) + square(y1 - y2)
fun distanceSquared(x1: Int, y1: Int, x2: Int, y2: Int): Int = square(x1 - x2) + square(y1 - y2)
@Deprecated("Likely searching for orientation")
inline fun direction(a: Vector2F, b: Vector2F): Vector2F = b - a
fun compare(l: Vector2F, r: Vector2F): Int = compare(l.x, l.y, r.x, r.y)
fun compare(lx: Float, ly: Float, rx: Float, ry: Float): Int = ly.compareTo(ry).let { ret -> if (ret == 0) lx.compareTo(rx) else ret }
fun compare(lx: Double, ly: Double, rx: Double, ry: Double): Int = ly.compareTo(ry).let { ret -> if (ret == 0) lx.compareTo(rx) else ret }
private fun square(x: Double): Double = x * x
private fun square(x: Float): Float = x * x
private fun square(x: Int): Int = x * x
fun dot(aX: Double, aY: Double, bX: Double, bY: Double): Double = (aX * bX) + (aY * bY)
fun dot(aX: Float, aY: Float, bX: Float, bY: Float): Float = (aX * bX) + (aY * bY)
fun dot(a: Vector2F, b: Vector2F): Float = dot(a.x, a.y, b.x, b.y)
fun crossProduct(ax: Float, ay: Float, bx: Float, by: Float): Float = (ax * by) - (bx * ay)
fun crossProduct(ax: Double, ay: Double, bx: Double, by: Double): Double = (ax * by) - (bx * ay)
fun crossProduct(p1: Vector2F, p2: Vector2F): Float = crossProduct(p1.x, p1.y, p2.x, p2.y)
fun minComponents(p1: Vector2F, p2: Vector2F): Vector2F = Vector2F(min(p1.x, p2.x), min(p1.y, p2.y))
fun minComponents(p1: Vector2F, p2: Vector2F, p3: Vector2F): Vector2F = Vector2F(
minOf(p1.x, p2.x, p3.x),
minOf(p1.y, p2.y, p3.y)
)
fun minComponents(p1: Vector2F, p2: Vector2F, p3: Vector2F, p4: Vector2F): Vector2F = Vector2F(
minOf(
p1.x,
p2.x,
p3.x,
p4.x
), minOf(p1.y, p2.y, p3.y, p4.y)
)
fun maxComponents(p1: Vector2F, p2: Vector2F): Vector2F = Vector2F(max(p1.x, p2.x), max(p1.y, p2.y))
fun maxComponents(p1: Vector2F, p2: Vector2F, p3: Vector2F): Vector2F = Vector2F(
maxOf(p1.x, p2.x, p3.x),
maxOf(p1.y, p2.y, p3.y)
)
fun maxComponents(p1: Vector2F, p2: Vector2F, p3: Vector2F, p4: Vector2F): Vector2F = Vector2F(
maxOf(
p1.x,
p2.x,
p3.x,
p4.x
), maxOf(p1.y, p2.y, p3.y, p4.y)
)
}
}

View File

@@ -0,0 +1,9 @@
package com.icegps.math.geometry
typealias Point3 = Vector3D
data class Vector3D(val x: Double, val y: Double, val z: Double) {
constructor() : this(0.0, 0.0, 0.0)
}
fun Vector3D.toVector2D(): Vector2D = Vector2D(x, y)

View File

@@ -0,0 +1,101 @@
package com.icegps.math.geometry
import com.icegps.math.IsAlmostEqualsF
import com.icegps.math.isAlmostEquals
import kotlin.math.abs
import kotlin.math.sqrt
data class Vector3F(val x: Float, val y: Float, val z: Float) : IsAlmostEqualsF<Vector3F> {
companion object {
val NaN = Vector3F(Float.NaN, Float.NaN, Float.NaN)
val ZERO = Vector3F(0f, 0f, 0f)
val ONE = Vector3F(1f, 1f, 1f)
val FORWARD = Vector3F(0f, 0f, 1f)
val BACK = Vector3F(0f, 0f, -1f)
val LEFT = Vector3F(-1f, 0f, 0f)
val RIGHT = Vector3F(1f, 0f, 0f)
val UP = Vector3F(0f, 1f, 0f)
val DOWN = Vector3F(0f, -1f, 0f)
operator fun invoke(): Vector3F = ZERO
fun cross(a: Vector3F, b: Vector3F): Vector3F = Vector3F(
((a.y * b.z) - (a.z * b.y)),
((a.z * b.x) - (a.x * b.z)),
((a.x * b.y) - (a.y * b.x)),
)
fun length(x: Float, y: Float, z: Float): Float = sqrt(lengthSq(x, y, z))
fun lengthSq(x: Float, y: Float, z: Float): Float = x * x + y * y + z * z
fun fromArray(array: FloatArray, offset: Int): Vector3F =
Vector3F(array[offset + 0], array[offset + 1], array[offset + 2])
inline fun func(func: (index: Int) -> Float): Vector3F = Vector3F(func(0), func(1), func(2))
}
//constructor(x: Float, y: Float, z: Float) : this(float4PackOf(x, y, z, 0f))
constructor(x: Int, y: Int, z: Int) : this(x.toFloat(), y.toFloat(), z.toFloat())
constructor(x: Double, y: Double, z: Double) : this(x.toFloat(), y.toFloat(), z.toFloat())
fun distanceTo(other: Vector3F): Float {
val dx = this.x - other.x
val dy = this.y - other.y
val dz = this.z - other.z
return sqrt(dx * dx + dy * dy + dz * dz)
}
val lengthSquared: Float get() = (x * x) + (y * y) + (z * z)
val length: Float get() = sqrt(lengthSquared)
fun normalized(): Vector3F {
val length = this.length
//if (length.isAlmostZero()) return Vector3.ZERO
if (length == 0f) return Vector3F.ZERO
return this / length
}
operator fun get(index: Int): Float = when (index) {
0 -> x
1 -> y
2 -> z
else -> throw IndexOutOfBoundsException()
}
operator fun unaryPlus(): Vector3F = this
operator fun unaryMinus(): Vector3F = Vector3F(-this.x, -this.y, -this.z)
operator fun plus(v: Vector3F): Vector3F = Vector3F(this.x + v.x, this.y + v.y, this.z + v.z)
operator fun minus(v: Vector3F): Vector3F = Vector3F(this.x - v.x, this.y - v.y, this.z - v.z)
operator fun times(v: Vector3F): Vector3F = Vector3F(this.x * v.x, this.y * v.y, this.z * v.z)
operator fun div(v: Vector3F): Vector3F = Vector3F(this.x / v.x, this.y / v.y, this.z / v.z)
operator fun rem(v: Vector3F): Vector3F = Vector3F(this.x % v.x, this.y % v.y, this.z % v.z)
operator fun times(v: Float): Vector3F = Vector3F(this.x * v, this.y * v, this.z * v)
operator fun div(v: Float): Vector3F = Vector3F(this.x / v, this.y / v, this.z / v)
operator fun rem(v: Float): Vector3F = Vector3F(this.x % v, this.y % v, this.z % v)
operator fun times(v: Int): Vector3F = this * v.toFloat()
operator fun div(v: Int): Vector3F = this / v.toFloat()
operator fun rem(v: Int): Vector3F = this % v.toFloat()
operator fun times(v: Double): Vector3F = this * v.toFloat()
operator fun div(v: Double): Vector3F = this / v.toFloat()
operator fun rem(v: Double): Vector3F = this % v.toFloat()
infix fun dot(v: Vector3F): Float = (x * v.x) + (y * v.y) + (z * v.z)
infix fun cross(v: Vector3F): Vector3F = cross(this, v)
/** Vector3 with inverted (1f / v) components to this */
fun inv(): Vector3F = Vector3F(1f / x, 1f / y, 1f / z)
fun isNaN(): Boolean = this.x.isNaN() && this.y.isNaN() && this.z.isNaN()
val absoluteValue: Vector3F get() = Vector3F(abs(x), abs(y), abs(z))
override fun isAlmostEquals(other: Vector3F, epsilon: Float): Boolean =
this.x.isAlmostEquals(other.x, epsilon) &&
this.y.isAlmostEquals(other.y, epsilon) &&
this.z.isAlmostEquals(other.z, epsilon)
}

25
settings.gradle.kts Normal file
View File

@@ -0,0 +1,25 @@
pluginManagement {
repositories {
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "maps"
include(":app")
include(":math")
include(":maps-view")