From 332ce0e6b8202a2b8eb07dced11bc5297528c8bf Mon Sep 17 00:00:00 2001 From: caramel Date: Tue, 7 Aug 2007 09:32:59 +0000 Subject: Ajout de la methode addCurves a MWritable, qui permet d ajouter des courbes sans les avoir tracees au prealable. Utilisee par la duplication de postit dans Aster --- src/MTools/Comp/MWritable.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/MTools') diff --git a/src/MTools/Comp/MWritable.pm b/src/MTools/Comp/MWritable.pm index 461468c..764e384 100644 --- a/src/MTools/Comp/MWritable.pm +++ b/src/MTools/Comp/MWritable.pm @@ -271,4 +271,18 @@ sub mdist { return (($x1 - $x2) ** 2 + ($y1 - $y2) ** 2 <= ($k) ** 2); } + +# from a reference to an array, this method clones the curves from this +# referenced array to the self array of curves, changing by the way +# the curves' group. +sub addCurves { + my ($self, $curves) = @_; + my $clone = undef; + foreach (@{$curves}) { + $clone = $zinc->clone($_); + $zinc -> chggroup ( $clone , minstance($self) ); + push( @{$self -> {__curves}} , $clone ); + } +} + 1; -- cgit v1.1