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
728774f0
Commit
728774f0
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
added Structure.Loci
parent
ac536d22
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-model/loci.ts
+8
-2
8 additions, 2 deletions
src/mol-model/loci.ts
src/mol-model/structure/structure/structure.ts
+17
-0
17 additions, 0 deletions
src/mol-model/structure/structure/structure.ts
src/mol-theme/label.ts
+2
-0
2 additions, 0 deletions
src/mol-theme/label.ts
with
27 additions
and
2 deletions
src/mol-model/loci.ts
+
8
−
2
View file @
728774f0
...
@@ -11,6 +11,7 @@ import { Sphere3D } from 'mol-math/geometry';
...
@@ -11,6 +11,7 @@ import { Sphere3D } from 'mol-math/geometry';
import
{
CentroidHelper
}
from
'
mol-math/geometry/centroid-helper
'
;
import
{
CentroidHelper
}
from
'
mol-math/geometry/centroid-helper
'
;
import
{
Vec3
}
from
'
mol-math/linear-algebra
'
;
import
{
Vec3
}
from
'
mol-math/linear-algebra
'
;
import
{
OrderedSet
}
from
'
mol-data/int
'
;
import
{
OrderedSet
}
from
'
mol-data/int
'
;
import
{
Structure
}
from
'
./structure/structure
'
;
/** A Loci that includes every loci */
/** A Loci that includes every loci */
export
const
EveryLoci
=
{
kind
:
'
every-loci
'
as
'
every-loci
'
}
export
const
EveryLoci
=
{
kind
:
'
every-loci
'
as
'
every-loci
'
}
...
@@ -29,6 +30,9 @@ export function isEmptyLoci(x: any): x is EmptyLoci {
...
@@ -29,6 +30,9 @@ export function isEmptyLoci(x: any): x is EmptyLoci {
export
function
areLociEqual
(
lociA
:
Loci
,
lociB
:
Loci
)
{
export
function
areLociEqual
(
lociA
:
Loci
,
lociB
:
Loci
)
{
if
(
isEveryLoci
(
lociA
)
&&
isEveryLoci
(
lociB
))
return
true
if
(
isEveryLoci
(
lociA
)
&&
isEveryLoci
(
lociB
))
return
true
if
(
isEmptyLoci
(
lociA
)
&&
isEmptyLoci
(
lociB
))
return
true
if
(
isEmptyLoci
(
lociA
)
&&
isEmptyLoci
(
lociB
))
return
true
if
(
Structure
.
isLoci
(
lociA
)
&&
Structure
.
isLoci
(
lociB
))
{
return
Structure
.
areLociEqual
(
lociA
,
lociB
)
}
if
(
StructureElement
.
isLoci
(
lociA
)
&&
StructureElement
.
isLoci
(
lociB
))
{
if
(
StructureElement
.
isLoci
(
lociA
)
&&
StructureElement
.
isLoci
(
lociB
))
{
return
StructureElement
.
areLociEqual
(
lociA
,
lociB
)
return
StructureElement
.
areLociEqual
(
lociA
,
lociB
)
}
}
...
@@ -44,7 +48,7 @@ export function areLociEqual(lociA: Loci, lociB: Loci) {
...
@@ -44,7 +48,7 @@ export function areLociEqual(lociA: Loci, lociB: Loci) {
export
{
Loci
}
export
{
Loci
}
type
Loci
=
StructureElement
.
Loci
|
Link
.
Loci
|
EveryLoci
|
EmptyLoci
|
Shape
.
Loci
type
Loci
=
StructureElement
.
Loci
|
Structure
.
Loci
|
Link
.
Loci
|
EveryLoci
|
EmptyLoci
|
Shape
.
Loci
namespace
Loci
{
namespace
Loci
{
...
@@ -54,7 +58,9 @@ namespace Loci {
...
@@ -54,7 +58,9 @@ namespace Loci {
if
(
loci
.
kind
===
'
every-loci
'
||
loci
.
kind
===
'
empty-loci
'
)
return
void
0
;
if
(
loci
.
kind
===
'
every-loci
'
||
loci
.
kind
===
'
empty-loci
'
)
return
void
0
;
sphereHelper
.
reset
();
sphereHelper
.
reset
();
if
(
loci
.
kind
===
'
element-loci
'
)
{
if
(
loci
.
kind
===
'
structure-loci
'
)
{
return
Sphere3D
.
clone
(
loci
.
structure
.
boundary
.
sphere
)
}
else
if
(
loci
.
kind
===
'
element-loci
'
)
{
for
(
const
e
of
loci
.
elements
)
{
for
(
const
e
of
loci
.
elements
)
{
const
{
indices
}
=
e
;
const
{
indices
}
=
e
;
const
pos
=
e
.
unit
.
conformation
.
position
;
const
pos
=
e
.
unit
.
conformation
.
position
;
...
...
This diff is collapsed.
Click to expand it.
src/mol-model/structure/structure/structure.ts
+
17
−
0
View file @
728774f0
...
@@ -280,6 +280,23 @@ function getUniqueAtomicResidueIndices(structure: Structure): ReadonlyMap<UUID,
...
@@ -280,6 +280,23 @@ function getUniqueAtomicResidueIndices(structure: Structure): ReadonlyMap<UUID,
namespace
Structure
{
namespace
Structure
{
export
const
Empty
=
new
Structure
([]);
export
const
Empty
=
new
Structure
([]);
/** Represents a single structure */
export
interface
Loci
{
readonly
kind
:
'
structure-loci
'
,
readonly
structure
:
Structure
,
}
export
function
Loci
(
structure
:
Structure
):
Loci
{
return
{
kind
:
'
structure-loci
'
,
structure
};
}
export
function
isLoci
(
x
:
any
):
x
is
Loci
{
return
!!
x
&&
x
.
kind
===
'
structure-loci
'
;
}
export
function
areLociEqual
(
a
:
Loci
,
b
:
Loci
)
{
return
a
.
structure
===
b
.
structure
}
export
function
create
(
units
:
ReadonlyArray
<
Unit
>
):
Structure
{
return
new
Structure
(
units
);
}
export
function
create
(
units
:
ReadonlyArray
<
Unit
>
):
Structure
{
return
new
Structure
(
units
);
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
src/mol-theme/label.ts
+
2
−
0
View file @
728774f0
...
@@ -20,6 +20,8 @@ function setElementLocation(loc: StructureElement, unit: Unit, index: StructureE
...
@@ -20,6 +20,8 @@ function setElementLocation(loc: StructureElement, unit: Unit, index: StructureE
export
function
labelFirst
(
loci
:
Loci
):
string
{
export
function
labelFirst
(
loci
:
Loci
):
string
{
switch
(
loci
.
kind
)
{
switch
(
loci
.
kind
)
{
case
'
structure-loci
'
:
return
loci
.
structure
.
models
.
map
(
m
=>
m
.
label
).
join
(
'
,
'
)
case
'
element-loci
'
:
case
'
element-loci
'
:
const
e
=
loci
.
elements
[
0
]
const
e
=
loci
.
elements
[
0
]
if
(
e
)
{
if
(
e
)
{
...
...
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