21 #ifndef Tulip_GLGRAPHINPUTDATA_H
22 #define Tulip_GLGRAPHINPUTDATA_H
24 #include <tulip/tulipconf.h>
25 #include <tulip/Observable.h>
26 #include <tulip/LayoutProperty.h>
27 #include <tulip/DoubleProperty.h>
28 #include <tulip/StringProperty.h>
29 #include <tulip/BooleanProperty.h>
30 #include <tulip/SizeProperty.h>
31 #include <tulip/IntegerProperty.h>
32 #include <tulip/ColorProperty.h>
36 class PropertyManager;
39 class EdgeExtremityGlyph;
40 class GlVertexArrayManager;
41 class GlMetaNodeRenderer;
42 class GlGraphRenderingParameters;
47 class TLP_GL_SCOPE GlGraphInputData :
public Observable {
57 VIEW_LABELBORDERCOLOR,
58 VIEW_LABELBORDERWIDTH,
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);
104 void setDeleteMetaNodeRendererAtDestructor(
bool deleteAtDestructor) {
105 _deleteMetaNodeRendererAtDestructor=deleteAtDestructor;
111 GlMetaNodeRenderer *getMetaNodeRenderer()
const {
112 return _metaNodeRenderer;
118 GlVertexArrayManager *getGlVertexArrayManager()
const {
119 return _glVertexArrayManager;
125 void setGlVertexArrayManager(GlVertexArrayManager * manager) {
126 _glVertexArrayManager=manager;
132 void deleteGlVertexArrayManagerInDestructor(
bool del) {
133 _deleteGlVertexArrayManager=del;
141 std::map<std::string, PropertyName>::iterator it =
142 _propertiesNameMap.find(name);
144 if (it != _propertiesNameMap.end())
145 return _propertiesMap[it->second];
155 T* getProperty(PropertyName propertyName)
const {
156 return static_cast<T*
>(_propertiesMap[propertyName]);
163 void setProperty(PropertyName propertyName, PropertyInterface *property) {
164 _properties.
erase(_propertiesMap[propertyName]);
165 _propertiesMap[propertyName]=property;
166 _properties.insert(property);
172 bool setProperty(
const std::string& name, PropertyInterface *property);
177 bool installProperties(
const std::map<std::string, tlp::PropertyInterface*>& propsMap);
182 ColorProperty * getElementColor()
const {
183 return getProperty<ColorProperty>(VIEW_COLOR);
188 void setElementColor(ColorProperty *property) {
189 setProperty(VIEW_COLOR,property);
194 ColorProperty *getElementLabelColor()
const {
195 return getProperty<ColorProperty>(VIEW_LABELCOLOR);
200 void setElementLabelColor(ColorProperty *property) {
201 setProperty(VIEW_LABELCOLOR,property);
206 ColorProperty *getElementLabelBorderColor()
const {
207 return getProperty<ColorProperty>(VIEW_LABELBORDERCOLOR);
212 void setElementLabelBorderColor(ColorProperty *property) {
213 setProperty(VIEW_LABELBORDERCOLOR,property);
218 DoubleProperty *getElementLabelBorderWidth()
const {
219 return getProperty<DoubleProperty>(VIEW_LABELBORDERWIDTH);
224 void setElementLabelBorderColor(DoubleProperty *property) {
225 setProperty(VIEW_LABELBORDERWIDTH,property);
230 SizeProperty *getElementSize()
const {
231 return getProperty<SizeProperty>(VIEW_SIZE);
236 void setElementSize(SizeProperty *property) {
237 setProperty(VIEW_SIZE,property);
242 IntegerProperty *getElementLabelPosition()
const {
243 return getProperty<IntegerProperty>(VIEW_LABELPOSITION);
248 void setElementLabelPosition(IntegerProperty *property) {
249 setProperty(VIEW_LABELPOSITION,property);
254 IntegerProperty *getElementShape()
const {
255 return getProperty<IntegerProperty>(VIEW_SHAPE);
260 void setElementShape(IntegerProperty *property) {
261 setProperty(VIEW_SHAPE,property);
266 DoubleProperty *getElementRotation()
const {
267 return getProperty<DoubleProperty>(VIEW_ROTATION);
272 void setElementRotation(DoubleProperty *property) {
273 setProperty(VIEW_ROTATION,property);
278 BooleanProperty *getElementSelected()
const {
279 return getProperty<BooleanProperty>(VIEW_SELECTED);
284 void setElementSelected(BooleanProperty *property) {
285 setProperty(VIEW_SELECTED,property);
290 StringProperty *getElementFont()
const {
291 return getProperty<StringProperty>(VIEW_FONT);
296 void setElementFont(StringProperty *property) {
297 setProperty(VIEW_FONT,property);
302 IntegerProperty *getElementFontSize()
const {
303 return getProperty<IntegerProperty>(VIEW_FONTSIZE);
308 void setElementFontSize(IntegerProperty *property) {
309 setProperty(VIEW_FONTSIZE,property);
314 StringProperty *getElementLabel()
const {
315 return getProperty<StringProperty>(VIEW_LABEL);
320 void setElementLabel(StringProperty *property) {
321 setProperty(VIEW_LABEL,property);
326 LayoutProperty *getElementLayout()
const {
327 return getProperty<LayoutProperty>(VIEW_LAYOUT);
332 void setElementLayout(LayoutProperty *property) {
333 setProperty(VIEW_LAYOUT,property);
338 StringProperty *getElementTexture()
const {
339 return getProperty<StringProperty>(VIEW_TEXTURE);
344 void setElementTexture(StringProperty *property) {
345 setProperty(VIEW_TEXTURE,property);
350 ColorProperty *getElementBorderColor()
const {
351 return getProperty<ColorProperty>(VIEW_BORDERCOLOR);
356 void setElementBorderColor(ColorProperty *property) {
357 setProperty(VIEW_BORDERCOLOR,property);
362 DoubleProperty *getElementBorderWidth()
const {
363 return getProperty<DoubleProperty>(VIEW_BORDERWIDTH);
368 void setElementBorderWidth(DoubleProperty *property) {
369 setProperty(VIEW_BORDERWIDTH,property);
374 IntegerProperty *getElementSrcAnchorShape()
const {
375 return getProperty<IntegerProperty>(VIEW_SRCANCHORSHAPE);
380 void setElementSrcAnchorShape(IntegerProperty *property) {
381 setProperty(VIEW_SRCANCHORSHAPE,property);
386 SizeProperty *getElementSrcAnchorSize()
const {
387 return getProperty<SizeProperty>(VIEW_SRCANCHORSIZE);
392 void setElementSrcAnchorSize(SizeProperty *property) {
393 setProperty(VIEW_SRCANCHORSIZE,property);
398 IntegerProperty *getElementTgtAnchorShape()
const {
399 return getProperty<IntegerProperty>(VIEW_TGTANCHORSHAPE);
404 void setElementTgtAnchorShape(IntegerProperty *property) {
405 setProperty(VIEW_TGTANCHORSHAPE,property);
410 SizeProperty *getElementTgtAnchorSize()
const {
411 return getProperty<SizeProperty>(VIEW_TGTANCHORSIZE);
416 void setElementTgtAnchorSize(SizeProperty *property) {
417 setProperty(VIEW_TGTANCHORSIZE,property);
422 IntegerProperty *getElementAnimationFrame()
const {
423 return getProperty<IntegerProperty>(VIEW_ANIMATIONFRAME);
428 void setElementAnimationFrame(IntegerProperty *property) {
429 setProperty(VIEW_ANIMATIONFRAME,property);
432 std::set<tlp::PropertyInterface*> properties()
const {
439 void reloadGraphProperties();
445 GlGraphRenderingParameters* renderingParameters()
const {
453 void setRenderingParameters(GlGraphRenderingParameters* newParameters) {
454 parameters = newParameters;
461 GlGraphRenderingParameters* parameters;
463 MutableContainer<Glyph *> glyphs;
464 MutableContainer<EdgeExtremityGlyph *> extremityGlyphs;
468 std::set<PropertyInterface*> _properties;
470 bool _deleteGlVertexArrayManager;
472 PropertyInterface* _propertiesMap[NB_PROPS];
473 static std::map<std::string,PropertyName> _propertiesNameMap;
475 bool _deleteMetaNodeRendererAtDestructor;
476 GlMetaNodeRenderer *_metaNodeRenderer;
477 GlVertexArrayManager *_glVertexArrayManager;