触摸事件
MxDrawActivity.touchesEvent
触摸事件。
参数 | 说明 |
int iType | 触摸类型 |
dx | 触摸的x坐标 |
dy | 触摸的y坐标 |
代码实现如下:
public int touchesEvent(int iType,double dX,double dY)标签:String,触摸,MxFunction,int,安卓版,dX,dY,new,CAD From: https://blog.51cto.com/u_10455293/5732390
{
double[] ret = MxFunction.docToView(dX,dY);
String sK;
sK = String.format("docToView:%f,%f",ret[0],ret[1]);
Log.e("docToView",sK);
if(false)
{
String sT;
sT = String.format("touchesEvent:%f,%f",dX,dY);
Log.e("touchesEvent",sT);
long lIdImage = MxFunction.findEntAtPoint(dX,dY,"IMAGE");
if(lIdImage != 0)
{
String sGetVal = MxFunction.getxDataString(lIdImage,"MyData");
Log.v("Find MxImage",decodeUnicode(sGetVal));
this.runOnUiThread(new Runnable() {
@Override
public void run() {
new AlertDialog.Builder(MxCADAppActivity.this).setTitle("系统提示")
//设置对话框标题
.setMessage("找到一个标记")
//设置显示的内容
.setPositiveButton("确定",new DialogInterface.OnClickListener() {
//添加确定按钮
@Override
public void onClick(DialogInterface dialog, int which) {
//确定按钮的响应事件
}
}).show();
//在按键响应事件中显示此对话框
}
}
);
}
else
{
// long lId = MxFunction.findEntAtPoint(dX,dY,"TEXT,MTEXT");
//if(lId != 0)
{
long lImageId = MxFunction.drawImage("start.png",dX,dY,30);
//long lImageId = MxFunction.drawImage2("start.png",dX,dY,dX + 1000,dY + 3000);
MxFunction.setxDataString(lImageId,"MyData","TestVal中文测试111");
String sGetVal = MxFunction.getxDataString(lImageId,"MyData");
this.runOnUiThread(new Runnable() {
@Override
public void run() {
new AlertDialog.Builder(MxCADAppActivity.this).setTitle("系统提示")
//设置对话框标题
.setMessage("在图上绘了一个标记")
//设置显示的内容
.setPositiveButton("确定",new DialogInterface.OnClickListener() {
//添加确定按钮
@Override
public void onClick(DialogInterface dialog, int which) {
//确定按钮的响应事件
// TODO Auto-generated method stub
}
}).show();
//在按键响应事件中显示此对话框
}
}
);
}
}
}
return 0;
}