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>
31 #include <tulip/LayoutProperty.h>
32 #include <tulip/DoubleProperty.h>
33 #include <tulip/StringProperty.h>
34 #include <tulip/BooleanProperty.h>
35 #include <tulip/SizeProperty.h>
36 #include <tulip/IntegerProperty.h>
37 #include <tulip/ColorProperty.h>
42 class PropertyManager;
45 class EdgeExtremityGlyph;
46 class GlVertexArrayManager;
51 class TLP_GL_SCOPE GlGraphInputData :
public Observable {
84 GlGraphInputData(Graph* graph, GlGraphRenderingParameters* parameters,GlMetaNodeRenderer *renderer = NULL);
91 Graph* getGraph()
const {
95 void treatEvent(
const Event &ev);
101 void setMetaNodeRenderer(GlMetaNodeRenderer *renderer,
bool deleteOldMetaNodeRenderer=
true) {
102 if(deleteOldMetaNodeRenderer)
103 delete _metaNodeRenderer;
105 _metaNodeRenderer = renderer;
111 void setDeleteMetaNodeRendererAtDestructor(
bool deleteAtDestructor) {
112 _deleteMetaNodeRendererAtDestructor=deleteAtDestructor;
118 GlMetaNodeRenderer *getMetaNodeRenderer()
const {
119 return _metaNodeRenderer;
125 GlVertexArrayManager *getGlVertexArrayManager()
const {
126 return _glVertexArrayManager;
132 void setGlVertexArrayManager(GlVertexArrayManager * manager) {
133 _glVertexArrayManager=manager;
139 void deleteGlVertexArrayManagerInDestructor(
bool del) {
140 _deleteGlVertexArrayManager=del;
148 std::map<std::string, PropertyName>::iterator it =
149 _propertiesNameMap.find(name);
151 if (it != _propertiesNameMap.end())
152 return _propertiesMap[it->second];
162 T* getProperty(PropertyName propertyName)
const {
163 return static_cast<T*
>(_propertiesMap[propertyName]);
170 void setProperty(PropertyName propertyName, PropertyInterface *property) {
171 _properties.
erase(_propertiesMap[propertyName]);
172 _propertiesMap[propertyName]=property;
173 _properties.insert(property);
179 bool setProperty(
const std::string& name, PropertyInterface *property);
184 bool installProperties(
const std::map<std::string, tlp::PropertyInterface*>& propsMap);
189 ColorProperty * getElementColor()
const {
190 return getProperty<ColorProperty>(VIEW_COLOR);
195 void setElementColor(ColorProperty *property) {
196 setProperty(VIEW_COLOR,property);
201 ColorProperty *getElementLabelColor()
const {
202 return getProperty<ColorProperty>(VIEW_LABELCOLOR);
207 void setElementLabelColor(ColorProperty *property) {
208 setProperty(VIEW_LABELCOLOR,property);
213 SizeProperty *getElementSize()
const {
214 return getProperty<SizeProperty>(VIEW_SIZE);
219 void setElementSize(SizeProperty *property) {
220 setProperty(VIEW_SIZE,property);
225 IntegerProperty *getElementLabelPosition()
const {
226 return getProperty<IntegerProperty>(VIEW_LABELPOSITION);
231 void setElementLabelPosition(IntegerProperty *property) {
232 setProperty(VIEW_LABELPOSITION,property);
237 IntegerProperty *getElementShape()
const {
238 return getProperty<IntegerProperty>(VIEW_SHAPE);
243 void setElementShape(IntegerProperty *property) {
244 setProperty(VIEW_SHAPE,property);
249 DoubleProperty *getElementRotation()
const {
250 return getProperty<DoubleProperty>(VIEW_ROTATION);
255 void setElementRotation(DoubleProperty *property) {
256 setProperty(VIEW_ROTATION,property);
261 BooleanProperty *getElementSelected()
const {
262 return getProperty<BooleanProperty>(VIEW_SELECTED);
267 void setElementSelected(BooleanProperty *property) {
268 setProperty(VIEW_SELECTED,property);
273 StringProperty *getElementFont()
const {
274 return getProperty<StringProperty>(VIEW_FONT);
279 void setElementFont(StringProperty *property) {
280 setProperty(VIEW_FONT,property);
285 IntegerProperty *getElementFontSize()
const {
286 return getProperty<IntegerProperty>(VIEW_FONTSIZE);
291 void setElementFontSize(IntegerProperty *property) {
292 setProperty(VIEW_FONTSIZE,property);
297 StringProperty *getElementLabel()
const {
298 return getProperty<StringProperty>(VIEW_LABEL);
303 void setElementLabel(StringProperty *property) {
304 setProperty(VIEW_LABEL,property);
309 LayoutProperty *getElementLayout()
const {
310 return getProperty<LayoutProperty>(VIEW_LAYOUT);
315 void setElementLayout(LayoutProperty *property) {
316 setProperty(VIEW_LAYOUT,property);
321 StringProperty *getElementTexture()
const {
322 return getProperty<StringProperty>(VIEW_TEXTURE);
327 void setElementTexture(StringProperty *property) {
328 setProperty(VIEW_TEXTURE,property);
333 ColorProperty *getElementBorderColor()
const {
334 return getProperty<ColorProperty>(VIEW_BORDERCOLOR);
339 void setElementBorderColor(ColorProperty *property) {
340 setProperty(VIEW_BORDERCOLOR,property);
345 DoubleProperty *getElementBorderWidth()
const {
346 return getProperty<DoubleProperty>(VIEW_BORDERWIDTH);
351 void setElementBorderWidth(DoubleProperty *property) {
352 setProperty(VIEW_BORDERWIDTH,property);
357 IntegerProperty *getElementSrcAnchorShape()
const {
358 return getProperty<IntegerProperty>(VIEW_SRCANCHORSHAPE);
363 void setElementSrcAnchorShape(IntegerProperty *property) {
364 setProperty(VIEW_SRCANCHORSHAPE,property);
369 SizeProperty *getElementSrcAnchorSize()
const {
370 return getProperty<SizeProperty>(VIEW_SRCANCHORSIZE);
375 void setElementSrcAnchorSize(SizeProperty *property) {
376 setProperty(VIEW_SRCANCHORSIZE,property);
381 IntegerProperty *getElementTgtAnchorShape()
const {
382 return getProperty<IntegerProperty>(VIEW_TGTANCHORSHAPE);
387 void setElementTgtAnchorShape(IntegerProperty *property) {
388 setProperty(VIEW_TGTANCHORSHAPE,property);
393 SizeProperty *getElementTgtAnchorSize()
const {
394 return getProperty<SizeProperty>(VIEW_TGTANCHORSIZE);
399 void setElementTgtAnchorSize(SizeProperty *property) {
400 setProperty(VIEW_TGTANCHORSIZE,property);
405 IntegerProperty *getElementAnimationFrame()
const {
406 return getProperty<IntegerProperty>(VIEW_ANIMATIONFRAME);
411 void setElementAnimationFrame(IntegerProperty *property) {
412 setProperty(VIEW_ANIMATIONFRAME,property);
415 std::set<tlp::PropertyInterface*> properties()
const {
422 void reloadGraphProperties();
428 GlGraphRenderingParameters* renderingParameters()
const {
436 void setRenderingParameters(GlGraphRenderingParameters* newParameters) {
437 parameters = newParameters;
444 GlGraphRenderingParameters* parameters;
446 MutableContainer<Glyph *> glyphs;
447 MutableContainer<EdgeExtremityGlyph *> extremityGlyphs;
451 std::set<PropertyInterface*> _properties;
453 bool _deleteGlVertexArrayManager;
455 PropertyInterface* _propertiesMap[NB_PROPS];
456 static std::map<std::string,PropertyName> _propertiesNameMap;
458 bool _deleteMetaNodeRendererAtDestructor;
459 GlMetaNodeRenderer *_metaNodeRenderer;
460 GlVertexArrayManager *_glVertexArrayManager;