1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
# Copyright (c) 1997-2024
# Ewgenij Gawrilow, Michael Joswig, and the polymake team
# Technische Universität Berlin, Germany
# https://polymake.org
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any
# later version: http://www.gnu.org/licenses/gpl.txt.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#-------------------------------------------------------------------------------
package Visual::CovectorLattice;
use Polymake::Struct (
[ '@ISA' => 'Container' ],
[ '$CovectorLattice' => '#%' ],
);
options %decorations = (
%Visual::Lattice::decorations,
# String if set to "hidden", the covectors are not displayed.
Covectors => enum("hidden"),
);
object CovectorLattice {
# @category Visualization
# Visualizes the covector lattice. This works the same as a visualization of a Hasse diagram
# except that by default, covectors are displayed. This can be turned off by the option Covectors=>"hidden"
user_method VISUAL(%Visual::CovectorLattice::decorations, { seed => undef }) {
my ($this, $decor, $seed)=@_;
my $show_covectors = delete($decor->{Covectors}) ne "hidden";
# Add the covector to the node label
if ($show_covectors) {
$decor->{LabelAlignment} = "center";
my @s;
for my $i (0 .. $this->N_NODES-1) {
# No label for extreme nodes
if ($i == $this->BOTTOM_NODE || $i == $this->TOP_NODE) {
push @s, ""; next;
}
my @covector_string = map {$_->size() == 0? "-" : join(" ", @{$_})} @{rows($this->COVECTORS->[$i])};
push @s, ($this->FACES->[$i])."\\\\( ".join(" , ",@covector_string)." )";
}
$decor->{NodeLabels} = \@s;
}
$this->SUPER::VISUAL($decor, $seed);
}
}
# Local Variables:
# mode: perl
# cperl-indent-level:3
# indent-tabs-mode:nil
# End:
|