import android.util.Log
import android.view.View
import jp.osdn.gokigen.thetaview.scene.IIndicator
-import java.lang.Exception
-
class CanvasView : View
{
private val informationMessage = mutableMapOf<IIndicator.Area, String>()
private val informationColor = mutableMapOf<IIndicator.Area, Int>()
- constructor(context: Context): super(context)
+ constructor(context: Context) : super(context)
{
initComponent()
}
initComponent()
}
- constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int): super(context, attrs, defStyleAttr)
+ constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
{
initComponent()
}
- constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int): super(context, attrs, defStyleAttr, defStyleRes)
+ constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes)
{
initComponent()
}
private fun initComponent()
{
Log.v(TAG, "initComponent")
-
-
}
override fun onDraw(canvas: Canvas?)
informationMessage[area] = message
informationColor[area] = color
}
- catch (e : Exception)
+ catch (e: Exception)
{
e.printStackTrace()
}
val fontMetrics = paint.fontMetrics
val fontHeight = fontMetrics.bottom - fontMetrics.top + 4.0f
- val posX = 10.0f
+ var posX = 10.0f
var posY = 20.0f
var message = informationMessage[IIndicator.Area.AREA_1]
var color = informationColor[IIndicator.Area.AREA_1]
- if ((message != null) && (color != null))
- {
+ if ((message != null) && (color != null)) {
paint.color = color
canvas.drawText(message, posX, posY, paint)
}
posY += fontHeight
message = informationMessage[IIndicator.Area.AREA_2]
color = informationColor[IIndicator.Area.AREA_2]
- if ((message != null) && (color != null))
- {
+ if ((message != null) && (color != null)) {
paint.color = color
canvas.drawText(message, posX, posY, paint)
}
posY += fontHeight
message = informationMessage[IIndicator.Area.AREA_3]
color = informationColor[IIndicator.Area.AREA_3]
- if ((message != null) && (color != null))
- {
+ if ((message != null) && (color != null)) {
paint.color = color
canvas.drawText(message, posX, posY, paint)
}
posY += fontHeight
message = informationMessage[IIndicator.Area.AREA_4]
color = informationColor[IIndicator.Area.AREA_4]
- if ((message != null) && (color != null))
- {
+ if ((message != null) && (color != null)) {
paint.color = color
canvas.drawText(message, posX, posY, paint)
}
posY += fontHeight
message = informationMessage[IIndicator.Area.AREA_5]
color = informationColor[IIndicator.Area.AREA_5]
- if ((message != null) && (color != null))
- {
+ if ((message != null) && (color != null)) {
paint.color = color
canvas.drawText(message, posX, posY, paint)
}
posY += fontHeight
message = informationMessage[IIndicator.Area.AREA_6]
color = informationColor[IIndicator.Area.AREA_6]
- if ((message != null) && (color != null))
- {
+ if ((message != null) && (color != null)) {
paint.color = color
canvas.drawText(message, posX, posY, paint)
}
posY += fontHeight
message = informationMessage[IIndicator.Area.AREA_7]
color = informationColor[IIndicator.Area.AREA_7]
- if ((message != null) && (color != null))
- {
+ if ((message != null) && (color != null)) {
paint.color = color
canvas.drawText(message, posX, posY, paint)
}
posY += fontHeight
message = informationMessage[IIndicator.Area.AREA_8]
color = informationColor[IIndicator.Area.AREA_8]
- if ((message != null) && (color != null))
- {
+ if ((message != null) && (color != null)) {
paint.color = color
canvas.drawText(message, posX, posY, paint)
}
posY += fontHeight
message = informationMessage[IIndicator.Area.AREA_9]
color = informationColor[IIndicator.Area.AREA_9]
- if ((message != null) && (color != null))
- {
+ if ((message != null) && (color != null)) {
paint.color = color
canvas.drawText(message, posX, posY, paint)
}
posY += fontHeight
+ message = informationMessage[IIndicator.Area.AREA_10]
+ color = informationColor[IIndicator.Area.AREA_10]
+ if ((message != null) && (color != null)) {
+ paint.color = color
+ canvas.drawText(message, posX, posY, paint)
+ }
+
+ posY += fontHeight
+ message = informationMessage[IIndicator.Area.AREA_11]
+ color = informationColor[IIndicator.Area.AREA_11]
+ if ((message != null) && (color != null)) {
+ paint.color = color
+ canvas.drawText(message, posX, posY, paint)
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ posY = 20.0f
+ //posY += fontHeight
message = informationMessage[IIndicator.Area.AREA_A]
+ posX = canvas.width - 10.0f - paint.measureText(message)
color = informationColor[IIndicator.Area.AREA_A]
- if ((message != null) && (color != null))
- {
+ if ((message != null) && (color != null)) {
paint.color = color
canvas.drawText(message, posX, posY, paint)
}
posY += fontHeight
message = informationMessage[IIndicator.Area.AREA_B]
+ posX = canvas.width - 10.0f - paint.measureText(message)
color = informationColor[IIndicator.Area.AREA_B]
- if ((message != null) && (color != null))
- {
+ if ((message != null) && (color != null)) {
+ paint.color = color
+ canvas.drawText(message, posX, posY, paint)
+ }
+
+ posY += fontHeight
+ message = informationMessage[IIndicator.Area.AREA_C]
+ posX = canvas.width - 10.0f - paint.measureText(message)
+ color = informationColor[IIndicator.Area.AREA_C]
+ if ((message != null) && (color != null)) {
+ paint.color = color
+ canvas.drawText(message, posX, posY, paint)
+ }
+
+ posY += fontHeight
+ message = informationMessage[IIndicator.Area.AREA_D]
+ posX = canvas.width - 10.0f - paint.measureText(message)
+ color = informationColor[IIndicator.Area.AREA_D]
+ if ((message != null) && (color != null)) {
+ paint.color = color
+ canvas.drawText(message, posX, posY, paint)
+ }
+
+ posY += fontHeight
+ message = informationMessage[IIndicator.Area.AREA_E]
+ posX = canvas.width - 10.0f - paint.measureText(message)
+ color = informationColor[IIndicator.Area.AREA_E]
+ if ((message != null) && (color != null)) {
+ paint.color = color
+ canvas.drawText(message, posX, posY, paint)
+ }
+
+ posY += fontHeight
+ message = informationMessage[IIndicator.Area.AREA_F]
+ posX = canvas.width - 10.0f - paint.measureText(message)
+ color = informationColor[IIndicator.Area.AREA_F]
+ if ((message != null) && (color != null)) {
+ paint.color = color
+ canvas.drawText(message, posX, posY, paint)
+ }
+
+ posY += fontHeight
+ message = informationMessage[IIndicator.Area.AREA_G]
+ posX = canvas.width - 10.0f - paint.measureText(message)
+ color = informationColor[IIndicator.Area.AREA_G]
+ if ((message != null) && (color != null)) {
+ paint.color = color
+ canvas.drawText(message, posX, posY, paint)
+ }
+
+ posY += fontHeight
+ message = informationMessage[IIndicator.Area.AREA_H]
+ posX = canvas.width - 10.0f - paint.measureText(message)
+ color = informationColor[IIndicator.Area.AREA_H]
+ if ((message != null) && (color != null)) {
paint.color = color
canvas.drawText(message, posX, posY, paint)
}
}
- catch (e : Exception)
+ catch (e: Exception)
{
e.printStackTrace()
}
}
- fun setShowCameraStatus(isEnable : Boolean)
+ fun setShowCameraStatus(isEnable: Boolean)
{
showCameraStatus = isEnable
}
- companion object
- {
+ companion object {
private val TAG = CanvasView::class.java.simpleName
}
-}
\ No newline at end of file
+}