事件点击控制
- 调用
-
let params={
-
maskType:"gviSelectFeatureLayer",
-
handle:"buildingbuilding"
-
}
-
let params2 = {
-
maskType: "gviSelectAll",
-
handle: ""
-
};
-
let cb=function(res) {
-
alert("自定义回调 查询成功")
-
}
-
switch (index)
-
{
-
-
case 1: cw5.clickModelManagerCtrl.mouseHand();break;
-
case 2: cw5.clickModelManagerCtrl.click();break;
-
case 3: cw5.clickModelManagerCtrl.hover();break;
-
case 4: cw5.clickModelManagerCtrl.click(params);break;
-
case 5: cw5.clickModelManagerCtrl.click(params2,cb);break;
-
case 6: cw5.clickModelManagerCtrl.hover(params);break;
-
case 7: cw5.clickModelManagerCtrl.hover(null,cb);break;
- clickModelManagerCtrl
-
import { innerCtrl } from "./clickInnerCtrl";
-
export const clickModelManagerCtrl = {};
-
/**
-
* 手型漫游
-
* 无参数
-
* */
-
clickModelManagerCtrl.mouseHand = function() {
-
innerCtrl.chooseMode("gviInteractNormal");
-
};
-
/**
-
* 点选
-
* params 限制条件,可选 包含maskType 查询类型, layerName 查询图层featureClassName
-
* clickFun 回调函数 可选,默认 高亮 返回结果到 window.cwClickRes
-
* */
-
clickModelManagerCtrl.click = function(params, clickFun) {
-
innerCtrl.chooseMode("gviMouseSelectClick",params, clickFun);
-
};
-
/**
-
* 悬浮
-
* * params 限制条件,可选 包含maskType 查询类型, layerName 查询图层featureClassName
-
* clickFun 回调函数 可选,默认 高亮 返回结果到 window.cwClickRes
-
* */
-
clickModelManagerCtrl.hover = function(params, clickFun) {
-
innerCtrl.chooseMode("gviMouseSelectHover",params, clickFun);
-
};
- innerCtrl
```javascript
import { cw5 } from "../index.js";
import {cwEventBus} from "../eventBus/eventBus"
export const innerCtrl={}
/**
-
通用点选类型选择入口
-
@param type 鼠标交互类型
-
@param maskType 筛选结果类型
-
@param layerName 筛选图层名称
-
@param clickFun 回调函数
*/
innerCtrl.chooseMode=function (type,params,clickFun) {if(type=='gviInteractNormal')
{
cw5.__g.interactMode = cw5.innerConfig.gviInteractMode.gviInteractNormal;
return;
}let maskType;
if(params==null)
{
maskType="gviSelectFeatureLayer";
innerCtrl.filter=null
}
else {
maskType=params.maskType||"gviSelectFeatureLayer";
if(params.handle!=""){
innerCtrl.filter= cw5.sceneLayerCtrl.getFl(params.handle).guid
}}
cw5.__g.interactMode = cw5.innerConfig.gviInteractMode.gviInteractSelect;
cw5.__g.mouseSelectObjectMask = this.GetEnumValue1(cw5.innerConfig.gviMouseSelectObjectMask,maskType)
cw5.__g.mouseSelectMode = this.GetEnumValue1(cw5.innerConfig.gviMouseSelectMode,type)
if(cw5.version==7){
cw5.__g.onmouseclickselect = this.mouseClickCommon;