Skip to content

Commit

Permalink
post-merge adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
Licini committed Jun 10, 2024
1 parent 70f63f9 commit 70df234
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 37 deletions.
23 changes: 14 additions & 9 deletions src/compas/scene/graphobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
from __future__ import division
from __future__ import print_function

import compas.colors # noqa: F401
import compas.datastructures # noqa: F401
import compas.geometry # noqa: F401

from compas.geometry import transform_points

from .descriptors.colordict import ColorDictAttribute
Expand All @@ -23,6 +27,10 @@ class GraphObject(SceneObject):
node_xyz : dict[hashable, list[float]]
Mapping between nodes and their view coordinates.
The default view coordinates are the actual coordinates of the nodes of the graph.
show_nodes : Union[bool, sequence[hashable]]
Flag for showing or hiding the nodes. Default is ``True``.
show_edges : Union[bool, sequence[tuple[hashable, hashable]]]
Flag for showing or hiding the edges. Default is ``True``.
nodecolor : :class:`compas.colors.ColorDict`
Mapping between nodes and RGB color values.
edgecolor : :class:`compas.colors.ColorDict`
Expand All @@ -31,10 +39,6 @@ class GraphObject(SceneObject):
The size of the nodes. Default is ``1.0``.
edgewidth : float
The width of the edges. Default is ``1.0``.
show_nodes : Union[bool, sequence[hashable]]
Flag for showing or hiding the nodes. Default is ``True``.
show_edges : Union[bool, sequence[tuple[hashable, hashable]]]
Flag for showing or hiding the edges. Default is ``True``.
See Also
--------
Expand All @@ -46,16 +50,16 @@ class GraphObject(SceneObject):
nodecolor = ColorDictAttribute()
edgecolor = ColorDictAttribute()

def __init__(self, nodecolor=None, edgecolor=None, nodesize=1.0, edgewidth=1.0, show_nodes=True, show_edges=True, **kwargs):
# type: (dict | compas.colors.Color | None, dict | compas.colors.Color | None, float, float, bool, bool, dict) -> None
def __init__(self, show_nodes=True, show_edges=True, nodecolor=None, edgecolor=None, nodesize=1.0, edgewidth=1.0, **kwargs):
# type: (bool | list, bool | list, dict | compas.colors.Color | None, dict | compas.colors.Color | None, float, float, dict) -> None
super(GraphObject, self).__init__(**kwargs)
self._node_xyz = None
self.show_nodes = show_nodes
self.show_edges = show_edges
self.nodecolor = nodecolor or self.color
self.edgecolor = edgecolor or self.color
self.nodesize = nodesize
self.edgewidth = edgewidth
self.show_nodes = show_nodes
self.show_edges = show_edges

@property
def settings(self):
Expand All @@ -71,12 +75,13 @@ def settings(self):

@property
def graph(self):
# type: () -> compas.datastructures.Graph
return self.item

@graph.setter
def graph(self, graph):
# type: (compas.datastructures.Graph) -> None
self._graph = graph
self._item = graph
self._transformation = None
self._node_xyz = None

Expand Down
33 changes: 16 additions & 17 deletions src/compas/scene/meshobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ class MeshObject(SceneObject):
vertex_xyz : dict[int, list[float]]
View coordinates of the vertices.
Defaults to the real coordinates.
color : :class:`compas.colors.Color`
The base RGB color of the mesh.
show_vertices : Union[bool, sequence[float]]
Flag for showing or hiding the vertices, or a list of keys for the vertices to show.
Default is ``False``.
show_edges : Union[bool, sequence[tuple[int, int]]]
Flag for showing or hiding the edges, or a list of keys for the edges to show.
Default is ``True``.
show_faces : Union[bool, sequence[int]]
Flag for showing or hiding the faces, or a list of keys for the faces to show.
Default is ``True``.
vertexcolor : :class:`compas.colors.ColorDict`
Vertex colors.
edgecolor : :class:`compas.colors.ColorDict`
Expand All @@ -38,15 +45,6 @@ class MeshObject(SceneObject):
The size of the vertices. Default is ``1.0``.
edgewidth : float
The width of the edges. Default is ``1.0``.
show_vertices : Union[bool, sequence[float]]
Flag for showing or hiding the vertices, or a list of keys for the vertices to show.
Default is ``False``.
show_edges : Union[bool, sequence[tuple[int, int]]]
Flag for showing or hiding the edges, or a list of keys for the edges to show.
Default is ``True``.
show_faces : Union[bool, sequence[int]]
Flag for showing or hiding the faces, or a list of keys for the faces to show.
Default is ``True``.
See Also
--------
Expand All @@ -59,18 +57,18 @@ class MeshObject(SceneObject):
edgecolor = ColorDictAttribute()
facecolor = ColorDictAttribute()

def __init__(self, vertexcolor=None, edgecolor=None, facecolor=None, vertexsize=1.0, edgewidth=1.0, show_vertices=False, show_edges=False, show_faces=True, **kwargs):
# type: (dict | compas.colors.Color | None, dict | compas.colors.Color | None, dict | compas.colors.Color | None, float, float, bool, bool, bool, dict) -> None
def __init__(self, show_vertices=False, show_edges=False, show_faces=True, vertexcolor=None, edgecolor=None, facecolor=None, vertexsize=1.0, edgewidth=1.0, **kwargs):
# type: (bool | list, bool | list, bool | list, dict | compas.colors.Color | None, dict | compas.colors.Color | None, dict | compas.colors.Color | None, float, float, dict) -> None
super(MeshObject, self).__init__(**kwargs)
self._vertex_xyz = None
self.show_vertices = show_vertices
self.show_edges = show_edges
self.show_faces = show_faces
self.vertexcolor = vertexcolor or self.contrastcolor
self.edgecolor = edgecolor or self.contrastcolor
self.facecolor = facecolor or self.color
self.vertexsize = vertexsize
self.edgewidth = edgewidth
self.show_vertices = show_vertices
self.show_edges = show_edges
self.show_faces = show_faces

