Logo Search packages:      
Sourcecode: qantenna version File versions  Download package

necoutput.h

/***************************************************************************
 *   Copyright (C) 2005 by                                                 *
 *   Lisandro Damián Nicanor Pérez Meyer - perezmeyer en/at gmail.com      *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef NECOUTPUT_H
#define NECOUTPUT_H

#include <QList>
#include <QtOpenGL/QtOpenGL>
#include "radiationpattern.h"

class GLWidget;

/**
      This class holds the values that were returned from the execution of NEC
      and process them so as to make them rendereable by OpenGL.
*/

00035 class NECOutput : public QObject
{

      Q_OBJECT

public:
      NECOutput(GLWidget * gl, QWidget * parent = 0);
      ~NECOutput();

      /**
            Function to insert the radiation data that generates NECOutputParser
            into the list of radiation patterns.
      */
      void SetRadiationPattern(RadiationPattern * newRadiationPattern);

      /// Change the color scheme
      void setColorScheme(int theColorScheme);

      /// Here we process the data in order to get OpenGL data
      void ProcessData();

      /// Will you please render?
      void Render();

      /**
            Sets the displacement of the radiattion pattern. Note that X, y and z
            are OGL's coordinates, not real coordinates.
      */
      void setDisplacement(double & x, double & y, double & z);

      /// The minimum in the scale
      void setDBMinimum(double newDB);
      /// The radius of the spheres
      void setRadius(double newRadius);
      /// The transparency (alpha) of the surfaces
      void setAlpha(double newAlpha);

      /// Surface rendering
      void setRenderSurface(bool render);
      /// Spheres rendering
      void setRenderSpheres(bool render);
      /// Mesh rendering
      void setRenderMesh(bool render);
      /// Inside triangles rendering
      void setRenderInsideTriangles(bool render);

      /// A way to change the size of the surface
      void setRo(double newRo);

private:
      /// Color calcs
      void calculateColors(int position, const double R, double & red, double & green, double & blue);

      /// A private function to calculate the radiation pattern
      void CalculateXYZ(const int i, double & x, double & y,
                        double & z, double & R);

      /// The triangles normals
      void calculateTriangleNormal(double x1, double y1, double z1,
                                   double x2, double y2, double z2,
                                   double x3, double y3, double z3,
                                   double & x, double & y, double & z);

      /// The surface calcs
      void calculateSurface();
      /// The mesh calcs
      void calculateMesh();
      /// The inside triangles calcs
      void calculateInsideTriangles();

      /// List of radiation data obtained from parsing NEC's output
00106       QList<RadiationPattern*> radiationPatternList;

      /// Do we plot the surface?
00109       bool surfaceEnabled;
      /// Do we plot the spheres?
00111       bool spheresEnabled;
      ///Do we plot the mesh?
00113       bool meshEnabled;
      /// Do we plot the inside triangles?
00115       bool insideTrianglesEnabled;

      /**
            The maximum power gain, so as to be able to normalize the
            radiation pattern
      */
00121       double maxPowerGain;

      /// The quadric for the spheres
00124       GLUquadricObj *quad;

      /// The surface vertex array
00127       QVector<double> surfaceVertexArray;
      /// The mesh vertex array
00129       QVector<double> meshVertexArray;
      /// The inside triangles vertex array
00131       QVector<double> insideTrianglesVertexArray;

      /// The surface color array
00134       QVector<double> surfaceColorArray;
      /// The mesh color array
00136       QVector<double> meshColorArray;
      /// The inside triangles color array
00138       QVector<double> insideTrianglesColorArray;

      /// The surface normal array
00141       QVector<double> surfaceNormalArray;
      /// The mesh normal array
00143       QVector<double> meshNormalArray;
      /// The inside triangles normal array
00145       QVector<double> insideTrianglesNormalArray;

      /// The minimum value of Gain in dB whic corresponds to (0,0,0)
00148       double dBMinimum;
      /// The radius of the spheres
00150       double radius;
      /// Alpha of the colors
00152       double alpha;

      /*
            We must sort the parts of the radiation patterns that are of
            our interest. This is why we have the two following lists.
      */
      /**
            phiStartList will contain the values of the starting positions of a new group of
            radiation patterns with the same phi angle.
      */
00162       QList<int> phiStartList;
      /// phiValues will contain the differents values of phi.
00164       QList<double> phiValues;

      /// Did we completed the above lists?
00167       bool listCompleted;

      /// Size of the surfaces
00170       double ro;

      // Displacement of the surface
      /// Displacement in x
00174       double deltaX;
      /// Displacement in y
00176       double deltaY;
      /// Displacement in z
00178       double deltaZ;

      /// A pointer to a GLWidget
00181       GLWidget *glWidget;

      /**
            The color scheme defines how a RP point will be coloured.
            0: Use the gain
            1: Use the polarization sense
      */
00188       int colorScheme;

};
#endif //NECOUTPUT_H


Generated by  Doxygen 1.6.0   Back to index