-
Notifications
You must be signed in to change notification settings - Fork 0
/
MI2RGB.mb
42 lines (26 loc) · 1.32 KB
/
MI2RGB.mb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Include "MapBasic.def"
Dim vPath, pToConvert, vPathExp as String
Declare Sub Main
Sub Main()
vPath = "G:\USER\Mey\Scripte\MapInfo Color to RGB\"
pToConvert = FileOpenDlg(vPath+ "Input\","TAB",".TAB", "Open Layer where RGB should be added")
print pToConvert
Open Table pToConvert as vToConvert
Alter Table vToConvert ( add fill Integer, R Integer, G Integer,B Integer ) Interactive
Select * From vToConvert where Str$(obj) = "Point" into Points
Update Points Set fill = styleattr(objectinfo(obj,2),2)
Select * From vToConvert where Str$(obj) = "Collection" into Collections
Update Collections Set fill = 0
Select * From vToConvert where Str$(obj) = "Line" into Lines
Update Lines Set fill = styleattr(objectinfo(obj,2),4)
Select * From vToConvert where Str$(obj) = "Region" into Regions
Update Regions Set fill = styleattr(objectinfo(obj,3),2)
Select * From vToConvert where Str$(obj) = "Text" into Texts
Update Texts Set fill = styleattr(objectinfo(obj,2),4)
Update vToConvert Set R = fill\65536
Update vToConvert Set G = (fill - (fill \ 65536)*65536)\256
Update vToConvert Set B = (fill - ((fill \ 65536)*65536) - (((fill - (fill \ 65536)*65536)\256))*256)
vPathExp = "G:\USER\Mey\Daten\" + vToConvert + "_RGB.TAB"
pToConvert = FileSaveAsDlg(vPathExp,".TAB","", "Export To ...")
Commit Table vToConvert as pToConvert
End Sub