File: GlScene.sip

package info (click to toggle)
tulip 4.8.0dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 179,264 kB
  • ctags: 64,517
  • sloc: cpp: 600,444; ansic: 36,311; makefile: 22,136; python: 1,304; sh: 946; yacc: 522; xml: 337; pascal: 157; php: 66; lex: 55
file content (170 lines) | stat: -rw-r--r-- 4,365 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/**
 *
 * This file is part of Tulip (www.tulip-software.org)
 *
 * Authors: David Auber and the Tulip development Team
 * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
 *
 * Tulip is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation, either version 3
 * of the License, or (at your option) any later version.
 *
 * Tulip 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.
 *
 */

// +-------------------------------------------------------------------------+
// | Tulip Python Bindings                                                   |
// | inspired for bindings by the Booggie project development team           |
// | (http://booggie.org/)                                                   |
// +-------------------------------------------------------------------------+

%ModuleHeaderCode
#include <tulip/Vector.h>
#include <tulip/GlLayer.h>
#include <tulip/GlLODCalculator.h>
typedef std::pair<std::string, tlp::GlLayer*> pairStringGlLayer;
namespace tlp {
typedef tlp::Vector<int, 4> Vec4i;
}
%End

typedef std::pair<std::string, tlp::GlLayer*> pairStringGlLayer;

namespace tlp {

enum RenderingEntitiesFlag {
  RenderingSimpleEntities =1,
  RenderingNodes = 2,
  RenderingEdges = 4,
  RenderingAll = 7,
  RenderingWithoutRemove = 8
};

struct SelectedEntity {
%TypeHeaderCode
#include <tulip/GlScene.h>
%End

  enum SelectedEntityType {
    UNKNOW_SELECTED = 0,
    NODE_SELECTED = 1,
    EDGE_SELECTED = 2,
    SIMPLE_ENTITY_SELECTED = 3
  };

  SelectedEntity();

  SelectedEntity(tlp::GlSimpleEntity *entity);

  SelectedEntity(tlp::Graph *graph,unsigned int id, SelectedEntityType type);

  tlp::GlSimpleEntity *getSimpleEntity() const;

  unsigned int getComplexEntityId() const;

  tlp::Graph *getComplexEntityGraph() const;

  SelectedEntityType getEntityType() const;

  tlp::node getNode() const;

  tlp::edge getEdge() const;

};

class GlScene  : tlp::Observable {
%TypeHeaderCode
#include <tulip/GlScene.h>
%End

%ConvertToSubClassCode
    if (dynamic_cast<tlp::GlScene*>(sipCpp)) {
      sipType = sipFindType("tlp::GlScene");
    } else {
      sipType = NULL;
    }
%End

public:

	GlScene();
	
	void initGlParameters();

	void draw();

	void centerScene();

	void ajustSceneToSize(int width, int height);

	void zoomXY(int step, const int x, const int y);

	void zoom(float factor,const tlp::Coord& dest);

	void zoom(int step);

	void translateCamera(const int x, const int y, const int z);

	void rotateScene(const int x, const int y, const int z);

    bool selectEntities(tlp::RenderingEntitiesFlag type, int x, int y, int h, int w, tlp::GlLayer *layer, std::vector<tlp::SelectedEntity>& selectedEntities /Out/);

	unsigned char * getImage();

	void setViewport(tlp::Vec4i &newViewport);
	
	void setViewport(int x, int y, int width, int height);

	tlp::Vec4i getViewport();

	void setBackgroundColor(const tlp::Color& color);

	tlp::Color getBackgroundColor();

	void setViewOrtho(bool viewOrtho);

	bool isViewOrtho();

    tlp::GlLayer *createLayer(const std::string &name);

    tlp::GlLayer *createLayerBefore(const std::string &layerName,const std::string &beforeLayerWithName);

    tlp::GlLayer *createLayerAfter(const std::string &layerName,const std::string &afterLayerWithName);

    void addExistingLayer(tlp::GlLayer *layer /Transfer/);

    bool addExistingLayerBefore(tlp::GlLayer *layer /Transfer/, const std::string &beforeLayerWithName);
	
    bool addExistingLayerAfter(tlp::GlLayer *layer, const std::string &afterLayerWithName);

	tlp::GlLayer* getLayer(const std::string& name);
	
    void removeLayer(const std::string& name,bool deleteLayer=true);

    void removeLayer(tlp::GlLayer *layer,bool deleteLayer=true);

    const std::vector<pairStringGlLayer> &getLayersList();

	void clearLayersList();

    tlp::BoundingBox getBoundingBox();

    tlp::GlGraphComposite* getGlGraphComposite();

	tlp::GlLayer* getGraphLayer();
	
    tlp::Camera getGraphCamera();

    void setGraphCamera(tlp::Camera* camera);

    void setClearBufferAtDraw(bool clear);

    bool getClearBufferAtDraw() const;

};
};