source: trunk/src/Outputs/KarmaAnnotationWriter.cc @ 1072

Last change on this file since 1072 was 1072, checked in by MatthewWhiting, 12 years ago

Starting to solve #50 - writing a number of classes to implement writing to different annotation files - have defined Karma and DS9 classes. Still to actually implement in the Duchamp code.

File size: 3.2 KB
Line 
1// -----------------------------------------------------------------------
2// KarmaAnnotationWriter.hh: Class for writing results to karma annotation files.
3// -----------------------------------------------------------------------
4// Copyright (C) 2006, Matthew Whiting, ATNF
5//
6// This program is free software; you can redistribute it and/or modify it
7// under the terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 2 of the License, or (at your
9// option) any later version.
10//
11// Duchamp is distributed in the hope that it will be useful, but WITHOUT
12// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14// for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with Duchamp; if not, write to the Free Software Foundation,
18// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
19//
20// Correspondence concerning Duchamp may be directed to:
21//    Internet email: Matthew.Whiting [at] atnf.csiro.au
22//    Postal address: Dr. Matthew Whiting
23//                    Australia Telescope National Facility, CSIRO
24//                    PO Box 76
25//                    Epping NSW 1710
26//                    AUSTRALIA
27// -----------------------------------------------------------------------
28#include <duchamp/Outputs/KarmaAnnotationWriter.hh>
29#include <duchamp/Outputs/AnnotationWriter.hh>
30#include <duchamp/Outputs/CatalogueWriter.hh>
31#include <duchamp/Outputs/FileCatalogueWriter.hh>
32#include <duchamp/Detection/detection.hh>
33#include <ios>
34#include <iostream>
35#include <fstream>
36#include <string>
37
38namespace duchamp {
39
40   KarmaAnnotationWriter::KarmaAnnotationWriter():
41    AnnotationWriter()
42  {
43  }
44
45  KarmaAnnotationWriter::KarmaAnnotationWriter(std::string name):
46    AnnotationWriter(name)
47  {
48  }
49
50  KarmaAnnotationWriter::KarmaAnnotationWriter(const KarmaAnnotationWriter& other)
51  {
52    this->operator=(other);
53  }
54
55  KarmaAnnotationWriter& KarmaAnnotationWriter::operator= (const KarmaAnnotationWriter& other)
56  {
57    if(this==&other) return *this;
58    ((AnnotationWriter &) *this) = other;
59    return *this;
60  }
61  void KarmaAnnotationWriter::writeTableHeader()
62  {
63    if(this->itsOpenFlag){
64      this->itsFileStream << "COLOR RED\n";
65      if(this->itsHead->isWCS()) this->itsFileStream << "COORD W\n";
66      else this->itsFileStream << "COORD P\n";
67    }
68  }
69
70  void KarmaAnnotationWriter::text(float x, float y, std::string text)
71  {
72    if(this->itsOpenFlag){
73      this->itsFileStream << "TEXT " << x << " " << y << " " << text<<"\n";
74    }
75  }
76  void KarmaAnnotationWriter::line(float x1, float x2, float y1, float y2)
77  {
78    if(this->itsOpenFlag){
79      this->itsFileStream << "LINE " << x1 << " " << y1 << " " << x2 << " " << y2 << "\n";
80    }
81  }
82  void KarmaAnnotationWriter::circle(float x, float y, float r)
83  {
84    if(this->itsOpenFlag){
85      this->itsFileStream << "CIRCLE " << x << " " << y << " " << r << "\n";
86    }
87  }
88  void KarmaAnnotationWriter::ellipse(float x, float y, float r1, float r2, float angle)
89  {
90    if(this->itsOpenFlag){
91      this->itsFileStream << "ELLIPSE " << x << " " << y << " " << r1 << " " << r2 << " " << angle << "\n";
92    }
93  }
94
95 
96}
Note: See TracBrowser for help on using the repository browser.