调用坡度分析接口也是只能有两个点,分析这两个对角点之间的矩形坡度变化
这边鼠标事件绑定的函数是画矩形面的,具体在画面那篇博客
// 坡度
function getSlope() {
sgworld.Window.SetInputMode(1); //鼠标恢复效果
sgworld.AttachEvent("OnLButtonDown", starsquare)
sgworld.AttachEvent("OnFrame", DrawsquareOnFrame)
sgworld.AttachEvent("OnRButtonUp", stopSlope)
}
function stopSlope(flags, x, y) {
var pWorldPointInfo = sgworld.Window.PixelToWorld(x, y, -1);
var pos = pWorldPointInfo.Position
// 解除绑定事件
sgworld.DetachEvent("OnLButtonDown", starsquare);
sgworld.DetachEvent("OnFrame", DrawsquareOnFrame);
sgworld.DetachEvent("OnRButtonUp", stopSlope);
polygon.Geometry.EndEdit();
sgworld.Window.SetInputMode(0); //鼠标恢复效果
var pPoints = polygon.Geometry.Points;
var point = []
// point.push(pPoints.Item(pPoints.count - 2))
// alert(333)
//这个地方不能传数组!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//定义slope需要的参数
sgworld.Analysis.CreateSlopeMap(pos.X, pos.Y, slope2.X, slope2.Y, 2, "")
// alert(222)
// alert(slope)
// sgworld.Creator.DeleteObject(polygon.ID)
polygon = null;
slope2 = null
// ScanTree()
}