Back to index

salome-gui  6.5.0
Defines | Functions
GLViewer_BaseObjects.cxx File Reference
#include "GLViewer_BaseObjects.h"
#include "GLViewer_BaseDrawers.h"
#include "GLViewer_AspectLine.h"
#include "GLViewer_CoordSystem.h"
#include "GLViewer_Text.h"
#include "GLViewer_Group.h"
#include "GLViewer_Drawer.h"
#include <QFile>

Go to the source code of this file.

Defines

#define SECTIONS   100
#define DISTANTION   5

Functions

void AddCoordsToHPGL (QString &buffer, QString command, GLViewer_CoordSystem *aViewerCS, GLViewer_CoordSystem *aPaperCS, double x, double y, bool NewLine=true)
 Adds coords to text buffer in HPGL format.
void AddCoordsToPS (QString &buffer, QString command, GLViewer_CoordSystem *aViewerCS, GLViewer_CoordSystem *aPaperCS, double x, double y, bool NewLine=true)
 Adds coords to text buffer in PostScript format.
void AddLineAspectToPS (QString &buffer, GLViewer_AspectLine *anAspect, GLViewer_CoordSystem *aViewerCS, GLViewer_CoordSystem *aPaperCS)
 Adds line aspect description to text buffer in PostScript format.

Define Documentation

#define DISTANTION   5

Definition at line 809 of file GLViewer_BaseObjects.cxx.

#define SECTIONS   100

Definition at line 808 of file GLViewer_BaseObjects.cxx.


Function Documentation

void AddCoordsToHPGL ( QString &  buffer,
QString  command,
GLViewer_CoordSystem aViewerCS,
GLViewer_CoordSystem aPaperCS,
double  x,
double  y,
bool  NewLine = true 
)

Adds coords to text buffer in HPGL format.

Parameters:
buffer- text buffer
command- command to be added with coords
aViewerCS- viewer co-ordinates system
aPaperCS- paper co-ordinates system
x- x co-ordinate
y- y co-ordinate
NewLine- adds new line to buffer

Definition at line 78 of file GLViewer_BaseObjects.cxx.

{
    if( aViewerCS && aPaperCS )
        aViewerCS->transform( *aPaperCS, x, y );

    QString temp = command + "%1, %2;";
    buffer += temp.arg( x ).arg( y );
    if( NewLine )
        buffer += ";\n";
}
void AddCoordsToPS ( QString &  buffer,
QString  command,
GLViewer_CoordSystem aViewerCS,
GLViewer_CoordSystem aPaperCS,
double  x,
double  y,
bool  NewLine = true 
)

Adds coords to text buffer in PostScript format.

Parameters:
buffer- text buffer
command- command to be added with coords
aViewerCS- viewer co-ordinates system
aPaperCS- paper co-ordinates system
x- x co-ordinate
y- y co-ordinate
NewLine- adds new line to buffer

Definition at line 100 of file GLViewer_BaseObjects.cxx.

{
    if( aViewerCS && aPaperCS )
        aViewerCS->transform( *aPaperCS, x, y );

    QString temp = "%1 %2 "+command;    
    buffer += temp.arg( x ).arg( y );
    if( NewLine )
        buffer += "\n";
}
void AddLineAspectToPS ( QString &  buffer,
GLViewer_AspectLine anAspect,
GLViewer_CoordSystem aViewerCS,
GLViewer_CoordSystem aPaperCS 
)

Adds line aspect description to text buffer in PostScript format.

Parameters:
buffer- text buffer
anAspect- line aspect
aViewerCS- viewer co-ordinates system
aPaperCS- paper co-ordinates system

Definition at line 119 of file GLViewer_BaseObjects.cxx.

{
    if( anAspect )
    {
        QColor col1, col2, col3;
        anAspect->getLineColors( col1, col2, col3 );

        float aWidth = anAspect->getLineWidth();
        int aLineType = anAspect->getLineType();

        QString temp = "%1 %2 %3 setrgbcolor\n";
        double rr = 1 - double( col1.red() ) / 255.0, //color inverting
               gg = 1 - double( col1.green() ) / 255.0,
               bb = 1 - double( col1.blue() ) / 255.0;

        buffer += temp.arg( rr ).arg( gg ).arg( bb );

        double x_stretch, y_stretch;
        aViewerCS->getStretching( *aPaperCS, x_stretch, y_stretch );
        buffer += temp.arg( x_stretch * aWidth )+" setlinewidth\n";

        if( aLineType==0 ) //solid
            buffer += "[] 0 setdash\n";
        else if( aLineType==1 ) //strip
            buffer += "[2] 0 setdash\n";
    }
}