From f922efaa04b8e2ed1eb162bab3422015c1b5bfc9 Mon Sep 17 00:00:00 2001 From: didier Date: Fri, 9 Nov 2007 14:28:40 +0000 Subject: Robustesse pour MMultiSelection MAntiRecouvrement Ajout d'une fonctionnalite utile pour la reco d'ecriture dans MWritable Ajout de la possibilite de passer en parametre une fonction "translate" particuliere dans le MMover --- src/MTools/Comp/MWritable.pm | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'src/MTools/Comp/MWritable.pm') diff --git a/src/MTools/Comp/MWritable.pm b/src/MTools/Comp/MWritable.pm index 764e384..ec7fbd8 100644 --- a/src/MTools/Comp/MWritable.pm +++ b/src/MTools/Comp/MWritable.pm @@ -37,6 +37,7 @@ package MTools::Comp::MWritable; # * write : force l'ecriture # * end_write : force une fin d'ecriture # * erase : force un effacement +# * getArrayFromCurves : renvoie les coordonnees des curves sous forme de tableau use strict; @@ -101,8 +102,8 @@ sub __endWrite { ($x, $y) = $zinc -> transform ('device', minstance ($self), [$x, $y]); $self -> writing ($x, $y); $self -> notify ('WRITE', $x, $y); - $self -> notify ('END_WRITE'); $self -> endWrite (); + $self -> notify ('END_WRITE'); } else { @@ -247,7 +248,44 @@ sub erase { } } } - +sub getArrayFromCurves { + my ($self,$format) = @_; + my @tab = (); + if (defined $self -> {__curves}) + { + my @curves = @{$self -> {__curves}}; + for (my $i = $#curves; $i >= 0 ; $i --) + { + my $single = ""; + my @points = $zinc -> coords ($curves [$i]); + for (my $j = 0; $j <= $#points; $j ++) + { + if (defined $format && $format eq "RECO") + { + $single .= sprintf" %d %d,",$points[$j]-> [0],$points[$j] -> [1]; + if ($j == $#points) + { + $single .=" break"; + } + } + else + { + $single .= sprintf"\[%d,%d",$points[$j]-> [0],$points[$j] -> [1]; + if (defined $points[$j] -> [2]) + { + $single .= sprintf",%s\]-",$points[$j] -> [2]; + } + else + { + $single .= sprintf"\]-"; + } + } + } + push (@tab,$single); + } + } + return \@tab; +} sub __deleteCurve { my ($self, $index) = @_; $self -> notify ('ERASE', $index); -- cgit v1.1