|
@@ -4,19 +4,14 @@ import android.graphics.Color
|
|
|
import android.graphics.PointF
|
|
|
import android.util.Log
|
|
|
import cn.sagacloud.android.cadengine.types.*
|
|
|
-import com.alibaba.fastjson.PropertyNamingStrategy
|
|
|
import com.sybotan.android.graphy.SGraphyScene
|
|
|
import com.sybotan.base.extensions.toJson
|
|
|
import com.sybotan.base.utils.SHttpUtil
|
|
|
import com.sybotan.base.utils.SJsonUtil
|
|
|
import android.text.TextUtils
|
|
|
-import android.util.SizeF
|
|
|
-import android.view.MotionEvent
|
|
|
import cn.sagacloud.android.cadengine.items.*
|
|
|
-import cn.sagacloud.android.cadengine.test.GraphyFmItem
|
|
|
import com.sybotan.android.graphy.SMotionEvent
|
|
|
import com.sybotan.android.graphy.events.SGraphyViewMoveEvent
|
|
|
-import com.sybotan.android.graphy.items.SGraphyClockItem
|
|
|
import org.greenrobot.eventbus.Subscribe
|
|
|
import org.greenrobot.eventbus.ThreadMode
|
|
|
|
|
@@ -31,6 +26,18 @@ open class FloorScene : SGraphyScene() {
|
|
|
var item: PointItem? = null
|
|
|
val point = Point()
|
|
|
var canEdit = true
|
|
|
+
|
|
|
+ /** 默认缩放比例,用于指定最小缩放比例*/
|
|
|
+ var defaultPointScale = 0.01785718f
|
|
|
+
|
|
|
+ /**
|
|
|
+ * normol 普通可以查看,可以点击问题点的模式
|
|
|
+ * dot 绘制问题点
|
|
|
+ * pipe 绘制管道模式
|
|
|
+ */
|
|
|
+ var type: String? = "dot"
|
|
|
+ var pipeLineList: ArrayList<PointF> = ArrayList()
|
|
|
+
|
|
|
/** item 数据 */
|
|
|
var data: FloorData? = null
|
|
|
set(value) {
|
|
@@ -121,6 +128,9 @@ open class FloorScene : SGraphyScene() {
|
|
|
/** 点 */
|
|
|
val pointItemList = java.util.ArrayList<PointItem>()
|
|
|
|
|
|
+ /** 管道 */
|
|
|
+ val pipeItemList = ArrayList<PipeLineItem>()
|
|
|
+
|
|
|
/**
|
|
|
* 获取底图压缩文件
|
|
|
*
|
|
@@ -223,6 +233,13 @@ open class FloorScene : SGraphyScene() {
|
|
|
item.zOrder = 100000f
|
|
|
addItem(item)
|
|
|
}
|
|
|
+
|
|
|
+ //添加问题点
|
|
|
+ for (item in pipeItemList) {
|
|
|
+ item.isVisible = isShowSpace
|
|
|
+ item.zOrder = 100000f
|
|
|
+ addItem(item)
|
|
|
+ }
|
|
|
} // Function addBaseMapItem()
|
|
|
|
|
|
/**
|
|
@@ -355,7 +372,9 @@ open class FloorScene : SGraphyScene() {
|
|
|
var outSide = false
|
|
|
//计算控制点的边界
|
|
|
//是否已经拥有该点
|
|
|
- if (canEdit) {
|
|
|
+ //打点业务
|
|
|
+
|
|
|
+ if ("dot".equals(type)) {
|
|
|
//便利该点所在的空间
|
|
|
for (space in spaceList) {
|
|
|
val polygonContainsPoint = Lasso.isPolygonContainsPoint(
|
|
@@ -363,18 +382,18 @@ open class FloorScene : SGraphyScene() {
|
|
|
android.graphics.Point(e.x.toInt(), -e.y.toInt())
|
|
|
)
|
|
|
// if (polygonContainsPoint) {
|
|
|
- outSide = true
|
|
|
- space.paint.color = Opt.spaceChoseColor
|
|
|
- space.outPaint.color = Color.rgb(0xbd, 0xe8, 0xfe)
|
|
|
- point.mX = e.x
|
|
|
- point.mY = e.y
|
|
|
- if (item != null) {
|
|
|
- removeItem(item!!)
|
|
|
- }
|
|
|
- item = PointItem(point, null)
|
|
|
- item!!.isVisible = true
|
|
|
- item!!.zOrder = 100000f
|
|
|
- addItem(item!!)
|
|
|
+ outSide = true
|
|
|
+ space.paint.color = Opt.spaceChoseColor
|
|
|
+ space.outPaint.color = Color.rgb(0xbd, 0xe8, 0xfe)
|
|
|
+ point.mX = e.x
|
|
|
+ point.mY = e.y
|
|
|
+ if (item != null) {
|
|
|
+ removeItem(item!!)
|
|
|
+ }
|
|
|
+ item = PointItem(point, null, defaultPointScale)
|
|
|
+ item!!.isVisible = true
|
|
|
+ item!!.zOrder = 100000f
|
|
|
+ addItem(item!!)
|
|
|
// } else {
|
|
|
// space!!.paint.color = Opt.spaceColor
|
|
|
// space.outPaint.color = Color.rgb(0xff, 0xff, 0xff)
|
|
@@ -383,21 +402,42 @@ open class FloorScene : SGraphyScene() {
|
|
|
if (!outSide) {
|
|
|
return true
|
|
|
}
|
|
|
- } else {
|
|
|
- for (space in spaceList) {
|
|
|
- val polygonContainsPoint = Lasso.isPolygonContainsPoint(
|
|
|
- space.mPoints,
|
|
|
- android.graphics.Point(e.x.toInt(), -e.y.toInt())
|
|
|
- )
|
|
|
- if (polygonContainsPoint) {
|
|
|
- outSide = true
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- if (!outSide) {
|
|
|
- return true
|
|
|
+ }
|
|
|
+// else {
|
|
|
+// for (space in spaceList) {
|
|
|
+// val polygonContainsPoint = Lasso.isPolygonContainsPoint(
|
|
|
+// space.mPoints,
|
|
|
+// android.graphics.Point(e.x.toInt(), -e.y.toInt())
|
|
|
+// )
|
|
|
+// if (polygonContainsPoint) {
|
|
|
+// outSide = true
|
|
|
+// break
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (!outSide) {
|
|
|
+// return true
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ //绘制管道业务
|
|
|
+ else if ("pipe".equals(type)) {
|
|
|
+ var pipe = PipeLine()
|
|
|
+ var pointf = PointF()
|
|
|
+ pointf.x = e.x
|
|
|
+ pointf.y = -e.y
|
|
|
+ pipeLineList.add(pointf)
|
|
|
+ pipe.points!!.add(pipeLineList)
|
|
|
+ var item = PipeLineItem(pipe, null)
|
|
|
+ item!!.isVisible = true
|
|
|
+ item!!.zOrder = 100000f
|
|
|
+ pipeItemList.add(item)
|
|
|
+ for (item in pipeItemList) {
|
|
|
+ item.isVisible = isShowSpace
|
|
|
+ item.zOrder = 100000f
|
|
|
+ addItem(item)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (topUp != null) {
|
|
|
topUp.onSingUp(e.x, e.y)
|
|
|
}
|