37 public function __construct($format, $file, $map, $lineType=self::LINETYPE_DIRECT, $scale=100,
38 $aspect=0.5, $border=50, $usemap=
'') {
40 parent::__construct($format, $file, $map, $lineType, $scale, $aspect, $border, $usemap);
42 $this->_labelDim[
'left'] = -10;
43 $this->_labelDim[
'top'] = -10;
44 $this->_labelDim[
'right'] = 80;
45 $this->_labelDim[
'bottom'] = 45;
47 $this->_textPos[
'left'] = -5;
48 $this->_textPos[
'top'] = -8;
55 parent::writeHeader();
57 $color = ImageColorAllocate($this->_img,0,150,0);
58 $this->writeFilledBorderedRect(
new Position($this->_border, $this->_border, 0),
59 new Position($this->_border+10, $this->_border+10, 0), $this->_bgColor, $color);
60 ImageString($this->_img,1, $this->_border+20, $this->_border+2,
"optional", $color);
62 $this->writeFilledBorderedRect(
new Position($this->_border, $this->_border+20, 0),
63 new Position($this->_border+10, $this->_border+30, 0), $this->_bgColor, $color);
64 ImageString($this->_img,1, $this->_border+20, $this->_border+22,
"required", $color);
65 $color = ImageColorAllocate($this->_img,150,150,150);
66 for($i=2;$i>=0;$i--) {
67 $this->writeFilledBorderedRect(
new Position($this->_border+2*$i, $this->_border+40+2*$i, 0),
68 new Position($this->_border+10+2*$i, $this->_border+50+2*$i, 0), $this->_bgColor, $color);
70 ImageString($this->_img,1, $this->_border+20, $this->_border+42,
"repetitive", $color);
77 $properties = $obj->getValueProperties($obj->
getType());
78 if (!strstr($obj->
getType(),
'->')) {
80 $bigText = $properties[
'oid'];
84 $smallText = substr ($obj->
getType(), 0, strrpos ($obj->
getType(),
":"));
85 $bigText = substr (strrchr ($obj->
getType(),
":"), 1);
86 $color = ImageColorAllocate($this->_img,150,150,150);
90 $x = $this->_map[$oid]->x * $this->_xscale - $this->_labelDim[
'left'] +
$this->_border;
91 $y = $this->_map[$oid]->y * $this->_yscale - $this->_labelDim[
'top'] +
$this->_border;
94 $color = ImageColorAllocate($this->_img,0,150,0);
99 for($i=3;$i>=1;$i--) {
100 $this->writeFilledBorderedRect(
new Position($x + $this->_labelDim[
'left']+5*$i, $y + $this->_labelDim[
'top']+5*$i, 0),
101 new Position($x + $this->_labelDim[
'right']+5*$i, $y + $this->_labelDim[
'bottom']+5*$i, 0),
102 $this->_bgColor, $color);
106 $this->writeFilledBorderedRect(
new Position($x + $this->_labelDim[
'left'], $y + $this->_labelDim[
'top'], 0),
107 new Position($x + $this->_labelDim[
'right'], $y + $this->_labelDim[
'bottom'], 0),
108 $this->_bgColor, $color);
110 ImageString($this->_img,2,
111 $x + $this->_textPos[
'left'],
112 $y + $this->_textPos[
'top'],
115 ImageString($this->_img,1,
116 $x + $this->_textPos[
'left'],
117 $y + $this->_textPos[
'top']+15,
118 "E: ".$properties[
'data_type'],
123 if (is_array($attribs)) {
124 foreach ($attribs as $attrib) {
125 ImageString($this->_img,1,
126 $x + $this->_textPos[
'left'],
127 $y + $this->_textPos[
'top']+25+10*$i,
133 ImageString($this->_img,45,
134 $x + $this->_textPos[
'left']+65,
135 $y + $this->_textPos[
'top']+37,
140 $parent = $obj->getParent();
145 if ($this->_usemap !=
'') {
146 echo
'<area shape="rect" coords="'.
147 ($x + $this->_labelDim[
'left']).
','.
148 ($y + $this->_labelDim[
'top']).
','.
149 ($x + $this->_labelDim[
'right']).
','.
150 ($y + $this->_labelDim[
'bottom'] + 8*$this->_map[$oid]->z).
151 '" onclick="javascript:alert(\'Node OID: '.$obj->getOID().
'\')
" alt="'.$obj->getOID().'">'."\n
";
155 private function writeFilledBorderedRect($topleft, $bottomright, $bgcolor, $bordercolor) {
156 ImageFilledRectangle($this->_img, $topleft->x, $topleft->y, $bottomright->x, $bottomright->y, $bgcolor);
157 ImageRectangle($this->_img, $topleft->x, $topleft->y, $bottomright->x, $bottomright->y, $bordercolor);
getType()
Get the type of the object.
getOID()
Get the object id of the PersistentObject.
getValueNames($excludeTransient=false)
Get the names of all items.
getProperty($name)
Get the value of a named property in the object.
drawConnectionLine($poid, $oid)
Draw connection line.
__construct($format, $file, $map, $lineType=self::LINETYPE_DIRECT, $scale=100, $aspect=0.5, $border=50, $usemap='')
Constructor.
ElementImageOutputStrategy outputs a tree of objects into an image file.
The Position class stores a coordinate tuple for use with the LayoutVisitor.
ImageOutputStrategy outputs a tree of objects into an image file.
writeObject(PersistentObject $obj)
PersistentObject defines the interface of all persistent objects.