@property
def settings(self):
Expand All @@ -90,12 +88,13 @@ def settings(self):

@property
def mesh(self):
# type: () -> compas.datastructures.Mesh
return self.item

@mesh.setter
def mesh(self, mesh):
# type: (compas.datastructures.Mesh) -> None
self._mesh = mesh
self._item = mesh
self._transformation = None
self._vertex_xyz = None

Expand Down
5 changes: 2 additions & 3 deletions src/compas/scene/volmeshobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class VolMeshObject(SceneObject):

def __init__(
self,
volmesh,
show_vertices=False,
show_edges=True,
show_faces=False,
Expand All @@ -81,7 +80,7 @@ def __init__(
edgewidth=1.0,
**kwargs,
):
# type: (compas.datastructures.VolMesh, bool | list, bool | list, bool | list, bool | list, compas.colors.Color | dict, compas.colors.Color | dict, compas.colors.Color | dict, compas.colors.Color | dict, float | dict, float | dict, dict) -> None
# type: (bool | list, bool | list, bool | list, bool | list, compas.colors.Color | dict, compas.colors.Color | dict, compas.colors.Color | dict, compas.colors.Color | dict, float | dict, float | dict, dict) -> None
super(VolMeshObject, self).__init__(**kwargs)
self._vertex_xyz = None
self.show_vertices = show_vertices
Expand Down Expand Up @@ -116,7 +115,7 @@ def volmesh(self):
@volmesh.setter
def volmesh(self, volmesh):
# type: (compas.datastructures.VolMesh) -> None
self._volmesh = volmesh
self._item = volmesh
self._transformation = None
self._vertex_xyz = None

Expand Down
14 changes: 9 additions & 5 deletions src/compas_rhino/scene/graphobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,23 @@


class RhinoGraphObject(RhinoSceneObject, GraphObject):
"""Scene object for drawing graph data structures."""
"""Scene object for drawing graph data structures.
Parameters
----------
graph : :class:`compas.datastructures.Graph`
A COMPAS graph.
nodegroup : str, optional
The name of the group for the nodes.
edgegroup : str, optional
The name of the group for the edges.
edgedirection : bool, optional
Flag for drawing the edges with an arrow indicating the direction.
**kwargs : dict, optional
Additional keyword arguments.
"""

def __init__(self, graph, nodegroup=None, edgegroup=None, edgedirection=False, **kwargs):
super(RhinoGraphObject, self).__init__(graph=graph, **kwargs)
def __init__(self, nodegroup=None, edgegroup=None, edgedirection=False, **kwargs):
super(RhinoGraphObject, self).__init__(**kwargs)
self._guids_nodes = None
self._guids_edges = None
self._guids_nodelabels = None
Expand Down
15 changes: 14 additions & 1 deletion src/compas_rhino/scene/meshobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ class RhinoMeshObject(RhinoSceneObject, MeshObject):
----------
disjoint : bool, optional
Draw the faces of the mesh disjointed.
Default is ``False``.
vertexgroup : str, optional
The name of the group for the vertices.
edgegroup : str, optional
The name of the group for the edges.
facegroup : str, optional
The name of the group for the faces.
**kwargs : dict, optional
Additional keyword arguments.
Expand All @@ -36,10 +43,16 @@ class RhinoMeshObject(RhinoSceneObject, MeshObject):
disjoint : bool, optional
Draw the faces of the mesh disjointed.
Default is ``False``.
vertexgroup : str, optional
The name of the group for the vertices.
edgegroup : str, optional
The name of the group for the edges.
facegroup : str, optional
The name of the group for the faces.
"""

def __init__(self, mesh, disjoint=False, vertexgroup=None, edgegroup=None, facegroup=None, **kwargs):
def __init__(self, disjoint=False, vertexgroup=None, edgegroup=None, facegroup=None, **kwargs):
super(RhinoMeshObject, self).__init__(**kwargs)
self.disjoint = disjoint
self._guid_mesh = None
Expand Down
20 changes: 18 additions & 2 deletions src/compas_rhino/scene/volmeshobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ class RhinoVolMeshObject(RhinoSceneObject, VolMeshObject):
disjoint : bool, optional
Draw the faces of the mesh disjointed.
Default is ``True``.
vertexgroup : str, optional
The name of the group for the vertices.
edgegroup : str, optional
The name of the group for the edges.
facegroup : str, optional
The name of the group for the faces.
cellgroup : str, optional
The name of the group for the cells.
**kwargs : dict, optional
Additional keyword arguments.
Expand All @@ -33,11 +41,19 @@ class RhinoVolMeshObject(RhinoSceneObject, VolMeshObject):
disjoint : bool
Draw the faces of the mesh disjointed.
Default is ``True``.
vertexgroup : str
The name of the group for the vertices.
edgegroup : str
The name of the group for the edges.
facegroup : str
The name of the group for the faces.
cellgroup : str
The name of the group for the cells.
"""

def __init__(self, volmesh, disjoint=True, vertexgroup=None, edgegroup=None, facegroup=None, cellgroup=None, **kwargs):
super(RhinoVolMeshObject, self).__init__(volmesh=volmesh, **kwargs)
def __init__(self, disjoint=True, vertexgroup=None, edgegroup=None, facegroup=None, cellgroup=None, **kwargs):
super(RhinoVolMeshObject, self).__init__(**kwargs)
self.disjoint = disjoint
self._guids_vertices = None
self._guids_edges = None
Expand Down

0 comments on commit 70df234

Please sign in to comment.