我试图用svg绘制一些点。它们是x,y坐标,范围很小:
57.206116 -6.223032
57.2225 -6.2441702
57.233299 -6.1833301
57.246666 -6.210278
57.208561 -6.2244201
当它们被绘制时,它们在屏幕上显然非常小。 这是我的viewbox命令:
print qq(
<svg width="20cm" height="20cm" viewBox="57 -7 3 3">);
如何对其进行优化,使其在20 x 20厘米的盒子中清晰显示。
#!/usr/bin/perl
use DBI;
use CGI::Carp qw(fatalsToBrowser);
#Set content type
print "Content-Type: image/svg-xml\n\n";
#Establish connection to database
$dbh = DBI->connect ('dbi:Oracle:geosgen','user','pass')
|| die "Man down! Man down!: $DBI::errstr";
#Send SQL query for finds
$sth1 = $dbh->prepare("select table_alias.mot.sdo_point.X, table_alias.mot.sdo_point.Y
from x.mounts table_alias");
$sth1->execute;
#Set content type
print qq(<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN"
"http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">);
print qq(<svg width="20cm" height="20cm" viewBox="57 -7 3 3">);
while (@data = $sth1->fetchrow_array()) {
print qq(
<g transform="scale(1,-1)">
<circle cx="$data[0]" cy="$data[1]" r="0.01" fill="green">
</circle>
</g>
);
}
print qq();
答案 0 :(得分:0)
我尝试了一下你的代码。
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN" "http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">
<body>
<div id="test">
<svg width="20cm" height="20cm" viewBox="57 -7 3 3" >
<rect x="57" y="-7" width="3" height="3" fill="none" stroke="black" stroke-width="0.01px" />
<g >
<circle cx="57.206116" cy="-6.223032" r="0.01" fill="green"></circle>
<circle cx="57.2225" cy="-6.2441702" r="0.01" fill="red"></circle>
<circle cx="57.233299" cy="-6.1833301" r="0.01" fill="blue"></circle>
</g>
</svg>
</div>
</body>
我删除了比例并添加了一个矩形以查看我们的位置。
这就是我的结果: