Main Page   Namespace List   Alphabetical List   Compound List   File List   Namespace Members   Compound Members  

AIDA_Info.cpp

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00004 //                                                                     //
00005 //  This library is free software; you can redistribute it and/or      //
00006 //  modify it under the terms of the GNU Lesser General Public         //
00007 //  License as published by the Free Software Foundation; either       //
00008 //  version 2.1 of the License, or (at your option) any later version. //
00009 //                                                                     //
00010 //  This library is distributed in the hope that it will be useful,    //
00011 //  but WITHOUT ANY WARRANTY; without even the implied warranty of     //
00012 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   //
00013 //  Lesser General Public License for more details.                    //
00014 //                                                                     //
00015 //  You should have received a copy of the GNU Lesser General Public   //
00016 //  License along with this library (see file COPYING); if not, write  //
00017 //  to the Free Software Foundation, Inc., 59 Temple Place, Suite      //
00018 //  330, Boston, MA 02111-1307 USA, or contact the author.             //
00019 //                                                                     //
00021 
00030 // 
00031 // Created by user sang on Sun Oct  6 17:29:38 2002
00032 // 
00033 
00034 
00035 
00036 #include "AIDA_Info.h"
00037 #include "AIDA_MarkerStyle.h"
00038 #include "AIDA_LineStyle.h"
00039 #include "AIDA_FillStyle.h"
00040 #include "GracePlotter/LegendBox.h"
00041 
00042 #include <iostream>
00043 
00044 
00045 
00046 namespace Anaphe {
00047 namespace AIDA_Plotter_Grace {
00048 
00049 
00050 
00052 //                                        //
00053 // Constructors, destructor and operator= //
00054 //                                        //
00056 
00057 AIDA_Info::AIDA_Info()
00058   : rep(0),
00059     ownRep(false)
00060 {
00061   // no-op
00062 }
00063 
00064 
00065 
00066 
00067 AIDA_Info::AIDA_Info(LegendBox* x, bool b)
00068   : rep(x),
00069     ownRep(b)
00070 {
00071   // no-op
00072 }
00073 
00074 
00075 
00076 
00077 AIDA_Info::~AIDA_Info()
00078 {
00079   if (ownRep) delete rep;
00080 }
00081 
00082 
00083 
00084 
00086 //                //
00087 // Public methods //
00088 //                //
00090 
00091 void AIDA_Info::clear()
00092 {
00093   if (!rep) { 
00094     crisis();
00095     return;
00096   }
00097   rep->clear();
00098 }
00099 
00100 
00101 
00102 
00103 void AIDA_Info::addText(const std::string& text)
00104 {
00105   if (!rep) { 
00106     crisis();
00107     return;
00108   }
00109   rep->addText(text);
00110 }
00111 
00112 
00113 
00114 
00115 void AIDA_Info::addLegend(const AIDA::IMarkerStyle& aistyle, 
00116                             const std::string& description)
00117 {
00118   if (!rep) { 
00119     crisis();
00120     return;
00121   }
00122   const AIDA_MarkerStyle* pr = dynamic_cast<const AIDA_MarkerStyle*>(&aistyle);
00123   if (pr == 0) return;
00124   AIDA_MarkerStyle* ncpr = const_cast<AIDA_MarkerStyle*>(pr);
00125   MarkerStyle* theRealStyle = ncpr->theRep();
00126   if (theRealStyle == 0) return;
00127   rep->addLegend(description,*theRealStyle);
00128 }
00129 
00130 
00131 
00132 
00133 void AIDA_Info::addLegend(const AIDA::ILineStyle& aistyle, 
00134                             const std::string& description)
00135 {
00136   if (!rep) { 
00137     crisis();
00138     return;
00139   }
00140   const AIDA_LineStyle* pr = dynamic_cast<const AIDA_LineStyle*>(&aistyle);
00141   if (pr == 0) return;
00142   AIDA_LineStyle* ncpr = const_cast<AIDA_LineStyle*>(pr);
00143   LineStyle* theRealStyle = ncpr->theRep();
00144   if (theRealStyle == 0) return;
00145   rep->addLegend(description,*theRealStyle);
00146 }
00147 
00148 
00149 
00150 
00151 void AIDA_Info::addLegend(const AIDA::IFillStyle& aistyle, 
00152                             const std::string& description)
00153 {
00154   if (!rep) { 
00155     crisis();
00156     return;
00157   }
00158   const AIDA_FillStyle* pr = dynamic_cast<const AIDA_FillStyle*>(&aistyle);
00159   if (pr == 0) return;
00160   AIDA_FillStyle* ncpr = const_cast<AIDA_FillStyle*>(pr);
00161   FillStyle* theRealStyle = ncpr->theRep();
00162   if (theRealStyle == 0) return;
00163   rep->addLegend(description,*theRealStyle);
00164 }
00165 
00166 
00167 
00168 
00169 LegendBox* AIDA_Info::theRep()
00170 {
00171   return rep;
00172 }
00173 
00174 
00175 
00176 
00177 void AIDA_Info::setRep(LegendBox& newRep, bool ownership)
00178 {
00179   if (ownRep) delete rep;
00180   rep = &newRep;
00181   ownRep = ownership;
00182 }
00183 
00184 
00185 
00186 
00188 //                 //
00189 // Private methods //
00190 //                 //
00192 
00193 void AIDA_Info::crisis()
00194 {
00195   std::cout << "*** AIDA_Plotter_Grace SEVERE ERROR: proxy failure in AIDA_Info" << std::endl; 
00196 }
00197 
00198 
00199 
00200 } // end of namespace AIDA_Plotter_Grace
00201 } // end of namespace Anaphe
00202 

Generated on Tue Jan 28 13:30:44 2003 for Anaphe_AIDA_Plotter_Grace by doxygen1.2.16