0
#!/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 mountains
$sth1 = $dbh->prepare("select table_alias.mot.sdo_point.X, table_alias.mot.sdo_point.Y, table_alias.name
from X.mounts table_alias");
$sth1->execute;
#Send SQL query for tourist attraction
$sth2 = $dbh->prepare("select table_alias.mot.sdo_point.X, table_alias.mot.sdo_point.Y
from s1227289.tours table_alias");
$sth2->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="-5.8 56 0.8 2">);
#print mountains
while (@data = $sth1->fetchrow_array()) {
print qq(
<circle cx="$data[1]" cy="$data[0]" r="0.002" fill="green">
</circle>
<text x="$data[1]"
y="$data[0]"
fill="black"
style='font-size:0.01px;font-family:Arial'>$data[2]</text>
);
}
#print tourist attractions
while (@data = $sth2->fetchrow_array()) {
print qq(
<circle cx="$data[1]" cy="$data[0]" r="0.002" fill="red">
</circle>
);
}
print qq(</svg>);
我一直在試圖解決這個問題,但無法讓我的頭部圓滑!問題在於轉型。繪製的點是顛倒的,需要翻轉。我之前已經修復過類似的問題,但這次y值都是負數(即-5.8)將SVG網格轉換爲座標網格
我該如何解決這個問題?總結一下,我基本上想要進行一次轉換,但我堅持如何用-ve數字來做到這一點。我已經搜索了類似的問題,但沒有人處理過-ve數字。