Mailinglisten-Archive |
Hallo Stephan,
Zunächst zu Deinem Problem , kannst mal erklären wo es bei den Multilinien
happert (verwende bei mir , da es vornehmlich Flächen sind halt Polygone)?
Mit dem Koordinatensystem in SVG ,dass hab ich schon früher mal gelköst.
Geht halt durch viewportänderung auf der Y-Achse , die dann negativ ist.
Somit müssen auch die Y-Werte im Koordinatensystem negativ sein.
Vielmehr hab ich Probleme mit der Stringauswertung.
Habs aber schonmal gelöst, jedoch sah der Ausgangsstring etwas anders aus.
Ausschnitt des damaligen Codes:
$sql="SELECT * FROM alkobj_pl LEFT JOIN beziehungnutzer USING(ObjNr) where
nutzer='$nutzer' and folie ='$folie'";
$result=mysql_query($sql,$conn);
if ($result) {
while ($row=mysql_fetch_object($result))
{
$i=0;
$color = "rgb(".rand(64,255).",".rand(64,254).",".rand(64,255).")";
if ($ObjArt=='7100') {$color="rgb(0,0,0)";}
$polyarray=explode(")",$row->ObjGeom);
print('<g id="'.$row->ObjNr.'">');
$j=0;
foreach($polyarray as $poly)
{
$poly=str_replace("(","",$poly);
$poly=str_replace(")","",$poly);
$poly= str_replace(' ,','#',$poly);
$poly= str_replace(' ',',',$poly);
$poly = str_replace('#',' ',$poly);
if(strchr($poly,",")==0 and $j>0) $poly=substr($poly,2);
$poly= str_replace(',',',-',$poly); // spiegeln der y-Achse
if (strlen($poly)>1)
{
print('<polygon id="'.$row->ObjNr.$i.'" points="'.$poly.'"
fill="'.$color.'" stroke="rgb(0,0,0)" stroke-width="0.5"
onmouseover="showParzelle(evt)" onmouseout="restoreParzelle(evt)"
onclick="show(evt)" /> ');
$i++;
}
$j++;
}
print('</g>');
}
}
damals sah der string etwa so aus: ((x y ,x y ,...)((x y ,x y )) //
Zusetzliches Blank und kein Text sowie andere Klammerung
daraus wurde (x,-y,....) (x,-y) für SVG
Folgendes Schema zeigt den heutigen Ausgansstring :
MULTIPOLYGON(((x y,x y,...)(x y,x y)
daraus soll werden (x,-y,....) (x,-y) für SVG
Für tips zum Umbau obigen Codes oder andere Lösung bin ich dankbar
Gruss
Burkhard Stollenwerk
php::bar PHP Wiki - Listenarchive