Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91626944
LineObject.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Nov 12, 21:18
Size
1 KB
Mime Type
text/x-python
Expires
Thu, Nov 14, 21:18 (2 d)
Engine
blob
Format
Raw Data
Handle
22295848
Attached To
rGLUPS glups
LineObject.py
View Options
from
OpenGL.GL
import
*
from
OpenGL.GLU
import
*
from
OpenGL.GLUT
import
*
from
PyQt4
import
QtCore
,
QtGui
,
QtOpenGL
from
GLObject
import
*
from
ParameterList
import
*
class
LineObject
(
GLObject
):
def
__init__
(
self
,
wx0
,
wy0
,
wz0
,
wx1
,
wy1
,
wz1
,
ID
=
'Line'
):
self
.
ID
=
ID
self
.
ListID
=
None
self
.
wx0
=
wx0
self
.
wy0
=
wy0
self
.
wz0
=
wz0
self
.
wx1
=
wx1
self
.
wy1
=
wy1
self
.
wz1
=
wz1
# init parameters
self
.
param
=
ParametersList
(
self
.
ID
)
self
.
param
[
"Color_r"
]
=
1.0
self
.
param
[
"Color_g"
]
=
0.0
self
.
param
[
"Color_b"
]
=
0.0
self
.
param
[
"Color_a"
]
=
1.0
self
.
param
[
"show"
]
=
1
self
.
GenList
()
def
GenList
(
self
):
if
self
.
ListID
==
None
:
self
.
ListID
=
glGenLists
(
1
)
glNewList
(
self
.
ListID
,
GL_COMPILE
)
glPointSize
(
2.0
)
glBegin
(
GL_LINES
)
glVertex3f
(
self
.
wx0
,
self
.
wy0
,
self
.
wz0
)
glVertex3f
(
self
.
wx1
,
self
.
wy1
,
self
.
wz1
)
glEnd
()
glPointSize
(
1.0
)
glEndList
()
def
Display
(
self
,
color
=
None
):
'''
display the object
'''
if
(
self
.
param
[
'show'
]):
if
color
==
None
:
glColor4d
(
self
.
param
[
"Color_r"
],
self
.
param
[
"Color_g"
],
self
.
param
[
"Color_b"
],
self
.
param
[
"Color_a"
])
else
:
glColor4d
(
color
[
0
],
color
[
1
],
color
[
2
],
self
.
param
[
"Color_a"
])
glPushMatrix
();
glCallList
(
self
.
ListID
)
glPopMatrix
();
def
ReadParameters
(
self
,
file
):
'''
read parameters
'''
pass
def
WriteParameters
(
self
,
file
):
'''
write parameters
'''
pass
def
AutoSetParameters
(
self
,
ModelSize
,
CenterOfMass
):
'''
auto set parameters
'''
pass
Event Timeline
Log In to Comment