-
-
Notifications
You must be signed in to change notification settings - Fork 91
/
q3dconst.py
186 lines (140 loc) · 3.69 KB
/
q3dconst.py
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# -*- coding: utf-8 -*-
# (C) 2018 Minoru Akagi
# SPDX-License-Identifier: GPL-2.0-or-later
from PyQt5.QtCore import Qt
class LayerType:
DEM = 0
POINT = 1
LINESTRING = 2
POLYGON = 3
POINTCLOUD = 4
class DEMMtlType:
MAPCANVAS = 0
LAYER = 1
FILE = 2
COLOR = 3
ICON_PATH = {
MAPCANVAS: "mLayoutItemMap.svg",
LAYER: "algorithms/mAlgorithmMergeLayers.svg",
FILE: "mLayoutItemPicture.svg"
}
class Script:
# Script ID
PROJ4 = 1
GLTFLOADER = 2
COLLADALOADER = 3
GLTFEXPORTER = 4
POTREE = 5
PCLAYER = 6
OUTLINE = 7
VIEWHELPER = 8
MESHLINE = 9
FETCH = 101
TEST = 201
# Script path (relative from js directory)
PATH = {
PROJ4: "proj4js/proj4.js",
GLTFLOADER: "threejs/loaders/GLTFLoader.js",
COLLADALOADER: "threejs/loaders/ColladaLoader.js",
GLTFEXPORTER: "threejs/exporters/GLTFExporter.js",
POTREE: "potree-core/potree.min.js",
PCLAYER: "pointcloudlayer.js",
OUTLINE: "threejs/effects/OutlineEffect.js",
VIEWHELPER: "threejs/editor/ViewHelper.js",
MESHLINE: "meshline/THREE.MeshLine.js",
FETCH: "unfetch/unfetch.js",
TEST: "../tests/gui/test.js"
}
# Layer properties
GEOM_WIDGET_MAX_COUNT = 5
MTL_WIDGET_MAX_COUNT = 2 # excluding color, color2 and opacity
class PropertyID:
ALT = 1
ALT2 = 2
PATH = 3
G0 = 10
G1 = 11
G2 = 12
G3 = 13
G4 = 14
C = 20
C2 = 21
OP = 22
M0 = 23
M1 = 24
LBLH = 30
LBLTXT = 31
PID_NAME_DICT = {
ALT: "fieldExpressionWidget_altitude",
ALT2: "comboEdit_altitude2",
PATH: "comboEdit_FilePath",
C: "comboEdit_Color",
C2: "comboEdit_Color2",
OP: "comboEdit_Opacity",
LBLH: "labelHeightWidget",
LBLTXT: "expression_Label"
}
# animation
DLY = 80
DUR = 81
ANIM_PID_NAME_DICT = {
DLY: "delay",
DUR: "duration"
}
@classmethod
def init(cls):
for i in range(GEOM_WIDGET_MAX_COUNT):
cls.PID_NAME_DICT[cls.G0 + i] = "geomWidget" + str(i)
for i in range(MTL_WIDGET_MAX_COUNT):
cls.PID_NAME_DICT[cls.M0 + i] = "mtlWidget" + str(i)
PropertyID.init()
class ATConst:
# ITEM TYPES
# TOP LEVEL
ITEM_TOPLEVEL = 32
ITEM_TL_CAMERA = 32
ITEM_TL_LAYER = 33
# GROUP
ITEM_GRP = 64
ITEM_GRP_CAMERA = 64
ITEM_GRP_OPACITY = 65
ITEM_GRP_TEXTURE = 66
ITEM_GRP_GROWING_LINE = 67
# MEMBER OF GROUP (KEYFRAME OR EFFECT)
ITEM_MBR = 128
ITEM_CAMERA = 128
ITEM_OPACITY = 129
ITEM_TEXTURE = 130
ITEM_GROWING_LINE = 131 # EFFECT
# ITEM_TL_LAYER
DATA_LAYER_ID = Qt.UserRole
# KEYFRAME GROUP
DATA_NEXT_INDEX = Qt.UserRole
# COMMON FOR KEYFRAME
DATA_EASING = Qt.UserRole + 1
DATA_DURATION = Qt.UserRole + 2
DATA_DELAY = Qt.UserRole + 3
DATA_NARRATION = Qt.UserRole + 4
# CAMERA KEYFRAME
DATA_CAMERA = Qt.UserRole
# OPACITY KEYFRAME
DATA_OPACITY = Qt.UserRole
# TEXTURE KEYFRAME
DATA_MTL_ID = Qt.UserRole
DATA_EFFECT = Qt.UserRole + 5
# LINE GROWING EFFECT
DATA_SEQ = Qt.UserRole
# EASING
EASING_NONE = 0
EASING_LINEAR = 1
EASING_EASE_INOUT = 2
EASING_EASE_IN = 3
EASING_EASE_OUT = 4
@classmethod
def defaultName(cls, typ):
name = ["Camera", "Opacity", "Texture", "Growing line"]
if typ & cls.ITEM_GRP:
return "Group" if typ == cls.ITEM_GRP_CAMERA else "{} group".format(name[typ - cls.ITEM_GRP])
if typ & cls.ITEM_MBR:
return "{} keyframe".format(name[typ - cls.ITEM_MBR])
return "UNDEF"