Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

layer.cpp

00001 /***************************************************************************
00002                           layer.cpp  -  description
00003           $Id: layer.cpp 51 2006-09-27 22:15:47Z neoneurone $
00004                              -------------------
00005     begin                : september 20th, 2003
00006     copyright            : (C) 2003-2006 by Duong-Khang NGUYEN
00007     email                : neoneurone @ users sourceforge net
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   any later version.                                                    *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 #include "layer.h"
00020 
00021 #include "structure.h"
00022 #include "guicontainer.h"   // for the "Query" function
00023 #include "guibutton.h"
00024 
00025 // Static variables
00026 uint Layer::uiNumberLayer = 0;
00027 GUIButton* Layer::pbtnQW;
00028 GUIButton* Layer::pbtnQE;
00029 GUIButton* Layer::pbtnQG;
00030 GUIButton* Layer::pbtnQR;
00031 GUIButton* Layer::pbtnQC;
00032 GUIButton* Layer::pbtnQI;
00033 //GUIButton* Layer::pbtnQP;
00034 
00035 
00036 Layer::Layer(){
00037     OPENCITY_DEBUG( "ctor" );
00038 
00039 // If called first time, create all the static variables
00040 // we do it here, because we need an initialized OpenGL context
00041 // if we do it on the declaration line, there will be runtime errors !
00042     if ( Layer::uiNumberLayer++ == 0) {
00043         Layer::pbtnQW = new GUIButton( 20,  20,  30, 30, ocHomeDirPrefix( "graphism/gui/query_water" ));
00044         Layer::pbtnQE = new GUIButton( 60,  0,   30, 30, ocHomeDirPrefix( "graphism/gui/query_electricity" ));
00045         Layer::pbtnQG = new GUIButton( 100, 20,  30, 30, ocHomeDirPrefix( "graphism/gui/query_gas" ));
00046         Layer::pbtnQR = new GUIButton( 20,  80,  30, 30, ocHomeDirPrefix( "graphism/gui/query_residential" ));
00047         Layer::pbtnQC = new GUIButton( 60,  100, 30, 30, ocHomeDirPrefix( "graphism/gui/query_commercial" ));
00048         Layer::pbtnQI = new GUIButton( 100, 80,  30, 30, ocHomeDirPrefix( "graphism/gui/query_industrial" ));
00049 
00050     // Disable the default alpha blending behaviour
00051         Layer::pbtnQW->Unset( OC_GUIMAIN_BLENDING );
00052         Layer::pbtnQE->Unset( OC_GUIMAIN_BLENDING );
00053         Layer::pbtnQG->Unset( OC_GUIMAIN_BLENDING );
00054         Layer::pbtnQR->Unset( OC_GUIMAIN_BLENDING );
00055         Layer::pbtnQC->Unset( OC_GUIMAIN_BLENDING );
00056         Layer::pbtnQI->Unset( OC_GUIMAIN_BLENDING );
00057     }
00058 }
00059 
00060 
00061    /*=====================================================================*/
00062 Layer::~Layer(){
00063     OPENCITY_DEBUG( "dtor" );
00064 
00065 // called for the last derived class ?
00066 // yes, then destroy all the static stuff
00067     if ( Layer::uiNumberLayer-- == 1) {
00068         delete Layer::pbtnQW;
00069         delete Layer::pbtnQE;
00070         delete Layer::pbtnQG;
00071         delete Layer::pbtnQR;
00072         delete Layer::pbtnQC;
00073         delete Layer::pbtnQI;
00074     }
00075 }
00076 
00077 
00078    /*=====================================================================*/
00079 const uint
00080 Layer::GetMaxLinear() const
00081 {
00082     return _uiLayerWidth * _uiLayerLength - 1;
00083 }
00084 
00085 
00086    /*=====================================================================*/
00087 void
00088 Layer::GetLayerSize(
00089     uint & w,
00090     uint & l) const
00091 {
00092     w = _uiLayerWidth;
00093     l = _uiLayerLength;
00094 }
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109 
00110 
00111 
00112 
00113 
00114 
00115 
00116 
00117 
00118 
00119 
00120 
00121 
00122 
00123 
00124 

Generated on Sat Nov 11 10:21:10 2006 for OpenCity by  doxygen 1.4.2