dot: heuristic to switch between circles and ellipses

* src/twaalgos/dotty.cc: Add an option (e) to force elliptic shape, and
a heuristic to choose between circle and ellipse by default.
* src/bin/common_aoutput.cc, src/bin/dstar2tgba.cc: Document 'e'.
* src/taalgos/dotty.cc: Ignore 'e'.
* wrap/python/spot.py (setup): Do not force circular states.  The
default should be fine.
* src/tests/det.test, src/tests/dstar.test, src/tests/monitor.test,
src/tests/neverclaimread.test, src/tests/readsave.test,
src/tests/sccdot.test, src/tests/tgbagraph.test: Adjust expected
results.
* NEWS: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2015-04-28 18:22:08 +02:00
parent 8aa88c2951
commit a4b63e8e7f
13 changed files with 65 additions and 22 deletions

View file

@ -47,7 +47,8 @@ namespace spot
bool opt_force_acc_trans_ = false;
bool opt_horizontal_ = true;
bool opt_name_ = false;
bool opt_circles_ = false;
enum { ShapeAuto = 0, ShapeCircle, ShapeEllipse }
opt_shape_ = ShapeAuto;
bool opt_show_acc_ = false;
bool mark_states_ = false;
bool opt_scc_ = false;
@ -123,10 +124,10 @@ namespace spot
opt_bullet_but_buchi = true;
break;
case 'c':
opt_circles_ = true;
opt_shape_ = ShapeCircle;
break;
case 'h':
opt_horizontal_ = true;
case 'e':
opt_shape_ = ShapeEllipse;
break;
case 'f':
if (*options != '(')
@ -141,6 +142,9 @@ namespace spot
options = end + 1;
}
break;
case 'h':
opt_horizontal_ = true;
break;
case 'n':
opt_name_ = true;
break;
@ -275,7 +279,6 @@ namespace spot
aut_->get_acceptance().used_inf_fin_sets();
if (opt_bullet && aut_->acc().num_sets() <= MAX_BULLET)
opt_all_bullets = true;
os_ << "digraph G {\n";
if (opt_horizontal_)
os_ << " rankdir=LR\n";
@ -317,8 +320,18 @@ namespace spot
}
os_ << " labelloc=\"t\"\n";
}
if (opt_circles_)
os_ << " node [shape=\"circle\"]\n";
switch (opt_shape_)
{
case ShapeCircle:
os_ << " node [shape=\"circle\"]\n";
break;
case ShapeEllipse:
// Do not print anything. Ellipse is
// the default shape used by GraphViz.
break;
case ShapeAuto:
SPOT_UNREACHABLE();
}
if (!opt_font_.empty())
os_ << " fontname=\"" << opt_font_
<< "\"\n node [fontname=\"" << opt_font_
@ -452,8 +465,16 @@ namespace spot
if (opt_name_)
name_ = aut_->get_named_prop<std::string>("automaton-name");
mark_states_ = !opt_force_acc_trans_ && aut_->has_state_based_acc();
if (opt_shape_ == ShapeAuto)
{
if (sn_ || aut->num_states() > 100)
opt_shape_ = ShapeEllipse;
else
opt_shape_ = ShapeCircle;
}
auto si =
std::unique_ptr<scc_info>(opt_scc_ ? new scc_info(aut) : nullptr);
start();
if (si)
{