Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
InstiApp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
RAHUL SHARMA
InstiApp
Commits
895fefc6
Commit
895fefc6
authored
Jul 15, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move map weights to constants
parent
290e2426
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
app/src/main/java/app/insti/Constants.java
app/src/main/java/app/insti/Constants.java
+5
-0
app/src/main/java/app/insti/fragment/MapFragment.java
app/src/main/java/app/insti/fragment/MapFragment.java
+6
-8
No files found.
app/src/main/java/app/insti/Constants.java
View file @
895fefc6
...
...
@@ -24,4 +24,9 @@ public class Constants {
public
static
final
String
BODY_LIST_JSON
=
"body_list_json"
;
public
static
final
String
LOGIN_MESSAGE
=
"Please login to continue!"
;
/* Map */
public
static
final
double
MAP_Xn
=
19.134417
,
MAP_Yn
=
72.901229
,
MAP_Zn
=
1757
,
MAP_Zyn
=
501
;
public
static
final
double
[]
MAP_WEIGHTS_X
=
{-
3.169666704720932
,
-
49.718259508124866
,
73.63847451738897
,
-
37.61187280930967
,
6.243068985662827
,
-
0.27454570486652585
,
5.479168324310082
,
-
2.0423035752734497
,
44.1757221052438
};
public
static
final
double
[]
MAP_WEIGHTS_Y
=
{
0.010619520345247447
,
-
14.46472789089445
,
61.00432524817795
,
12.593699865482979
,
-
1.3923808471860513
,
0.05646175191919056
,
0.3826096686410426
,
0.07802615132849677
,
-
10.35622400664665
};
}
app/src/main/java/app/insti/fragment/MapFragment.java
View file @
895fefc6
...
...
@@ -81,6 +81,7 @@ import java.util.List;
import
java.util.Locale
;
import
java.util.regex.Pattern
;
import
app.insti.Constants
;
import
app.insti.MainActivity
;
import
app.insti.R
;
import
app.insti.api.RetrofitInterface
;
...
...
@@ -205,6 +206,7 @@ public class MapFragment extends Fragment implements TextWatcher,
}
void
setupWithData
(
List
<
Venue
>
venues
)
{
if
(
getView
()
==
null
||
getActivity
()
==
null
)
return
;
Locations
mLocations
=
new
Locations
(
venues
);
data
=
mLocations
.
data
;
markerlist
=
new
ArrayList
<
com
.
mrane
.
data
.
Marker
>(
data
.
values
());
...
...
@@ -1059,6 +1061,7 @@ public class MapFragment extends Fragment implements TextWatcher,
}
public
void
setupGPS
()
{
if
(
getView
()
==
null
||
getActivity
()
==
null
)
return
;
// Permissions stuff
if
(
ContextCompat
.
checkSelfPermission
(
getActivity
(),
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
...
...
@@ -1089,22 +1092,17 @@ public class MapFragment extends Fragment implements TextWatcher,
public
void
onLocationChanged
(
Location
loc
)
{
if
(
getView
()
==
null
||
getActivity
()
==
null
)
return
;
Toast
.
makeText
(
getActivity
().
getBaseContext
(),
"Location changed: Lat: "
+
loc
.
getLatitude
()
+
" Lng: "
+
loc
.
getLongitude
(),
Toast
.
LENGTH_SHORT
);
// Set the origin
double
Xn
=
19.134417
,
Yn
=
72.901229
,
Zn
=
1757
,
Zyn
=
501
;
double
Xn
=
Constants
.
MAP_Xn
,
Yn
=
Constants
.
MAP_Yn
,
Zn
=
Constants
.
MAP_Zn
,
Zyn
=
Constants
.
MAP_Zyn
;
double
x
=
(
loc
.
getLatitude
()
-
Xn
)
*
1000
;
double
y
=
(
loc
.
getLongitude
()
-
Yn
)
*
1000
;
// Pre-trained weights
double
[]
A
=
{-
3.169666704720932
,
-
49.718259508124866
,
73.63847451738897
,
-
37.61187280930967
,
6.243068985662827
,
-
0.27454570486652585
,
5.479168324310082
,
-
2.0423035752734497
,
44.1757221052438
}
;
double
[]
A
=
Constants
.
MAP_WEIGHTS_X
;
int
px
=
(
int
)(
Zn
+
A
[
0
]
+
A
[
1
]*
x
+
A
[
2
]*
y
+
A
[
3
]*
x
*
x
+
A
[
4
]*
x
*
x
*
y
+
A
[
5
]*
x
*
x
*
y
*
y
+
A
[
6
]*
y
*
y
+
A
[
7
]*
x
*
y
*
y
+
A
[
8
]*
x
*
y
);
A
=
new
double
[]
{
0.010619520345247447
,
-
14.46472789089445
,
61.00432524817795
,
12.593699865482979
,
-
1.3923808471860513
,
0.05646175191919056
,
0.3826096686410426
,
0.07802615132849677
,
-
10.35622400664665
}
;
A
=
Constants
.
MAP_WEIGHTS_Y
;
int
py
=
(
int
)(
Zyn
+
A
[
0
]
+
A
[
1
]*
x
+
A
[
2
]*
y
+
A
[
3
]*
x
*
x
+
A
[
4
]*
x
*
x
*
y
+
A
[
5
]*
x
*
x
*
y
*
y
+
A
[
6
]*
y
*
y
+
A
[
7
]*
x
*
y
*
y
+
A
[
8
]*
x
*
y
);
if
(
px
>
0
&&
py
>
0
&&
px
<
5430
&&
py
<
5375
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment