天天看點

地形圖完善建築物屬主、名稱、樓層等

在平台上調下的EPS地形圖,存在建成房屋、棚房、建議房屋等的個别屬主、名稱和樓層丢失。為了避免EPS檢查程式報錯,可使用EPScript編寫程式,自動化填入屬性。

Sub OnClick()
''添加代碼
SSProcess.PushUndoMark  
SSProcess.ClearSelection
SSProcess.ClearSelectCondition
SSProcess.ClearSelectConditionGroups
SSprocess.SetSelectCondition "SSObj_Type","==","AREA"
SSProcess.SetSelectCondition "SSObj_Code","==","211000,215000,212000"     ''建成房屋;棚房;簡易房屋
SSProcess.SelectFilter
geocount = SSProcess.GetSelGeoCount()
if geocount > 0 then
	''鎖定資料庫
    SSProcess.SetMapStatus 1, 2
	dim owner,name
	for i=0 to geocount-1 
		''修改屬主和名稱
		owner=SSProcess.GetSelGeoValue(i,"[Owner]")
		name=SSProcess.GetSelGeoValue(i,"[Name]")
		story=SSProcess.GetSelGeoValue(i,"[Story]")
		if owner="" and name="" then
			SSProcess.SetSelGeoValue i, "[Name]","-1"
			SSProcess.SetSelGeoValue i, "[Owner]","-1"
		elseif owner="" and name<>"" then
			SSProcess.SetSelGeoValue i, "[Owner]",name
		elseif owner<>"" and name="" then
			SSProcess.SetSelGeoValue i, "[Name]",owner
		end if
		''修改建築物樓層
		if story="0" or story="" then
			SSProcess.SetSelGeoValue i, "[Story]","1"
		end if
		''加入存庫對象清單
	    SSProcess.AddSelGeoToSaveGeoList i
	next
		''開鎖資料庫
	SSProcess.SetMapStatus 0, 2
	'存庫對象清單儲存到資料庫
	SSProcess.SaveBufferObjToDatabase  
end if
End Sub