Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rocolibjill
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jillian Pantig
rocolibjill
Commits
89260424
Commit
89260424
authored
3 years ago
by
pjil27
Browse files
Options
Downloads
Patches
Plain Diff
including DecorationPort.py
parent
b15bf7e9
Branches
Branches containing commit
No related merge requests found
Pipeline
#72
failed with stage
in 2 minutes and 13 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rocolib/api/ports/DecorationPort.py
+44
-0
44 additions, 0 deletions
rocolib/api/ports/DecorationPort.py
with
44 additions
and
0 deletions
rocolib/api/ports/DecorationPort.py
0 → 100644
+
44
−
0
View file @
89260424
from
rocolib.api.ports
import
Port
,
FacePort
from
rocolib.utils.utils
import
decorateGraph
import
numpy
as
np
class
DecorationPort
(
Port
):
def
__init__
(
self
,
parent
,
decoration
):
Port
.
__init__
(
self
,
parent
,
{})
self
.
decoration
=
decoration
def
getDecoration
(
self
):
return
self
.
decoration
def
toString
(
self
):
return
str
(
self
.
decoration
)
def
canMate
(
self
,
otherPort
):
return
(
otherPort
.
getFaceName
()
is
not
None
)
def
attachFrom
(
self
,
fromPort
,
graph
,
**
kwargs
):
# If from face to decoration, we can decorate the face
if
isinstance
(
fromPort
,
FacePort
):
face
=
graph
.
getFace
(
fromPort
.
getFaceName
())
deco
=
self
.
getDecoration
()
if
face
is
not
None
:
decorateGraph
(
face
,
decoration
=
deco
,
**
kwargs
)
class
AnchorPort
(
FacePort
):
def
__init__
(
self
,
parent
,
graph
,
face
,
transform
):
FacePort
.
__init__
(
self
,
parent
,
graph
,
face
)
self
.
transform
=
transform
def
getTransform
(
self
):
return
self
.
transform
def
canMate
(
self
,
otherPort
):
return
False
def
attachFrom
(
self
,
fromPort
,
graph
,
**
kwargs
):
if
isinstance
(
fromPort
,
DecorationPort
):
deco
=
fromPort
.
getDecoration
().
faces
[
0
]
face
=
self
.
getFaceName
()
graph
.
mergeFace
(
deco
.
joinedFaces
[
0
][
0
].
name
,
face
,
np
.
dot
(
self
.
getTransform
(),
deco
.
transform2D
))
This diff is collapsed.
Click to expand it.
Preview
0%
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