aboutsummaryrefslogtreecommitdiff
path: root/src/MTools/Comp/MWritable.pm
diff options
context:
space:
mode:
authorcaramel2007-08-07 09:32:59 +0000
committercaramel2007-08-07 09:32:59 +0000
commit332ce0e6b8202a2b8eb07dced11bc5297528c8bf (patch)
tree7e974e51cafb7fa4acdce33711edd50bb233518b /src/MTools/Comp/MWritable.pm
parent1eb75a14c3a6a994f640566171c091e1075e9c33 (diff)
downloadmtc-332ce0e6b8202a2b8eb07dced11bc5297528c8bf.zip
mtc-332ce0e6b8202a2b8eb07dced11bc5297528c8bf.tar.gz
mtc-332ce0e6b8202a2b8eb07dced11bc5297528c8bf.tar.bz2
mtc-332ce0e6b8202a2b8eb07dced11bc5297528c8bf.tar.xz
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
Diffstat (limited to 'src/MTools/Comp/MWritable.pm')
-rw-r--r--src/MTools/Comp/MWritable.pm14
1 files changed, 14 insertions, 0 deletions
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;