24 $this->hier_id = $a_hier_id;
25 $this->purpose = $a_purpose;
28 $this->item_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
33 function getMAItemNode($a_hier_id, $a_purpose, $a_pc_id =
"", $a_sub_element =
"")
38 $path =
"//PageContent[@PCID = '".$a_pc_id.
"']/MediaObject/MediaAliasItem[@Purpose='$a_purpose']".$a_sub_element;
40 if (count(
$res->nodeset) == 1)
42 return $res->nodeset[0];
47 $path =
"//PageContent[@HierId = '".$a_hier_id.
"']/MediaObject/MediaAliasItem[@Purpose='$a_purpose']".$a_sub_element;
49 if (count(
$res->nodeset) > 0)
51 return $res->nodeset[0];
60 $path =
"//PageContent[@PCID = '".$a_pc_id.
"']/MediaObject/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
62 if (count(
$res->nodeset) > 0)
70 $path =
"//PageContent[@HierId = '".$a_hier_id.
"']/MediaObject/MediaAliasItem[@Purpose='$a_purpose']/Parameter";
72 if (count(
$res->nodeset) > 0)
83 $path =
"//PageContent[@PCID = '".$a_pc_id.
"']/MediaObject/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
85 if (count(
$res->nodeset) > 0)
93 $path =
"//PageContent[@HierId = '".$a_hier_id.
"']/MediaObject/MediaAliasItem[@Purpose='$a_purpose']/MapArea";
95 if (count(
$res->nodeset) > 0)
108 $this->pcid = $a_pcid;
128 if (is_object($this->item_node))
144 $path =
"//PageContent[@HierId = '".$this->hier_id.
"']/MediaObject";
146 if (count(
$res->nodeset) > 0)
148 $obj_node =&
$res->nodeset[0];
149 $item_node =& $this->dom->create_element(
"MediaAliasItem");
151 $item_node->set_attribute(
"Purpose", $this->purpose);
162 array(
"Caption",
"TextRepresentation",
"Parameter",
"MapArea"),
163 "", array(
"Width" => $a_width),
false);
172 $layout_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
174 if (is_object($layout_node))
176 return $layout_node->get_attribute(
"Width");
187 $layout_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
189 if (is_object($layout_node))
191 return $layout_node->has_attribute(
"Width");
201 $layout_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
203 if (is_object($layout_node))
205 if ($layout_node->has_attribute(
"Width"))
207 $layout_node->remove_attribute(
"Width");
209 if ($layout_node->has_attribute(
"Height"))
211 $layout_node->remove_attribute(
"Height");
222 array(
"Caption",
"TextRepresentation",
"Parameter",
"MapArea"),
223 "", array(
"Height" => $a_height),
false);
232 $layout_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
234 if (is_object($layout_node))
236 return $layout_node->get_attribute(
"Height");
247 array(
"TextRepresentation",
"Parameter",
"MapArea"),
248 $a_caption, array(
"Align" =>
"bottom"));
257 $caption_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
259 if (is_object($caption_node))
261 return $caption_node->get_content();
272 $caption_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
274 if (is_object($caption_node))
286 $caption_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
288 if (is_object($caption_node))
290 $caption_node->unlink_node($caption_node);
300 array(
"Parameter",
"MapArea"),
301 $a_text_representation, array());
309 $text_representation_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
310 $this->
getPcId(),
"/TextRepresentation");
311 if (is_object($text_representation_node))
313 return $text_representation_node->get_content();
324 $text_representation_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
325 $this->
getPcId(),
"/TextRepresentation");
326 if (is_object($text_representation_node))
338 $text_representation_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
339 $this->
getPcId(),
"/TextRepresentation");
340 if (is_object($text_representation_node))
342 $text_representation_node->unlink_node($text_representation_node);
349 array(
"Caption",
"TextRepresentation",
"Parameter",
"MapArea"),
350 "", array(
"HorizontalAlign" => $a_halign),
false);
356 $layout_node = $this->
getMAItemNode($this->hier_id, $this->purpose,
358 if (is_object($layout_node))
360 return $layout_node->get_attribute(
"HorizontalAlign");
372 for($i=0; $i < count($par_nodes); $i++)
374 $par_node =& $par_nodes[$i];
375 $par_node->unlink_node($par_node);
378 if (is_array($a_par_array))
380 foreach($a_par_array as $par => $val)
382 $attributes = array (
"Name" => $par,
"Value" => $val);
384 "Parameter", array(
"MapArea"),
"", $attributes);
401 for($i=0; $i < count($par_nodes); $i++)
403 $par_node =& $par_nodes[$i];
404 $par_arr[] = $par_node->get_attribute(
"Name").
"=\"".$par_node->get_attribute(
"Value").
"\"";
406 return implode($par_arr,
", ");
417 for($i=0; $i < count($par_nodes); $i++)
419 $par_node =& $par_nodes[$i];
420 $par_arr[$par_node->get_attribute(
"Name")] =
421 $par_node->get_attribute(
"Value");
442 if (count($par_nodes) > 0)
456 if (count($par_nodes) > 0)
458 for($i=0; $i < count($par_nodes); $i++)
460 $par_node =& $par_nodes[$i];
461 $par_node->unlink_node($par_node);
474 $maparea_arr = array();
475 for($i=0; $i < count($ma_nodes); $i++)
477 $maparea_node = $ma_nodes[$i];
478 $childs = $maparea_node->child_nodes();
480 if ($childs[0]->node_name() ==
"ExtLink")
482 $link = array(
"LinkType" =>
"ExtLink",
483 "Href" => $childs[0]->get_attribute(
"Href"),
484 "Title" => $childs[0]->get_content());
486 if ($childs[0]->node_name() ==
"IntLink")
488 $link = array(
"LinkType" =>
"IntLink",
489 "Target" => $childs[0]->get_attribute(
"Target"),
490 "Type" => $childs[0]->get_attribute(
"Type"),
491 "TargetFrame" => $childs[0]->get_attribute(
"TargetFame"),
492 "Title" => $childs[0]->get_content());
494 $maparea_arr[] = array(
496 "Shape" => $maparea_node->get_attribute(
"Shape"),
497 "Coords" => $maparea_node->get_attribute(
"Coords"),
511 if (is_object($ma_nodes[$a_nr - 1]))
513 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
514 if (is_object($childs[0]) &&
515 ($childs[0]->node_name() ==
"IntLink" || $childs[0]->node_name() ==
"ExtLink"))
517 $childs[0]->set_content($a_title);
529 if (is_object($ma_nodes[$a_nr - 1]))
533 $attributes = array(
"Type" => $a_type,
"Target" => $a_target,
534 "TargetFrame" => $a_target_frame);
536 array(
""),
$title, $attributes);
547 if (is_object($ma_nodes[$a_nr - 1]))
551 $attributes = array(
"Href" => $a_href);
553 array(
""),
$title, $attributes);
564 if (is_object($ma_nodes[$a_nr - 1]))
566 $ma_nodes[$a_nr - 1]->set_attribute(
"Shape", $a_shape_type);
567 $ma_nodes[$a_nr - 1]->set_attribute(
"Coords", $a_coords);
577 $attributes = array(
"Shape" => $a_shape_type,
578 "Coords" => $a_coords);
580 "MapArea", array(),
"", $attributes);
582 if ($a_link[
"LinkType"] ==
"int" || $a_link[
"LinkType"] ==
"IntLink")
584 $attributes = array(
"Type" => $a_link[
"Type"],
585 "TargetFrame" => $a_link[
"TargetFrame"],
586 "Target" => $a_link[
"Target"]);
588 array(
""), $a_title, $attributes);
590 if ($a_link[
"LinkType"] ==
"ext" || $a_link[
"LinkType"] ==
"ExtLink")
592 $attributes = array(
"Href" => $a_link[
"Href"]);
594 array(
""), $a_title, $attributes);
605 if (is_object($ma_nodes[$a_nr - 1]))
607 $ma_nodes[$a_nr - 1]->unlink_node($ma_nodes[$a_nr - 1]);
617 $path =
"//PageContent[@HierId = '".$this->hier_id.
"']/MediaObject/MediaAliasItem[@Purpose='".$this->purpose.
"']/MapArea";
619 for ($i = 0; $i < count(
$res->nodeset); $i++)
621 $res->nodeset[$i]->unlink_node(
$res->nodeset[$i]);
632 if (is_object($ma_nodes[$a_nr - 1]))
634 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
635 if ($childs[0]->node_name() ==
"IntLink")
639 if ($childs[0]->node_name() ==
"ExtLink")
653 if (is_object($ma_nodes[$a_nr - 1]))
655 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
656 return $childs[0]->get_attribute(
"Type");
667 if (is_object($ma_nodes[$a_nr - 1]))
669 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
670 return $childs[0]->get_attribute(
"Target");
681 if (is_object($ma_nodes[$a_nr - 1]))
683 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
684 return $childs[0]->get_attribute(
"TargetFrame");
695 if (is_object($ma_nodes[$a_nr - 1]))
697 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
698 return $childs[0]->get_attribute(
"Href");
709 if (is_object($ma_nodes[$a_nr - 1]))
711 $childs = $ma_nodes[$a_nr - 1]->child_nodes();
712 return $childs[0]->get_content();
721 if (is_object($this->item_node))
723 $this->item_node->unlink_node($this->item_node);
734 $a_output_new_area, $a_area_type, $a_coords)
738 if (!$a_st_item->copyOriginal())
742 $a_st_item->buildMapWorkImage();
749 if ($width == 0 && $height == 0)
751 $width = $a_st_item->getWidth();
752 $height = $a_st_item->getHeight();
754 $size = @getimagesize($a_st_item->getMapWorkCopyName());
756 if (
$size[0] > 0 && $width > 0)
758 $x_ratio = $width /
$size[0];
761 if (
$size[1] > 0 && $height > 0)
763 $y_ratio = $height /
$size[1];
768 for ($i=0; $i < count($areas); $i++)
770 if ( ((($i+1) == $a_area_nr) && !$a_exclude) ||
771 ((($i+1) != $a_area_nr) && $a_exclude) ||
776 $area->setShape($areas[$i][
"Shape"]);
777 $area->setCoords($areas[$i][
"Coords"]);
778 $area->draw($a_st_item->getMapWorkImage(), $a_st_item->color1, $a_st_item->color2,
true,
783 if ($a_output_new_area)
786 $area->setShape($a_area_type);
787 $area->setCoords($a_coords);
788 $area->draw($a_st_item->getMapWorkImage(), $a_st_item->color1, $a_st_item->color2,
false,
792 $a_st_item->saveMapWorkImage();