Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

Photo.h

Go to the documentation of this file.
00001 /*
00002  * Photo.h
00003  *
00004  *  Created on: 9-jan-2009
00005  *      Author: dodijk
00006  */
00007 
00008 #ifndef PHOTO_H_
00009 #define PHOTO_H_
00010 
00011 #include "Util/XmlDoc.h"
00012 #include "Persistency/XmlFileReader.h"
00013 
00014 namespace Impala {
00015 namespace Application {
00016 namespace TagsLife {
00017 
00018 using namespace std;
00019 
00020 class Photo : public Util::XmlDoc{
00021 public:
00022         string id, secret;
00023         int farm, server;
00024         string owner, title, ownername;
00025         float latitude, longitude;
00026         int views;
00027     // RvB: Commented next line. (string tags[])
00028     // Not standard C++ resulting in warning. Does not seem to be used anywhere
00029         //string tags[];
00030         Photo(DOMNode* photo) {
00031                 initPhoto(photo);
00032         }
00033         //virtual ~Tag();
00034 
00035         string imageUrl() {return imageUrl("");}
00036 
00037         string imageUrl(string sizeSuffix) {
00038           string url = "http://farm";
00039           url += MakeString(farm);
00040           url += ".static.flickr.com/";
00041           url += MakeString(server) + "/";
00042           url += id + "_" + secret;
00043           if(sizeSuffix.length() > 0) url += "_" + sizeSuffix;
00044           url += ".jpg";
00045           return(url);
00046         }
00047 
00048 private:
00049     void initPhoto(DOMNode* photo) {
00050                 //<photo accuracy="0" datetaken="2007-12-03 23:43:22"
00051                 // datetakengranularity="0" dateupload="1196753888" farm="3" iconfarm="3" iconserver="2139"
00052                 // id="2085457991" isfamily="0" isfriend="0" ispublic="1" lastupdate="1226395381" license="0"
00053                 // latitude="0" longitude="0" machine_tags="" media="photo" media_status="ready"
00054                 // owner="73379027@N00" ownername="Angela Layana" secret="6c11c40286" server="2147"
00055                 // tags="amywinehouse" title="2007 vs 2004" views="168000" />
00056                 id = GetAttributeValue(photo, "id");
00057                 secret = GetAttributeValue(photo, "secret");
00058 
00059                 farm = atoi(GetAttributeValue(photo, "farm"));
00060                 server = atoi(GetAttributeValue(photo, "server"));
00061 
00062                 owner = GetAttributeValue(photo, "owner");
00063                 title = GetAttributeValue(photo, "title");
00064                 ownername = GetAttributeValue(photo, "ownername");
00065 
00066                 latitude = atof(GetAttributeValue(photo, "latitude"));
00067                 longitude = atof(GetAttributeValue(photo, "longitude"));
00068 
00069                 views = atoi(GetAttributeValue(photo, "views"));
00070     }
00071     ILOG_VAR_DEC;
00072 };
00073 
00074 ILOG_VAR_INIT(Photo, Impala.Application.TagsLife);
00075 
00076 }
00077 }
00078 }
00079 
00080 #endif /* TAG_H_ */

Generated on Fri Mar 19 09:30:39 2010 for ImpalaSrc by  doxygen 1.5.1