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

AIDA_AxisStyle.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:45:30 2002
00032 // 
00033 
00034 
00035 
00036 #include "AIDA_AxisStyle.h"
00037 #include "AIDA_TextStyle.h"
00038 #include "AIDA_LineStyle.h"
00039 #include "GracePlotter/AxisStyle.h"
00040 
00041 
00042 
00043 #include <iostream>
00044 
00045 namespace Anaphe {
00046 namespace AIDA_Plotter_Grace {
00047 
00048 
00049 
00051 //                                        //
00052 // Constructors, destructor and operator= //
00053 //                                        //
00055 
00056 AIDA_AxisStyle::AIDA_AxisStyle()
00057   : rep(0),
00058     ownRep(false)
00059 {
00060   // no-op
00061 }
00062 
00063 
00064 
00065 
00066 AIDA_AxisStyle::AIDA_AxisStyle(AxisStyle* x, bool b)
00067   : rep(x),
00068     ownRep(b)
00069 {
00070   // no-op
00071 }
00072 
00073 
00074 
00075 AIDA_AxisStyle::~AIDA_AxisStyle()
00076 {
00077   // no-op
00078 }
00079 
00080 
00081 
00082 
00084 //                //
00085 // Public methods //
00086 //                //
00088 
00089 void AIDA_AxisStyle::reset()
00090 {
00091   if (!rep) { 
00092     crisis();
00093     return;
00094   }
00095   rep->reset();
00096 }
00097 
00098 
00099 
00100 
00101 bool AIDA_AxisStyle::setParameter(const std::string& paramName, const std::string& options)
00102 {
00103   if (!rep) { 
00104     crisis();
00105     return false;
00106   }
00107   return rep->setParameter(paramName,options);
00108 }
00109 
00110 
00111 
00112 
00113 std::string AIDA_AxisStyle::parameterValue(const std::string& param) const
00114 {
00115   if (!rep) { 
00116     crisis();
00117     return "";
00118   }
00119   return rep->parameterValue(param);
00120 }
00121 
00122 
00123 
00124 
00125 std::vector<std::string> AIDA_AxisStyle::availableParameters() const
00126 {
00127   if (!rep) { 
00128     crisis();
00129     return std::vector<std::string>();
00130   }
00131   return rep->availableParameters();
00132 }
00133 
00134 
00135 
00136 
00137 std::vector<std::string> 
00138 AIDA_AxisStyle::availableParameterOptions(const std::string& paramName) const
00139 {
00140   if (!rep) { 
00141     crisis();
00142     return std::vector<std::string>();
00143   }
00144   return rep->availableOptions(paramName);
00145 }
00146 
00147 
00148 
00149 
00150 AIDA::ILineStyle& AIDA_AxisStyle::lineStyle()
00151 {
00152   static AIDA_LineStyle pr;
00153   if (!rep) { 
00154     crisis();
00155     return pr;
00156   }
00157   LineStyle& gls = rep->lineStyle();
00158   pr.setRep(gls,false);
00159   return pr;
00160 }
00161 
00162 
00163 
00164 
00165 AIDA::ITextStyle& AIDA_AxisStyle::tickLabelStyle()
00166 {
00167   static AIDA_TextStyle pr;
00168   if (!rep) { 
00169     crisis();
00170     return pr;
00171   }
00172   TextStyle& gts = rep->tickLabelStyle();
00173   pr.setRep(gts,false);
00174   return pr;
00175 }
00176 
00177 
00178 
00179 
00180 AIDA::ITextStyle& AIDA_AxisStyle::labelStyle()
00181 {
00182   static AIDA_TextStyle pr;
00183   if (!rep) { 
00184     crisis();
00185     return pr;
00186   }
00187   TextStyle& gts = rep->labelStyle();
00188   pr.setRep(gts,false);
00189   return pr;
00190 }
00191 
00192 
00193 
00194 
00195 bool AIDA_AxisStyle::setlineStyle(const AIDA::ILineStyle& lineStyle)
00196 {
00197   if (!rep) { 
00198     crisis();
00199     return false;
00200   }
00201   const AIDA_LineStyle* pr = dynamic_cast<const AIDA_LineStyle*>(&lineStyle);
00202   if (!pr) return false; //ND no plugnplay message?
00203   AIDA_LineStyle* ncpr = const_cast<AIDA_LineStyle*>(pr);
00204   LineStyle* tsrep = ncpr->theRep();
00205   if (tsrep == 0) return false;
00206   else {
00207     rep->setLineStyle(*tsrep);
00208     return true;
00209   }
00210 }
00211 
00212 
00213 
00214 
00215 bool AIDA_AxisStyle::setTickLabelStyle(const AIDA::ITextStyle& tickLabelStyle)
00216 {
00217   if (!rep) { 
00218     crisis();
00219     return false;
00220   }
00221   const AIDA_TextStyle* pr = dynamic_cast<const AIDA_TextStyle*>(&tickLabelStyle);
00222   if (!pr) return false;
00223   AIDA_TextStyle* ncpr = const_cast<AIDA_TextStyle*>(pr);
00224   TextStyle* tsrep = ncpr->theRep();
00225   if (tsrep == 0) return false;
00226   else {
00227     rep->setTickLabelStyle(*tsrep);
00228     return true;
00229   }
00230 }
00231 
00232 
00233 
00234 
00235 bool AIDA_AxisStyle::setLabelStyle(const AIDA::ITextStyle& labelStyle)
00236 {
00237   if (!rep) { 
00238     crisis();
00239     return false;
00240   }
00241   const AIDA_TextStyle* pr = dynamic_cast<const AIDA_TextStyle*>(&labelStyle);
00242   if (!pr) return false;
00243   AIDA_TextStyle* ncpr = const_cast<AIDA_TextStyle*>(pr);
00244   TextStyle* tsrep = ncpr->theRep();
00245   if (tsrep == 0) return false;
00246   else {
00247     rep->setLabelStyle(*tsrep);
00248     return true;
00249   }
00250 }
00251 
00252 
00253 
00254 
00255 void AIDA_AxisStyle::setLabel(const std::string& label)
00256 {
00257   if (!rep) { 
00258     crisis();
00259     return;
00260   }
00261   return rep->setLabel(label);
00262 }
00263 
00264 
00265 
00266 
00267 AxisStyle* AIDA_AxisStyle::theRep()
00268 {
00269   return rep;
00270 }
00271 
00272 
00273 
00274 
00275 void AIDA_AxisStyle::setRep(AxisStyle& newRep, bool ownership)
00276 {
00277   if (ownRep) delete rep;
00278   rep = &newRep;
00279   ownRep = ownership;
00280 }
00281 
00282 
00283 
00284 
00286 //                 //
00287 // Private methods //
00288 //                 //
00290 void AIDA_AxisStyle::crisis() const
00291 {
00292   std::cout << "*** AIDA_Plotter_Grace ERROR: proxy failure in AIDA_AxisStyle" << std::endl;
00293 }
00294 
00295 
00296 
00297 } // end of namespace AIDA_Plotter_Grace
00298 } // end of namespace Anaphe
00299 

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