00001
00002
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00021
00030
00031
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
00054
00056
00057 AIDA_Info::AIDA_Info()
00058 : rep(0),
00059 ownRep(false)
00060 {
00061
00062 }
00063
00064
00065
00066
00067 AIDA_Info::AIDA_Info(LegendBox* x, bool b)
00068 : rep(x),
00069 ownRep(b)
00070 {
00071
00072 }
00073
00074
00075
00076
00077 AIDA_Info::~AIDA_Info()
00078 {
00079 if (ownRep) delete rep;
00080 }
00081
00082
00083
00084
00086
00087
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
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 }
00201 }
00202