void Targets::plotTarget (rts2db::Target *tar, XmlRpc::HttpParams *params, const char* &response_type, char* &response, size_t &response_length) { response_type = "image/jpeg"; AltPlot ap (params->getInteger ("w", 800), params->getInteger ("h", 600)); Magick::Geometry size (params->getInteger ("w", 800), params->getInteger ("h", 600)); double from = params->getDouble ("from", 0); double to = params->getDouble ("to", 0); if (from < 0 && to == 0) { // just fr specified - from to = time (NULL); from += to; } else if (from == 0 && to == 0) { // default - one day to = time (NULL); from = to - 86400; } Magick::Image mimage (size, "white"); ap.getPlot (from, to, tar, &mimage); Magick::Blob blob; mimage.write (&blob, "jpeg"); response_length = blob.length(); response = new char[response_length]; memcpy (response, blob.data(), response_length); }
void Night::printAlt (int year, int month, int day, XmlRpc::HttpParams *params, const char* &response_type, char* &response, size_t &response_length) { response_type = "image/jpeg"; AltPlot ap (params->getInteger ("w", 800), params->getInteger ("h", 600)); Magick::Geometry size (params->getInteger ("w", 800), params->getInteger ("h", 600)); time_t from; int64_t duration; getNightDuration (year, month, day, from, duration); time_t end = from + duration; rts2db::ImageSetDate is = rts2db::ImageSetDate (from, end); is.load (); Magick::Image mimage (size, "white"); ap.getPlot (from, end, &is, &mimage); Magick::Blob blob; mimage.write (&blob, "jpeg"); response_length = blob.length(); response = new char[response_length]; memcpy (response, blob.data(), response_length); }
void Targets::processForm (XmlRpc::HttpParams *params, const char* &response_type, char* &response, size_t &response_length) { #ifdef RTS2_HAVE_LIBJPEG if (!strcmp (params->getString ("plot", "xxx"), "Plot target altitude")) { response_type = "image/jpeg"; AltPlot ap (params->getInteger ("w", 800), params->getInteger ("h", 600)); Magick::Geometry size (params->getInteger ("w", 800), params->getInteger ("h", 600)); double from = params->getDouble ("from", 0); double to = params->getDouble ("to", 0); if (from < 0 && to == 0) { // just fr specified - from to = time (NULL); from += to; } else if (from == 0 && to == 0) { // default - one hour to = time (NULL); from = to - 86400; } std::list < int > ti; for (XmlRpc::HttpParams::iterator iter = params->begin (); iter != params->end (); iter++) { if (!strcmp (iter->getName (), "tid")) ti.push_back (atoi (iter->getValue ())); } rts2db::TargetSet ts = rts2db::TargetSet (); ts.load (ti); Magick::Image mimage (size, "white"); ap.getPlot (from, to, &ts, &mimage); Magick::Blob blob; mimage.write (&blob, "jpeg"); response_length = blob.length(); response = new char[response_length]; memcpy (response, blob.data(), response_length); return; } #endif // RTS2_HAVE_LIBJPEG }