Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
6ecafc45
Commit
6ecafc45
authored
May 02, 2013
by
Tiago Peixoto
Browse files
Implement halo size option in graph_draw()
parent
c8c4518d
Changes
3
Hide whitespace changes
Inline
Side-by-side
doc/demos/animation_zombies.py
View file @
6ecafc45
...
...
@@ -78,6 +78,7 @@ if not offscreen:
edge_color
=
[
0.6
,
0.6
,
0.6
,
1
],
vertex_surface
=
vertex_sfcs
,
vertex_halo
=
newly_infected
,
vertex_halo_size
=
1.2
,
vertex_halo_color
=
[
0.8
,
0
,
0
,
0.6
])
else
:
count
=
0
...
...
src/graph/draw/graph_cairo_draw.cc
View file @
6ecafc45
...
...
@@ -54,6 +54,7 @@ enum vertex_attr_t {
VERTEX_PENWIDTH
,
VERTEX_HALO
,
VERTEX_HALO_COLOR
,
VERTEX_HALO_SIZE
,
VERTEX_TEXT
,
VERTEX_TEXT_COLOR
,
VERTEX_TEXT_POSITION
,
...
...
@@ -117,7 +118,7 @@ typedef pair<double, double> pos_t;
typedef
tuple
<
double
,
double
,
double
,
double
>
color_t
;
typedef
tr1
::
unordered_map
<
int
,
boost
::
any
>
attrs_t
;
typedef
mpl
::
map3
6
<
typedef
mpl
::
map3
7
<
mpl
::
pair
<
mpl
::
int_
<
VERTEX_SHAPE
>
,
vertex_shape_t
>
,
mpl
::
pair
<
mpl
::
int_
<
VERTEX_COLOR
>
,
color_t
>
,
mpl
::
pair
<
mpl
::
int_
<
VERTEX_FILL_COLOR
>
,
color_t
>
,
...
...
@@ -127,6 +128,7 @@ typedef mpl::map36<
mpl
::
pair
<
mpl
::
int_
<
VERTEX_PENWIDTH
>
,
double
>
,
mpl
::
pair
<
mpl
::
int_
<
VERTEX_HALO
>
,
uint8_t
>
,
mpl
::
pair
<
mpl
::
int_
<
VERTEX_HALO_COLOR
>
,
color_t
>
,
mpl
::
pair
<
mpl
::
int_
<
VERTEX_HALO_SIZE
>
,
double
>
,
mpl
::
pair
<
mpl
::
int_
<
VERTEX_TEXT
>
,
string
>
,
mpl
::
pair
<
mpl
::
int_
<
VERTEX_TEXT_COLOR
>
,
color_t
>
,
mpl
::
pair
<
mpl
::
int_
<
VERTEX_TEXT_POSITION
>
,
double
>
,
...
...
@@ -602,12 +604,13 @@ public:
if
(
_attrs
.
template
get
<
uint8_t
>(
VERTEX_HALO
)
&&
!
outline
)
{
color_t
c
=
_attrs
.
template
get
<
color_t
>(
VERTEX_HALO_COLOR
);
double
hs
=
_attrs
.
template
get
<
double
>(
VERTEX_HALO_SIZE
);
cr
.
set_source_rgba
(
get
<
0
>
(
c
),
get
<
1
>
(
c
),
get
<
2
>
(
c
),
get
<
3
>
(
c
));
cr
.
save
();
cr
.
scale
(
aspect
,
1.0
);
cr
.
arc
(
0
,
0
,
size
,
0
,
2
*
M_PI
);
cr
.
restore
();
cr
.
arc
(
0
,
0
,
size
*
hs
/
2
,
0
,
2
*
M_PI
);
cr
.
fill
();
cr
.
restore
();
}
python
::
object
osrc
=
_attrs
.
template
get
<
python
::
object
>(
VERTEX_SURFACE
);
...
...
@@ -1631,6 +1634,7 @@ BOOST_PYTHON_MODULE(libgraph_tool_draw)
.
value
(
"pen_width"
,
VERTEX_PENWIDTH
)
.
value
(
"halo"
,
VERTEX_HALO
)
.
value
(
"halo_color"
,
VERTEX_HALO_COLOR
)
.
value
(
"halo_size"
,
VERTEX_HALO_SIZE
)
.
value
(
"text"
,
VERTEX_TEXT
)
.
value
(
"text_color"
,
VERTEX_TEXT_COLOR
)
.
value
(
"text_position"
,
VERTEX_TEXT_POSITION
)
...
...
src/graph_tool/draw/cairo_draw.py
View file @
6ecafc45
...
...
@@ -80,6 +80,7 @@ _vdefaults = {
"pen_width"
:
0.8
,
"halo"
:
0
,
"halo_color"
:
[
0.
,
0.
,
1.
,
0.5
],
"halo_size"
:
1.5
,
"text"
:
""
,
"text_color"
:
[
0.
,
0.
,
0.
,
1.
],
"text_position"
:
-
1.
,
...
...
@@ -590,6 +591,9 @@ def graph_draw(g, pos=None, vprops=None, eprops=None, vorder=None, eorder=None,
| halo_color | Color used to draw the halo. | ``str`` or list of | ``[0., 0., 1., 0.5]`` |
| | | ``floats`` | |
+---------------+---------------------------------------------------+------------------------+----------------------------------+
| halo_size | Relative size of the halo. | ``float`` | ``1.5`` |
| | | | |
+---------------+---------------------------------------------------+------------------------+----------------------------------+
| text | Text to draw together with the vertex. | ``str`` | ``""`` |
+---------------+---------------------------------------------------+------------------------+----------------------------------+
| text_color | Color used to draw the text. If the value is | ``str`` or list of | ``"auto"`` |
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment