Source for file Mark.class.php
Documentation is available at Mark.class.php
* This work is hereby released into the Public Domain.
* To view a copy of the public domain dedication,
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
require_once dirname(__FILE__ ). "/../Graph.class.php";
define("MARK_INVERTED_TRIANGLE", 4);
* @package linea21.externals
* Move position from this vector
* @param int $x Add this interval to X coord
* @param int $y Add this interval to Y coord
$this->move = $this->move->move($x, $y);
* @param bool $hide TRUE to hide marks, FALSE otherwise
function hide($hide = TRUE) {
$this->hide = (bool) $hide;
function show($show = TRUE) {
$this->hide = (bool) !$show;
* @param int $size Size in pixels
$this->size = (int) $size;
* @param int $type New mark type
* @param int $size Mark size (can be NULL)
function setType($type, $size = NULL) {
$this->type = (int) $type;
* Fill the mark with a color or a gradient
* @param mixed $fill A color or a gradient
if(is_a($fill, 'awColor') or is_a($fill, 'awGradient')) {
* Only for MARK_IMAGE type.
* @param $point Mark center
function draw($driver, $point) {
// Check if we can print marks
if($this->type !== NULL) {
$realPoint = $this->move->move($point->x, $point->y);
$this->draw($driver, $point);
$this->draw($driver, $point);
$this->draw($driver, $point);
list ($x, $y) = $point->getLocation();
$x1 = (int) ($x - $this->size / 2);
$y1 = (int) ($y - $this->size / 2);
$size = $this->border->visible() ? 1 : 0;
$this->driver->filledRectangle(
new awPoint($x1 + $size, $y1 + $size),
new awPoint($x2 - $size, $y2 - $size)
list ($x, $y) = $point->getLocation();
// Set default style and thickness
$triangle->setThickness(1);
// Bottom of the triangle
$triangle->append(new awPoint($x, $y + $size / sqrt(3)));
$triangle->append(new awPoint($x - $size / 2, $y - $size / (2 * sqrt(3))));
$triangle->append(new awPoint($x + $size / 2, $y - $size / (2 * sqrt(3))));
$triangle->append(new awPoint($x, $y - $size / sqrt(3)));
$triangle->append(new awPoint($x - $size / 2, $y + $size / (2 * sqrt(3))));
$triangle->append(new awPoint($x + $size / 2, $y + $size / (2 * sqrt(3))));
$this->driver->filledPolygon($this->fill, $triangle);
if($this->border->visible()) {
list ($x, $y) = $point->getLocation();
// Set default style and thickness
$rhombus->setThickness(1);
$rhombus->append(new awPoint($x, $y - $this->size / 2));
$rhombus->append(new awPoint($x + $this->size / 2, $y));
$rhombus->append(new awPoint($x, $y + $this->size / 2));
$rhombus->append(new awPoint($x - $this->size / 2, $y));
$this->driver->filledPolygon($this->fill, $rhombus);
if($this->border->visible()) {
function drawCross($point, $upright = FALSE) {
list ($x, $y) = $point->getLocation();
$y11 = (int) ($y - $this->size / 2);
$y12 = (int) ($y + $this->size / 2);
$x11 = (int) ($x - $this->size / 2);
$y11 = (int) ($y + $this->size / 2);
$x12 = (int) ($x + $this->size / 2);
$y12 = (int) ($y - $this->size / 2);
$y21 = (int) ($y - $this->size / 2);
$y22 = (int) ($y + $this->size / 2);
$x21 = (int) ($x - $this->size / 2);
$x22 = (int) ($x + $this->size / 2);
$width = $this->image->width;
$height = $this->image->height;
list ($x, $y) = $point->getLocation();
$x1 = (int) ($x - $width / 2);
$y1 = (int) ($y - $width / 2);
|