Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
ddaa970f
Commit
ddaa970f
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
take ply property type into account for ui
parent
a14236c4
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mol-io/reader/ply/parser.ts
+4
-0
4 additions, 0 deletions
src/mol-io/reader/ply/parser.ts
src/mol-io/reader/ply/schema.ts
+2
-0
2 additions, 0 deletions
src/mol-io/reader/ply/schema.ts
src/mol-model-formats/shape/ply.ts
+13
-6
13 additions, 6 deletions
src/mol-model-formats/shape/ply.ts
with
19 additions
and
6 deletions
src/mol-io/reader/ply/parser.ts
+
4
−
0
View file @
ddaa970f
...
...
@@ -154,6 +154,7 @@ function parseTableElement(state: State, spec: TableElementSpec) {
const
{
count
,
properties
}
=
spec
const
propertyCount
=
properties
.
length
const
propertyNames
:
string
[]
=
[]
const
propertyTypes
:
PlyType
[]
=
[]
const
propertyTokens
:
Tokens
[]
=
[]
const
propertyColumns
=
new
Map
<
string
,
Column
<
number
>>
()
...
...
@@ -175,6 +176,7 @@ function parseTableElement(state: State, spec: TableElementSpec) {
const
{
type
,
name
}
=
properties
[
i
]
const
column
=
TokenColumn
(
propertyTokens
[
i
],
getColumnSchema
(
type
))
propertyNames
.
push
(
name
)
propertyTypes
.
push
(
type
)
propertyColumns
.
set
(
name
,
column
)
}
...
...
@@ -182,6 +184,7 @@ function parseTableElement(state: State, spec: TableElementSpec) {
kind
:
'
table
'
,
rowCount
:
count
,
propertyNames
,
propertyTypes
,
getProperty
:
(
name
:
string
)
=>
propertyColumns
.
get
(
name
)
})
}
...
...
@@ -225,6 +228,7 @@ function parseListElement(state: State, spec: ListElementSpec) {
kind
:
'
list
'
,
rowCount
:
count
,
name
:
property
.
name
,
type
:
property
.
dataType
,
value
:
(
row
:
number
)
=>
{
const
start
=
offsets
[
row
]
const
end
=
offsets
[
row
+
1
]
...
...
This diff is collapsed.
Click to expand it.
src/mol-io/reader/ply/schema.ts
+
2
−
0
View file @
ddaa970f
...
...
@@ -61,6 +61,7 @@ export interface PlyTable {
readonly
kind
:
'
table
'
readonly
rowCount
:
number
readonly
propertyNames
:
ReadonlyArray
<
string
>
readonly
propertyTypes
:
ReadonlyArray
<
PlyType
>
getProperty
(
name
:
string
):
Column
<
number
>
|
undefined
}
...
...
@@ -73,5 +74,6 @@ export interface PlyList {
readonly
kind
:
'
list
'
readonly
rowCount
:
number
,
readonly
name
:
string
,
readonly
type
:
PlyType
,
value
:
(
row
:
number
)
=>
PlyListValue
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/mol-model-formats/shape/ply.ts
+
13
−
6
View file @
ddaa970f
...
...
@@ -22,12 +22,19 @@ import { deepClone } from 'mol-util/object';
// TODO support 'edge' and 'material' elements, see https://www.mathworks.com/help/vision/ug/the-ply-format.html
function
createPlyShapeParams
(
vertex
?:
PlyTable
)
{
const
options
:
[
string
,
string
][]
=
[[
''
,
''
]]
const
groupOptions
:
[
string
,
string
][]
=
[[
''
,
''
]]
const
colorOptions
:
[
string
,
string
][]
=
[[
''
,
''
]]
const
defaultValues
=
{
group
:
''
,
red
:
''
,
green
:
''
,
blue
:
''
}
if
(
vertex
)
{
for
(
let
i
=
0
,
il
=
vertex
.
propertyNames
.
length
;
i
<
il
;
++
i
)
{
const
name
=
vertex
.
propertyNames
[
i
]
options
.
push
([
name
,
name
])
const
type
=
vertex
.
propertyTypes
[
i
]
if
(
type
===
'
uchar
'
||
type
===
'
uint8
'
||
type
===
'
ushort
'
||
type
===
'
uint16
'
||
type
===
'
uint
'
||
type
===
'
uint32
'
)
groupOptions
.
push
([
name
,
name
])
if
(
type
===
'
uchar
'
||
type
===
'
uint8
'
)
colorOptions
.
push
([
name
,
name
])
}
// TODO hardcoded as convenience for data provided by MegaMol
...
...
@@ -43,9 +50,9 @@ function createPlyShapeParams(vertex?: PlyTable) {
coloring
:
PD
.
MappedStatic
(
defaultValues
.
red
&&
defaultValues
.
green
&&
defaultValues
.
blue
?
'
vertex
'
:
'
uniform
'
,
{
vertex
:
PD
.
Group
({
red
:
PD
.
Select
(
defaultValues
.
red
,
o
ptions
,
{
label
:
'
Red Property
'
}),
green
:
PD
.
Select
(
defaultValues
.
green
,
o
ptions
,
{
label
:
'
Green Property
'
}),
blue
:
PD
.
Select
(
defaultValues
.
blue
,
o
ptions
,
{
label
:
'
Blue Property
'
}),
red
:
PD
.
Select
(
defaultValues
.
red
,
colorO
ptions
,
{
label
:
'
Red Property
'
}),
green
:
PD
.
Select
(
defaultValues
.
green
,
colorO
ptions
,
{
label
:
'
Green Property
'
}),
blue
:
PD
.
Select
(
defaultValues
.
blue
,
colorO
ptions
,
{
label
:
'
Blue Property
'
}),
},
{
isFlat
:
true
}),
uniform
:
PD
.
Group
({
color
:
PD
.
Color
(
ColorNames
.
grey
)
...
...
@@ -53,7 +60,7 @@ function createPlyShapeParams(vertex?: PlyTable) {
}),
grouping
:
PD
.
MappedStatic
(
defaultValues
.
group
?
'
vertex
'
:
'
none
'
,
{
vertex
:
PD
.
Group
({
group
:
PD
.
Select
(
defaultValues
.
group
,
o
ptions
,
{
label
:
'
Group Property
'
}),
group
:
PD
.
Select
(
defaultValues
.
group
,
groupO
ptions
,
{
label
:
'
Group Property
'
}),
},
{
isFlat
:
true
}),
none
:
PD
.
Group
({
})
}),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment