LOGO
帮助文档
旧版文档
命令调用事件触摸事件初始化完成调用事件当前选择实体发生变化调用事件打开完成时调用事件
命令调用事件

MxDrawActivity.commandEvent


命令调用事件。


参数说明

int iCommand

命令ID,这个ID用户自已来取的,只要多个命令ID不重复就可以


代码实现如下:


public void commandEvent(int iCommand){
     if(iCommand == 103)
    {
    MxFunction.newFile();
    Log.e("isModifyed",MxFunction.isModifyed() ? "Y" : "N");

    MrxDbgUiPrPoint getPoint = new MrxDbgUiPrPoint();
    getPoint.setMessage("点取图块插入点");
    if(getPoint.go() != MrxDbgUiPrPoint.Status.kOk)
    {
        return;
    }
    McGePoint3d pt = getPoint.value();

    String sFileName = MxFunction.getWorkDir() + "/tree.dwg";
    String sBlkName = "tree";
    MxLibDraw.insertBlock(sFileName,sBlkName);


    MxLibDraw.drawBlockReference(pt.x,pt.y,sBlkName,0.3,0);

    MxFunction.zoomAll();

    Log.e("isModifyed",MxFunction.isModifyed() ? "Y" : "N");
    }
}
触摸事件

MxDrawActivity.touchesEvent


触摸事件。


参数说明

int iType

触摸类型

dx

触摸的x坐标

dy

触摸的y坐标


代码实现如下:


public  int touchesEvent(int iType,double dX,double dY)
{

    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;
}
初始化完成调用事件

MxDrawActivity.initComplete


初始化完成时调用的事件。

当前选择实体发生变化调用事件

MxDrawActivity.selectModified


当前选择实体发生变化,会调用该事件。


参数 说明

long lId

当前被选择的实体lId,是一个实体lid链表

打开完成时调用事件

MxDrawActivity.openComplete


打开完成时调用的事件。


参数 说明

isOK

是否成功