示例#1
0
function CreatePolygon($coordinates)
{
    $geometryFactory = new MgGeometryFactory();
    $coordinateCollection = new MgCoordinateCollection();
    $linearRingCollection = new MgLinearRingCollection();
    for ($index = 0; $index < count($coordinates); ++$index) {
        $coordinate = $geometryFactory->CreateCoordinateXY(ParseLocaleDouble($coordinates[$index]), ParseLocaleDouble($coordinates[++$index]));
        $coordinateCollection->Add($coordinate);
    }
    $coordinateCollection->Add($geometryFactory->CreateCoordinateXY(ParseLocaleDouble($coordinates[0]), ParseLocaleDouble($coordinates[1])));
    $linearRingCollection = $geometryFactory->CreateLinearRing($coordinateCollection);
    $captureBox = $geometryFactory->CreatePolygon($linearRingCollection, null);
    return $captureBox;
}
示例#2
0
function DrawExtentCS()
{
    global $pdf, $font, $margin, $printSize, $legendWidth;
    if ($_POST["normalizedBox"] && trim($_POST["normalizedBox"]) != "") {
        $fontSize = 9;
        $decimals = 6;
        $padding = 5;
        $textHeight = 5;
        $normalizedBox = $_POST["normalizedBox"];
        $extent_cs = explode(",", $normalizedBox);
        //2,3 ; 6,7
        $lefttop_cs = " x:" . number_format($extent_cs[6], $decimals) . ", y:" . number_format($extent_cs[7], $decimals) . "   ";
        $rightbuttom_cs = " x:" . number_format($extent_cs[2], $decimals) . ", y:" . number_format($extent_cs[3], $decimals) . "   ";
        $pdf->SetFont($font, "", $fontSize, "", true);
        //cell width
        $lt_cellwidth = $pdf->GetStringWidth($lefttop_cs, $font, $fontSize);
        $rb_cellwidth = $pdf->GetStringWidth($rightbuttom_cs, $font, $fontSize);
        //cell location
        $lefttop = array(ParseLocaleDouble($margin[2]) + $padding, ParseLocaleDouble($margin[0]) + $padding);
        $rightbuttom = array(ParseLocaleDouble($margin[2]) + $printSize->width - $rb_cellwidth - $padding, ParseLocaleDouble($margin[0]) + $printSize->height - $padding - $textHeight);
        $pdf->SetFillColor(255, 255, 255);
        $pdf->SetXY($lefttop[0] + $legendWidth, $lefttop[1], false);
        $pdf->Cell($lt_cellwidth, 0, $lefttop_cs, 1, 0, '', true, '', 0, false, 'T', 'M');
        $pdf->SetXY($rightbuttom[0], $rightbuttom[1], false);
        $pdf->Cell($rb_cellwidth, 0, $rightbuttom_cs, 1, 0, '', true, '', 0, false, 'T', 'M');
    }
}