diff --git a/OCH/taxi/driver/src/main/res/layout/taxi_base_fragment.xml b/OCH/taxi/driver/src/main/res/layout/taxi_base_fragment.xml index c45608809b..74184bf9ba 100644 --- a/OCH/taxi/driver/src/main/res/layout/taxi_base_fragment.xml +++ b/OCH/taxi/driver/src/main/res/layout/taxi_base_fragment.xml @@ -129,16 +129,6 @@ app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon" tools:visibility="visible" /> - - + + + + diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/layout/layout_status_bar_over_item.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/layout/layout_status_bar_over_item.xml index 7faa8a0dfa..08b00f9d2f 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/res/layout/layout_status_bar_over_item.xml +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/layout/layout_status_bar_over_item.xml @@ -1,5 +1,5 @@ \ No newline at end of file + android:layout_width="@dimen/dp_51_5" + android:layout_height="@dimen/dp_40_5" /> \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/BoneTopStatusLayout.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/BoneTopStatusLayout.kt index e41748556a..a252cb2960 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/BoneTopStatusLayout.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/BoneTopStatusLayout.kt @@ -7,12 +7,16 @@ import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.content.ContextCompat import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.bone.status.StartAutoPilotStatusView +import com.zhjt.mogo_core_function_devatools.status.StatusManager +import com.zhjt.mogo_core_function_devatools.status.entity.SpeedStatus +import com.zhjt.mogo_core_function_devatools.status.entity.Status +import kotlinx.android.synthetic.main.view_bone_top_status.view.speed_custom import kotlinx.android.synthetic.main.view_bone_top_status.view.topStatusContainer class BoneTopStatusLayout @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 ) : ConstraintLayout(context, attrs, defStyleAttr), - StartAutoPilotStatusView.IStartAutoPilotStatusChanged { + StartAutoPilotStatusView.IStartAutoPilotStatusChanged, StatusManager.IStatusListener { companion object { const val TAG = "BoneTopStatusLayout" @@ -25,11 +29,20 @@ class BoneTopStatusLayout @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() StartAutoPilotStatusView.addStatusChangedListener(TAG, this) + StatusManager.addListener(TAG, this) } override fun onDetachedFromWindow() { super.onDetachedFromWindow() StartAutoPilotStatusView.removeStatusChangedListener(TAG) + StatusManager.removeListener(TAG) + } + + override fun onStatusChanged(changed: List, all: List) { + changed.find { it is SpeedStatus }?.also { + val speed = it as SpeedStatus + speed_custom?.updateSpeed(speed.speed) + } } override fun onStatusError() { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/status/speed/SpeedView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/status/speed/SpeedView.kt new file mode 100644 index 0000000000..4fb37b98e6 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/status/speed/SpeedView.kt @@ -0,0 +1,38 @@ +package com.mogo.eagle.core.function.hmi.bone.status.speed + +import android.content.Context +import android.graphics.Color +import android.graphics.LinearGradient +import android.graphics.Shader +import android.graphics.Shader.TileMode.CLAMP +import android.util.AttributeSet +import android.util.Log +import android.view.LayoutInflater +import android.widget.LinearLayout +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.kotlin.scope +import kotlinx.android.synthetic.main.layout_speed_view.view.tv_speed +import kotlinx.coroutines.launch + +class SpeedView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : + LinearLayout(context, attrs, defStyleAttr) { + + companion object { + private const val TAG = "SpeedView" + } + + init { + LayoutInflater.from(context).inflate(R.layout.layout_speed_view, this, true) + } + + fun updateSpeed(speed: Int) { + tv_speed?.post { + tv_speed?.also { + Log.d(TAG, "--- (${it.width},${it.height})") + it.paint.shader = LinearGradient(it.width.toFloat() / 2.0f, 0f, it.width.toFloat() / 2.0f, it.height.toFloat(), Color.parseColor("#19FFCB"), Color.parseColor("#1970FF"), CLAMP) + it.text = "$speed" + } + } + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/mofang/MoFangStatusView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/mofang/MoFangStatusView.kt index 3cda1fea21..2114c61714 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/mofang/MoFangStatusView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/mofang/MoFangStatusView.kt @@ -12,24 +12,17 @@ import com.mogo.eagle.core.function.api.devatools.mofang.IMoGoMoFangProvider.OnM import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.kotlin.scope import com.mogo.eagle.core.utilcode.util.ToastUtils -import com.mogo.eagle.core.utilcode.util.UiThreadHandler -import kotlinx.android.synthetic.main.layout_mofang_status.view.tv_icon_1 -import kotlinx.android.synthetic.main.layout_mofang_status.view.tv_icon_2 -import kotlinx.android.synthetic.main.layout_mofang_status.view.tv_icon_3 -import kotlinx.android.synthetic.main.layout_mofang_status.view.tv_icon_4 -import kotlinx.android.synthetic.main.layout_mofang_status.view.tv_icon_5 -import kotlinx.android.synthetic.main.layout_mofang_status.view.v_lp_1 -import kotlinx.android.synthetic.main.layout_mofang_status.view.v_lp_2 -import kotlinx.android.synthetic.main.layout_mofang_status.view.v_lp_3 -import kotlinx.android.synthetic.main.layout_mofang_status.view.v_lp_4 -import kotlinx.android.synthetic.main.layout_mofang_status.view.v_lp_5 -import kotlinx.android.synthetic.main.layout_mofang_status.view.v_sp_1 -import kotlinx.android.synthetic.main.layout_mofang_status.view.v_sp_2 -import kotlinx.android.synthetic.main.layout_mofang_status.view.v_sp_3 -import kotlinx.android.synthetic.main.layout_mofang_status.view.v_sp_4 -import kotlinx.android.synthetic.main.layout_mofang_status.view.v_sp_5 -import me.jessyan.autosize.utils.AutoSizeUtils +import kotlinx.android.synthetic.main.layout_mofang_status.view.iv_key_1 +import kotlinx.android.synthetic.main.layout_mofang_status.view.iv_key_2 +import kotlinx.android.synthetic.main.layout_mofang_status.view.iv_key_3 +import kotlinx.android.synthetic.main.layout_mofang_status.view.iv_key_4 +import kotlinx.android.synthetic.main.layout_mofang_status.view.iv_key_5 +import kotlinx.coroutines.Job +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.atomic.AtomicInteger /** @@ -43,6 +36,8 @@ class MoFangStatusView : LinearLayout, OnMoFangStatusListener, IMoGoAutopilotSta private val autoPilotState by lazy { AtomicInteger(CallerAutoPilotStatusListenerManager.getState()) } + private val pendingJobs by lazy { ConcurrentHashMap() } + constructor(context: Context) : super(context) constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) @@ -50,10 +45,7 @@ class MoFangStatusView : LinearLayout, OnMoFangStatusListener, IMoGoAutopilotSta init { View.inflate(context, R.layout.layout_mofang_status, this) orientation = VERTICAL - background = ContextCompat.getDrawable(context, R.drawable.bg_mf_status) - val lr = AutoSizeUtils.dp2px(context, 30f) - val tb = AutoSizeUtils.dp2px(context, 33f) - setPadding(lr, tb, lr, tb) + background = ContextCompat.getDrawable(context, R.drawable.icon_mofang_status_bg) } override fun onAttachedToWindow() { @@ -82,7 +74,7 @@ class MoFangStatusView : LinearLayout, OnMoFangStatusListener, IMoGoAutopilotSta if (last != state) { if (last == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) { Log.d(TAG, "自驾改成非自驾,重置状态") - UiThreadHandler.post { + scope.launch { reset() } } @@ -103,71 +95,70 @@ class MoFangStatusView : LinearLayout, OnMoFangStatusListener, IMoGoAutopilotSta return } if (keyCode == KeyEvent.KEYCODE_A) { - if (tv_icon_2?.tag != 2 && tv_icon_2?.isSelected == true) { - tv_icon_2?.isSelected = false - v_lp_2?.visibility = View.VISIBLE - v_lp_2?.isSelected = false - v_sp_2?.visibility = View.INVISIBLE + if (iv_key_2?.tag != "0") { + iv_key_2?.tag = "0" + iv_key_2?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_default)) + } + if (iv_key_1?.tag == "0") { + iv_key_1?.tag = "1" + iv_key_1?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_clicked)) } - tv_icon_1?.isSelected = true - v_lp_1?.visibility = View.INVISIBLE - v_sp_1?.visibility = View.VISIBLE } if (keyCode == KeyEvent.KEYCODE_B) { - if (tv_icon_1?.isSelected == true) { - tv_icon_1?.isSelected = false - v_lp_1?.visibility = View.VISIBLE - v_lp_1?.isSelected = false - v_sp_1?.visibility = View.INVISIBLE + if (iv_key_1?.tag != "0") { + iv_key_1?.tag = "0" + iv_key_1?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_default)) + } + if (iv_key_2?.tag == "0") { + iv_key_2?.tag = "1" + iv_key_2?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_clicked)) + pendingJobs[keyCode]?.cancel() + scope.launch { + delay(1000) + iv_key_2?.tag = "0" + iv_key_2?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_default)) + }.also { pendingJobs[keyCode] = it } } - tv_icon_2?.isSelected = true - tv_icon_2?.tag = 1 - v_lp_2?.visibility = View.INVISIBLE - v_sp_2?.visibility = View.VISIBLE - UiThreadHandler.postDelayed({ - tv_icon_2?.tag = null - tv_icon_2?.isSelected = false - v_lp_2?.visibility = View.VISIBLE - v_lp_2?.isSelected = false - v_sp_2?.visibility = View.INVISIBLE - }, 1000) } if (keyCode == KeyEvent.KEYCODE_C) { - tv_icon_3?.isSelected = true - v_lp_3?.visibility = View.INVISIBLE - v_sp_3?.visibility = View.VISIBLE - UiThreadHandler.postDelayed({ - tv_icon_3?.isSelected = false - v_lp_3?.visibility = View.VISIBLE - v_lp_3?.isSelected = false - v_sp_3?.visibility = View.INVISIBLE - }, 1000) + if (iv_key_3?.tag == "0") { + iv_key_3?.tag = "1" + iv_key_3?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_clicked)) + pendingJobs[keyCode]?.cancel() + scope.launch { + delay(1000) + iv_key_3?.tag = "0" + iv_key_3?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_default)) + }.also { pendingJobs[keyCode] = it } + } } if (keyCode == KeyEvent.KEYCODE_D) { - tv_icon_4?.isSelected = true - v_lp_4?.visibility = View.INVISIBLE - v_sp_4?.visibility = View.VISIBLE - UiThreadHandler.postDelayed({ - tv_icon_4?.isSelected = false - v_lp_4?.visibility = View.VISIBLE - v_lp_4?.isSelected = false - v_sp_4?.visibility = View.INVISIBLE - }, 1000) + if (iv_key_4?.tag == "0") { + iv_key_4?.tag = "1" + iv_key_4?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_clicked)) + pendingJobs[keyCode]?.cancel() + scope.launch { + delay(1000) + iv_key_4?.tag = "0" + iv_key_4?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_default)) + }.also { pendingJobs[keyCode] = it } + } } if (keyCode == KeyEvent.KEYCODE_E) { - tv_icon_5?.isSelected = true - v_lp_5?.visibility = View.INVISIBLE - v_sp_5?.visibility = View.VISIBLE - UiThreadHandler.postDelayed({ - tv_icon_5?.isSelected = false - v_lp_5?.visibility = View.VISIBLE - v_lp_5?.isSelected = false - v_sp_5?.visibility = View.INVISIBLE - }, 1000) + if (iv_key_5?.tag == "0") { + iv_key_5?.tag = "1" + iv_key_5?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_clicked)) + pendingJobs[keyCode]?.cancel() + scope.launch { + delay(1000) + iv_key_5?.tag = "0" + iv_key_5?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_default)) + }.also { pendingJobs[keyCode] = it } + } } } @@ -182,44 +173,41 @@ class MoFangStatusView : LinearLayout, OnMoFangStatusListener, IMoGoAutopilotSta return } if (keyCode == KeyEvent.KEYCODE_A) { - if (tv_icon_2?.tag != 2 && tv_icon_2?.isSelected == true) { - tv_icon_2?.isSelected = false - v_lp_2?.visibility = View.VISIBLE - v_lp_2?.isSelected = false - v_sp_2?.visibility = View.INVISIBLE + if (iv_key_2?.tag != "0") { + iv_key_2?.tag = "0" + pendingJobs[KeyEvent.KEYCODE_B]?.cancel() + iv_key_2?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_default)) + } + if (iv_key_1?.tag != "2") { + iv_key_1?.tag = "2" + iv_key_1?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_long_clicked)) } - tv_icon_1?.isSelected = true - v_lp_1?.visibility = View.VISIBLE - v_lp_1?.isSelected = true - v_sp_1?.visibility = View.INVISIBLE } if (keyCode == KeyEvent.KEYCODE_B) { - tv_icon_2?.isSelected = true - tv_icon_2?.tag = 2 - v_lp_2?.visibility = View.VISIBLE - v_lp_2?.isSelected = true - v_sp_2?.visibility = View.INVISIBLE - UiThreadHandler.postDelayed({ - tv_icon_2?.tag = null - tv_icon_2?.isSelected = false - v_lp_2?.visibility = View.VISIBLE - v_lp_2?.isSelected = false - v_sp_2?.visibility = View.INVISIBLE - }, 1000) + if (iv_key_2?.tag != "2") { + iv_key_2?.tag = "2" + iv_key_2?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_long_clicked)) + pendingJobs[keyCode]?.cancel() + scope.launch { + delay(1000) + iv_key_2?.tag = "0" + iv_key_2?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_default)) + } + } } if (keyCode == KeyEvent.KEYCODE_E) { - tv_icon_5?.isSelected = true - v_lp_5?.visibility = View.VISIBLE - v_lp_5?.isSelected = true - v_sp_5?.visibility = View.INVISIBLE - UiThreadHandler.postDelayed({ - tv_icon_5?.isSelected = false - v_lp_5?.visibility = View.VISIBLE - v_lp_5?.isSelected = false - v_sp_5?.visibility = View.INVISIBLE - }, 1000) + if (iv_key_5?.tag != "2") { + iv_key_5?.tag = "2" + iv_key_5?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_long_clicked)) + pendingJobs[keyCode]?.cancel() + scope.launch { + delay(1000) + iv_key_5?.tag = "0" + iv_key_5?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_default)) + } + } } } @@ -239,12 +227,14 @@ class MoFangStatusView : LinearLayout, OnMoFangStatusListener, IMoGoAutopilotSta val key1 = keyCodes[0] val key2 = keyCodes[1] if (key1 == KeyEvent.KEYCODE_A && key2 == KeyEvent.KEYCODE_B || (key1 == KeyEvent.KEYCODE_B && key2 == KeyEvent.KEYCODE_A)) { - tv_icon_1?.isSelected = true - v_lp_1?.visibility = View.INVISIBLE - v_sp_1?.visibility = View.VISIBLE - tv_icon_2?.isSelected = true - v_lp_2.visibility = View.INVISIBLE - v_sp_2.visibility = View.VISIBLE + if (iv_key_1?.tag != "1") { + iv_key_1?.tag = "1" + iv_key_1?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_clicked)) + } + if (iv_key_2?.tag != "1") { + iv_key_2?.tag = "1" + iv_key_2?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_clicked)) + } } } @@ -257,30 +247,25 @@ class MoFangStatusView : LinearLayout, OnMoFangStatusListener, IMoGoAutopilotSta } private fun reset() { - tv_icon_1?.isSelected = false - v_lp_1?.visibility = View.VISIBLE - v_lp_1?.isSelected = false - v_sp_1?.visibility = View.INVISIBLE - - tv_icon_2?.isSelected = false - v_lp_2?.visibility = View.VISIBLE - v_lp_2?.isSelected = false - v_sp_2?.visibility = View.INVISIBLE - - - tv_icon_3?.isSelected = false - v_lp_3?.visibility = View.VISIBLE - v_lp_3?.isSelected = false - v_sp_3?.visibility = View.INVISIBLE - - tv_icon_4?.isSelected = false - v_lp_4?.visibility = View.VISIBLE - v_lp_4?.isSelected = false - v_sp_4?.visibility = View.INVISIBLE - - tv_icon_5?.isSelected = false - v_lp_5?.visibility = View.VISIBLE - v_lp_5?.isSelected = false - v_sp_5?.visibility = View.INVISIBLE + if (iv_key_1?.tag != "0") { + iv_key_1?.tag = "0" + iv_key_1?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_default)) + } + if (iv_key_2?.tag != "0") { + iv_key_2?.tag = "0" + iv_key_2?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_default)) + } + if (iv_key_3?.tag != "0") { + iv_key_3?.tag = "0" + iv_key_3?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_default)) + } + if (iv_key_4?.tag != "0") { + iv_key_4?.tag = "0" + iv_key_4?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_default)) + } + if (iv_key_5?.tag != "0") { + iv_key_5?.tag = "0" + iv_key_5?.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.icon_mofang_key_default)) + } } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/viewport/VisualAngleToggleView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/viewport/VisualAngleToggleView.kt new file mode 100644 index 0000000000..f4c63f507b --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/viewport/VisualAngleToggleView.kt @@ -0,0 +1,179 @@ +package com.mogo.eagle.core.function.hmi.ui.viewport + +import android.animation.Animator +import android.animation.AnimatorListenerAdapter +import android.animation.ValueAnimator +import android.content.Context +import android.util.AttributeSet +import android.view.GestureDetector +import android.view.LayoutInflater +import android.view.MotionEvent +import android.view.ViewConfiguration +import android.view.animation.AccelerateDecelerateInterpolator +import android.widget.LinearLayout +import androidx.core.content.ContextCompat +import com.mogo.eagle.core.function.angle.scenes.Default +import com.mogo.eagle.core.function.angle.scenes.LongSight +import com.mogo.eagle.core.function.api.map.angle.IMoGoVisualAngleChangeProvider +import com.mogo.eagle.core.function.api.map.angle.Scene +import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.kotlin.scope +import kotlinx.android.synthetic.main.layout_visual_angle_toggle.view.iv_toggle_block +import kotlinx.coroutines.launch +import me.jessyan.autosize.utils.AutoSizeUtils +import kotlin.math.abs +import kotlin.math.max + +class VisualAngleToggleView : LinearLayout, IMoGoVisualAngleChangeProvider.OnMoGoVisualAngleSceneChangeListener { + + companion object { + private const val TAG = "VisualAngleToggleView" + } + + constructor(context: Context?) : this(context, null) + constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, 0) + constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { + orientation = VERTICAL + isClickable = true + LayoutInflater.from(context).inflate(R.layout.layout_visual_angle_toggle, this, true) + val defaultSlop = AutoSizeUtils.dp2px(context, 12.0f) + val scrollSlop = max(context?.let { ViewConfiguration.get(it).scaledTouchSlop } ?: defaultSlop, defaultSlop) + val gestureDetector = GestureDetector(context, object : GestureDetector.SimpleOnGestureListener() { + + override fun onDown(e: MotionEvent): Boolean { + return true + } + + override fun onScroll(e1: MotionEvent, e2: MotionEvent, distanceX: Float, distanceY: Float): Boolean { + val absX = abs(e2.x - e1.x) + val absY = abs(e2.y - e1.y) + if (absY <= absX) { + return false + } + if (e2.y - e1.y >= scrollSlop) { + moveToBottom() + return true + } + if (e1.y - e2.y >= scrollSlop) { + moveToTop() + return true + } + return super.onScroll(e1, e2, distanceX, distanceY) + } + }) + iv_toggle_block?.setOnTouchListener { _, event -> gestureDetector.onTouchEvent(event) } + if (context != null) { + background = ContextCompat.getDrawable(context, R.drawable.bg_visual_angle_toggle) + } + } + + private fun moveToBottom() { + if (iv_toggle_block?.tag == "0") { + return + } + val start = if (iv_toggle_block?.tag == 1) AutoSizeUtils.dp2px(context, 185.0f) else AutoSizeUtils.dp2px(context, 109.0f) + iv_toggle_block?.tag = "0" + iv_toggle_block?.isEnabled = false + val end = AutoSizeUtils.dp2px(context, 276.0f) + val animator = ValueAnimator.ofInt(start, end) + animator.addUpdateListener { l -> + val current = l.animatedValue as? Int ?: 0 + (iv_toggle_block?.layoutParams as? LayoutParams)?.also { it.topMargin = current }?.also { iv_toggle_block?.layoutParams = it } + } + animator.addListener(object : AnimatorListenerAdapter() { + override fun onAnimationStart(animation: Animator, isReverse: Boolean) { + CallerVisualAngleManager.changeScene(Default()) + } + override fun onAnimationEnd(animation: Animator, isReverse: Boolean) { + super.onAnimationEnd(animation, isReverse) + iv_toggle_block?.isEnabled = true + } + }) + animator.interpolator = AccelerateDecelerateInterpolator() + animator.setDuration(200) + animator.start() + } + + private fun moveToTop() { + if (iv_toggle_block?.tag == "2") { + return + } + val start = if (iv_toggle_block?.tag == 1) AutoSizeUtils.dp2px(context, 185.0f) else AutoSizeUtils.dp2px(context, 276.0f) + iv_toggle_block?.tag = "2" + iv_toggle_block?.isEnabled = false + val end = AutoSizeUtils.dp2px(context, 109.0f) + val animator = ValueAnimator.ofInt(start, end) + animator.addUpdateListener { l -> + val current = l.animatedValue as? Int ?: 0 + (iv_toggle_block?.layoutParams as? LayoutParams)?.also { it.topMargin = current }?.also { iv_toggle_block?.layoutParams = it } + } + animator.addListener(object : AnimatorListenerAdapter() { + override fun onAnimationStart(animation: Animator, isReverse: Boolean) { + CallerVisualAngleManager.changeScene(LongSight()) + + } + override fun onAnimationEnd(animation: Animator, isReverse: Boolean) { + iv_toggle_block?.isEnabled = true + } + }) + animator.interpolator = AccelerateDecelerateInterpolator() + animator.setDuration(200) + animator.start() + } + + private fun moveToMiddle() { + if (iv_toggle_block?.tag == "1") { + return + } + val start = if (iv_toggle_block?.tag == 2) AutoSizeUtils.dp2px(context, 109.0f) else AutoSizeUtils.dp2px(context, 276.0f) + iv_toggle_block?.tag = "1" + iv_toggle_block?.isEnabled = false + val end = AutoSizeUtils.dp2px(context, 185.0f) + val animator = ValueAnimator.ofInt(start, end) + animator.addUpdateListener { l -> + val current = l.animatedValue as? Int ?: 0 + (iv_toggle_block?.layoutParams as? LayoutParams)?.also { it.topMargin = current }?.also { iv_toggle_block?.layoutParams = it } + } + animator.interpolator = AccelerateDecelerateInterpolator() + animator.setDuration(200) + animator.start() + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerVisualAngleManager.addListener(TAG, this) + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerVisualAngleManager.removeListener(TAG) + } + + override fun onSceneChanged(scene: Scene) { + val isCanSwitch = scene.isCanSwitch() + scope.launch { + if (isCanSwitch != isEnabled) { + isEnabled = isCanSwitch + } + if (iv_toggle_block?.isEnabled != isCanSwitch) { + iv_toggle_block?.isEnabled = isCanSwitch + } + } + if (!isCanSwitch) { + scope.launch { + moveToMiddle() + } + } else { + if (scene is Default) { + scope.launch { + moveToBottom() + } + } else if (scene is LongSight) { + scope.launch { + moveToTop() + } + } + } + } +} diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_mofang_key_clicked.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_mofang_key_clicked.png new file mode 100644 index 0000000000..7c8974d75b Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_mofang_key_clicked.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_mofang_key_default.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_mofang_key_default.png new file mode 100644 index 0000000000..73e4d23b58 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_mofang_key_default.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_mofang_key_long_clicked.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_mofang_key_long_clicked.png new file mode 100644 index 0000000000..390e0158fd Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_mofang_key_long_clicked.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_mofang_status_bg.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_mofang_status_bg.png new file mode 100644 index 0000000000..6719017216 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_mofang_status_bg.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_visual_angle_toggle_block_default.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_visual_angle_toggle_block_default.png new file mode 100644 index 0000000000..dff6f03248 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_visual_angle_toggle_block_default.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_visual_angle_toggle_block_pressed.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_visual_angle_toggle_block_pressed.png new file mode 100644 index 0000000000..fd960cb679 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_visual_angle_toggle_block_pressed.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_visual_angle_toggle_disable.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_visual_angle_toggle_disable.png new file mode 100644 index 0000000000..5ccedf346b Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_visual_angle_toggle_disable.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_visual_angle_toggle_enable.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_visual_angle_toggle_enable.png new file mode 100644 index 0000000000..584a7de01e Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_visual_angle_toggle_enable.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_mf_status.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_mf_status.xml deleted file mode 100644 index d57d698808..0000000000 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_mf_status.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_visual_angle_toggle.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_visual_angle_toggle.xml new file mode 100644 index 0000000000..5db95b931c --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_visual_angle_toggle.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_visual_angle_toggle_block.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_visual_angle_toggle_block.xml new file mode 100644 index 0000000000..ee8cd7c595 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_visual_angle_toggle_block.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_mofang_status.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_mofang_status.xml index c5dcdbabb8..79c783b90d 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_mofang_status.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_mofang_status.xml @@ -1,195 +1,64 @@ + tools:parentTag="android.widget.LinearLayout"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_speed_view.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_speed_view.xml new file mode 100644 index 0000000000..e631fa1cd7 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_speed_view.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_visual_angle_toggle.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_visual_angle_toggle.xml new file mode 100644 index 0000000000..51091be7cc --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_visual_angle_toggle.xml @@ -0,0 +1,19 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_bone_container.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_bone_container.xml index 7cba717e3a..956a3ac6e7 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_bone_container.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_bone_container.xml @@ -34,4 +34,6 @@ android:elevation="20dp" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintTop_toTopOf="parent" /> + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_bone_top_status.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_bone_top_status.xml index c76c7340b7..96f62d0f35 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_bone_top_status.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_bone_top_status.xml @@ -6,6 +6,15 @@ android:layout_height="@dimen/dp_357" android:background="@drawable/bg_top_status_layout_normal"> + + diff --git a/core/mogo-core-res/src/main/res/drawable-xhdpi/icon_status_route_download_failed.png b/core/mogo-core-res/src/main/res/drawable-xhdpi/icon_status_route_download_failed.png index 2df85fe783..dcdbeeb945 100644 Binary files a/core/mogo-core-res/src/main/res/drawable-xhdpi/icon_status_route_download_failed.png and b/core/mogo-core-res/src/main/res/drawable-xhdpi/icon_status_route_download_failed.png differ diff --git a/core/mogo-core-res/src/main/res/values/dimens.xml b/core/mogo-core-res/src/main/res/values/dimens.xml index 4d28213fee..0ced2ceb45 100644 --- a/core/mogo-core-res/src/main/res/values/dimens.xml +++ b/core/mogo-core-res/src/main/res/values/dimens.xml @@ -65,6 +65,7 @@ 38dp 39dp 40dp + 40.5dp 41dp 42dp 43dp @@ -76,6 +77,7 @@ 49dp 50dp 51dp + 51.5dp 52dp 53dp 54dp diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/kotlin/Extensions.kt b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/kotlin/Extensions.kt index a39239dd0d..e0ad842277 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/kotlin/Extensions.kt +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/kotlin/Extensions.kt @@ -98,7 +98,7 @@ val T.lifecycleOwner: LifecycleOwner } val T.scope - get() = lifecycleOwner.lifecycleScope + get() = lifecycleOwner.lifecycleScope + SupervisorJob() fun View.onClick(block: (View) -> Unit) { this.setOnClickListener { diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/map/MapEngine.kt b/libraries/mapmodule/src/main/java/com/autonavi/nge/map/MapEngine.kt index 177791d257..e752f063de 100644 --- a/libraries/mapmodule/src/main/java/com/autonavi/nge/map/MapEngine.kt +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/map/MapEngine.kt @@ -3,426 +3,467 @@ package com.autonavi.nge.map import android.content.res.AssetManager import android.util.Log import com.zhidaoauto.map.sdk.open.MapAutoApi +import java.util.concurrent.atomic.AtomicLong class MapEngine { private val TAG = javaClass.simpleName - private var mObj: Long = 0 + private val mObj by lazy { AtomicLong(0L) } fun MapEngine() { } - fun load(dataDir: String, mapView: MapView,assetManager: AssetManager): Boolean { - if (mObj == 0L) { - mObj = loadJni(dataDir, mapView, assetManager) - } - return mObj != 0L + fun load(dataDir: String, mapView: MapView, assetManager: AssetManager): Boolean { + return mObj.get() != 0L || mObj.compareAndSet(0L, loadJni(dataDir, mapView, assetManager)) } fun render() { - if (mObj != 0L) { - renderJni(mObj) + val obj = mObj.get() + if (obj != 0L) { + renderJni(obj) } } fun resize(newWidth: Int, newHeight: Int) { - if (mObj != 0L) { - resizeJni(mObj, newWidth, newHeight) + val obj = mObj.get() + if (obj != 0L) { + resizeJni(obj, newWidth, newHeight) } } fun scroll(dx: Float, dy: Float) { - if (mObj != 0L) { - scrollJni(mObj, dx, dy) + val obj = mObj.get() + if (obj != 0L) { + scrollJni(obj, dx, dy) } } fun scrollByAnim(dx: Float, dy: Float) { - if (mObj != 0L) { - scrollByAnimJni(mObj, dx, dy) + val obj = mObj.get() + if (obj != 0L) { + scrollByAnimJni(obj, dx, dy) } } fun setZoomIndex(zoomIndex: Int) { - if (mObj != 0L) { - setZoomIndexJni(mObj, zoomIndex) + val obj = mObj.get() + if (obj != 0L) { + setZoomIndexJni(obj, zoomIndex) } } fun getZoomIndex(): Int { - return if (mObj != 0L) { - getZoomIndexJni(mObj) + val obj = mObj.get() + return if (obj != 0L) { + getZoomIndexJni(obj) } else 0 } fun setZoomValue(zoomValue: Float) { - if (mObj != 0L) { - setZoomValueJni(mObj, zoomValue) + val obj = mObj.get() + if (obj != 0L) { + setZoomValueJni(obj, zoomValue) } } fun getZoomValue(): Float { - return if (mObj != 0L) { - getZoomValueJni(mObj) + val obj = mObj.get() + return if (obj != 0L) { + getZoomValueJni(obj) } else 0.0f } fun zoomIn() { - if (mObj != 0L) { - zoomInJni(mObj) + val obj = mObj.get() + if (obj != 0L) { + zoomInJni(obj) } } fun zoomOut() { - if (mObj != 0L) { - zoomOutJni(mObj) + val obj = mObj.get() + if (obj != 0L) { + zoomOutJni(obj) } } fun scale(scale: Float) { - if (mObj != 0L) { - scaleJni(mObj, scale) + val obj = mObj.get() + if (obj != 0L) { + scaleJni(obj, scale) } } fun scaleByCenter(centerX: Int, centerY: Int, scale: Float) { - if (mObj != 0L) { - scaleByCenterJni(mObj, centerX, centerY, scale) + val obj = mObj.get() + if (obj != 0L) { + scaleByCenterJni(obj, centerX, centerY, scale) } } fun rotate(angle: Float) { - if (mObj != 0L) { - rotateJni(mObj, angle) + val obj = mObj.get() + if (obj != 0L) { + rotateJni(obj, angle) } } fun lookUpDown(look: Float) { - if (mObj != 0L) { - lookUpDownJni(mObj, look) + val obj = mObj.get() + if (obj != 0L) { + lookUpDownJni(obj, look) } } fun setCenter(lon: Double, lat: Double) { - if (mObj != 0L) { - setCenterJni(mObj, lon, lat) + val obj = mObj.get() + if (obj != 0L) { + setCenterJni(obj, lon, lat) } } fun getCenter(point: DoubleArray) { - if (mObj != 0L) { - getCenterJni(mObj, point) + val obj = mObj.get() + if (obj != 0L) { + getCenterJni(obj, point) } } - fun animateTo( - lon: Double, - lat: Double, - alt: Float, - zoom: Float, - rotateAngle: Float, - overlookAngle: Float, - eyeHeight: Float, - duration: Int, - fov: Float - ) { - if (mObj != 0L) { - animateToJni( - mObj, lon, lat, alt, zoom, rotateAngle, overlookAngle, eyeHeight, duration,fov - ) + fun animateTo(lon: Double, lat: Double, alt: Float, zoom: Float, rotateAngle: Float, overlookAngle: Float, eyeHeight: Float, duration: Int, fov: Float) { + val obj = mObj.get() + if (obj != 0L) { + animateToJni(obj, lon, lat, alt, zoom, rotateAngle, overlookAngle, eyeHeight, duration, fov) } } fun setRouteProp(prop: Int, lon: Int, lat: Int) { - if (mObj != 0L) { - setRoutePropJni(mObj, prop, lon, lat) + val obj = mObj.get() + if (obj != 0L) { + setRoutePropJni(obj, prop, lon, lat) } } fun drawRoute() { - if (mObj != 0L) { - drawRouteJni(mObj) + val obj = mObj.get() + if (obj != 0L) { + drawRouteJni(obj) } } fun drawNavArrow() { - if (mObj != 0L) { - drawNavArrowJni(mObj) + val obj = mObj.get() + if (obj != 0L) { + drawNavArrowJni(obj) } } fun getRulerInfo(): Float { - return if (mObj != 0L) { - getRulerInfoJni(mObj) + val obj = mObj.get() + return if (obj != 0L) { + getRulerInfoJni(obj) } else 0.0f } fun showAllRouteLine() { - if (mObj != 0L) { - showAllRouteLineJni(mObj) + val obj = mObj.get() + if (obj != 0L) { + showAllRouteLineJni(obj) } } fun showRouteLine(pOneX: Float, pOneY: Float, pTwoX: Float, pTwoY: Float) { - if (mObj != 0L) { - showRouteLineJni(mObj, pOneX, pOneY, pTwoX, pTwoY) + val obj = mObj.get() + if (obj != 0L) { + showRouteLineJni(obj, pOneX, pOneY, pTwoX, pTwoY) } } fun addAntCoor(sessionId: Int, lon: Int, lat: Int, time: Int) { - if (mObj != 0L) { - addAntCoorJni(mObj, sessionId, lon, lat, time) + val obj = mObj.get() + if (obj != 0L) { + addAntCoorJni(obj, sessionId, lon, lat, time) } } fun drawMapMatchedPosition() { - if (mObj != 0L) { - drawMapMatchedPositionJni(mObj) + val obj = mObj.get() + if (obj != 0L) { + drawMapMatchedPositionJni(obj) } } - fun drawCar( - lon: Long, - lat: Long, - z: Short, - angle: Short, - scale: Int, - rate: Float, - data: ByteArray?, - len: Int - ) { - if (mObj != 0L) { - drawCarJni(mObj, lon, lat, z, angle, scale, rate, data, len) + fun drawCar(lon: Long, lat: Long, z: Short, angle: Short, scale: Int, rate: Float, data: ByteArray?, len: Int) { + val obj = mObj.get() + if (obj != 0L) { + drawCarJni(obj, lon, lat, z, angle, scale, rate, data, len) } } fun updateCar(lon: Long, lat: Long, z: Short, angle: Short) { - if (mObj != 0L) { - updateCarJni(mObj, lon, lat, z, angle) + val obj = mObj.get() + if (obj != 0L) { + updateCarJni(obj, lon, lat, z, angle) } } fun getCarPosition(position: IntArray?): Int { - return if (mObj != 0L) { - getCarPositionJni(mObj, position) + val obj = mObj.get() + return if (obj != 0L) { + getCarPositionJni(obj, position) } else 0 } fun setTrafIDStat(locCode: Int, dir: Int, evtCode: Int) { - if (mObj != 0L) { - setTrafIDStatJni(mObj, locCode, dir, evtCode) + val obj = mObj.get() + if (obj != 0L) { + setTrafIDStatJni(obj, locCode, dir, evtCode) } } fun getTrafIDStat(tileId: Int, linkId: Int): Int { - return if (mObj != 0L) { - getTrafIDStatJni(mObj, tileId, linkId) + val obj = mObj.get() + return if (obj != 0L) { + getTrafIDStatJni(obj, tileId, linkId) } else 0 } fun setTraffic(stat: Int) { - if (mObj != 0L) { - setTrafficJni(mObj, stat) + val obj = mObj.get() + if (obj != 0L) { + setTrafficJni(obj, stat) } } fun isTrafficOn(): Boolean { - return if (mObj != 0L) { - isTrafficOnJni(mObj) + val obj = mObj.get() + return if (obj != 0L) { + isTrafficOnJni(obj) } else false } fun commitTrafficStat(locTableCode: Int) { - if (mObj != 0L) { - commitTrafficStatJni(mObj, locTableCode) + val obj = mObj.get() + if (obj != 0L) { + commitTrafficStatJni(obj, locTableCode) } } fun routeSearching(showcnt: Int) { - if (mObj != 0L) { - routeSearchingJni(mObj, showcnt) + val obj = mObj.get() + if (obj != 0L) { + routeSearchingJni(obj, showcnt) } } fun getDAngle(): Float { - return if (mObj != 0L) { - getDAngleJni(mObj) + val obj = mObj.get() + return if (obj != 0L) { + getDAngleJni(obj) } else 45.0f } fun setDAngle(angle: Float) { - if (mObj != 0L) { - setDAngleJni(mObj, angle) + val obj = mObj.get() + if (obj != 0L) { + setDAngleJni(obj, angle) } } fun getRotateAngle(): Float { - return if (mObj != 0L) { - getRotateAngleJni(mObj) + val obj = mObj.get() + return if (obj != 0L) { + getRotateAngleJni(obj) } else 0.0f } fun setRotateAngle(angle: Float) { - if (mObj != 0L) { - setRotateAngleJni(mObj, angle) + val obj = mObj.get() + if (obj != 0L) { + setRotateAngleJni(obj, angle) } } fun setVerticalViewFieldAngle(angle: Float) { - if (mObj != 0L) { - setVerticalViewFieldAngleJni(mObj, angle) + val obj = mObj.get() + if (obj != 0L) { + setVerticalViewFieldAngleJni(obj, angle) } } fun getVerticalViewFieldAngle(): Float { - return if (mObj != 0L) { - getVerticalViewFieldAngleJni(mObj) + val obj = mObj.get() + return if (obj != 0L) { + getVerticalViewFieldAngleJni(obj) } else 45.0f } fun getEyeHeight(): Float { - return if (mObj != 0L) { - getEyeHeightJni(mObj) + val obj = mObj.get() + return if (obj != 0L) { + getEyeHeightJni(obj) } else 45.0f } fun setEyeHeight(eyeHeight: Float) { - if (mObj != 0L) { - setEyeHeightJni(mObj, eyeHeight) + val obj = mObj.get() + if (obj != 0L) { + setEyeHeightJni(obj, eyeHeight) } } fun clearRouteObjs() { - if (mObj != 0L) { - clearRouteObjsJni(mObj) + val obj = mObj.get() + if (obj != 0L) { + clearRouteObjsJni(obj) } } fun clearRouteSearchedObjs() { - if (mObj != 0L) { - clearRouteSearchedObjsJni(mObj) + val obj = mObj.get() + if (obj != 0L) { + clearRouteSearchedObjsJni(obj) } } fun drawSearchResult() { - if (mObj != 0L) { - drawSearchResultJni(mObj) + val obj = mObj.get() + if (obj != 0L) { + drawSearchResultJni(obj) } } fun clearSearchResult() { - if (mObj != 0L) { - clearSearchResultJni(mObj) + val obj = mObj.get() + if (obj != 0L) { + clearSearchResultJni(obj) } } fun setMapStyle(styleMode: Int) { - if (mObj != 0L) { - setMapStyleJni(mObj, styleMode) + val obj = mObj.get() + if (obj != 0L) { + setMapStyleJni(obj, styleMode) } } fun getMapStyle(): Int { - return if (mObj != 0L) { - getMapStyleJni(mObj) + val obj = mObj.get() + return if (obj != 0L) { + getMapStyleJni(obj) } else 1 } fun set3DBuildingVisible(isVisibel: Boolean) { - if (mObj != 0L) { - set3DBuildingVisibleJni(mObj, isVisibel) + val obj = mObj.get() + if (obj != 0L) { + set3DBuildingVisibleJni(obj, isVisibel) } } fun lonlatToPixels(lon: Double, lat: Double): Pixels? { - return if (mObj != 0L) { - lonlatToPixelsJni(mObj, lon, lat) + val obj = mObj.get() + return if (obj != 0L) { + lonlatToPixelsJni(obj, lon, lat) } else null } fun pixelsToLonlat(x: Float, y: Float): LonLat? { - return if (mObj != 0L) { - pixelsToLonlatJni(mObj, x, y) + val obj = mObj.get() + return if (obj != 0L) { + pixelsToLonlatJni(obj, x, y) } else null } fun shakeSceneManual() { - if (mObj != 0L) { - shakeSceneManualJni(mObj) + val obj = mObj.get() + if (obj != 0L) { + shakeSceneManualJni(obj) } } fun shakeMapManual() { - if (mObj != 0L) { - shakeMapManualJni(mObj) + val obj = mObj.get() + if (obj != 0L) { + shakeMapManualJni(obj) } } fun getResulation(): Float { - return if (mObj != 0L) { - getResulationJni(mObj) + val obj = mObj.get() + return if (obj != 0L) { + getResulationJni(obj) } else 0.0f } fun drawTraffic(trafficJson: String) { - if (mObj != 0L) { - drawTrafficJni(mObj, trafficJson) + val obj = mObj.get() + if (obj != 0L) { + drawTrafficJni(obj, trafficJson) } } fun addImage(imageKey: String, imageData: ByteArray?, width: Int, height: Int): Int { - return if (mObj != 0L) { - addImageJni(mObj, imageKey, imageData, width, height) + val obj = mObj.get() + return if (obj != 0L) { + addImageJni(obj, imageKey, imageData, width, height) } else 10001 } fun removeImage(imageKey: String) { - if (mObj != 0L) { - removeImageJni(mObj, imageKey) + val obj = mObj.get() + if (obj != 0L) { + removeImageJni(obj, imageKey) } } fun updateImage(imageKey: String, imageData: ByteArray?, width: Int, height: Int) { - if (mObj != 0L) { - updateImageJni(mObj, imageKey, imageData, width, height) + val obj = mObj.get() + if (obj != 0L) { + updateImageJni(obj, imageKey, imageData, width, height) } } fun getSuitableZoom(minLon: Double, minLat: Double, maxLon: Double, maxLat: Double): Int { - return if (mObj != 0L) { - getSuitableZoomJni(mObj, minLon, minLat, maxLon, maxLat) + val obj = mObj.get() + return if (obj != 0L) { + getSuitableZoomJni(obj, minLon, minLat, maxLon, maxLat) } else -1 } fun clearAllTmcLines() { - if (mObj != 0L) { - clearAllTmcLinesJni(mObj) + val obj = mObj.get() + if (obj != 0L) { + clearAllTmcLinesJni(obj) } } fun setTmcData(tmcData: ByteArray?) { - if (mObj != 0L) { - setTmcDataJni(mObj, tmcData) + val obj = mObj.get() + if (obj != 0L) { + setTmcDataJni(obj, tmcData) } } fun setEyeToOriginDis(eyeToOriginDis: Float) { - if (mObj != 0L) { - setEyeToOriginDisJni(mObj, eyeToOriginDis) + val obj = mObj.get() + if (obj != 0L) { + setEyeToOriginDisJni(obj, eyeToOriginDis) } } fun setScreenToOriginDis(screenToOriginDis: Float) { - if (mObj != 0L) { - setScreenToOriginDisJni(mObj, screenToOriginDis) + val obj = mObj.get() + if (obj != 0L) { + setScreenToOriginDisJni(obj, screenToOriginDis) } } fun setScaleMapCenter(lon: Double, lat: Double) { - if (mObj != 0L) { - setScaleMapCenterJni(mObj, lon, lat) + val obj = mObj.get() + if (obj != 0L) { + setScaleMapCenterJni(obj, lon, lat) } } @@ -431,754 +472,810 @@ class MapEngine { } fun setOffset(lon: Int, lat: Int) { - if (mObj != 0L) { - setOffsetJni(mObj, lon, lat) + val obj = mObj.get() + if (obj != 0L) { + setOffsetJni(obj, lon, lat) } } fun setOffsetByRate(rateX: Float, rateY: Float, angle: Float) { - if (mObj != 0L) { - setOffsetByRateJni(mObj, rateX, rateY, angle) + val obj = mObj.get() + if (obj != 0L) { + setOffsetByRateJni(obj, rateX, rateY, angle) } } fun setPointToCenter(xRate: Float, yRate: Float) { - if (mObj != 0L) { - setPointToCenterJni(mObj, xRate, yRate) + val obj = mObj.get() + if (obj != 0L) { + setPointToCenterJni(obj, xRate, yRate) } } fun setRenderFrequency(enable: Boolean, renderTimePer: Int) { - if (mObj != 0L) { - setRenderFrequencyJni(mObj, enable, renderTimePer) + val obj = mObj.get() + if (obj != 0L) { + setRenderFrequencyJni(obj, enable, renderTimePer) } } fun setLightPosition(position: FloatArray) { - if (mObj != 0L) { - setLightPositionJni(mObj, position) + val obj = mObj.get() + if (obj != 0L) { + setLightPositionJni(obj, position) } } fun setLightDiffuse(color: FloatArray) { - if (mObj != 0L) { - setLightDiffuseJni(mObj, color) + val obj = mObj.get() + if (obj != 0L) { + setLightDiffuseJni(obj, color) } } fun setLightSpecular(color: FloatArray) { - if (mObj != 0L) { - setLightSpecularJni(mObj, color) + val obj = mObj.get() + if (obj != 0L) { + setLightSpecularJni(obj, color) } } fun setFrontFaceShiness(frontFaceShiness: Float) { - if (mObj != 0L) { - setFrontFaceShinessJni(mObj, frontFaceShiness) + val obj = mObj.get() + if (obj != 0L) { + setFrontFaceShinessJni(obj, frontFaceShiness) } } - fun updatePointCloudDataByPb( - dataArray: ByteArray?, - isTrasformer: Boolean, - isResidual: Boolean, - isReset: Boolean - ): Boolean { - return if (mObj != 0L) { - updatePointCloudDataByPbJni(mObj, dataArray, isTrasformer, isResidual, isReset) + fun updatePointCloudDataByPb(dataArray: ByteArray?, isTrasformer: Boolean, isResidual: Boolean, isReset: Boolean): Boolean { + val obj = mObj.get() + return if (obj != 0L) { + updatePointCloudDataByPbJni(obj, dataArray, isTrasformer, isResidual, isReset) } else false } - fun updatePointCloudData( - dataStr: String, - isTrasformer: Boolean, - isResidual: Boolean, - isReset: Boolean - ): Boolean { - return if (mObj != 0L) { - updatePointCloudDataJni(mObj, dataStr, isTrasformer, isResidual, isReset) + fun updatePointCloudData(dataStr: String, isTrasformer: Boolean, isResidual: Boolean, isReset: Boolean): Boolean { + val obj = mObj.get() + return if (obj != 0L) { + updatePointCloudDataJni(obj, dataStr, isTrasformer, isResidual, isReset) } else false } fun setIsDrawPointCloud(isDrawPointCloud: Boolean) { - if (mObj != 0L) { - setIsDrawPointCloudJni(mObj, isDrawPointCloud) + val obj = mObj.get() + if (obj != 0L) { + setIsDrawPointCloudJni(obj, isDrawPointCloud) } } fun setPointCloudDisplayFllowAnim(isDisplayFllowAnim: Boolean, totalAnimTime: Int) { - if (mObj != 0L) { - setPointCloudDisplayFllowAnimJni(mObj, isDisplayFllowAnim, totalAnimTime) + val obj = mObj.get() + if (obj != 0L) { + setPointCloudDisplayFllowAnimJni(obj, isDisplayFllowAnim, totalAnimTime) } } fun setPointCloudSize(pointCloudSize: Float) { - if (mObj != 0L) { - setPointCloudSizeJni(mObj, pointCloudSize) + val obj = mObj.get() + if (obj != 0L) { + setPointCloudSizeJni(obj, pointCloudSize) } } fun setPointCloudColor(color: String) { - if (mObj != 0L) { - setPointCloudColorJni(mObj, color) + val obj = mObj.get() + if (obj != 0L) { + setPointCloudColorJni(obj, color) } } fun setIsEnableShadow(b: Boolean) { - if (mObj != 0L) { - setIsEnableShadowJni(mObj, b) + val obj = mObj.get() + if (obj != 0L) { + setIsEnableShadowJni(obj, b) } } fun setHDTypeVisible(type: IntArray?) { - if (mObj != 0L) { - setHDTypeVisibleJni(mObj, type) + val obj = mObj.get() + if (obj != 0L) { + setHDTypeVisibleJni(obj, type) } } fun switchData(x: Double, y: Double, isWgs84: Boolean): DoubleArray? { - return if (mObj != 0L) { - switchDataJni(mObj, x, y, isWgs84) + val obj = mObj.get() + return if (obj != 0L) { + switchDataJni(obj, x, y, isWgs84) } else null } - fun updateAnchorByJson( - anchorId: String, - json: String, - infobitmap: ByteArray?, - infoWidth: Int, - infoHeight: Int - ): Boolean { - return if (mObj != 0L) { - updateAnchorByJsonJni(mObj, anchorId, json, infobitmap, infoWidth, infoHeight) + fun updateAnchorByJson(anchorId: String, json: String, infobitmap: ByteArray?, infoWidth: Int, infoHeight: Int): Boolean { + val obj = mObj.get() + return if (obj != 0L) { + updateAnchorByJsonJni(obj, anchorId, json, infobitmap, infoWidth, infoHeight) } else false } fun setSomeAnchorZIndex(anchorId: String, zIndex: Int) { - if (mObj != 0L) { - setSomeAnchorZIndexJni(mObj, anchorId, zIndex) + val obj = mObj.get() + if (obj != 0L) { + setSomeAnchorZIndexJni(obj, anchorId, zIndex) } } fun drawAnchor(nameId: String, lon: Double, lat: Double, imagePath: String) { - if (mObj != 0L) { - drawAnchorJni(mObj, nameId, lon, lat, imagePath) + val obj = mObj.get() + if (obj != 0L) { + drawAnchorJni(obj, nameId, lon, lat, imagePath) } } fun removeAnchor(anchorId: String) { - if (mObj != 0L) { - removeAnchorJni(mObj, anchorId) + val obj = mObj.get() + if (obj != 0L) { + removeAnchorJni(obj, anchorId) } } fun findAnchorAtScreen(x: Int, y: Int): String { - return if (mObj != 0L) { - findAnchorAtScreenJni(mObj, x, y) + val obj = mObj.get() + return if (obj != 0L) { + findAnchorAtScreenJni(obj, x, y) } else "" } fun startAnimation(anchorId: String) { - if (mObj != 0L) { - startAnimationJni(mObj, anchorId) + val obj = mObj.get() + if (obj != 0L) { + startAnimationJni(obj, anchorId) } } fun endAnimation(anchorId: String) { - if (mObj != 0L) { - endAnimationJni(mObj, anchorId) + val obj = mObj.get() + if (obj != 0L) { + endAnimationJni(obj, anchorId) } } - fun addDynamicAnchorPostion( - anchorId: String, - points: DoubleArray, - angle: Float, - current: Long, - duration: Int - ) { - if (mObj != 0L) { - addDynamicAnchorPostionJni(mObj, anchorId, points, angle, current, duration) + fun addDynamicAnchorPostion(anchorId: String, points: DoubleArray, angle: Float, current: Long, duration: Int) { + val obj = mObj.get() + if (obj != 0L) { + addDynamicAnchorPostionJni(obj, anchorId, points, angle, current, duration) } } fun addTranslateAnimationToAnchor(anchorId: String, points: DoubleArray, duration: Int) { - if (mObj != 0L) { - addTranslateAnimationToAnchorJni(mObj, anchorId, points, duration) + val obj = mObj.get() + if (obj != 0L) { + addTranslateAnimationToAnchorJni(obj, anchorId, points, duration) } } fun addScaleAnimationToAnchor(anchorId: String, min: Float, max: Float, duration: Int) { - if (mObj != 0L) { - addScaleAnimationToAnchorJni(mObj, anchorId, min, max, duration) + val obj = mObj.get() + if (obj != 0L) { + addScaleAnimationToAnchorJni(obj, anchorId, min, max, duration) } } fun addFlashAnimationToAnchor(anchorId: String, imageJson: String, duration: Int) { - if (mObj != 0L) { - addFlashAnimationToAnchorJni(mObj, anchorId, imageJson, duration) + val obj = mObj.get() + if (obj != 0L) { + addFlashAnimationToAnchorJni(obj, anchorId, imageJson, duration) } } - fun addRotateAnimationToAnchor( - anchorId: String, - startAngle: Float, - endAngle: Float, - duration: Int - ) { - if (mObj != 0L) { - addRotateAnimationToAnchorJni(mObj, anchorId, startAngle, endAngle, duration) + fun addRotateAnimationToAnchor(anchorId: String, startAngle: Float, endAngle: Float, duration: Int) { + val obj = mObj.get() + if (obj != 0L) { + addRotateAnimationToAnchorJni(obj, anchorId, startAngle, endAngle, duration) } } fun setSomeAnchorCanClickable(anchorId: String, canClickable: Boolean) { - if (mObj != 0L) { - setSomeAnchorCanClickableJni(mObj, anchorId, canClickable) + val obj = mObj.get() + if (obj != 0L) { + setSomeAnchorCanClickableJni(obj, anchorId, canClickable) } } fun setSomeAnchorUnTop(anchorId: String) { - if (mObj != 0L) { - setSomeAnchorUnTopJni(mObj, anchorId) + val obj = mObj.get() + if (obj != 0L) { + setSomeAnchorUnTopJni(obj, anchorId) } } fun setSomeAnchorTop(anchorId: String) { - if (mObj != 0L) { - setSomeAnchorTopJni(mObj, anchorId) + val obj = mObj.get() + if (obj != 0L) { + setSomeAnchorTopJni(obj, anchorId) } } fun setSomeAnchorInfowindowOffset(anchorId: String, disx: Int, disy: Int) { - if (mObj != 0L) { - setSomeAnchorInfowindowOffsetJni(mObj, anchorId, disx, disy) + val obj = mObj.get() + if (obj != 0L) { + setSomeAnchorInfowindowOffsetJni(obj, anchorId, disx, disy) } } fun setSomeAnchorFlat(anchorId: String, isFlat: Boolean) { - if (mObj != 0L) { - setSomeAnchorFlatJni(mObj, anchorId, isFlat) + val obj = mObj.get() + if (obj != 0L) { + setSomeAnchorFlatJni(obj, anchorId, isFlat) } } fun setSomeAnchorDrawModel(anchorId: String, dragModel: Boolean) { - if (mObj != 0L) { - setSomeAnchorDrawModelJni(mObj, anchorId, dragModel) + val obj = mObj.get() + if (obj != 0L) { + setSomeAnchorDrawModelJni(obj, anchorId, dragModel) } } fun setSomeDrawModelPointScreenPosition(screenx: Int, screeny: Int): Boolean { - return if (mObj != 0L) { - setSomeDrawModelPointScreenPositionJni(mObj, screenx, screeny) + val obj = mObj.get() + return if (obj != 0L) { + setSomeDrawModelPointScreenPositionJni(obj, screenx, screeny) } else false } fun addManyAnchors(json: String, count: Int) { - if (mObj != 0L) { - addManyAnchorsJni(mObj, json, count) + val obj = mObj.get() + if (obj != 0L) { + addManyAnchorsJni(obj, json, count) } } fun addManyAnchorByJson(json: String, count: Int) { - if (mObj != 0L) { - addManyAnchorByJsonJni(mObj, json, count) + val obj = mObj.get() + if (obj != 0L) { + addManyAnchorByJsonJni(obj, json, count) } } fun removeClusterByClusterid(clusterId: String) { - if (mObj != 0L) { - removeClusterByClusteridJni(mObj, clusterId) + val obj = mObj.get() + if (obj != 0L) { + removeClusterByClusteridJni(obj, clusterId) } } fun removeManyAnchor(allAnchorJson: String, count: Int) { - if (mObj != 0L) { - removeManyAnchorJni(mObj, allAnchorJson, count) + val obj = mObj.get() + if (obj != 0L) { + removeManyAnchorJni(obj, allAnchorJson, count) } } fun clearAllCluster() { - if (mObj != 0L) { - clearAllClusterJni(mObj) + val obj = mObj.get() + if (obj != 0L) { + clearAllClusterJni(obj) } } - fun createConstAnchor( - attribute: String, - infoBitmap: ByteArray?, - infoWidth: Int, - infoHeight: Int - ): Boolean { - return if (mObj != 0L) { - createConstAnchorJni(mObj, attribute, infoBitmap, infoWidth, infoHeight) + fun createConstAnchor(attribute: String, infoBitmap: ByteArray?, infoWidth: Int, infoHeight: Int): Boolean { + val obj = mObj.get() + return if (obj != 0L) { + createConstAnchorJni(obj, attribute, infoBitmap, infoWidth, infoHeight) } else false } fun addAnchorAsync(json: String) { - if (mObj != 0L) { - addAnchorAsyncJni(mObj, json) + val obj = mObj.get() + if (obj != 0L) { + addAnchorAsyncJni(obj, json) } } fun executeAnchorAdd() { - if (mObj != 0L) { - executeAnchorAddJni(mObj) + val obj = mObj.get() + if (obj != 0L) { + executeAnchorAddJni(obj) } } fun setConstAnchorPositionFlag(isUpdate: Boolean) { - if (mObj != 0L) { - setConstAnchorPositionFlagJni(mObj, isUpdate) + val obj = mObj.get() + if (obj != 0L) { + setConstAnchorPositionFlagJni(obj, isUpdate) } } fun addAnchor(json: String, infoBitmap: ByteArray?, infoWidth: Int, infoHeight: Int): Boolean { - return if (mObj != 0L) { - addAnchorJni(mObj, json, infoBitmap, infoWidth, infoHeight) + val obj = mObj.get() + return if (obj != 0L) { + addAnchorJni(obj, json, infoBitmap, infoWidth, infoHeight) } else false } fun getAnchorProperty(id: String, propertyName: String): String { - return if (mObj != 0L) { - getAnchorPropertyJni(mObj, id, propertyName) + val obj = mObj.get() + return if (obj != 0L) { + getAnchorPropertyJni(obj, id, propertyName) } else "" } fun updateAnchorProperty(id: String, propertyName: String, propertyValue: String): Boolean { - return if (mObj != 0L) { - updateAnchorPropertyJni(mObj, id, propertyName, propertyValue) + val obj = mObj.get() + return if (obj != 0L) { + updateAnchorPropertyJni(obj, id, propertyName, propertyValue) } else false } - fun updateInfoWindowWithBitMap( - id: String, - imageData: ByteArray, - width: Int, - height: Int - ): Boolean { - return if (mObj != 0L) { - updateInfoWindowWithBitMapJni(mObj, id, imageData, width, height) + fun updateInfoWindowWithBitMap(id: String, imageData: ByteArray, width: Int, height: Int): Boolean { + val obj = mObj.get() + return if (obj != 0L) { + updateInfoWindowWithBitMapJni(obj, id, imageData, width, height) } else false } fun updateAnchorWithBitmap(id: String, imageKey: String): Boolean { - return if (mObj != 0L) { - updateAnchorWithBitmapJni(mObj, id, imageKey) + val obj = mObj.get() + return if (obj != 0L) { + updateAnchorWithBitmapJni(obj, id, imageKey) } else false } fun clearAllAnchors(): Boolean { - return if (mObj != 0L) { - clearAllAnchorsJni(mObj) + val obj = mObj.get() + return if (obj != 0L) { + clearAllAnchorsJni(obj) } else false } fun showInfoWindow(id: String) { - if (mObj != 0L) { - showInfoWindowJni(mObj, id) + val obj = mObj.get() + if (obj != 0L) { + showInfoWindowJni(obj, id) } } fun hideInfoWindow(id: String) { - if (mObj != 0L) { - hideInfoWindowJni(mObj, id) + val obj = mObj.get() + if (obj != 0L) { + hideInfoWindowJni(obj, id) } } fun setAnchorRate(rate: Float) { - if (mObj != 0L) { - setAnchorRateJni(mObj, rate) + val obj = mObj.get() + if (obj != 0L) { + setAnchorRateJni(obj, rate) } } fun setAnchorScale(wideLeft: Float, wideRight: Float, highUp: Float, hightDown: Float) { - if (mObj != 0L) { - setAnchorScaleJni(mObj, wideLeft, wideRight, highUp, hightDown) + val obj = mObj.get() + if (obj != 0L) { + setAnchorScaleJni(obj, wideLeft, wideRight, highUp, hightDown) } } fun setNameMode(mode: Int, recordCnt: Int) { - if (mObj != 0L) { - setNameModeJni(mObj, mode, recordCnt) + val obj = mObj.get() + if (obj != 0L) { + setNameModeJni(obj, mode, recordCnt) } } fun setSelfLocaionControl(mode: Int) { - if (mObj != 0L) { - setSelfLocaionControlJni(mObj, mode) + val obj = mObj.get() + if (obj != 0L) { + setSelfLocaionControlJni(obj, mode) } } fun setLockSelfCar(enable: Boolean) { - if (mObj != 0L) { - setLockSelfCarJni(mObj, enable) + val obj = mObj.get() + if (obj != 0L) { + setLockSelfCarJni(obj, enable) } } fun isAnchorDynamicMoving(anchorID: String): Boolean { - return if (mObj != 0L) { - isAnchorDynamicMovingJni(mObj, anchorID) + val obj = mObj.get() + return if (obj != 0L) { + isAnchorDynamicMovingJni(obj, anchorID) } else false } -// fun updateBatchAnchorPositon(dataStr: String): Boolean { -// return if (mObj != 0L) { -// updateBatchAnchorPositonJni(mObj, dataStr) -// } else false -// } + // fun updateBatchAnchorPositon(dataStr: String): Boolean { + // return if (mObj.get() != 0L) { + // updateBatchAnchorPositonJni(mObj.get(), dataStr) + // } else false + // } - fun updateBatchAnchorPositon(data: ByteArray?): Boolean{ - return if(mObj != 0L){ - updateBatchAnchorPositonJni(mObj,data); - }else false + fun updateBatchAnchorPositon(data: ByteArray?): Boolean { + val obj = mObj.get() + return if (obj != 0L) { + updateBatchAnchorPositonJni(obj, data); + } else false } fun setAnchorFlash(id: String, colorType: Int, color: String, time: Float, angle: Float) { - if (mObj != 0L) { - setAnchorFlashJni(mObj, id, colorType, color, time, angle) + val obj = mObj.get() + if (obj != 0L) { + setAnchorFlashJni(obj, id, colorType, color, time, angle) } } - fun setAnchorGradientColor( - startColor: String, - endColor: String, - startDistance: Float, - endDistance: Float - ) { - if (mObj != 0L) { - setAnchorGradientColorJni(mObj, startColor, endColor, startDistance, endDistance) + fun setAnchorGradientColor(startColor: String, endColor: String, startDistance: Float, endDistance: Float) { + val obj = mObj.get() + if (obj != 0L) { + setAnchorGradientColorJni(obj, startColor, endColor, startDistance, endDistance) } } fun setTailLightsType(type: Int, time: Int) { - if (mObj != 0L) { - setTailLightsTypeJni(mObj, type, time) + val obj = mObj.get() + if (obj != 0L) { + setTailLightsTypeJni(obj, type, time) } } - fun drawLine( - name: String, - points: DoubleArray, - lineWidth: Int, - r: Char, - g: Char, - b: Char, - a: Char, - isLoop: Boolean - ) { - if (mObj != 0L) { - drawLineJni(mObj, name, points, lineWidth, r, g, b, a, isLoop) + fun drawLine(name: String, points: DoubleArray, lineWidth: Int, r: Char, g: Char, b: Char, a: Char, isLoop: Boolean) { + val obj = mObj.get() + if (obj != 0L) { + drawLineJni(obj, name, points, lineWidth, r, g, b, a, isLoop) } } fun drawCircle(name: String, lonlats: DoubleArray, r: Char, g: Char, b: Char, a: Char) { - if (mObj != 0L) { - drawCircleJni(mObj, name, lonlats, r, g, b, a) + val obj = mObj.get() + if (obj != 0L) { + drawCircleJni(obj, name, lonlats, r, g, b, a) } } fun drawEllipse(name: String, lonlats: DoubleArray, r: Char, g: Char, b: Char, a: Char) { - if (mObj != 0L) { - drawEllipseJni(mObj, name, lonlats, r, g, b, a) + val obj = mObj.get() + if (obj != 0L) { + drawEllipseJni(obj, name, lonlats, r, g, b, a) } } fun drawPolygon(name: String, lonlats: DoubleArray, r: Char, g: Char, b: Char, a: Char) { - if (mObj != 0L) { - drawPolygonJni(mObj, name, lonlats, r, g, b, a) + val obj = mObj.get() + if (obj != 0L) { + drawPolygonJni(obj, name, lonlats, r, g, b, a) } } fun removePrimitiveByNameId(name: String) { - if (mObj != 0L) { - removePrimitiveByNameIdJni(mObj, name) + val obj = mObj.get() + if (obj != 0L) { + removePrimitiveByNameIdJni(obj, name) } } fun drawLine(jsonOption: String) { - if (mObj != 0L) { - drawLineJni(mObj, jsonOption) + val obj = mObj.get() + if (obj != 0L) { + drawLineJni(obj, jsonOption) } } fun drawThickLine(strJsonOption: String) { - if (mObj != 0L) { - drawThickLineJni(mObj, strJsonOption) + val obj = mObj.get() + if (obj != 0L) { + drawThickLineJni(obj, strJsonOption) } } fun setVisiable(id: String, bVisiable: Boolean) { - if (mObj != 0L) { - setVisiableJni(mObj, id, bVisiable) + val obj = mObj.get() + if (obj != 0L) { + setVisiableJni(obj, id, bVisiable) } } fun setWidth(id: String, width: Float) { - if (mObj != 0L) { - setWidthJni(mObj, id, width) + val obj = mObj.get() + if (obj != 0L) { + setWidthJni(obj, id, width) } } fun setGeodesic(id: String, bGeodesic: Boolean) { - if (mObj != 0L) { - setGeodesicJni(mObj, id, bGeodesic) + val obj = mObj.get() + if (obj != 0L) { + setGeodesicJni(obj, id, bGeodesic) } } fun setTransparency(id: String, transparency: Float) { - if (mObj != 0L) { - setTransparencyJni(mObj, id, transparency) + val obj = mObj.get() + if (obj != 0L) { + setTransparencyJni(obj, id, transparency) } } fun setColor(id: String, color: Int) { - if (mObj != 0L) { - setColorJni(mObj, id, color) + val obj = mObj.get() + if (obj != 0L) { + setColorJni(obj, id, color) } } fun setZIndex(id: String, zIndex: Float) { - if (mObj != 0L) { - setZIndexJni(mObj, id, zIndex) + val obj = mObj.get() + if (obj != 0L) { + setZIndexJni(obj, id, zIndex) } } fun useGradient(id: String, bUseGradient: Boolean) { - if (mObj != 0L) { - useGradientJni(mObj, id, bUseGradient) + val obj = mObj.get() + if (obj != 0L) { + useGradientJni(obj, id, bUseGradient) } } fun setDottedLineType(id: String, type: Int) { - if (mObj != 0L) { - setDottedLineTypeJni(mObj, id, type) + val obj = mObj.get() + if (obj != 0L) { + setDottedLineTypeJni(obj, id, type) } } fun setOption(id: String, strJsonOption: String) { - if (mObj != 0L) { - setOptionJni(mObj, id, strJsonOption) + val obj = mObj.get() + if (obj != 0L) { + setOptionJni(obj, id, strJsonOption) } } - fun draw3DPolygon( - id: String, - lonlatArr: DoubleArray, - height: Float, - width: Float, - count: Int, - color: FloatArray - ) { - if (mObj != 0L) { - draw3DPolygonJni(mObj, id, lonlatArr, height, width, count, color) + fun draw3DPolygon(id: String, lonlatArr: DoubleArray, height: Float, width: Float, count: Int, color: FloatArray) { + val obj = mObj.get() + if (obj != 0L) { + draw3DPolygonJni(obj, id, lonlatArr, height, width, count, color) } } fun clearAllPrimitives(): Boolean { - return if (mObj != 0L) { - clearAllPrimitivesJni(mObj) + val obj = mObj.get() + return if (obj != 0L) { + clearAllPrimitivesJni(obj) } else false } fun setDeadZoneVisiable(enable: Boolean) { - if (mObj != 0L) { - setDeadZoneVisiableJni(mObj,enable) + val obj = mObj.get() + if (obj != 0L) { + setDeadZoneVisiableJni(obj, enable) } } - fun drawDeadZone(strJsonOption:String?) { - if (mObj != 0L) { - drawDeadZoneJni(mObj,strJsonOption) + fun drawDeadZone(strJsonOption: String?) { + val obj = mObj.get() + if (obj != 0L) { + drawDeadZoneJni(obj, strJsonOption) } } fun setCfgKeyVal(key: String?, value: String?) { - if(mObj != 0L){ - setCfgKeyValJni(mObj,key,value) + val obj = mObj.get() + if (obj != 0L) { + setCfgKeyValJni(obj, key, value) } } fun unload() { Log.i(TAG, "MapEngine: unload") - if (mObj != 0L) { - unloadJni(mObj) - mObj = 0 - } - } - fun setLightWave(cmd:String){ - if (mObj != 0L) { - setPainterCmdJni(mObj,"lightwave",cmd) + val obj = mObj.get() + if (obj != 0L) { + if (mObj.compareAndSet(obj, 0L)) { + unloadJni(obj) + } } } - fun setGuideLine(cmd:String?){ - if (mObj != 0L) { - setPainterCmdJni(mObj,"guideline",cmd) + fun setLightWave(cmd: String) { + val obj = mObj.get() + if (obj != 0L) { + setPainterCmdJni(obj, "lightwave", cmd) } } - fun setTexture(name: String,ba:ByteArray?){ - if (mObj != 0L) { - setTextureJni(mObj,name,ba) + + fun setGuideLine(cmd: String?) { + val obj = mObj.get() + if (obj != 0L) { + setPainterCmdJni(obj, "guideline", cmd) } } - fun setStyleName(name:String){ - if (mObj != 0L) { - setPainterCmdJni(mObj,"style",name) + + fun setTexture(name: String, ba: ByteArray?) { + val obj = mObj.get() + if (obj != 0L) { + setTextureJni(obj, name, ba) } } - fun onChangeStyle(styleMode:Int){ - if(styleMode== MapAutoApi.MAP_STYLE_NIGHT_VR) - setStyleName("night") - else if(styleMode== MapAutoApi.MAP_STYLE_DAY_VR) - setStyleName("day") - else if(styleMode== MapAutoApi.MAP_STYLE_DAY_VR_BUS) - setStyleName("bus_day") - else if(styleMode== MapAutoApi.MAP_STYLE_DAY_VR_TAXI) - setStyleName("taxi_day") + + fun setStyleName(name: String) { + val obj = mObj.get() + if (obj != 0L) { + setPainterCmdJni(obj, "style", name) + } } - private external fun loadJni(projectDir: String, mapView: MapView?,assetManager: AssetManager?): Long - private external fun resizeJni(obj:Long,newWidth: Int, newHeight: Int) + fun onChangeStyle(styleMode: Int) { + if (styleMode == MapAutoApi.MAP_STYLE_NIGHT_VR) setStyleName("night") + else if (styleMode == MapAutoApi.MAP_STYLE_DAY_VR) setStyleName("day") + else if (styleMode == MapAutoApi.MAP_STYLE_DAY_VR_BUS) setStyleName("bus_day") + else if (styleMode == MapAutoApi.MAP_STYLE_DAY_VR_TAXI) setStyleName("taxi_day") + } - private external fun renderJni(obj:Long) + private external fun loadJni(projectDir: String, mapView: MapView?, assetManager: AssetManager?): Long - private external fun scrollJni(obj:Long,dx: Float, dy: Float) + private external fun resizeJni(obj: Long, newWidth: Int, newHeight: Int) - private external fun scrollByAnimJni(obj:Long,dx: Float, dy: Float) + private external fun renderJni(obj: Long) - private external fun setZoomIndexJni(obj:Long,zoomIndex: Int) + private external fun scrollJni(obj: Long, dx: Float, dy: Float) - private external fun getZoomIndexJni(obj:Long): Int + private external fun scrollByAnimJni(obj: Long, dx: Float, dy: Float) - private external fun setZoomValueJni(obj:Long,zoomValue: Float) + private external fun setZoomIndexJni(obj: Long, zoomIndex: Int) - private external fun getZoomValueJni(obj:Long): Float + private external fun getZoomIndexJni(obj: Long): Int - private external fun zoomInJni(obj:Long) + private external fun setZoomValueJni(obj: Long, zoomValue: Float) - private external fun zoomOutJni(obj:Long) + private external fun getZoomValueJni(obj: Long): Float - private external fun scaleJni(obj:Long,scale: Float) + private external fun zoomInJni(obj: Long) - private external fun scaleByCenterJni(obj:Long,centerX: Int, centerY: Int, scale: Float) + private external fun zoomOutJni(obj: Long) - private external fun rotateJni(obj:Long,angle: Float) + private external fun scaleJni(obj: Long, scale: Float) - private external fun lookUpDownJni(obj:Long,look: Float) + private external fun scaleByCenterJni(obj: Long, centerX: Int, centerY: Int, scale: Float) - private external fun setCenterJni(obj:Long,lon: Double, lat: Double) + private external fun rotateJni(obj: Long, angle: Float) - private external fun getCenterJni(obj:Long,point: DoubleArray) + private external fun lookUpDownJni(obj: Long, look: Float) + + private external fun setCenterJni(obj: Long, lon: Double, lat: Double) + + private external fun getCenterJni(obj: Long, point: DoubleArray) + + private external fun animateToJni(obj: Long, lon: Double, lat: Double, alt: Float, zoom: Float, rotateAngle: Float, overlookAngle: Float, eyeHeight: Float, duration: Int, fov: Float) - private external fun animateToJni(obj:Long,lon: Double, lat: Double, alt: Float, zoom: Float, rotateAngle: Float, overlookAngle: Float, eyeHeight: Float, duration: Int,fov: Float) /** * 导航 设置导航参数 */ - private external fun setRoutePropJni(obj:Long,prop: Int, lon: Int, lat: Int) + private external fun setRoutePropJni(obj: Long, prop: Int, lon: Int, lat: Int) + /** * 导航 绘制导航 */ - private external fun drawRouteJni(obj:Long) + private external fun drawRouteJni(obj: Long) + /** * 导航 绘制导航指向标 */ - private external fun drawNavArrowJni(obj:Long) + private external fun drawNavArrowJni(obj: Long) + /** * 导航 获取导航路线 */ - private external fun getRulerInfoJni(obj:Long): Float + private external fun getRulerInfoJni(obj: Long): Float + /** * 导航 显示所有导航路线 */ - private external fun showAllRouteLineJni(obj:Long) + private external fun showAllRouteLineJni(obj: Long) + /** * 导航 显示导航路线 */ - private external fun showRouteLineJni(obj:Long,pOneX: Float, pOneY: Float, pTwoX: Float, pTwoY: Float) + private external fun showRouteLineJni(obj: Long, pOneX: Float, pOneY: Float, pTwoX: Float, pTwoY: Float) - private external fun addAntCoorJni(obj:Long,sessionId: Int, lon: Int, lat: Int, time: Int) + private external fun addAntCoorJni(obj: Long, sessionId: Int, lon: Int, lat: Int, time: Int) + + private external fun drawMapMatchedPositionJni(obj: Long) - private external fun drawMapMatchedPositionJni(obj:Long) /** * 导航 添加车标 */ - private external fun drawCarJni(obj:Long,lon: Long, lat: Long, z: Short, angle: Short, scale: Int, rate: Float, data: ByteArray?, len: Int) + private external fun drawCarJni(obj: Long, lon: Long, lat: Long, z: Short, angle: Short, scale: Int, rate: Float, data: ByteArray?, len: Int) + /** * 导航 更新车标 */ - private external fun updateCarJni(obj:Long,lon: Long, lat: Long, z: Short, angle: Short) + private external fun updateCarJni(obj: Long, lon: Long, lat: Long, z: Short, angle: Short) + /** * 导航 获取车的位置 */ - private external fun getCarPositionJni(obj:Long,position: IntArray?): Int + private external fun getCarPositionJni(obj: Long, position: IntArray?): Int + /** * TMC */ - private external fun setTrafIDStatJni(obj:Long,locCode: Int, dir: Int, evtCode: Int) + private external fun setTrafIDStatJni(obj: Long, locCode: Int, dir: Int, evtCode: Int) + /** * TMC */ - private external fun getTrafIDStatJni(obj:Long,tileId: Int, linkId: Int): Int + private external fun getTrafIDStatJni(obj: Long, tileId: Int, linkId: Int): Int + /** * TMC 开关 */ - private external fun setTrafficJni(obj:Long,stat: Int) + private external fun setTrafficJni(obj: Long, stat: Int) + /** * TMC 是否开启 */ - private external fun isTrafficOnJni(obj:Long): Boolean + private external fun isTrafficOnJni(obj: Long): Boolean + /** * TMC */ - private external fun commitTrafficStatJni(obj:Long,locTableCode: Int) + private external fun commitTrafficStatJni(obj: Long, locTableCode: Int) + /** * 导航 */ - private external fun routeSearchingJni(obj:Long,showcnt: Int) + private external fun routeSearchingJni(obj: Long, showcnt: Int) + /** * 地图 获取3D角 */ - private external fun getDAngleJni(obj:Long): Float + private external fun getDAngleJni(obj: Long): Float + /** * 地图 设置3D角 */ - private external fun setDAngleJni(obj:Long,angle: Float) + private external fun setDAngleJni(obj: Long, angle: Float) + /** * 地图 获取偏转角 */ - private external fun getRotateAngleJni(obj:Long): Float + private external fun getRotateAngleJni(obj: Long): Float + /** * 地图 设置偏转角 */ - private external fun setRotateAngleJni(obj:Long,angle: Float) + private external fun setRotateAngleJni(obj: Long, angle: Float) //视域调整 - private external fun setVerticalViewFieldAngleJni(obj:Long,angle: Float) + private external fun setVerticalViewFieldAngleJni(obj: Long, angle: Float) //获取视域角 - private external fun getVerticalViewFieldAngleJni(obj:Long): Float + private external fun getVerticalViewFieldAngleJni(obj: Long): Float //获取眼睛高度 - private external fun getEyeHeightJni(obj:Long): Float + private external fun getEyeHeightJni(obj: Long): Float //设置眼睛高度 - private external fun setEyeHeightJni(obj:Long,eyeHeight: Float) + private external fun setEyeHeightJni(obj: Long, eyeHeight: Float) + /** * 导航 清理路由信息 */ - private external fun clearRouteObjsJni(obj:Long) + private external fun clearRouteObjsJni(obj: Long) + /** * 导航 清理路由信息 */ - private external fun clearRouteSearchedObjsJni(obj:Long) + private external fun clearRouteSearchedObjsJni(obj: Long) + /** * 搜索 绘制poi结果 */ - private external fun drawSearchResultJni(obj:Long) + private external fun drawSearchResultJni(obj: Long) + /** * 搜索 清理poi结果 */ - private external fun clearSearchResultJni(obj:Long) + private external fun clearSearchResultJni(obj: Long) // 视图模式 // 0: 日间模式 @@ -1187,73 +1284,84 @@ class MapEngine { // 3:日间导航模式 // 4:夜间导航模式 // 5.VR模式 - private external fun setMapStyleJni(obj:Long,styleMode: Int) + private external fun setMapStyleJni(obj: Long, styleMode: Int) - private external fun getMapStyleJni(obj:Long): Int + private external fun getMapStyleJni(obj: Long): Int + + private external fun set3DBuildingVisibleJni(obj: Long, isVisibel: Boolean) - private external fun set3DBuildingVisibleJni(obj:Long,isVisibel: Boolean) /** * 地图 经纬度转屏幕坐标 */ - private external fun lonlatToPixelsJni(obj:Long,lon: Double, lat: Double): Pixels? + private external fun lonlatToPixelsJni(obj: Long, lon: Double, lat: Double): Pixels? + /** * 地图 屏幕坐标转经纬度 */ - private external fun pixelsToLonlatJni(obj:Long,x: Float, y: Float): LonLat? + private external fun pixelsToLonlatJni(obj: Long, x: Float, y: Float): LonLat? //场景刷新 - private external fun shakeSceneManualJni(obj:Long) + private external fun shakeSceneManualJni(obj: Long) //地图刷新 - private external fun shakeMapManualJni(obj:Long) + private external fun shakeMapManualJni(obj: Long) + //获取屏幕分辨率 - private external fun getResulationJni(obj:Long): Float + private external fun getResulationJni(obj: Long): Float - private external fun drawTrafficJni(obj:Long,trafficJson: String) + private external fun drawTrafficJni(obj: Long, trafficJson: String) - private external fun addImageJni(obj:Long,imageKey: String, imageData: ByteArray?, width: Int, height: Int): Int + private external fun addImageJni(obj: Long, imageKey: String, imageData: ByteArray?, width: Int, height: Int): Int - private external fun removeImageJni(obj:Long,imageKey: String) + private external fun removeImageJni(obj: Long, imageKey: String) - private external fun updateImageJni(obj:Long,imageKey: String, imageData: ByteArray?, width: Int, height: Int) + private external fun updateImageJni(obj: Long, imageKey: String, imageData: ByteArray?, width: Int, height: Int) + + private external fun getSuitableZoomJni(obj: Long, minLon: Double, minLat: Double, maxLon: Double, maxLat: Double): Int - private external fun getSuitableZoomJni(obj:Long,minLon: Double, minLat: Double, maxLon: Double, maxLat: Double): Int /** * TMC 清理TMC已绘制数据 */ - private external fun clearAllTmcLinesJni(obj:Long) + private external fun clearAllTmcLinesJni(obj: Long) + /** * TMC 设置TMC数据 */ - private external fun setTmcDataJni(obj:Long,tmcData: ByteArray?) + private external fun setTmcDataJni(obj: Long, tmcData: ByteArray?) - private external fun setEyeToOriginDisJni(obj:Long,eyeToOriginDis: Float) + private external fun setEyeToOriginDisJni(obj: Long, eyeToOriginDis: Float) + + private external fun setScreenToOriginDisJni(obj: Long, screenToOriginDis: Float) - private external fun setScreenToOriginDisJni(obj:Long,screenToOriginDis: Float) // 设置缩放中心点 - private external fun setScaleMapCenterJni(obj:Long,lon: Double, lat: Double) + private external fun setScaleMapCenterJni(obj: Long, lon: Double, lat: Double) + //自定义路径 private external fun setStyleDirJni(dir: String) + /** * 地图 设置屏幕中心偏移 */ - private external fun setOffsetJni(obj:Long,lon: Int, lat: Int) + private external fun setOffsetJni(obj: Long, lon: Int, lat: Int) + + private external fun setOffsetByRateJni(obj: Long, rateX: Float, rateY: Float, angle: Float) - private external fun setOffsetByRateJni(obj:Long,rateX: Float, rateY: Float, angle: Float) //设置屏幕上的某个像素点为地图中心点。 - private external fun setPointToCenterJni(obj:Long,xRate: Float, yRate: Float) + private external fun setPointToCenterJni(obj: Long, xRate: Float, yRate: Float) + //设置同频渲染相关参数 - private external fun setRenderFrequencyJni(obj:Long,enable: Boolean, renderTimePer: Int) + private external fun setRenderFrequencyJni(obj: Long, enable: Boolean, renderTimePer: Int) + //设置灯光位置 - private external fun setLightPositionJni(obj:Long,position: FloatArray) + private external fun setLightPositionJni(obj: Long, position: FloatArray) //漫反射 - private external fun setLightDiffuseJni(obj:Long,color: FloatArray) + private external fun setLightDiffuseJni(obj: Long, color: FloatArray) //镜面反射 - private external fun setLightSpecularJni(obj:Long,color: FloatArray) + private external fun setLightSpecularJni(obj: Long, color: FloatArray) - private external fun setFrontFaceShinessJni(obj:Long,frontFaceShiness: Float) + private external fun setFrontFaceShinessJni(obj: Long, frontFaceShiness: Float) /** * 更新点云数据 @@ -1263,7 +1371,7 @@ class MapEngine { * @param isReset 是否重置数据 * @return 是否执行 */ - private external fun updatePointCloudDataByPbJni(obj:Long,dataArray: ByteArray?, isTrasformer: Boolean, isResidual: Boolean, isReset: Boolean): Boolean + private external fun updatePointCloudDataByPbJni(obj: Long, dataArray: ByteArray?, isTrasformer: Boolean, isResidual: Boolean, isReset: Boolean): Boolean /** * 更新点云数据 @@ -1273,59 +1381,46 @@ class MapEngine { * @param isReset 是否重置数据 * @return 是否执行 */ - private external fun updatePointCloudDataJni(obj:Long,dataStr: String, isTrasformer: Boolean, isResidual: Boolean, isReset: Boolean): Boolean + private external fun updatePointCloudDataJni(obj: Long, dataStr: String, isTrasformer: Boolean, isResidual: Boolean, isReset: Boolean): Boolean /** * 设置是否绘制点云 * @param isDrawPointCloud 是否绘制 默认false 不绘制 */ - private external fun setIsDrawPointCloudJni(obj:Long,isDrawPointCloud: Boolean) + private external fun setIsDrawPointCloudJni(obj: Long, isDrawPointCloud: Boolean) /** * 绘制点云是否有动画 * @param isDisplayFllowAnim 是否有动画 * @param totalAnimTime 动画时间(100-10000) */ - private external fun setPointCloudDisplayFllowAnimJni(obj:Long,isDisplayFllowAnim: Boolean, totalAnimTime: Int) + private external fun setPointCloudDisplayFllowAnimJni(obj: Long, isDisplayFllowAnim: Boolean, totalAnimTime: Int) // 点云大小设置(0.1-20) - private external fun setPointCloudSizeJni(obj:Long,pointCloudSize: Float) + private external fun setPointCloudSizeJni(obj: Long, pointCloudSize: Float) // 点云颜色 - private external fun setPointCloudColorJni(obj:Long,color: String) + private external fun setPointCloudColorJni(obj: Long, color: String) //更新高精地图显示元素 - private external fun setHDTypeVisibleJni(obj:Long,type: IntArray?) + private external fun setHDTypeVisibleJni(obj: Long, type: IntArray?) - private external fun unloadJni(obj:Long) + private external fun unloadJni(obj: Long) //是否启用阴影 - private external fun setIsEnableShadowJni(obj:Long,b: Boolean) + private external fun setIsEnableShadowJni(obj: Long, b: Boolean) external fun isCollision(data: String): String //转换数据 - private external fun switchDataJni(obj:Long,x: Double, y: Double, isWgs84: Boolean): DoubleArray + private external fun switchDataJni(obj: Long, x: Double, y: Double, isWgs84: Boolean): DoubleArray - private external fun setStyleNameJni(obj:Long,name: String) + private external fun setStyleNameJni(obj: Long, name: String) - private external fun updateAnchorByJsonJni( - obj: Long, - anchorId: String, - json: String, - infobitmap: ByteArray?, - infoWidth: Int, - infoHeight: Int - ): Boolean + private external fun updateAnchorByJsonJni(obj: Long, anchorId: String, json: String, infobitmap: ByteArray?, infoWidth: Int, infoHeight: Int): Boolean private external fun setSomeAnchorZIndexJni(obj: Long, anchorId: String, zIndex: Int) - private external fun drawAnchorJni( - obj: Long, - nameId: String, - lon: Double, - lat: Double, - imagePath: String - ) + private external fun drawAnchorJni(obj: Long, nameId: String, lon: Double, lat: Double, imagePath: String) private external fun removeAnchorJni(obj: Long, anchorId: String) private external fun findAnchorAtScreenJni(obj: Long, x: Int, y: Int): String @@ -1335,65 +1430,27 @@ class MapEngine { private external fun endAnimationJni(obj: Long, anchorId: String) //动态平移 - private external fun addDynamicAnchorPostionJni( - obj: Long, - anchorId: String, - points: DoubleArray, - angle: Float, - current: Long, - duration: Int - ) + private external fun addDynamicAnchorPostionJni(obj: Long, anchorId: String, points: DoubleArray, angle: Float, current: Long, duration: Int) //平移 - private external fun addTranslateAnimationToAnchorJni( - obj: Long, - anchorId: String, - points: DoubleArray, - duration: Int - ) + private external fun addTranslateAnimationToAnchorJni(obj: Long, anchorId: String, points: DoubleArray, duration: Int) //缩放 - private external fun addScaleAnimationToAnchorJni( - obj: Long, - anchorId: String, - min: Float, - max: Float, - duration: Int - ) + private external fun addScaleAnimationToAnchorJni(obj: Long, anchorId: String, min: Float, max: Float, duration: Int) - private external fun addFlashAnimationToAnchorJni( - obj: Long, - anchorId: String, - imageJson: String, - duration: Int - ) + private external fun addFlashAnimationToAnchorJni(obj: Long, anchorId: String, imageJson: String, duration: Int) //旋转 - private external fun addRotateAnimationToAnchorJni( - obj: Long, - anchorId: String, - startAngle: Float, - endAngle: Float, - duration: Int - ) + private external fun addRotateAnimationToAnchorJni(obj: Long, anchorId: String, startAngle: Float, endAngle: Float, duration: Int) - private external fun setSomeAnchorCanClickableJni( - obj: Long, - anchorId: String, - canClickable: Boolean - ) + private external fun setSomeAnchorCanClickableJni(obj: Long, anchorId: String, canClickable: Boolean) // 非置顶 private external fun setSomeAnchorUnTopJni(obj: Long, anchorId: String) private external fun setSomeAnchorTopJni(obj: Long, anchorId: String) - private external fun setSomeAnchorInfowindowOffsetJni( - obj: Long, - anchorId: String, - disx: Int, - disy: Int - ) + private external fun setSomeAnchorInfowindowOffsetJni(obj: Long, anchorId: String, disx: Int, disy: Int) // 设置是否是平贴 private external fun setSomeAnchorFlatJni(obj: Long, anchorId: String, isFlat: Boolean) @@ -1402,11 +1459,7 @@ class MapEngine { private external fun setSomeAnchorDrawModelJni(obj: Long, anchorId: String, dragModel: Boolean) // 设置拖拽位置 - private external fun setSomeDrawModelPointScreenPositionJni( - obj: Long, - screenx: Int, - screeny: Int - ): Boolean + private external fun setSomeDrawModelPointScreenPositionJni(obj: Long, screenx: Int, screeny: Int): Boolean private external fun addManyAnchorsJni(obj: Long, json: String, count: Int) @@ -1420,13 +1473,7 @@ class MapEngine { private external fun clearAllClusterJni(obj: Long) - private external fun createConstAnchorJni( - obj: Long, - attribute: String, - infoBitmap: ByteArray?, - infoWidth: Int, - infoHeight: Int - ): Boolean + private external fun createConstAnchorJni(obj: Long, attribute: String, infoBitmap: ByteArray?, infoWidth: Int, infoHeight: Int): Boolean private external fun addAnchorAsyncJni(obj: Long, json: String) @@ -1434,13 +1481,7 @@ class MapEngine { private external fun setConstAnchorPositionFlagJni(obj: Long, isUpdate: Boolean) - private external fun addAnchorJni( - obj: Long, - json: String, - infoBitmap: ByteArray?, - infoWidth: Int, - infoHeight: Int - ): Boolean + private external fun addAnchorJni(obj: Long, json: String, infoBitmap: ByteArray?, infoWidth: Int, infoHeight: Int): Boolean /** * 返回anchor的对象属性值 @@ -1459,12 +1500,7 @@ class MapEngine { * @param propertyValue 要更新的属性值 * @return */ - private external fun updateAnchorPropertyJni( - obj: Long, - id: String, - propertyName: String, - propertyValue: String - ): Boolean + private external fun updateAnchorPropertyJni(obj: Long, id: String, propertyName: String, propertyValue: String): Boolean /** * 更新infowindow内容 @@ -1475,13 +1511,7 @@ class MapEngine { * @param height 图片高度 * @return true 更新成功 false 更新失败 */ - private external fun updateInfoWindowWithBitMapJni( - obj: Long, - id: String, - imageData: ByteArray, - width: Int, - height: Int - ): Boolean + private external fun updateInfoWindowWithBitMapJni(obj: Long, id: String, imageData: ByteArray, width: Int, height: Int): Boolean /** * 更新anchor @@ -1515,13 +1545,7 @@ class MapEngine { private external fun setAnchorRateJni(obj: Long, rate: Float) //For Test 四个顶点设置锚点变形 左宽 右宽 上高 下高 - private external fun setAnchorScaleJni( - obj: Long, - wideLeft: Float, - wideRight: Float, - highUp: Float, - hightDown: Float - ) + private external fun setAnchorScaleJni(obj: Long, wideLeft: Float, wideRight: Float, highUp: Float, hightDown: Float) //nMode 1:按Tile存储 2:按文件存储 nRecordCnt 单个文件存储的记录个数 private external fun setNameModeJni(obj: Long, mode: Int, recordCnt: Int) @@ -1540,71 +1564,25 @@ class MapEngine { private external fun isAnchorDynamicMovingJni(obj: Long, anchorID: String): Boolean //批量更新 -// private external fun updateBatchAnchorPositonJni(obj: Long, dataStr: String): Boolean + // private external fun updateBatchAnchorPositonJni(obj: Long, dataStr: String): Boolean private external fun updateBatchAnchorPositonJni(obj: Long, data: ByteArray?): Boolean - private external fun setAnchorFlashJni( - obj: Long, - id: String, - colorType: Int, - color: String, - time: Float, - angle: Float - ) + private external fun setAnchorFlashJni(obj: Long, id: String, colorType: Int, color: String, time: Float, angle: Float) - private external fun setAnchorGradientColorJni( - obj: Long, - startColor: String, - endColor: String, - startDistance: Float, - endDistance: Float - ) + private external fun setAnchorGradientColorJni(obj: Long, startColor: String, endColor: String, startDistance: Float, endDistance: Float) private external fun setTailLightsTypeJni(obj: Long, type: Int, time: Int) /*图元接口*/ - private external fun drawLineJni( - obj: Long, name: String, - points: DoubleArray, - lineWidth: Int, - r: Char, - g: Char, - b: Char, - a: Char, - isLoop: Boolean - ) + private external fun drawLineJni(obj: Long, name: String, points: DoubleArray, lineWidth: Int, r: Char, g: Char, b: Char, a: Char, isLoop: Boolean) - private external fun drawCircleJni( - obj: Long, - name: String, - lonlats: DoubleArray, - r: Char, - g: Char, - b: Char, - a: Char - ) + private external fun drawCircleJni(obj: Long, name: String, lonlats: DoubleArray, r: Char, g: Char, b: Char, a: Char) - private external fun drawEllipseJni( - obj: Long, - name: String, - lonlats: DoubleArray, - r: Char, - g: Char, - b: Char, - a: Char - ) + private external fun drawEllipseJni(obj: Long, name: String, lonlats: DoubleArray, r: Char, g: Char, b: Char, a: Char) - private external fun drawPolygonJni( - obj: Long, - name: String, - lonlats: DoubleArray, - r: Char, - g: Char, - b: Char, - a: Char - ) + private external fun drawPolygonJni(obj: Long, name: String, lonlats: DoubleArray, r: Char, g: Char, b: Char, a: Char) private external fun removePrimitiveByNameIdJni(obj: Long, name: String) @@ -1630,23 +1608,15 @@ class MapEngine { private external fun setOptionJni(obj: Long, id: String, strJsonOption: String) - private external fun draw3DPolygonJni( - obj: Long, - id: String, - lonlatArr: DoubleArray, - height: Float, - width: Float, - count: Int, - color: FloatArray - ) + private external fun draw3DPolygonJni(obj: Long, id: String, lonlatArr: DoubleArray, height: Float, width: Float, count: Int, color: FloatArray) - private external fun setCfgKeyValJni(obj: Long,key: String?,value: String?) + private external fun setCfgKeyValJni(obj: Long, key: String?, value: String?) private external fun clearAllPrimitivesJni(obj: Long): Boolean - private external fun drawDeadZoneJni(obj: Long,strJsonOption: String?) + private external fun drawDeadZoneJni(obj: Long, strJsonOption: String?) - private external fun setDeadZoneVisiableJni(obj:Long,b: Boolean) - private external fun setTextureJni(obj: Long,name:String,ba:ByteArray?) //设置一些元素的纹理,比如路面("road"),地面("plane")啥的 - private external fun setPainterCmdJni(obj: Long,name:String?,cmd:String?) + private external fun setDeadZoneVisiableJni(obj: Long, b: Boolean) + private external fun setTextureJni(obj: Long, name: String, ba: ByteArray?) //设置一些元素的纹理,比如路面("road"),地面("plane")啥的 + private external fun setPainterCmdJni(obj: Long, name: String?, cmd: String?) } \ No newline at end of file