CAnnotationParser Class Reference

Parsing XML into array. Source: String, Local file. More...

Inheritance diagram for CAnnotationParser:

CAnnotationBase List of all members.

Public Member Functions

 clear ()
 CAnnotationParser ()
 getParsedAnnotations ()
 getCaption ()
 getCaptionCoords ()
 getOriginalImageSize ()
 getLastImageSize ()
 getXML ()
 startElement ($parser, $name, $attrs)
 endElement ($parser, $tagname)
 characterData ($parser, $data)
 parseString ($xml_string)
 parseFile ($path)
 getStrip ()
 getCalloutColor ()

Public Attributes

 $xml_string = ""
 $annotations = array()
 $caption = ""
 $sizex = 1
 $sizey = 1
 $lastx = 1
 $lasty = 1
 $captionx = 1
 $captiony = 1
 $name = ""
 $x = ""
 $y = ""
 $curtag = "a"
 $UID = 0
 $depth = 0
 $label_opened = 0
 $label
 $callout_color = 0

Detailed Description

Parsing XML into array. Source: String, Local file.

Class for working with XML contains annotations: Parse from string, file, get parsed annotations, image caption etc


Constructor & Destructor Documentation

CAnnotationParser::CAnnotationParser  ) 
 

Constructor. Initializing the object.


Member Function Documentation

CAnnotationParser::getCalloutColor  ) 
 

Returns callout and frame color in web format (rrggbb) from parsed xml

CAnnotationParser::getCaption  ) 
 

Return image caption if exists

CAnnotationParser::getCaptionCoords  ) 
 

Return array with caption coordinates

['x'] will return X coord
['y'] will return Y coord

See also:
getParsedAnnotations()

CAnnotationParser::getLastImageSize  ) 
 

Return array with last edited (when last annotations was made) image size

['x'] will return image width
['y'] will return image height

See also:
getParsedAnnotations()

CAnnotationParser::getOriginalImageSize  ) 
 

Return array with original (when first annotations was made) image size

['x'] will return image width
['y'] will return image height

See also:
getParsedAnnotations()

CAnnotationParser::getParsedAnnotations  ) 
 

Returns parsed annotations from XML.

Format: array of hashes
[0] => ("name", "x", "y", "UID")
[1] => ("name", "x", "y", "UID")
...
Where
name - Annotation text
x - X coord from left top corner
y - Y coord from left top corner
UID - unique number of annotation

Example:

   $annotations = $parser->getParsedAnnotations();

   foreach ($annotations as $a)
   {
     // Now we recalculate annotation positions because image size can be modified after placing comments
     // and we need hold correct positions
     $last = $parser->getLastImageSize();
     $orig = $parser->getOriginalImageSize();
   
     $x = round($a['x'] * ($last['x'] / $orig['x']));
     $y = round($a['y'] * ($last['y'] / $orig['y']));
     
   }

CAnnotationParser::getStrip  ) 
 

Return annotations without XML tags, separated by ';'

Returns:
String with annotations

CAnnotationParser::getXML  ) 
 

Return source XML

CAnnotationParser::parseFile path  ) 
 

Read XML string from a jpeg file and parsing it into array of annotations

Parameters:
$path Local path to jpeg file
Returns:
TRUE if all looks ok

FALSE if error occured

CAnnotationParser::parseString xml_string  ) 
 

Parsing XML string into array of annotations

Parameters:
$xml_string Source XML with annotations
Returns:
TRUE if all looks ok

FALSE if error occured


The documentation for this class was generated from the following file:
Generated on Fri Jul 28 12:50:53 2006 for FotoTaggerWebAPI by  doxygen 1.4.6-NO