Angularjs Openlayers-交互单击处理程序和抽屉
我的抽屉和点击事件有点问题。我已尝试将条件更改为singleClick,click,并已将其删除Angularjs Openlayers-交互单击处理程序和抽屉,angularjs,javascript-events,openlayers-3,angular-openlayers,Angularjs,Javascript Events,Openlayers 3,Angular Openlayers,我的抽屉和点击事件有点问题。我已尝试将条件更改为singleClick,click,并已将其删除 如果将条件添加到交互中,则不调用抽屉(我需要抽屉放置点) 如果删除该条件,则不会调用click处理程序,但会调用draund 由于点击没有被处理,它似乎进入了某种平移模式,地图在我移动鼠标的任何地方都会移动 我的流程是 -用户单击以添加点,并显示该点的属性屏幕。 -一旦用户输入属性,屏幕就会消失,然后他们可以删除一个点。 -放置点后,将调用一个服务来执行任务 -如果服务确定它是一个坏点,它将自动
- 如果将条件添加到交互中,则不调用抽屉(我需要抽屉放置点)
- 如果删除该条件,则不会调用click处理程序,但会调用draund李>
-用户单击以添加点,并显示该点的属性屏幕。
-一旦用户输入属性,屏幕就会消失,然后他们可以删除一个点。
-放置点后,将调用一个服务来执行任务
-如果服务确定它是一个坏点,它将自动从地图中删除
draw = new ol.interaction.Draw({
source : addrVectorSource,
type: "Point",
//condition: ol.events.condition.singleClick
});
看来我在付款人功能中出错了。 ol debug.js:99465未捕获类型错误:this.source_u2;.addFeature不是函数
//[DRAW]
draw.on('drawend', function (e) {
console.log('drawend');
start_drawing = false;
//var id = guid();
if (typeof ($scope.addr.prefix) == 'undefined') {
$scope.addr.prefix = '';
}
if (typeof ($scope.addr.suffix) == 'undefined') {
$scope.addr.suffix = '';
}
var id = $scope.addr.prefix + $scope.addr.addrnbr + $scope.addr.suffix + '-' + $scope.selAddr.uuid;
e.feature.featureID = id;
e.feature.setId(id);
$scope.map.removeInteraction(draw);
$scope.map.removeInteraction(modify);
$scope.map.removeInteraction(select);
e.feature.setProperties({
'id': id,
'name': "Point", // Can be anything
'description': 'Some values',
'addrnum': ($scope.addr.prefix + $scope.addr.addrnbr + $scope.addr.suffix).toUpperCase()
})
$scope.nLon = e.feature.getGeometry().getCoordinates()[0];
$scope.nLat = e.feature.getGeometry().getCoordinates()[1];
$scope.addID = e.feature.getId();
var lcstat = $scope.addr.lifeCycleStatus;
var lifecycle = LCSSearch($scope.lifeStatus.lifeCycles, lcstat);
var featyp = $scope.addr.featureType;
var featuretype = FTSearch($scope.featTypes.features, featyp);
addrVectorSource.addFeature(e.feature);
//ID = addrnum + segmentUUID
$scope.nAddAddress($scope.nLat, $scope.nLon, $scope.addr.addrnbr, $scope.uuid, $scope.addr.prefix, $scope.addr.suffix, $scope.addr.lifeCycleStatus, $scope.addr.featureType, $scope.sSegment.SNSID, $scope.sSegment.StreetNameFk, id, lifecycle, featuretype);
});
//[DRAW]
// Call Service to check placement permissions
// aid = AddrNum + StreetUUID
$scope.nAddAddress = function (lat, lon, addrnum, suuid, prefix, suffix, lcstat, featyp, SNSID, SNFK, aid, lifecycle, featuretype) {
var UTObj = {
token: Lockr.get('token'),
uid: Lockr.get('user'),
};
var mapID = $scope.mapid;
var promise = MapService.AddAddress(UTObj, mapID, suuid, lat, lon, addrnum, prefix, suffix, lcstat, featyp, SNSID, SNFK, aid, lifecycle, featuretype);
promise.then(
function (payload) {
$scope.AddrRet = payload.data.PlacePointResult;
//Assign AddrRet.aid to drawn feature
$scope.assignAddressUUID(aid, $scope.AddrRet.UUID);
$scope.drawing = false;
console.log($scope.AddrRet.msg);
var msg = $scope.AddrRet.msg;
$scope.toastMessage(msg);
$scope.editState = 'NONE';
$scope.hbtnD = $scope.hbtnoff;
console.log('DrawingOff');
},
function (errorPayload) {
console.log('Error Adding Address');
$scope.removeAddressFeature(aid);
$scope.drawing = false;
var msg = errorPayload.data.msg;
$scope.toastMessage(msg);
$scope.editState = 'NONE';
$scope.hbtnD = $scope.hbtnoff;
console.log('DrawingOff');
});
};
我想你还需要展示一些代码。你用的都是这些标签吗?Jonatas,是的,我用的是Angular和Openlayers。谢谢我做了更多的研究,发现on-draund函数中出现了一个错误。一旦我的点被放置,我将尝试在DB中验证它。如果不允许用户在此处放置点,则会将其删除。我猜地图会进入一种奇怪的平移状态,并等待我在放置点之前再次单击,因为出现了错误。ol debug.js:99465 Uncaught TypeError:this.source_u2;.addFeature不是一个函数,我想您还需要显示一些代码。你用的都是这些标签吗?Jonatas,是的,我用的是Angular和Openlayers。谢谢我做了更多的研究,发现on-draund函数中出现了一个错误。一旦我的点被放置,我将尝试在DB中验证它。如果不允许用户在此处放置点,则会将其删除。我猜地图会进入一种奇怪的平移状态,并等待我在放置点之前再次单击,因为出现了错误。ol debug.js:99465未捕获类型错误:this.source_u2;.addFeature不是函数