コード例 #1
0
 /**
  * Adds to the TCPDF instance, the data related to a row in the GIS dataset.
  *
  * @param string $spatial    GIS LINESTRING object
  * @param string $label      Label for the GIS LINESTRING object
  * @param string $line_color Color for the GIS LINESTRING object
  * @param array  $scale_data Array containing data related to scaling
  * @param object $pdf        TCPDF instance
  *
  * @return object the modified TCPDF instance
  * @access public
  */
 public function prepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf)
 {
     // allocate colors
     $red = hexdec(substr($line_color, 1, 2));
     $green = hexdec(substr($line_color, 3, 2));
     $blue = hexdec(substr($line_color, 4, 2));
     $line = array('width' => 1.5, 'color' => array($red, $green, $blue));
     // Trim to remove leading 'LINESTRING(' and trailing ')'
     $linesrting = substr($spatial, 11, strlen($spatial) - 12);
     $points_arr = $this->extractPoints($linesrting, $scale_data);
     foreach ($points_arr as $point) {
         if (!isset($temp_point)) {
             $temp_point = $point;
         } else {
             // draw line section
             $pdf->Line($temp_point[0], $temp_point[1], $point[0], $point[1], $line);
             $temp_point = $point;
         }
     }
     // print label
     if (isset($label) && trim($label) != '') {
         $pdf->SetXY($points_arr[1][0], $points_arr[1][1]);
         $pdf->SetFontSize(5);
         $pdf->Cell(0, 0, trim($label));
     }
     return $pdf;
 }
コード例 #2
0
 /**
  * Adds to the TCPDF instance, the data related to a row in the GIS dataset.
  *
  * @param string $spatial    GIS POLYGON object
  * @param string $label      Label for the GIS POLYGON object
  * @param string $fill_color Color for the GIS POLYGON object
  * @param array  $scale_data Array containing data related to scaling
  * @param object $pdf        TCPDF instance
  *
  * @return object the modified TCPDF instance
  * @access public
  */
 public function prepareRowAsPdf($spatial, $label, $fill_color, $scale_data, $pdf)
 {
     // allocate colors
     $red = hexdec(substr($fill_color, 1, 2));
     $green = hexdec(substr($fill_color, 3, 2));
     $blue = hexdec(substr($fill_color, 4, 2));
     $color = array($red, $green, $blue);
     // Trim to remove leading 'POLYGON((' and trailing '))'
     $polygon = substr($spatial, 9, strlen($spatial) - 11);
     // If the polygon doesnt have an inner polygon
     if (strpos($polygon, "),(") === false) {
         $points_arr = $this->extractPoints($polygon, $scale_data, true);
     } else {
         // Seperate outer and inner polygons
         $parts = explode("),(", $polygon);
         $outer = $parts[0];
         $inner = array_slice($parts, 1);
         $points_arr = $this->extractPoints($outer, $scale_data, true);
         foreach ($inner as $inner_poly) {
             $points_arr = array_merge($points_arr, $this->extractPoints($inner_poly, $scale_data, true));
         }
     }
     // 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(5);
         $pdf->Cell(0, 0, trim($label));
     }
     return $pdf;
 }
コード例 #3
0
 /**
  * Adds to the TCPDF instance, the data related to a row in the GIS dataset.
  *
  * @param string $spatial     GIS MULTIPOINT object
  * @param string $label       Label for the GIS MULTIPOINT object
  * @param string $point_color Color for the GIS MULTIPOINT object
  * @param array  $scale_data  Array containing data related to scaling
  * @param object $pdf         TCPDF instance
  *
  * @return object the modified TCPDF instance
  * @access public
  */
 public function prepareRowAsPdf($spatial, $label, $point_color, $scale_data, $pdf)
 {
     // allocate colors
     $red = hexdec(substr($point_color, 1, 2));
     $green = hexdec(substr($point_color, 3, 2));
     $blue = hexdec(substr($point_color, 4, 2));
     $line = array('width' => 1.25, 'color' => array($red, $green, $blue));
     // Trim to remove leading 'MULTIPOINT(' and trailing ')'
     $multipoint = substr($spatial, 11, strlen($spatial) - 12);
     $points_arr = $this->extractPoints($multipoint, $scale_data);
     foreach ($points_arr as $point) {
         // 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) != '' && ($points_arr[0][0] != '' && $points_arr[0][1] != '')) {
         $pdf->SetXY($points_arr[0][0], $points_arr[0][1]);
         $pdf->SetFontSize(5);
         $pdf->Cell(0, 0, trim($label));
     }
     return $pdf;
 }
コード例 #4
0
ファイル: general_labels.php プロジェクト: Jacquesvw/phpBMS
 /**
  * function printLabel
  *
  * generates the contents on an individual label, and adds them to the PDF
  *
  * @param object $pdf the PDF object
  * @param array $therecord the data record
  * @param int $thex x corrdinate of current PDF
  * @param int $they y coordinate of current PDF
  * @param int $textRows number of text rows that will be printed
  *
  * @return object returns the modified PDF object
  */
 function printLabel($pdf, $therecord, $thex, $they, $textRows)
 {
     $pdf->SetXY($thex + $this->settings["labelMarginLeft"], $they + $this->settings["labelMarginTop"]);
     $textHeight = 0.135;
     for ($i = 1; $i <= $textRows; $i++) {
         if (isset($this->settings["rowText" . $i . "Font"])) {
             $pdf = $this->setFont($pdf, $this->settings["rowText" . $i . "Font"]);
         }
         if (isset($this->settings["rowText" . $i . "Height"])) {
             $textHeight = $this->settings["rowText" . $i . "Height"];
         }
         if ($therecord["rowText" . $i]) {
             $pdf->Cell($this->settings["labelWidth"] - $this->settings["labelMarginLeft"], $textHeight, $therecord["rowText" . $i], $this->settings["borderDebug"], 2, "L");
         }
         //$pdf->SetX($thex + $this->settings["labelMarginLeft"]);
     }
     //endfor
     return $pdf;
 }
コード例 #5
0
 /**
  * Adds to the TCPDF instance, the data related to a row in the GIS dataset.
  *
  * @param string $spatial    GIS MULTILINESTRING object
  * @param string $label      Label for the GIS MULTILINESTRING object
  * @param string $line_color Color for the GIS MULTILINESTRING object
  * @param array  $scale_data Array containing data related to scaling
  * @param object $pdf        TCPDF instance
  *
  * @return object the modified TCPDF instance
  * @access public
  */
 public function prepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf)
 {
     // allocate colors
     $red = hexdec(substr($line_color, 1, 2));
     $green = hexdec(substr($line_color, 3, 2));
     $blue = hexdec(substr($line_color, 4, 2));
     $line = array('width' => 1.5, 'color' => array($red, $green, $blue));
     // Trim to remove leading 'MULTILINESTRING((' and trailing '))'
     $multilinestirng = substr($spatial, 17, strlen($spatial) - 19);
     // 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) {
             if (!isset($temp_point)) {
                 $temp_point = $point;
             } else {
                 // draw line section
                 $pdf->Line($temp_point[0], $temp_point[1], $point[0], $point[1], $line);
                 $temp_point = $point;
             }
         }
         unset($temp_point);
         // print label
         if (isset($label) && trim($label) != '' && $first_line) {
             $pdf->SetXY($points_arr[1][0], $points_arr[1][1]);
             $pdf->SetFontSize(5);
             $pdf->Cell(0, 0, trim($label));
         }
         $first_line = false;
     }
     return $pdf;
 }