~ubuntu-branches/debian/jessie/ugene/jessie

« back to all changes in this revision

Viewing changes to src/plugins/biostruct3d_view/src/WormsGLRenderer.h

  • Committer: Package Import Robot
  • Author(s): Steffen Moeller
  • Date: 2011-11-02 13:29:07 UTC
  • mfrom: (1.2.1) (3.1.11 natty)
  • Revision ID: package-import@ubuntu.com-20111102132907-o34gwnt0uj5g6hen
Tags: 1.9.8+repack-1
* First release to Debian
  - added README.Debian
  - increased policy version to 3.9.2
  - added URLs for version control system
* Added debug package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************
2
 
* Unipro UGENE - Integrated Bioinformatics Suite
3
 
* Copyright (C) 2008 Unipro, Russia (http://ugene.unipro.ru)
4
 
* All Rights Reserved
5
 
6
 
*     This source code is distributed under the terms of the
7
 
*     GNU General Public License. See the files COPYING and LICENSE
8
 
*     for details.
9
 
*****************************************************************/
 
1
/**
 
2
 * UGENE - Integrated Bioinformatics Tools.
 
3
 * Copyright (C) 2008-2011 UniPro <ugene@unipro.ru>
 
4
 * http://ugene.unipro.ru
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU General Public License
 
8
 * as published by the Free Software Foundation; either version 2
 
9
 * of the License, or (at your option) any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program; if not, write to the Free Software
 
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
19
 * MA 02110-1301, USA.
 
20
 */
10
21
 
11
 
#ifndef _GB2_BIOSTRUCT3D_WORMS_RENDERER_H_
12
 
#define _GB2_BIOSTRUCT3D_WORMS_RENDERER_H_
 
22
#ifndef _U2_BIOSTRUCT3D_WORMS_RENDERER_H_
 
23
#define _U2_BIOSTRUCT3D_WORMS_RENDERER_H_
13
24
 
14
25
#include <QtCore/QSharedDataPointer>
15
26
#include <QtCore/QVector>
16
27
#include <QtCore/QMap>
17
28
#include <QtCore/QPair>
18
29
 
19
 
#include <core_api/Vector3D.h>
 
30
#include <U2Core/Vector3D.h>
20
31
#include "BioStruct3DGLRender.h"
21
32
#include "GraphicUtils.h"
22
33
 
23
34
class Object3D;
24
35
class AtomData;
25
36
 
26
 
namespace GB2 { 
27
 
 
28
 
    class WormsGLRenderer : public BioStruct3DGLRenderer {
29
 
 
30
 
        struct Monomer {
31
 
            Monomer() : alphaCarbon(NULL), carbonylOxygen(NULL) {}
32
 
            QSharedDataPointer<AtomData> alphaCarbon;
33
 
            QSharedDataPointer<AtomData> carbonylOxygen;
34
 
        };
35
 
 
36
 
        struct BioPolymer {
37
 
            QMap<int,Monomer> monomerMap;
38
 
        };
39
 
        
40
 
        QMap<int, BioPolymer> bioPolymerMap;
41
 
        
42
 
        struct CoordData {
43
 
            CoordData() { }
44
 
            CoordData(const Vector3D& v, const Color4f& c, int id) : site(v), color(c), redisueId(id) { } 
45
 
            Vector3D site;
46
 
            Color4f color;
47
 
            int redisueId;
48
 
        };
49
 
        
50
 
        // Alpha carbon coords
51
 
        QMap< int, QVector<CoordData> > coordsDataMap;
 
37
namespace U2 { 
 
38
 
 
39
class WormsGLRenderer : public BioStruct3DGLRenderer {
 
40
 
 
41
 
 
42
    // BioPolymer molecule
 
43
 
 
44
    struct Monomer
 
45
    {
 
46
        Monomer() : alphaCarbon(NULL), carbonylOxygen(NULL) {}
 
47
        QSharedDataPointer<AtomData> alphaCarbon;
 
48
        QSharedDataPointer<AtomData> carbonylOxygen;
 
49
    };
 
50
 
 
51
    struct BioPolymerModel
 
52
    {
 
53
        QMap<int,Monomer> monomerMap;
 
54
    };
 
55
 
 
56
    struct BioPolymer
 
57
    {
 
58
        // multiple models
 
59
        QVector<BioPolymerModel> bpModels;
 
60
    };
 
61
 
 
62
    QMap<int, BioPolymer > bioPolymerMap;
 
63
 
 
64
 
 
65
    // Worm Model
 
66
 
 
67
    typedef QVector<SharedAtom> AtomsVector;
 
68
 
 
69
    struct WormModel {
52
70
        //! These coords required to draw worms endings correctly
53
 
        QMap<int, QPair<Vector3D, Vector3D> > fakeAtomCoords;
54
 
 
55
 
        void createObjects3D();
56
 
        void createWormCoordsData();
57
 
        
58
 
        void drawWorms(); 
59
 
 
60
 
        void drawSecondaryStructure();
61
 
 
62
 
        QVector<Object3D* >  objects;
63
 
 
64
 
    public:
65
 
        
66
 
        WormsGLRenderer(const BioStruct3D& struc, const BioStruct3DColorScheme* s);
67
 
        
68
 
        ~WormsGLRenderer();
69
 
        
70
 
        void drawBioStruct3D();
71
 
        
72
 
        void updateColorScheme(const BioStruct3DColorScheme* s);
73
 
        
74
 
        RENDERER_FACTORY(WormsGLRenderer)
75
 
 
76
 
    };
 
71
        Vector3D openingAtom, closingAtom;
 
72
        // Worm building atom coords
 
73
        AtomsVector atoms;
 
74
        // Objects representing secondary structure
 
75
        QVector<Object3D*>  objects;
 
76
    };
 
77
 
 
78
    struct Worm {
 
79
        QVector<WormModel> models;
 
80
    };
 
81
 
 
82
    QMap<int, Worm> wormMap;
 
83
    Color4f atomColor;
 
84
 
 
85
 
 
86
    void createObjects3D();
 
87
    Object3D* createStrand3D( int startId, int endId, const BioPolymerModel &bpModel );
 
88
    Object3D* createHelix3D( int startId, int endId, const BioPolymerModel &bpModel );
 
89
    void createWorms();
 
90
    void drawWorms();
 
91
    void drawSecondaryStructure();
 
92
    const float* getAtomColor(const SharedAtom& atom);
 
93
 
 
94
protected:
 
95
    WormsGLRenderer(const BioStruct3D& struc, const BioStruct3DColorScheme* s, const QList<int> &shownModels, const BioStruct3DRendererSettings *settings);
 
96
 
 
97
public:
 
98
    virtual ~WormsGLRenderer();
 
99
 
 
100
    virtual void create();
 
101
    virtual void drawBioStruct3D();
 
102
 
 
103
    virtual void updateColorScheme();
 
104
    virtual void updateShownModels();
 
105
    virtual void updateSettings();
 
106
 
 
107
public:
 
108
    static bool isAvailableFor(const BioStruct3D &);
 
109
 
 
110
    RENDERER_FACTORY(WormsGLRenderer)
 
111
};
77
112
 
78
113
} //namespace
79
114
 
80
 
#endif // _GB2_BIOSTRUCT3D_WORMS_RENDERER_H_
 
115
#endif // _U2_BIOSTRUCT3D_WORMS_RENDERER_H_