Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_fiveworld
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_fiveworld
Commits
2ebe1a42
Commit
2ebe1a42
authored
Jul 12, 2021
by
fengruiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定位功能完成
vr全景功能已完成80%
parent
48a74b8d
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
474 additions
and
49 deletions
+474
-49
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-0
AppApplication.kt
app/src/main/java/com/mints/street/AppApplication.kt
+19
-0
GridMapAdapter.kt
app/src/main/java/com/mints/street/adapter/GridMapAdapter.kt
+8
-1
HomeFragment.kt
app/src/main/java/com/mints/street/main/home/HomeFragment.kt
+181
-45
PanoramicActivity.kt
...c/main/java/com/mints/street/main/vr/PanoramicActivity.kt
+225
-0
PanoramicViewModel.kt
.../main/java/com/mints/street/main/vr/PanoramicViewModel.kt
+10
-0
activity_aboutus.xml
app/src/main/res/layout/activity_aboutus.xml
+1
-1
activity_moresettings.xml
app/src/main/res/layout/activity_moresettings.xml
+1
-1
activity_panoramic.xml
app/src/main/res/layout/activity_panoramic.xml
+27
-0
activity_permissions.xml
app/src/main/res/layout/activity_permissions.xml
+1
-1
No files found.
app/src/main/AndroidManifest.xml
View file @
2ebe1a42
...
...
@@ -172,6 +172,7 @@
android:exported=
"false"
android:screenOrientation=
"behind"
android:windowSoftInputMode=
"adjustResize|stateHidden"
/>
<activity
android:name=
".main.vr.PanoramicActivity"
/>
</application>
</manifest>
\ No newline at end of file
app/src/main/java/com/mints/street/AppApplication.kt
View file @
2ebe1a42
package
com.mints.street
import
android.content.Context
import
android.os.StrictMode
import
android.os.StrictMode.VmPolicy
import
android.util.Log
import
android.widget.Toast
import
com.baidu.lbsapi.BMapManager
import
com.baidu.mapapi.CoordType
import
com.baidu.mapapi.SDKInitializer
import
com.cuieney.rxpay_annotation.WX
import
com.fry.base.base.BaseApp
import
com.mints.street.main.vr.PanoramicActivity
import
com.mints.street.manager.CsjGroMoreManager
import
com.mints.street.manager.UmengManager
import
me.goldze.mvvmhabit.utils.KLog
import
java.util.concurrent.TimeoutException
/**
...
...
@@ -54,10 +59,24 @@ class AppApplication : BaseApp() {
//自4.3.0起,百度地图SDK所有接口均支持百度坐标和国测局坐标,用此方法设置您使用的坐标类型.
//包括BD09LL和GCJ02两种坐标,默认是BD09LL坐标。
SDKInitializer
.
setCoordType
(
CoordType
.
BD09LL
)
//百度全景
initEngineManager
(
this
)
}
/**
* 初始化百度全景
*/
private
fun
initEngineManager
(
context
:
Context
)
{
if
(
mBMapManager
==
null
)
{
mBMapManager
=
BMapManager
(
context
)
}
if
(
mBMapManager
?.
init
(
PanoramicActivity
.
MyGeneralListener
())==
false
)
{
KLog
.
e
(
"BMapManager"
,
"BMapManager 初始化错误!"
)
}
}
companion
object
{
var
mContext
:
AppApplication
?
=
null
var
mBMapManager
:
BMapManager
?
=
null
fun
getContext
():
AppApplication
?
{
return
mContext
...
...
app/src/main/java/com/mints/street/adapter/GridMapAdapter.kt
View file @
2ebe1a42
...
...
@@ -8,7 +8,9 @@ import com.fry.base.adapter.BindingViewHolder
import
com.fry.base.binding.setMargin
import
com.mints.street.R
import
com.mints.street.databinding.ItemGridMapAdapterBinding
import
com.mints.street.main.vr.PanoramicActivity
import
me.goldze.mvvmhabit.utils.AppUtils
import
me.goldze.mvvmhabit.utils.RxUtils
/**
* Created by 冯瑞雨 on 2021/7/9.
...
...
@@ -18,12 +20,17 @@ class GridMapAdapter(val context: Context,val list :List<String>):AbstractVLayo
holder
:
BindingViewHolder
<
ItemGridMapAdapterBinding
>,
position
:
Int
)
{
var
a
=
holder
.
binding
.
bg
.
layoutParams
var
a
=
holder
.
binding
.
bg
.
layoutParams
if
(
position
%
2
==
0
){
holder
.
binding
.
bg
.
setMargin
(
AppUtils
.
dp2Px
(
context
,
10F
),
AppUtils
.
dp2Px
(
context
,
10F
),
AppUtils
.
dp2Px
(
context
,
10F
),
0
,
null
,
null
,
null
)
}
else
{
holder
.
binding
.
bg
.
setMargin
(
0
,
AppUtils
.
dp2Px
(
context
,
10F
),
AppUtils
.
dp2Px
(
context
,
10F
),
0
,
null
,
null
,
null
)
}
RxUtils
.
onMultiClick
(
holder
.
binding
.
bg
){
PanoramicActivity
.
starPanoramicActivity
(
context
,
""
,
PanoramicActivity
.
WGS84
,
lat
=
39.906283536127169
,
lon
=
116.39129554889048
)
}
}
override
fun
getItemCount
()
=
list
.
size
...
...
app/src/main/java/com/mints/street/main/home/HomeFragment.kt
View file @
2ebe1a42
package
com.mints.street.main.home
import
android.content.Context.SENSOR_SERVICE
import
android.graphics.Color
import
android.hardware.Sensor
import
android.hardware.SensorEvent
import
android.hardware.SensorEventListener
import
android.hardware.SensorManager
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.TextView
import
com.baidu.location.BDLocation
import
com.baidu.location.BDLocationListener
import
com.baidu.location.LocationClient
import
com.baidu.location.LocationClientOption
import
com.baidu.mapapi.map.*
import
com.baidu.mapapi.model.LatLng
import
com.baidu.mapapi.search.core.RecommendStopInfo
import
com.baidu.mapapi.search.recommendstop.OnGetRecommendStopResultListener
import
com.baidu.mapapi.search.recommendstop.RecommendStopResult
import
com.baidu.mapapi.search.recommendstop.RecommendStopSearch
import
com.baidu.mapapi.search.recommendstop.RecommendStopSearchOption
import
com.fry.base.base.BaseFragment
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.databinding.FragmentHomeBinding
import
me.goldze.mvvmhabit.base.AppManager
import
me.goldze.mvvmhabit.utils.KLog
import
me.goldze.mvvmhabit.utils.RxUtils
...
...
@@ -24,7 +31,7 @@ import me.goldze.mvvmhabit.utils.RxUtils
* Created by 冯瑞雨 on 2021/7/2.
* 首页页面
*/
class
HomeFragment
:
BaseFragment
<
FragmentHomeBinding
,
HomeViewModel
>()
{
class
HomeFragment
:
BaseFragment
<
FragmentHomeBinding
,
HomeViewModel
>(),
SensorEventListener
{
private
var
mBaiduMap
:
BaiduMap
?
=
null
...
...
@@ -32,28 +39,54 @@ class HomeFragment:BaseFragment<FragmentHomeBinding,HomeViewModel>(){
private
var
mRecommendStopSearch
:
RecommendStopSearch
?
=
null
// 定位相关
private
var
mLocClient
:
LocationClient
?
=
null
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?)=
R
.
layout
.
fragment_home
// 定位图层显示方式
private
var
mCurrentMode
:
MyLocationConfiguration
.
LocationMode
?
=
null
private
var
mSensorManager
:
SensorManager
?
=
null
private
var
lastX
=
0.0
//// 此处设置开发者获取到的方向信息,顺时针0-360
private
var
mCurrentDirection
=
0
//纬度
private
var
mCurrentLat
=
0.0
//经度
private
var
mCurrentLon
=
0.00
//设置定位数据的精度信息,单位:米
private
var
mCurrentAccracy
=
0f
override
fun
initVariableId
()=
BR
.
viewModel
// 是否首次定位
private
var
isFirstLoc
=
true
private
var
myLocationData
:
MyLocationData
?
=
null
override
fun
initData
()
{
super
.
initData
()
initMap
()
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
)
=
R
.
layout
.
fragment_home
override
fun
initVariableId
()
=
BR
.
viewModel
override
fun
onActivityCreated
(
savedInstanceState
:
Bundle
?)
{
super
.
onActivityCreated
(
savedInstanceState
)
initMap
()
}
override
fun
initData
()
{
super
.
initData
()
viewModel
.
add
()
}
private
fun
initMap
(){
private
fun
initMap
()
{
mBaiduMap
=
binding
.
bmapView
.
map
mBaiduMap
?.
mapType
=
BaiduMap
.
MAP_TYPE_SATELLITE
binding
.
bmapView
.
showZoomControls
(
false
)
//设置是否显示缩放控件
//设置是否显示缩放控件
binding
.
bmapView
.
showZoomControls
(
false
)
// 构建地图状态
val
builder
=
MapStatus
.
Builder
()
// 默认 天安门
...
...
@@ -62,27 +95,31 @@ class HomeFragment:BaseFragment<FragmentHomeBinding,HomeViewModel>(){
val
zoom
=
11.0f
builder
.
target
(
center
).
zoom
(
zoom
)
val
mapStatusUpdate
=
MapStatusUpdateFactory
.
newMapStatus
(
builder
.
build
())
// 设置地图状态
mBaiduMap
?.
setMapStatus
(
mapStatusUpdate
)
mBaiduMap
?.
setOnMapStatusChangeListener
(
object
:
BaiduMap
.
OnMapStatusChangeListener
{
mBaiduMap
?.
setOnMapStatusChangeListener
(
object
:
BaiduMap
.
OnMapStatusChangeListener
{
override
fun
onMapStatusChangeStart
(
status
:
MapStatus
?)
{
KLog
.
a
(
"百度map"
,
"移动开始"
)
KLog
.
a
(
"百度map"
,
"移动开始"
)
}
override
fun
onMapStatusChangeStart
(
status
:
MapStatus
?,
reason
:
Int
)
{
KLog
.
a
(
"百度map"
,
"移动开始,两个参数"
)
KLog
.
a
(
"百度map"
,
"移动开始,两个参数"
)
}
override
fun
onMapStatusChange
(
status
:
MapStatus
?)
{
KLog
.
a
(
"百度map"
,
"移动改变"
)
KLog
.
a
(
"百度map"
,
"移动改变"
)
}
override
fun
onMapStatusChangeFinish
(
status
:
MapStatus
?)
{
KLog
.
a
(
"百度map"
,
"移动结束"
)
val
center
=
status
?.
target
mRecommendStopSearch
?.
requestRecommendStop
(
RecommendStopSearchOption
().
location
(
center
))
KLog
.
a
(
"百度map"
,
"移动结束"
)
mRecommendStopSearch
?.
requestRecommendStop
(
RecommendStopSearchOption
().
location
(
center
)
)
}
})
...
...
@@ -98,13 +135,55 @@ class HomeFragment:BaseFragment<FragmentHomeBinding,HomeViewModel>(){
mBaiduMap
?.
setMapStatus
(
MapStatusUpdateFactory
.
zoomOut
())
}
mRecommendStopSearch
=
RecommendStopSearch
.
newInstance
()
mRecommendStopSearch
?.
setOnGetRecommendStopResultListener
(
object
:
OnGetRecommendStopResultListener
{
override
fun
onGetRecommendStopResult
(
result
:
RecommendStopResult
?)
{
if
(
result
!=
null
)
{
addMarkerToMap
(
result
.
recommendStopInfoList
)
}
mRecommendStopSearch
?.
setOnGetRecommendStopResultListener
{
result
->
if
(
result
!=
null
)
{
addMarkerToMap
(
result
.
recommendStopInfoList
)
}
})
}
//重新回到定位点
RxUtils
.
onMultiClick
(
binding
.
imageLocationIcon
){
// 默认 天安门
val
center
=
LatLng
(
mCurrentLat
,
mCurrentLon
)
// 默认 11级
val
zoom
=
17.0f
builder
.
target
(
center
).
zoom
(
zoom
)
val
mapStatusUpdate
=
MapStatusUpdateFactory
.
newMapStatus
(
builder
.
build
())
// 设置地图状态
mBaiduMap
?.
setMapStatus
(
mapStatusUpdate
)
}
//定位初始化
initLocation
()
}
/**
* 定位初始化
*/
private
fun
initLocation
()
{
// 获取传感器管理服务
mSensorManager
=
AppManager
.
getAppManager
().
currentActivity
.
getSystemService
(
SENSOR_SERVICE
)
as
SensorManager
mCurrentMode
=
MyLocationConfiguration
.
LocationMode
.
NORMAL
// 为系统的方向传感器注册监听器
mSensorManager
?.
registerListener
(
this
,
mSensorManager
?.
getDefaultSensor
(
Sensor
.
TYPE_ORIENTATION
),
SensorManager
.
SENSOR_DELAY_UI
)
// 开启定位图层
mBaiduMap
?.
isMyLocationEnabled
=
true
// 定位初始化
mLocClient
=
LocationClient
(
context
)
mLocClient
?.
registerLocationListener
(
MyLocationListener
())
val
option
=
LocationClientOption
()
// 打开gps
option
.
isOpenGps
=
true
// 设置坐标类型
option
.
setCoorType
(
"bd09ll"
)
option
.
setScanSpan
(
1000
)
mLocClient
?.
locOption
=
option
mLocClient
?.
start
()
}
...
...
@@ -120,33 +199,90 @@ class HomeFragment:BaseFragment<FragmentHomeBinding,HomeViewModel>(){
override
fun
onDestroy
()
{
super
.
onDestroy
()
// 取消注册传感器监听
mSensorManager
?.
unregisterListener
(
this
)
// 退出时销毁定位
mLocClient
?.
stop
()
// 关闭定位图层
mBaiduMap
?.
isMyLocationEnabled
=
false
mRecommendStopSearch
?.
destroy
()
binding
.
bmapView
.
onDestroy
()
}
/**
* 推荐上车点添加到地图上
* @param stops 推荐上车点列表
*/
private
fun
addMarkerToMap
(
stops
:
List
<
RecommendStopInfo
?
>?)
{
stops
?.
apply
{
mBaiduMap
?.
clear
()
for
(
stop
in
this
)
{
stop
?.
apply
{
val
textView
=
TextView
(
context
)
textView
.
text
=
stop
.
name
textView
.
setBackgroundColor
(
Color
.
WHITE
)
val
infoWindow
=
InfoWindow
(
textView
,
stop
.
location
,
-
47
)
val
markerOptions
=
MarkerOptions
()
markerOptions
.
icon
(
mBitmapDescriptor
).
position
(
stop
.
location
).
scaleX
(
0.5f
).
scaleY
(
0.5f
)
.
infoWindow
(
infoWindow
)
mBaiduMap
!!
.
addOverlay
(
markerOptions
)
}
}
}
stops
?.
apply
{
mBaiduMap
?.
clear
()
for
(
stop
in
this
)
{
stop
?.
apply
{
val
textView
=
TextView
(
context
)
textView
.
text
=
stop
.
name
textView
.
setBackgroundColor
(
Color
.
WHITE
)
val
infoWindow
=
InfoWindow
(
textView
,
stop
.
location
,
-
47
)
val
markerOptions
=
MarkerOptions
()
markerOptions
.
icon
(
mBitmapDescriptor
).
position
(
stop
.
location
).
scaleX
(
0.5f
)
.
scaleY
(
0.5f
)
.
infoWindow
(
infoWindow
)
mBaiduMap
!!
.
addOverlay
(
markerOptions
)
}
}
}
}
/**
* 定位SDK监听函数
*/
inner
class
MyLocationListener
:
BDLocationListener
{
override
fun
onReceiveLocation
(
location
:
BDLocation
)
{
// MapView 销毁后不在处理新接收的位置
mBaiduMap
?.
apply
{
mCurrentLat
=
location
.
latitude
mCurrentLon
=
location
.
longitude
mCurrentAccracy
=
location
.
radius
myLocationData
=
MyLocationData
.
Builder
()
.
accuracy
(
location
.
radius
)
// 设置定位数据的精度信息,单位:米
.
direction
(
mCurrentDirection
.
toFloat
())
// 此处设置开发者获取到的方向信息,顺时针0-360
.
latitude
(
location
.
latitude
)
.
longitude
(
location
.
longitude
)
.
build
()
this
.
setMyLocationData
(
myLocationData
)
if
(
isFirstLoc
)
{
isFirstLoc
=
false
val
ll
=
LatLng
(
location
.
latitude
,
location
.
longitude
)
val
builder
=
MapStatus
.
Builder
()
builder
.
target
(
ll
).
zoom
(
18.0f
)
this
.
animateMapStatus
(
MapStatusUpdateFactory
.
newMapStatus
(
builder
.
build
()))
}
}
}
}
override
fun
onSensorChanged
(
sensorEvent
:
SensorEvent
?)
{
val
x
:
Double
=
sensorEvent
?.
values
?.
get
(
SensorManager
.
DATA_X
)
?.
toDouble
()
?:
0.0
if
(
kotlin
.
math
.
abs
(
x
-
lastX
)
>
1.0
)
{
mCurrentDirection
=
x
.
toInt
()
myLocationData
=
MyLocationData
.
Builder
()
.
accuracy
(
mCurrentAccracy
)
// 设置定位数据的精度信息,单位:米
.
direction
(
mCurrentDirection
.
toFloat
())
// 此处设置开发者获取到的方向信息,顺时针0-360
.
latitude
(
mCurrentLat
)
.
longitude
(
mCurrentLon
)
.
build
()
mBaiduMap
?.
setMyLocationData
(
myLocationData
)
}
lastX
=
x
}
override
fun
onAccuracyChanged
(
sensor
:
Sensor
?,
accuracy
:
Int
)
{
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/main/vr/PanoramicActivity.kt
0 → 100644
View file @
2ebe1a42
package
com.mints.street.main.vr
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
android.view.Window
import
com.baidu.lbsapi.BMapManager
import
com.baidu.lbsapi.MKGeneralListener
import
com.baidu.lbsapi.panoramaview.PanoramaView
import
com.baidu.lbsapi.panoramaview.PanoramaViewListener
import
com.fry.base.base.BaseActivity
import
com.mints.street.AppApplication
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.databinding.ActivityPanoramicBinding
import
me.goldze.mvvmhabit.base.AppManager
import
me.goldze.mvvmhabit.utils.KLog
/**
* Created by 冯瑞雨 on 2021/7/12.
* 全景页面
*/
class
PanoramicActivity
:
BaseActivity
<
ActivityPanoramicBinding
,
PanoramicViewModel
>()
{
companion
object
{
const
val
PID
=
0
// PID方式
const
val
GEO
=
1
// 经纬度方式
const
val
MERCATOR
=
2
// 墨卡托方式
const
val
UID_STREET
=
3
// UID方式展示外景
const
val
UID_INTERIOR
=
4
// UID方式展示内景
const
val
UID_STREET_CUSTOMALBUM
=
5
// UID方式展示外景(使用自定义相册)
const
val
MARKER
=
6
// 标注
const
val
OTHER
=
7
// 其他测试
const
val
COORDINATE_CONVERTER
=
8
// 坐标转换测试
const
val
WGS84
=
9
// 大地坐标系方式
const
val
GCJ02
=
10
// 国测局加密方式
fun
starPanoramicActivity
(
context
:
Context
,
name
:
String
,
type
:
Int
,
pid
:
String
?
=
null
,
lon
:
Double
?
=
null
,
lat
:
Double
?
=
null
)
{
val
intent
=
Intent
(
context
,
PanoramicActivity
::
class
.
java
)
intent
.
putExtra
(
"name"
,
name
)
intent
.
putExtra
(
"type"
,
type
)
intent
.
putExtra
(
"pid"
,
pid
)
intent
.
putExtra
(
"lon"
,
lon
)
intent
.
putExtra
(
"lat"
,
lat
)
context
.
startActivity
(
intent
)
}
}
internal
class
MyGeneralListener
:
MKGeneralListener
{
override
fun
onGetPermissionState
(
iError
:
Int
)
{
// 非零值表示key验证未通过
if
(
iError
!=
0
)
{
// 授权Key错误:
KLog
.
e
(
"BMapManager"
,
"请在AndoridManifest.xml中输入正确的授权Key,并检查您的网络连接是否正常!error: $iError"
)
}
else
{
KLog
.
a
(
"BMapManager"
,
"key认证成功"
)
}
}
}
override
fun
initContentView
(
savedInstanceState
:
Bundle
?)
=
R
.
layout
.
activity_panoramic
override
fun
initVariableId
()
=
BR
.
viewModel
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
//requestWindowFeature(Window.FEATURE_NO_TITLE)
initBMapManager
()
}
override
fun
initData
()
{
super
.
initData
()
val
intent
=
intent
if
(
intent
!=
null
)
{
testPanoByType
(
name
=
intent
.
getStringExtra
(
"name"
)
?:
"全景"
,
type
=
intent
.
getIntExtra
(
"type"
,
-
1
),
pid
=
intent
.
getStringExtra
(
"pid"
),
lon
=
intent
.
getDoubleExtra
(
"lon"
,
0.0
),
lat
=
intent
.
getDoubleExtra
(
"lat"
,
0.0
)
)
}
}
private
fun
initBMapManager
()
{
if
(
AppApplication
.
mBMapManager
==
null
)
{
AppApplication
.
mBMapManager
=
BMapManager
(
AppApplication
.
mContext
)
AppApplication
.
mBMapManager
?.
init
(
MyGeneralListener
())
}
}
/**
* 加载全景
* @param name 标题名称 必填
* @param type type类型 必选
* @param pid 百度pid 非必填
* @param lon 纬度 非必填
* @param lat 经度 非必填
*/
private
fun
testPanoByType
(
name
:
String
,
type
:
Int
,
pid
:
String
?
=
null
,
lon
:
Double
?
=
null
,
lat
:
Double
?
=
null
)
{
KLog
.
e
(
"PanoramicActivity"
,
"测试--------------- $name $type $pid $lon $lat"
)
if
(
type
==
-
1
)
{
KLog
.
e
(
"PanoramicActivity"
,
"错误类型"
)
return
}
binding
.
panorama
.
setShowTopoLink
(
true
)
// 测试回调函数,需要注意的是回调函数要在setPanorama()之前调用,否则回调函数可能执行异常
binding
.
panorama
.
setPanoramaViewListener
(
object
:
PanoramaViewListener
{
override
fun
onDescriptionLoadEnd
(
p0
:
String
?)
{
KLog
.
i
(
"PanoramicActivity"
,
"onLoadPanoramaStart..."
)
}
override
fun
onLoadPanoramaBegin
()
{
KLog
.
i
(
"PanoramicActivity"
,
"onLoadPanoramaBegin..."
)
}
override
fun
onLoadPanoramaEnd
(
p0
:
String
?)
{
KLog
.
i
(
"PanoramicActivity"
,
"onLoadPanoramaEnd..."
)
}
override
fun
onLoadPanoramaError
(
p0
:
String
?)
{
}
override
fun
onMessage
(
p0
:
String
?,
p1
:
Int
)
{
}
override
fun
onCustomMarkerClick
(
p0
:
String
?)
{
}
override
fun
onMoveStart
()
{
}
override
fun
onMoveEnd
()
{
}
})
binding
.
ctbTitle
.
setTitle
(
name
)
when
(
type
)
{
//通过百度全景ID(PID)获取全景
PID
->
{
if
(
pid
==
null
)
{
return
}
binding
.
panorama
.
setPanoramaImageLevel
(
PanoramaView
.
ImageDefinition
.
ImageDefinitionHigh
)
binding
.
panorama
.
setPanorama
(
pid
)
}
//通过大地坐标系(WGS84)获取全景
WGS84
->
{
if
(
lon
==
null
||
lat
==
null
||
lon
<=
0
||
lat
<=
0
)
{
return
}
binding
.
panorama
.
setPanoramaImageLevel
(
PanoramaView
.
ImageDefinition
.
ImageDefinitionMiddle
)
binding
.
panorama
.
setPanorama
(
lon
,
lat
,
PanoramaView
.
COORDTYPE_WGS84
)
}
//通过国测局加密坐标(GCJ02)获取全景
GCJ02
->
{
if
(
lon
==
null
||
lat
==
null
||
lon
<=
0
||
lat
<=
0
)
{
return
}
binding
.
panorama
.
setPanoramaImageLevel
(
PanoramaView
.
ImageDefinition
.
ImageDefinitionMiddle
)
binding
.
panorama
.
setPanorama
(
lon
,
lat
,
PanoramaView
.
COORDTYPE_GCJ02
)
}
//通过百度经纬度坐标(BD09LL)获取全景
GEO
->
{
if
(
lon
==
null
||
lat
==
null
||
lon
<=
0
||
lat
<=
0
)
{
return
}
binding
.
panorama
.
setPanoramaImageLevel
(
PanoramaView
.
ImageDefinition
.
ImageDefinitionMiddle
)
binding
.
panorama
.
setPanorama
(
lon
,
lat
,
PanoramaView
.
COORDTYPE_BD09LL
)
}
//通过百度墨卡托坐标(BD09MC)获取全景
MERCATOR
->
{
if
(
lon
==
null
||
lat
==
null
||
lon
<=
0
||
lat
<=
0
)
{
return
}
binding
.
panorama
.
setPanoramaImageLevel
(
PanoramaView
.
ImageDefinition
.
ImageDefinitionMiddle
)
binding
.
panorama
.
setPanorama
(
lon
,
lat
,
PanoramaView
.
COORDTYPE_BD09MC
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/main/vr/PanoramicViewModel.kt
0 → 100644
View file @
2ebe1a42
package
com.mints.street.main.vr
import
android.app.Application
import
me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/12.
*/
class
PanoramicViewModel
(
application
:
Application
):
BaseViewModel
(
application
)
{
}
\ No newline at end of file
app/src/main/res/layout/activity_aboutus.xml
View file @
2ebe1a42
...
...
@@ -5,7 +5,7 @@
<data>
<variable
name=
"
V
iewModel"
name=
"
v
iewModel"
type=
"com.mints.street.main.my.AboutusViewModel"
/>
</data>
<RelativeLayout
...
...
app/src/main/res/layout/activity_moresettings.xml
View file @
2ebe1a42
...
...
@@ -4,7 +4,7 @@
<data>
<variable
name=
"
V
iewModel"
name=
"
v
iewModel"
type=
"com.mints.street.main.my.MoresettingsViewModel"
/>
</data>
...
...
app/src/main/res/layout/activity_panoramic.xml
0 → 100644
View file @
2ebe1a42
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"viewModel"
type=
"com.mints.street.main.vr.PanoramicViewModel"
/>
</data>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<com.fry.base.ui.widget.CommonTitleBar
android:id=
"@+id/ctb_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/white"
app:ctb_theme=
"dark"
app:ctb_title=
"全景"
app:layout_constraintTop_toTopOf=
"parent"
/>
<com.baidu.lbsapi.panoramaview.PanoramaView
android:id=
"@+id/panorama"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:clickable=
"true"
/>
</LinearLayout>
</layout>
\ No newline at end of file
app/src/main/res/layout/activity_permissions.xml
View file @
2ebe1a42
...
...
@@ -3,7 +3,7 @@
<data>
<variable
name=
"
V
iewModel"
name=
"
v
iewModel"
type=
"com.mints.street.main.my.PermissionsViewModel"
/>
</data>
...
...
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