Labels for each part in the geometry is not a good idea
This commit is contained in:
parent
a1f2d5311a
commit
acb6656961
@ -79,6 +79,7 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
|
||||
// Seperate each linestring
|
||||
$linestirngs = explode("),(", $multilinestirng);
|
||||
|
||||
$first_line = true;
|
||||
foreach ($linestirngs as $linestring) {
|
||||
$points_arr = $this->extractPoints($linestring, $scale_data);
|
||||
foreach ($points_arr as $point) {
|
||||
@ -92,9 +93,10 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
|
||||
}
|
||||
unset($temp_point);
|
||||
// print label if applicable
|
||||
if (isset($label) && trim($label) != '') {
|
||||
if (isset($label) && trim($label) != '' && $first_line) {
|
||||
imagestring($image, 2, $points_arr[1][0], $points_arr[1][1], trim($label), $black);
|
||||
}
|
||||
$first_line = false;
|
||||
}
|
||||
return $image;
|
||||
}
|
||||
@ -123,6 +125,7 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
|
||||
// Seperate each linestring
|
||||
$linestirngs = explode("),(", $multilinestirng);
|
||||
|
||||
$first_line = true;
|
||||
foreach ($linestirngs as $linestring) {
|
||||
$points_arr = $this->extractPoints($linestring, $scale_data);
|
||||
foreach ($points_arr as $point) {
|
||||
@ -136,11 +139,12 @@ class PMA_GIS_Multilinestring extends PMA_GIS_Geometry
|
||||
}
|
||||
unset($temp_point);
|
||||
// print label
|
||||
if (isset($label) && trim($label) != '') {
|
||||
if (isset($label) && trim($label) != '' && $first_line) {
|
||||
$pdf->SetXY($points_arr[1][0], $points_arr[1][1]);
|
||||
$pdf->SetFontSize(7);
|
||||
$pdf->Cell(0, 0, trim($label));
|
||||
}
|
||||
$first_line = false;
|
||||
}
|
||||
return $pdf;
|
||||
}
|
||||
|
||||
@ -73,12 +73,14 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry
|
||||
// draw a small circle to mark the point
|
||||
if ($point[0] != '' && $point[1] != '') {
|
||||
imagearc($image, $point[0], $point[1], 7, 7, 0, 360, $color);
|
||||
// print label for each point
|
||||
if (isset($label) && trim($label) != '') {
|
||||
imagestring($image, 2, $point[0], $point[1], trim($label), $black);
|
||||
}
|
||||
}
|
||||
}
|
||||
// print label for each point
|
||||
if ((isset($label) && trim($label) != '')
|
||||
&& ($points_arr[0][0] != '' && $points_arr[0][1] != '')
|
||||
) {
|
||||
imagestring($image, 2, $points_arr[0][0], $points_arr[0][1], trim($label), $black);
|
||||
}
|
||||
return $image;
|
||||
}
|
||||
|
||||
@ -109,14 +111,16 @@ class PMA_GIS_Multipoint extends PMA_GIS_Geometry
|
||||
// draw a small circle to mark the point
|
||||
if ($point[0] != '' && $point[1] != '') {
|
||||
$pdf->Circle($point[0], $point[1], 2, 0, 360, 'D', $line);
|
||||
// print label for each point
|
||||
if (isset($label) && trim($label) != '') {
|
||||
$pdf->SetXY($point[0], $point[1]);
|
||||
$pdf->SetFontSize(7);
|
||||
$pdf->Cell(0, 0, trim($label));
|
||||
}
|
||||
}
|
||||
}
|
||||
// print label for each point
|
||||
if ((isset($label) && trim($label) != '')
|
||||
&& ($points_arr[0][0] != '' && $points_arr[0][1] != '')
|
||||
) {
|
||||
$pdf->SetXY($points_arr[0][0], $points_arr[0][1]);
|
||||
$pdf->SetFontSize(7);
|
||||
$pdf->Cell(0, 0, trim($label));
|
||||
}
|
||||
return $pdf;
|
||||
}
|
||||
|
||||
|
||||
@ -93,6 +93,7 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
|
||||
// Seperate each polygon
|
||||
$polygons = explode(")),((", $multipolygon);
|
||||
|
||||
$first_poly = true;
|
||||
foreach ($polygons as $polygon) {
|
||||
// If the polygon doesnt have an inner polygon
|
||||
if (strpos($polygon, "),(") === false) {
|
||||
@ -113,10 +114,15 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
|
||||
}
|
||||
// draw polygon
|
||||
imagefilledpolygon($image, $points_arr, sizeof($points_arr) / 2, $color);
|
||||
// print label if applicable
|
||||
if (isset($label) && trim($label) != '') {
|
||||
imagestring($image, 2, $points_arr[2], $points_arr[3], trim($label), $black);
|
||||
// mark label point if applicable
|
||||
if (isset($label) && trim($label) != '' && $first_poly) {
|
||||
$label_point = array($points_arr[2], $points_arr[3]);
|
||||
}
|
||||
$first_poly = false;
|
||||
}
|
||||
// print label if applicable
|
||||
if (isset($label_point)) {
|
||||
imagestring($image, 2, $points_arr[2], $points_arr[3], trim($label), $black);
|
||||
}
|
||||
return $image;
|
||||
}
|
||||
@ -145,6 +151,7 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
|
||||
// Seperate each polygon
|
||||
$polygons = explode(")),((", $multipolygon);
|
||||
|
||||
$first_poly = true;
|
||||
foreach ($polygons as $polygon) {
|
||||
// If the polygon doesnt have an inner polygon
|
||||
if (strpos($polygon, "),(") === false) {
|
||||
@ -166,12 +173,18 @@ class PMA_GIS_Multipolygon extends PMA_GIS_Geometry
|
||||
}
|
||||
// draw polygon
|
||||
$pdf->Polygon($points_arr, 'F*', array(), $color, true);
|
||||
// print label if applicable
|
||||
if (isset($label) && trim($label) != '') {
|
||||
$pdf->SetXY($points_arr[2], $points_arr[3]);
|
||||
$pdf->SetFontSize(7);
|
||||
$pdf->Cell(0, 0, trim($label));
|
||||
// mark label point if applicable
|
||||
if (isset($label) && trim($label) != '' && $first_poly) {
|
||||
$label_point = array($points_arr[2], $points_arr[3]);
|
||||
}
|
||||
$first_poly = false;
|
||||
}
|
||||
|
||||
// print label if applicable
|
||||
if (isset($label_point)) {
|
||||
$pdf->SetXY($label_point[0], $label_point[1]);
|
||||
$pdf->SetFontSize(7);
|
||||
$pdf->Cell(0, 0, trim($label));
|
||||
}
|
||||
return $pdf;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user