21 #ifndef Tulip_GLGRAPHINPUTDATA_H
22 #define Tulip_GLGRAPHINPUTDATA_H
24 #include <tulip/tulipconf.h>
26 #include <tulip/MutableContainer.h>
28 #include <tulip/GlMetaNodeRenderer.h>
29 #include <tulip/GlGraphRenderingParameters.h>
30 #include <tulip/ObservableGraph.h>
37 class IntegerProperty;
38 class BooleanProperty;
41 class PropertyManager;
44 class EdgeExtremityGlyph;
45 class GlVertexArrayManager;
50 class TLP_GL_SCOPE GlGraphInputData :
public Observable {
82 GlGraphInputData(Graph* graph, GlGraphRenderingParameters* parameters,GlMetaNodeRenderer *renderer = NULL);
89 Graph* getGraph()
const {
93 void treatEvent(
const Event &ev);
99 void setMetaNodeRenderer(GlMetaNodeRenderer *renderer,
bool deleteOldMetaNodeRenderer=
true) {
100 if(deleteOldMetaNodeRenderer)
101 delete _metaNodeRenderer;
103 _metaNodeRenderer = renderer;
109 void setDeleteMetaNodeRendererAtDestructor(
bool deleteAtDestructor) {
110 _deleteMetaNodeRendererAtDestructor=deleteAtDestructor;
116 GlMetaNodeRenderer *getMetaNodeRenderer()
const {
117 return _metaNodeRenderer;
123 GlVertexArrayManager *getGlVertexArrayManager()
const {
124 return _glVertexArrayManager;
130 void setGlVertexArrayManager(GlVertexArrayManager * manager) {
131 _glVertexArrayManager=manager;
137 void deleteGlVertexArrayManagerInDestructor(
bool del) {
138 _deleteGlVertexArrayManager=del;
146 T* getProperty(PropertyName propertyName)
const {
147 T*
property=
static_cast<T*
>(_propertiesMap.find(propertyName)->second);
155 void setProperty(PropertyName propertyName,PropertyInterface *property) {
156 _properties.erase(_propertiesMap[propertyName]);
157 _propertiesMap[propertyName]=property;
158 _properties.insert(property);
160 for(std::map<std::string,PropertyName>::iterator it=_propertiesNameMap.begin(); it!=_propertiesNameMap.end(); ++it) {
161 if((*it).second==propertyName) {
162 _propertiesNameMap.erase(it);
171 ColorProperty * getElementColor()
const {
172 return getProperty<ColorProperty>(VIEW_COLOR);
177 void setElementColor(ColorProperty *property) {
178 setProperty(VIEW_COLOR,property);
183 ColorProperty *getElementLabelColor()
const {
184 return getProperty<ColorProperty>(VIEW_LABELCOLOR);
189 void setElementLabelColor(ColorProperty *property) {
190 setProperty(VIEW_LABELCOLOR,property);
195 SizeProperty *getElementSize()
const {
196 return getProperty<SizeProperty>(VIEW_SIZE);
201 void setElementSize(SizeProperty *property) {
202 setProperty(VIEW_SIZE,property);
207 IntegerProperty *getElementLabelPosition()
const {
208 return getProperty<IntegerProperty>(VIEW_LABELPOSITION);
213 void setElementLabelPosition(IntegerProperty *property) {
214 setProperty(VIEW_LABELPOSITION,property);
219 IntegerProperty *getElementShape()
const {
220 return getProperty<IntegerProperty>(VIEW_SHAPE);
225 void setElementShape(IntegerProperty *property) {
226 setProperty(VIEW_SHAPE,property);
231 DoubleProperty *getElementRotation()
const {
232 return getProperty<DoubleProperty>(VIEW_ROTATION);
237 void setElementRotation(DoubleProperty *property) {
238 setProperty(VIEW_ROTATION,property);
243 BooleanProperty *getElementSelected()
const {
244 return getProperty<BooleanProperty>(VIEW_SELECTED);
249 void setElementSelected(BooleanProperty *property) {
250 setProperty(VIEW_SELECTED,property);
255 StringProperty *getElementFont()
const {
256 return getProperty<StringProperty>(VIEW_FONT);
261 void setElementFont(StringProperty *property) {
262 setProperty(VIEW_FONT,property);
267 IntegerProperty *getElementFontSize()
const {
268 return getProperty<IntegerProperty>(VIEW_FONTSIZE);
273 void setElementFontSize(IntegerProperty *property) {
274 setProperty(VIEW_FONTSIZE,property);
279 StringProperty *getElementLabel()
const {
280 return getProperty<StringProperty>(VIEW_LABEL);
285 void setElementLabel(StringProperty *property) {
286 setProperty(VIEW_LABEL,property);
291 LayoutProperty *getElementLayout()
const {
292 return getProperty<LayoutProperty>(VIEW_LAYOUT);
297 void setElementLayout(LayoutProperty *property) {
298 setProperty(VIEW_LAYOUT,property);
303 StringProperty *getElementTexture()
const {
304 return getProperty<StringProperty>(VIEW_TEXTURE);
309 void setElementTexture(StringProperty *property) {
310 setProperty(VIEW_TEXTURE,property);
315 ColorProperty *getElementBorderColor()
const {
316 return getProperty<ColorProperty>(VIEW_BORDERCOLOR);
321 void setElementBorderColor(ColorProperty *property) {
322 setProperty(VIEW_BORDERCOLOR,property);
327 DoubleProperty *getElementBorderWidth()
const {
328 return getProperty<DoubleProperty>(VIEW_BORDERWIDTH);
333 void setElementBorderWidth(DoubleProperty *property) {
334 setProperty(VIEW_BORDERWIDTH,property);
339 IntegerProperty *getElementSrcAnchorShape()
const {
340 return getProperty<IntegerProperty>(VIEW_SRCANCHORSHAPE);
345 void setElementSrcAnchorShape(IntegerProperty *property) {
346 setProperty(VIEW_SRCANCHORSHAPE,property);
351 SizeProperty *getElementSrcAnchorSize()
const {
352 return getProperty<SizeProperty>(VIEW_SRCANCHORSIZE);
357 void setElementSrcAnchorSize(SizeProperty *property) {
358 setProperty(VIEW_SRCANCHORSIZE,property);
363 IntegerProperty *getElementTgtAnchorShape()
const {
364 return getProperty<IntegerProperty>(VIEW_TGTANCHORSHAPE);
369 void setElementTgtAnchorShape(IntegerProperty *property) {
370 setProperty(VIEW_TGTANCHORSHAPE,property);
375 SizeProperty *getElementTgtAnchorSize()
const {
376 return getProperty<SizeProperty>(VIEW_TGTANCHORSIZE);
381 void setElementTgtAnchorSize(SizeProperty *property) {
382 setProperty(VIEW_TGTANCHORSIZE,property);
387 IntegerProperty *getElementAnimationFrame()
const {
388 return getProperty<IntegerProperty>(VIEW_ANIMATIONFRAME);
393 void setElementAnimationFrame(IntegerProperty *property) {
394 setProperty(VIEW_ANIMATIONFRAME,property);
397 std::set<tlp::PropertyInterface*> properties()
const {
404 void reloadGraphProperties();
410 GlGraphRenderingParameters* renderingParameters()
const {
418 void setRenderingParameters(GlGraphRenderingParameters* newParameters) {
419 parameters = newParameters;
426 GlGraphRenderingParameters* parameters;
428 MutableContainer<Glyph *> glyphs;
429 MutableContainer<EdgeExtremityGlyph *> extremityGlyphs;
433 std::set<PropertyInterface*> _properties;
435 bool _deleteGlVertexArrayManager;
437 std::map<PropertyName,PropertyInterface*> _propertiesMap;
438 std::map<std::string,PropertyName> _propertiesNameMap;
440 bool _deleteMetaNodeRendererAtDestructor;
441 GlMetaNodeRenderer *_metaNodeRenderer;
442 GlVertexArrayManager *_glVertexArrayManager;