aboutsummaryrefslogtreecommitdiff
path: root/src/SVG/SVG2zinc.pm
diff options
context:
space:
mode:
authorbouyssou2008-01-25 13:08:38 +0000
committerbouyssou2008-01-25 13:08:38 +0000
commit200d077a62db0d382222f90109f26ff42d049c4d (patch)
tree2647ebb770366d7034fbf83ca3019463fd582ef2 /src/SVG/SVG2zinc.pm
parentac09f61ab379f723c51838d9669c574da3fa82af (diff)
downloadmtc-200d077a62db0d382222f90109f26ff42d049c4d.zip
mtc-200d077a62db0d382222f90109f26ff42d049c4d.tar.gz
mtc-200d077a62db0d382222f90109f26ff42d049c4d.tar.bz2
mtc-200d077a62db0d382222f90109f26ff42d049c4d.tar.xz
Ajout du type d'un item zinc (text, rect, etc.) dans ses propres tags. Ce systeme avait ete supprime lors de la creation de la table de hash des items mais il semble que cela reste encore utile : notamment lors de l utilisation de la librairie Tk::Zinc::Text qui offre une gestion de saisie de texte sur un item Text.
Diffstat (limited to 'src/SVG/SVG2zinc.pm')
-rw-r--r--src/SVG/SVG2zinc.pm20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/SVG/SVG2zinc.pm b/src/SVG/SVG2zinc.pm
index 753fff7..09d577b 100644
--- a/src/SVG/SVG2zinc.pm
+++ b/src/SVG/SVG2zinc.pm
@@ -489,7 +489,7 @@ sub clipPath {
%attrs = &expandAttributes ($elementname,%attrs);
my ($name,$natural) = &name ($elementname, $attrs{id});
print "In clippath $name NYI\n";
- my $res = "->add('group',$current_group, -tags => [$name], -priority => 10, -atomic => 1, -visible => 0";
+ my $res = "->add('group',$current_group, -tags => ['__clipPath',$name], -priority => 10, -atomic => 1, -visible => 0";
unshift @prev_groups, $current_group;
unshift @prev_contexts, \%current_context;
my $prop;
@@ -542,7 +542,7 @@ sub use {
}
$ref =~ s/\#//;
my $cleanedId = &cleanName($ref); # to make the name zinc compliant
- my $res = "-> clone ('$cleanedId', -visible => 1, -tags => [$name]";
+ my $res = "-> clone ('$cleanedId', -visible => 1, -tags => ['cloned_$cleanedId',$name]";
$res .= &analyze_style (\%attrs);
$res .=");";
my ($x,$y,$width,$height) = ($attrs{x},$attrs{y},$attrs{width},$attrs{height});
@@ -1023,7 +1023,7 @@ sub image {
return;
}
- $res .= ", -tags => [$name], -composescale => 1, -composerotation => 1, -priority => 10);";
+ $res .= ", -tags => [$name,'$ref'], -composescale => 1, -composerotation => 1, -priority => 10);";
push @RES, $res ;
my ($x, $y, $width, $height) = &sizesConvert ( \%attrs , qw (x y width height));
@@ -1071,7 +1071,7 @@ sub line {
%attrs = &expandAttributes ($elementname,%attrs);
my ($name,$natural) = &name ($elementname, $attrs{id});
my $res = printFindKey ($name). "\$previous = ->add ('curve', $current_group, [$attrs{x1}, $attrs{y1}, $attrs{x2}, $attrs{y2}], -priority => 10";
- $res .= ", -tags => [$name]," if ($natural or $attrs{transform});
+ $res .= ", -tags => ['line',$name]," if ($natural or $attrs{transform});
$res .= &analyze_style (\%attrs);
$res .=");";
&attrs_implemented ( 'line', $name, [qw (x1 y1 x2 y2 style id transform )], %attrs );
@@ -1136,7 +1136,7 @@ my %save_current_context = ();
my ($name,$natural) = &name ($elementname, $attrs{id});
($text_x, $text_y) = &sizesConvert( \%attrs , qw (x y));
$res = printFindKey ($name)."->add('text',$current_group, -composescale => 1, -composerotation => 1, -position => [0, 0]";
- $res .= ", -tags => [$name]" if ($natural or $attrs{transform});
+ $res .= ", -tags => ['text',$name]" if ($natural or $attrs{transform});
$res .= ", -anchor => 'nw'";
$res .= &analyze_text_style (\%attrs);
@texts = ();
@@ -1212,7 +1212,7 @@ sub polyline {
my ($name,$natural) = &name ($elementname, $attrs{id});
my $res = printFindKey ($name)."\$previous ->add('curve',$current_group,[" . &points(\%attrs);
$res .= "]";
- $res .= ", -tags => [$name]" if ($natural or $attrs{transform});
+ $res .= ", -tags => ['polyline',$name]" if ($natural or $attrs{transform});
$res .= ", -priority => 10";
$res .= &analyze_style (\%attrs);
$res .=");";
@@ -1252,7 +1252,7 @@ sub rect {
$add_stroke = 0;
my $res = printFindKey ($name)."\$previous = -> add('$type',$current_group, [$path]";
- $res .= ", -tags => [$name]" if ($natural or $attrs{transform});
+ $res .= ", -tags => ['rect',$name]" if ($natural or $attrs{transform});
$res .= ", -priority => 10";
$res .= ", -filled => 1" unless defined $attrs{fill} and $attrs{fill} eq 'none';
@@ -1321,7 +1321,7 @@ sub ellipse {
my ($cx,$cy,$rx,$ry)=&sizesConvert( \%attrs , qw (cx cy rx ry));
my $res = printFindKey ($name)."\$previous = ->add('arc', $current_group, [". ($cx-$rx) . ", ". ($cy-$ry) .
", " . ($cx+$rx) . ", ". ($cy+$ry) . "]";
- $res .= ", -tags => [$name]" if ($natural or $attrs{transform});
+ $res .= ", -tags => ['ellipse',$name]" if ($natural or $attrs{transform});
$res .= ", -priority => 10";
# by default, ellipses are filled
# from svg specifs). The value is set here, and can be overidden later
@@ -1360,7 +1360,7 @@ sub circle {
my ($cx,$cy,$r)=&sizesConvert( \%attrs , qw (cx cy r));
my $res = printFindKey ($name)."\$previous = -> add('arc',$current_group,[". ($cx-$r) . ", ". ($cy-$r) .
", " . ($cx+$r) . ", ". ($cy+$r) . "]";
- $res .= ", -tags => [$name]" if ($natural or $attrs{transform});
+ $res .= ", -tags => ['circle',$name]" if ($natural or $attrs{transform});
$res .= ", -priority => 10";
# by default, circles are filled
# from svg specifs). The value is set here, and can be overidden later
@@ -1398,7 +1398,7 @@ sub polygon {
my ($name,$natural) = &name ($elementname, $attrs{id});
my $res = printFindKey ($name)."\$previous = -> add('curve',$current_group,[" . &points(\%attrs);
$res .= "], -closed => 1";
- $res .= ", -tags => [$name]" if ($natural or $attrs{transform});
+ $res .= ", -tags => ['polygon',$name]" if ($natural or $attrs{transform});
$res .= ", -priority => 10";
# by default, polygones are filled
# from svg specifs). The value is set here, and can be overidden later