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
Expand all
Show 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.
...
...
@@ -24,6 +26,11 @@ class GridMapAdapter(val context: Context,val list :List<String>):AbstractVLayo
}
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
This diff is collapsed.
Click to expand it.
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