├── demo
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── values
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ ├── menu
│ │ │ │ └── menu_main.xml
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ └── layout
│ │ │ │ └── activity_main.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── tanapruk
│ │ │ └── reversegeocodedemo
│ │ │ └── MainActivity.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── tanapruk
│ │ └── reversegeocodedemo
│ │ └── ApplicationTest.java
├── proguard-rules.pro
└── build.gradle
├── reversegeocode
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ └── values
│ │ │ │ └── strings.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── tanapruk
│ │ │ └── reversegeocode
│ │ │ ├── Polygon
│ │ │ ├── Point.java
│ │ │ ├── Line.java
│ │ │ └── Polygon.java
│ │ │ ├── GeocodeListBuilder.java
│ │ │ └── GeocodeList.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── tanapruk
│ │ │ └── reversegeocode
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── tanapruk
│ │ └── reversegeocode
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── .gitignore
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── README.md
├── gradlew.bat
└── gradlew
/demo/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/reversegeocode/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':demo'
2 | include ':reversegeocode'
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | **/.gradle
2 | **/local.properties
3 | **/.idea
4 | .DS_Store
5 | **/build
6 | **/captures
7 | **/*.iml
8 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tanapruk/ReverseGeocodeCountry/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/reversegeocode/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ReverseGeocode
3 |
4 |
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tanapruk/ReverseGeocodeCountry/HEAD/demo/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tanapruk/ReverseGeocodeCountry/HEAD/demo/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tanapruk/ReverseGeocodeCountry/HEAD/demo/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tanapruk/ReverseGeocodeCountry/HEAD/demo/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 48dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Jun 29 13:57:15 ICT 2016
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
7 |
--------------------------------------------------------------------------------
/reversegeocode/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/demo/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/demo/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/demo/src/androidTest/java/com/tanapruk/reversegeocodedemo/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.tanapruk.reversegeocodedemo;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/reversegeocode/src/main/java/com/tanapruk/reversegeocode/Polygon/Point.java:
--------------------------------------------------------------------------------
1 | package com.tanapruk.reversegeocode.Polygon;
2 | /**
3 | * Point on 2D landscape
4 | *
5 | * @author Roman Kushnarenko (sromku@gmail.com)
6 | */
7 | public class Point
8 | {
9 | public Point(float x, float y)
10 | {
11 | this.x = x;
12 | this.y = y;
13 | }
14 |
15 | public float x;
16 | public float y;
17 |
18 | @Override
19 | public String toString()
20 | {
21 | return String.format("(%.2f,%.2f)", x, y);
22 | }
23 | }
--------------------------------------------------------------------------------
/reversegeocode/src/test/java/com/tanapruk/reversegeocode/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.tanapruk.reversegeocode;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/demo/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Reverse Geocode Country
3 |
4 |
5 | Settings
6 | Input Your Latitude and Longitude
7 | Latitude:
8 | Longitude:
9 | 000.000000
10 | Find
11 | Result
12 | Country ID:
13 | Country Name:
14 |
15 |
16 |
--------------------------------------------------------------------------------
/demo/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/trusttanapruk/Documents/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/demo/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion '23.0.3'
6 |
7 | defaultConfig {
8 | applicationId "com.tanapruk.reversegeocodecountry"
9 | minSdkVersion 15
10 | targetSdkVersion 24
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(include: ['*.jar'], dir: 'libs')
24 | compile 'com.android.support:appcompat-v7:24.0.0'
25 | compile project(path: ':reversegeocode')
26 | }
27 |
--------------------------------------------------------------------------------
/reversegeocode/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/trusttanapruk/Documents/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/demo/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/reversegeocode/src/androidTest/java/com/tanapruk/reversegeocode/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.tanapruk.reversegeocode;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.tanap.reversegeocode.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/demo/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
14 |
15 |
20 |
21 |
25 |
26 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/reversegeocode/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "23.0.3"
6 |
7 | defaultConfig {
8 | minSdkVersion 14
9 | targetSdkVersion 24
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 |
15 | }
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 | }
23 |
24 | dependencies {
25 | compile fileTree(dir: 'libs', include: ['*.jar'])
26 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
27 | exclude group: 'com.android.support', module: 'support-annotations'
28 | })
29 | compile 'com.android.support:appcompat-v7:24.0.0'
30 | compile 'com.google.code.gson:gson:2.4'
31 | testCompile 'junit:junit:4.12'
32 | }
33 |
--------------------------------------------------------------------------------
/reversegeocode/src/main/java/com/tanapruk/reversegeocode/GeocodeListBuilder.java:
--------------------------------------------------------------------------------
1 | package com.tanapruk.reversegeocode;
2 |
3 | import android.content.Context;
4 |
5 | import com.google.gson.Gson;
6 |
7 | import java.io.IOException;
8 | import java.io.InputStream;
9 |
10 | /**
11 | * Created by Tanapruk on 8/11/15 AD.
12 | */
13 | public class GeocodeListBuilder {
14 |
15 | final static private String filepath = "ReverseGeocodeCountryWithName.json";
16 |
17 | public static String getCountryName(Context context , Double latitude, Double longitude) {
18 | return getGeocodeListFromJSON(context).getCountryName(latitude,longitude);
19 | }
20 |
21 | public static String getCountryId(Context context, Double latitude, Double longitude) {
22 | return getGeocodeList(context).getCountryId(latitude,longitude);
23 | }
24 |
25 | private static GeocodeList getGeocodeList(Context context) {
26 | return getGeocodeListFromJSON(context);
27 | }
28 |
29 | private static GeocodeList getGeocodeListFromJSON(Context context) {
30 | String jsonString = getJSONFromAsset(context);
31 | Gson gson = new Gson();
32 | return gson.fromJson(jsonString, GeocodeList.class);
33 | }
34 |
35 | private static String getJSONFromAsset(Context context) {
36 | String json = null;
37 | try {
38 | InputStream is = context.getAssets().open(filepath);
39 | int size = is.available();
40 | byte[] buffer = new byte[size];
41 | is.read(buffer);
42 | is.close();
43 | json = new String(buffer, "UTF-8");
44 | } catch (IOException ex) {
45 | ex.printStackTrace();
46 | return null;
47 | }
48 | return json;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/demo/src/main/java/com/tanapruk/reversegeocodedemo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.tanapruk.reversegeocodedemo;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.view.View;
7 | import android.widget.Button;
8 | import android.widget.EditText;
9 | import android.widget.TextView;
10 | import android.widget.Toast;
11 |
12 | import com.tanapruk.reversegeocode.GeocodeListBuilder;
13 |
14 | public class MainActivity extends AppCompatActivity {
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_main);
20 |
21 |
22 | Button btnFind = (Button) findViewById(R.id.btn_find_country);
23 | btnFind.setOnClickListener(new View.OnClickListener() {
24 | @Override
25 | public void onClick(View v) {
26 |
27 | EditText editLatitude = (EditText) findViewById(R.id.edit_latitude);
28 | EditText editLongitude = (EditText) findViewById(R.id.edit_longitude);
29 | TextView textCountryId = (TextView) findViewById(R.id.text_country_id);
30 | TextView textCountryName = (TextView) findViewById(R.id.text_country_name);
31 | Context context = getApplicationContext();
32 |
33 | Double latitude = Double.valueOf(editLatitude.getText().toString());
34 | Double longitude = Double.valueOf(editLongitude.getText().toString());
35 |
36 |
37 | String countryId = GeocodeListBuilder.getCountryId(context, latitude, longitude);
38 | String countryName = GeocodeListBuilder.getCountryName(context, latitude, longitude);
39 |
40 |
41 | textCountryId.setText(countryId);
42 | textCountryName.setText(countryName);
43 |
44 | Toast.makeText(context, "ID: " + countryId + " " + " Name: " + countryName, Toast.LENGTH_SHORT).show();
45 |
46 | }
47 | });
48 | }
49 |
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Android Offline Reverse Geocode Country
2 |
3 | A module for getting a country name and country code when given a specific latitude and longitude. It works offline. No need for an Internet connection.
4 |
5 |
6 | ## Usage
7 | ##### Copy the following files to your project:
8 | 1. Polygon folder
9 | 1. Line
10 | 2. Point
11 | 3. Polygon
12 | 2. GeocoderList.java
13 | 3. GeocoderListBuilder.java
14 | 4. ReverseGeocodeCountryWithName.json (in assets folder)
15 |
16 | The code is simplified to one line.
17 | ```
18 | String countryId = GeocodeListBuilder.getCountryId(context, latitude, longitude);
19 | String countryName = GeocodeListBuilder.getCountryName(context, latitude, longitude);
20 |
21 | ```
22 |
23 | ## Sample App
24 |
25 |
26 | [Reverse Geocode Country on Play Store](https://play.google.com/store/apps/details?id=com.tanapruk.reversegeocodecountry)
27 |
28 | ## Attribution
29 | The code here are combine from:
30 |
31 |
32 | 1. [ios-offline-reverse-geocode-country](https://github.com/krisrak/ios-offline-reverse-geocode-country)
33 | I modified the JSON file so that it is easier to deserialization in android.
34 |
35 | 2. [polygon-contains-point](https://github.com/sromku/polygon-contains-point)
36 | This module helps locate a given latitude and longitude whether it is in a polygon of a given country.
37 |
38 | ## License
39 | The MIT License (MIT)
40 |
41 | Copyright (c) 2015 Tanapruk Tangphianphan
42 | ```
43 | Permission is hereby granted, free of charge, to any person obtaining a copy
44 | of this software and associated documentation files (the "Software"), to deal
45 | in the Software without restriction, including without limitation the rights
46 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
47 | copies of the Software, and to permit persons to whom the Software is
48 | furnished to do so, subject to the following conditions:
49 |
50 | The above copyright notice and this permission notice shall be included in all
51 | copies or substantial portions of the Software.
52 |
53 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
54 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
55 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
56 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
57 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
58 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
59 | SOFTWARE.
60 | ```
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/reversegeocode/src/main/java/com/tanapruk/reversegeocode/Polygon/Line.java:
--------------------------------------------------------------------------------
1 | package com.tanapruk.reversegeocode.Polygon;
2 |
3 | /**
4 | * Line is defined by starting point and ending point on 2D dimension.
5 | *
6 | * @author Roman Kushnarenko (sromku@gmail.com)
7 | */
8 | public class Line
9 | {
10 | private final Point _start;
11 | private final Point _end;
12 | private float _a = Float.NaN;
13 | private float _b = Float.NaN;
14 | private boolean _vertical = false;
15 |
16 | public Line(Point start, Point end)
17 | {
18 | _start = start;
19 | _end = end;
20 |
21 | if (_end.x - _start.x != 0)
22 | {
23 | _a = ((_end.y - _start.y) / (_end.x - _start.x));
24 | _b = _start.y - _a * _start.x;
25 | }
26 |
27 | else
28 | {
29 | _vertical = true;
30 | }
31 | }
32 |
33 | /**
34 | * Indicate whereas the point lays on the line.
35 | *
36 | * @param point
37 | * - The point to check
38 | * @return True if the point lays on the line, otherwise return False
39 | */
40 | public boolean isInside(Point point)
41 | {
42 | float maxX = _start.x > _end.x ? _start.x : _end.x;
43 | float minX = _start.x < _end.x ? _start.x : _end.x;
44 | float maxY = _start.y > _end.y ? _start.y : _end.y;
45 | float minY = _start.y < _end.y ? _start.y : _end.y;
46 |
47 | if ((point.x >= minX && point.x <= maxX) && (point.y >= minY && point.y <= maxY))
48 | {
49 | return true;
50 | }
51 | return false;
52 | }
53 |
54 | /**
55 | * Indicate whereas the line is vertical.
56 | * For example, line like x=1 is vertical, in other words parallel to axis Y.
57 | * In this case the A is (+/-)infinite.
58 | *
59 | * @return True if the line is vertical, otherwise return False
60 | */
61 | public boolean isVertical()
62 | {
63 | return _vertical;
64 | }
65 |
66 | /**
67 | * y = Ax + B
68 | *
69 | * @return The A
70 | */
71 | public float getA()
72 | {
73 | return _a;
74 | }
75 |
76 | /**
77 | * y = Ax + B
78 | *
79 | * @return The B
80 | */
81 | public float getB()
82 | {
83 | return _b;
84 | }
85 |
86 | /**
87 | * Get start point
88 | *
89 | * @return The start point
90 | */
91 | public Point getStart()
92 | {
93 | return _start;
94 | }
95 |
96 | /**
97 | * Get end point
98 | *
99 | * @return The end point
100 | */
101 | public Point getEnd()
102 | {
103 | return _end;
104 | }
105 |
106 | @Override
107 | public String toString()
108 | {
109 | return String.format("%s-%s", _start.toString(), _end.toString());
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/demo/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
21 |
25 |
26 |
33 |
43 |
44 |
45 |
49 |
50 |
57 |
67 |
68 |
69 |
70 |
71 |
78 |
79 |
84 |
85 |
94 |
95 |
96 |
100 |
101 |
108 |
115 |
116 |
117 |
118 |
119 |
123 |
124 |
131 |
138 |
139 |
140 |
141 |
142 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn ( ) {
37 | echo "$*"
38 | }
39 |
40 | die ( ) {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/reversegeocode/src/main/java/com/tanapruk/reversegeocode/GeocodeList.java:
--------------------------------------------------------------------------------
1 | package com.tanapruk.reversegeocode;
2 |
3 | import android.util.Log;
4 | import com.google.gson.annotations.SerializedName;
5 | import com.tanapruk.reversegeocode.Polygon.Point;
6 | import com.tanapruk.reversegeocode.Polygon.Polygon;
7 | import java.util.List;
8 |
9 | /**
10 | * Created by Tanapruk on 8/7/2015.
11 | */
12 | public class GeocodeList {
13 |
14 |
15 | @SerializedName("geocodelist")
16 | private List geocodeList;
17 |
18 |
19 | private List getGeocodeList() {
20 | return geocodeList;
21 | }
22 |
23 | private int getIndexFromCountryName(String countryName) {
24 | int index = 0;
25 | for (int i = 0; i < getGeocodeList().size(); i++) {
26 | if (getGeocodeList().get(i).getName().equals(countryName)) {
27 | index = i;
28 | break;
29 | }
30 | }
31 |
32 | return index;
33 | }
34 |
35 | private void setGeocodeList(List geocodeList) {
36 | this.geocodeList = geocodeList;
37 | }
38 |
39 | public String getCountryName(double latitude, double longitude) {
40 | return getGeocode(latitude, longitude).getName();
41 | }
42 | public String getCountryId(double latitude, double longitude) {
43 | return getGeocode(latitude, longitude).getId();
44 | }
45 |
46 | Geocode getGeocode(double latitude, double longitude) {
47 | Point currentPoint = new Point((float) latitude, (float) longitude);
48 | for (int i = 0; i < geocodeList.size(); i++) {
49 | Geocode geocode = geocodeList.get(i);
50 | List polygonSetList = geocode.getPolygonSetList();
51 | for (int j = 0; j < polygonSetList.size(); j++) {
52 | PolygonSet polygonSet = polygonSetList.get(j);
53 | List polygonList = polygonSet.getPolygonList();
54 | Polygon.Builder polygonBuilder = new Polygon.Builder();
55 | for (int k = 0; k < polygonList.size(); k++) {
56 | LocationPoint locationPoint = polygonList.get(k);
57 | polygonBuilder.addVertex(new Point((float) locationPoint.getLatitude(), (float) locationPoint.getLongitude()));
58 | }
59 | Polygon polygon = polygonBuilder.build();
60 | if (polygon.contains(currentPoint)) {
61 | return geocode;
62 | }
63 | }
64 | }
65 | Log.e("Check", "Your latitude and longitude doesn't match anywhere on earth.");
66 | Geocode geocode = new Geocode();
67 | geocode.setId("No match found.");
68 | geocode.setName("No match found");
69 | return geocode;
70 | }
71 |
72 | private class Geocode {
73 | String id;
74 | String name;
75 | Geometry geometry;
76 |
77 | private String getId() {
78 | return id;
79 | }
80 |
81 | private void setId(String id) {
82 | this.id = id;
83 | }
84 |
85 | private String getName() {
86 | return name;
87 | }
88 |
89 | private void setName(String name) {
90 | this.name = name;
91 | }
92 |
93 | private Geometry getGeometry() {
94 | return geometry;
95 | }
96 |
97 | private void setGeometry(Geometry geometry) {
98 | this.geometry = geometry;
99 | }
100 |
101 | private String getType() {
102 | return geometry.getType();
103 | }
104 |
105 | private Coordinates getCoordinates() {
106 | return geometry.getCoordinates();
107 | }
108 |
109 | private boolean isMultiPolygon() {
110 | return (geometry.getType().equals("MultiPolygon"));
111 | }
112 |
113 | private List getPolygonSetList() {
114 | return geometry.getCoordinates().getPolygonsetList();
115 | }
116 | }
117 |
118 | private class Geometry {
119 |
120 | String type;
121 | Coordinates coordinates;
122 |
123 | private String getType() {
124 | return type;
125 | }
126 |
127 | private void setType(String type) {
128 | this.type = type;
129 | }
130 |
131 | private Coordinates getCoordinates() {
132 | return coordinates;
133 | }
134 |
135 | private void setCoordinates(Coordinates coordinates) {
136 | this.coordinates = coordinates;
137 | }
138 | }
139 |
140 |
141 | private class Coordinates {
142 |
143 | @SerializedName("polygonset")
144 | List polygonSetList;
145 |
146 | public List getPolygonsetList() {
147 | return polygonSetList;
148 | }
149 |
150 | public void setPolygonsetList(List polygonSetList) {
151 | this.polygonSetList = polygonSetList;
152 | }
153 | }
154 |
155 |
156 | private class PolygonSet {
157 | @SerializedName("polygon")
158 | List polygonList;
159 |
160 | private List getPolygonList() {
161 | return polygonList;
162 | }
163 |
164 | private void setPolygonList(List polygonList) {
165 | this.polygonList = polygonList;
166 | }
167 | }
168 |
169 | private class LocationPoint {
170 |
171 | double latitude;
172 | double longitude;
173 |
174 | public LocationPoint(double latitude, double longitude) {
175 | this.latitude = latitude;
176 | this.longitude = longitude;
177 | }
178 |
179 | public double getLatitude() {
180 | return latitude;
181 | }
182 |
183 | public void setLatitude(double latitude) {
184 | this.latitude = latitude;
185 | }
186 |
187 | public double getLongitude() {
188 | return longitude;
189 | }
190 |
191 | public void setLongitude(double longitude) {
192 | this.longitude = longitude;
193 | }
194 | }
195 |
196 |
197 | }
198 |
--------------------------------------------------------------------------------
/reversegeocode/src/main/java/com/tanapruk/reversegeocode/Polygon/Polygon.java:
--------------------------------------------------------------------------------
1 | package com.tanapruk.reversegeocode.Polygon;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | /**
7 | * The 2D polygon.
8 | *
9 | * @see {@link Builder}
10 | * @author Roman Kushnarenko (sromku@gmail.com)
11 | */
12 | public class Polygon
13 | {
14 | private final BoundingBox _boundingBox;
15 | private final List _sides;
16 |
17 | private Polygon(List sides, BoundingBox boundingBox)
18 | {
19 | _sides = sides;
20 | _boundingBox = boundingBox;
21 | }
22 |
23 | /**
24 | * Get the builder of the polygon
25 | *
26 | * @return The builder
27 | */
28 | public static Builder Builder()
29 | {
30 | return new Builder();
31 | }
32 |
33 | /**
34 | * Builder of the polygon
35 | *
36 | * @author Roman Kushnarenko (sromku@gmail.com)
37 | */
38 | public static class Builder
39 | {
40 | private List _vertexes = new ArrayList();
41 | private List _sides = new ArrayList();
42 | private BoundingBox _boundingBox = null;
43 |
44 | private boolean _firstPoint = true;
45 | private boolean _isClosed = false;
46 |
47 | /**
48 | * Add vertex points of the polygon.
49 | * It is very important to add the vertexes by order, like you were drawing them one by one.
50 | *
51 | * @param point
52 | * The vertex point
53 | * @return The builder
54 | */
55 | public Builder addVertex(Point point)
56 | {
57 | if (_isClosed)
58 | {
59 | // each hole we start with the new array of vertex points
60 | _vertexes = new ArrayList();
61 | _isClosed = false;
62 | }
63 |
64 | updateBoundingBox(point);
65 | _vertexes.add(point);
66 |
67 | // add line (edge) to the polygon
68 | if (_vertexes.size() > 1)
69 | {
70 | Line Line = new Line(_vertexes.get(_vertexes.size() - 2), point);
71 | _sides.add(Line);
72 | }
73 |
74 | return this;
75 | }
76 |
77 | /**
78 | * Close the polygon shape. This will create a new side (edge) from the last vertex point to the first vertex point.
79 | *
80 | * @return The builder
81 | */
82 | public Builder close()
83 | {
84 | validate();
85 |
86 | // add last Line
87 | _sides.add(new Line(_vertexes.get(_vertexes.size() - 1), _vertexes.get(0)));
88 | _isClosed = true;
89 |
90 | return this;
91 | }
92 |
93 | /**
94 | * Build the instance of the polygon shape.
95 | *
96 | * @return The polygon
97 | */
98 | public Polygon build()
99 | {
100 | validate();
101 |
102 | // in case you forgot to close
103 | if (!_isClosed)
104 | {
105 | // add last Line
106 | _sides.add(new Line(_vertexes.get(_vertexes.size() - 1), _vertexes.get(0)));
107 | }
108 |
109 | Polygon polygon = new Polygon(_sides, _boundingBox);
110 | return polygon;
111 | }
112 |
113 | /**
114 | * Update bounding box with a new point.
115 | *
116 | * @param point
117 | * New point
118 | */
119 | private void updateBoundingBox(Point point)
120 | {
121 | if (_firstPoint)
122 | {
123 | _boundingBox = new BoundingBox();
124 | _boundingBox.xMax = point.x;
125 | _boundingBox.xMin = point.x;
126 | _boundingBox.yMax = point.y;
127 | _boundingBox.yMin = point.y;
128 |
129 | _firstPoint = false;
130 | }
131 | else
132 | {
133 | // set bounding box
134 | if (point.x > _boundingBox.xMax)
135 | {
136 | _boundingBox.xMax = point.x;
137 | }
138 | else if (point.x < _boundingBox.xMin)
139 | {
140 | _boundingBox.xMin = point.x;
141 | }
142 | if (point.y > _boundingBox.yMax)
143 | {
144 | _boundingBox.yMax = point.y;
145 | }
146 | else if (point.y < _boundingBox.yMin)
147 | {
148 | _boundingBox.yMin = point.y;
149 | }
150 | }
151 | }
152 |
153 | private void validate()
154 | {
155 | if (_vertexes.size() < 3)
156 | {
157 | throw new RuntimeException("Polygon must have at least 3 points");
158 | }
159 | }
160 | }
161 |
162 | /**
163 | * Check if the the given point is inside of the polygon.
164 | *
165 | * @param point
166 | * The point to check
167 | * @return True if the point is inside the polygon, otherwise return False
168 | */
169 | public boolean contains(Point point)
170 | {
171 | if (inBoundingBox(point))
172 | {
173 | Line ray = createRay(point);
174 | int intersection = 0;
175 | for (Line side : _sides)
176 | {
177 | if (intersect(ray, side))
178 | {
179 | // System.out.println("intersection++");
180 | intersection++;
181 | }
182 | }
183 |
184 | /*
185 | * If the number of intersections is odd, then the point is inside the polygon
186 | */
187 | if (intersection % 2 == 1)
188 | {
189 | return true;
190 | }
191 | }
192 | return false;
193 | }
194 |
195 | public List getSides()
196 | {
197 | return _sides;
198 | }
199 |
200 | /**
201 | * By given ray and one side of the polygon, check if both lines intersect.
202 | *
203 | * @param ray
204 | * @param side
205 | * @return True if both lines intersect, otherwise return False
206 | */
207 | private boolean intersect(Line ray, Line side)
208 | {
209 | Point intersectPoint = null;
210 |
211 | // if both vectors aren't from the kind of x=1 lines then go into
212 | if (!ray.isVertical() && !side.isVertical())
213 | {
214 | // check if both vectors are parallel. If they are parallel then no intersection point will exist
215 | if (ray.getA() - side.getA() == 0)
216 | {
217 | return false;
218 | }
219 |
220 | float x = ((side.getB() - ray.getB()) / (ray.getA() - side.getA())); // x = (b2-b1)/(a1-a2)
221 | float y = side.getA() * x + side.getB(); // y = a2*x+b2
222 | intersectPoint = new Point(x, y);
223 | }
224 |
225 | else if (ray.isVertical() && !side.isVertical())
226 | {
227 | float x = ray.getStart().x;
228 | float y = side.getA() * x + side.getB();
229 | intersectPoint = new Point(x, y);
230 | }
231 |
232 | else if (!ray.isVertical() && side.isVertical())
233 | {
234 | float x = side.getStart().x;
235 | float y = ray.getA() * x + ray.getB();
236 | intersectPoint = new Point(x, y);
237 | }
238 |
239 | else
240 | {
241 | return false;
242 | }
243 |
244 | // System.out.println("Ray: " + ray.toString() + " ,Side: " + side);
245 | // System.out.println("Intersect point: " + intersectPoint.toString());
246 |
247 | if (side.isInside(intersectPoint) && ray.isInside(intersectPoint))
248 | {
249 | return true;
250 | }
251 |
252 | return false;
253 | }
254 |
255 | /**
256 | * Create a ray. The ray will be created by given point and on point outside of the polygon.
257 | * The outside point is calculated automatically.
258 | *
259 | * @param point
260 | * @return
261 | */
262 | private Line createRay(Point point)
263 | {
264 | // create outside point
265 | float epsilon = (_boundingBox.xMax - _boundingBox.xMin) / 100f;
266 | Point outsidePoint = new Point(_boundingBox.xMin - epsilon, _boundingBox.yMin);
267 |
268 | Line vector = new Line(outsidePoint, point);
269 | return vector;
270 | }
271 |
272 | /**
273 | * Check if the given point is in bounding box
274 | *
275 | * @param point
276 | * @return True if the point in bounding box, otherwise return False
277 | */
278 | private boolean inBoundingBox(Point point)
279 | {
280 | if (point.x < _boundingBox.xMin || point.x > _boundingBox.xMax || point.y < _boundingBox.yMin || point.y > _boundingBox.yMax)
281 | {
282 | return false;
283 | }
284 | return true;
285 | }
286 |
287 | private static class BoundingBox
288 | {
289 | public float xMax = Float.NEGATIVE_INFINITY;
290 | public float xMin = Float.NEGATIVE_INFINITY;
291 | public float yMax = Float.NEGATIVE_INFINITY;
292 | public float yMin = Float.NEGATIVE_INFINITY;
293 | }
294 | }
295 |
--------------------------------------------------------------------------------