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;
43 class GlGlyphRenderer;
48 class TLP_GL_SCOPE GlGraphInputData :
public Observable {
58 VIEW_LABELBORDERCOLOR,
59 VIEW_LABELBORDERWIDTH,
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);
106 GlMetaNodeRenderer *getMetaNodeRenderer()
const {
107 return _metaNodeRenderer;
113 GlVertexArrayManager *getGlVertexArrayManager()
const {
114 return _glVertexArrayManager;
117 GlGlyphRenderer *getGlGlyphRenderer()
const {
118 return _glGlyphRenderer;
124 void setGlVertexArrayManager(GlVertexArrayManager * manager) {
125 _glVertexArrayManager=manager;
133 std::map<std::string, PropertyName>::iterator it =
134 _propertiesNameMap.find(name);
136 if (it != _propertiesNameMap.end())
137 return _propertiesMap[it->second];
147 T* getProperty(PropertyName propertyName)
const {
148 return static_cast<T*
>(_propertiesMap[propertyName]);
155 void setProperty(PropertyName propertyName, PropertyInterface *property) {
156 _properties.
erase(_propertiesMap[propertyName]);
157 _propertiesMap[propertyName]=property;
158 _properties.insert(property);
164 bool setProperty(
const std::string& name, PropertyInterface *property);
169 bool installProperties(
const std::map<std::string, tlp::PropertyInterface*>& propsMap);
174 ColorProperty * getElementColor()
const {
175 return getProperty<ColorProperty>(VIEW_COLOR);
180 void setElementColor(ColorProperty *property) {
181 setProperty(VIEW_COLOR,property);
186 ColorProperty *getElementLabelColor()
const {
187 return getProperty<ColorProperty>(VIEW_LABELCOLOR);
192 void setElementLabelColor(ColorProperty *property) {
193 setProperty(VIEW_LABELCOLOR,property);
198 ColorProperty *getElementLabelBorderColor()
const {
199 return getProperty<ColorProperty>(VIEW_LABELBORDERCOLOR);
204 void setElementLabelBorderColor(ColorProperty *property) {
205 setProperty(VIEW_LABELBORDERCOLOR,property);
210 DoubleProperty *getElementLabelBorderWidth()
const {
211 return getProperty<DoubleProperty>(VIEW_LABELBORDERWIDTH);
216 void setElementLabelBorderWidth(DoubleProperty *property) {
217 setProperty(VIEW_LABELBORDERWIDTH,property);
222 SizeProperty *getElementSize()
const {
223 return getProperty<SizeProperty>(VIEW_SIZE);
228 void setElementSize(SizeProperty *property) {
229 setProperty(VIEW_SIZE,property);
234 IntegerProperty *getElementLabelPosition()
const {
235 return getProperty<IntegerProperty>(VIEW_LABELPOSITION);
240 void setElementLabelPosition(IntegerProperty *property) {
241 setProperty(VIEW_LABELPOSITION,property);
246 IntegerProperty *getElementShape()
const {
247 return getProperty<IntegerProperty>(VIEW_SHAPE);
252 void setElementShape(IntegerProperty *property) {
253 setProperty(VIEW_SHAPE,property);
258 DoubleProperty *getElementRotation()
const {
259 return getProperty<DoubleProperty>(VIEW_ROTATION);
264 void setElementRotation(DoubleProperty *property) {
265 setProperty(VIEW_ROTATION,property);
270 BooleanProperty *getElementSelected()
const {
271 return getProperty<BooleanProperty>(VIEW_SELECTED);
276 void setElementSelected(BooleanProperty *property) {
277 setProperty(VIEW_SELECTED,property);
282 StringProperty *getElementFont()
const {
283 return getProperty<StringProperty>(VIEW_FONT);
288 void setElementFont(StringProperty *property) {
289 setProperty(VIEW_FONT,property);
294 IntegerProperty *getElementFontSize()
const {
295 return getProperty<IntegerProperty>(VIEW_FONTSIZE);
300 void setElementFontSize(IntegerProperty *property) {
301 setProperty(VIEW_FONTSIZE,property);
306 StringProperty *getElementLabel()
const {
307 return getProperty<StringProperty>(VIEW_LABEL);
312 void setElementLabel(StringProperty *property) {
313 setProperty(VIEW_LABEL,property);
318 LayoutProperty *getElementLayout()
const {
319 return getProperty<LayoutProperty>(VIEW_LAYOUT);
324 void setElementLayout(LayoutProperty *property) {
325 setProperty(VIEW_LAYOUT,property);
330 StringProperty *getElementTexture()
const {
331 return getProperty<StringProperty>(VIEW_TEXTURE);
336 void setElementTexture(StringProperty *property) {
337 setProperty(VIEW_TEXTURE,property);
342 ColorProperty *getElementBorderColor()
const {
343 return getProperty<ColorProperty>(VIEW_BORDERCOLOR);
348 void setElementBorderColor(ColorProperty *property) {
349 setProperty(VIEW_BORDERCOLOR,property);
354 DoubleProperty *getElementBorderWidth()
const {
355 return getProperty<DoubleProperty>(VIEW_BORDERWIDTH);
360 void setElementBorderWidth(DoubleProperty *property) {
361 setProperty(VIEW_BORDERWIDTH,property);
366 IntegerProperty *getElementSrcAnchorShape()
const {
367 return getProperty<IntegerProperty>(VIEW_SRCANCHORSHAPE);
372 void setElementSrcAnchorShape(IntegerProperty *property) {
373 setProperty(VIEW_SRCANCHORSHAPE,property);
378 SizeProperty *getElementSrcAnchorSize()
const {
379 return getProperty<SizeProperty>(VIEW_SRCANCHORSIZE);
384 void setElementSrcAnchorSize(SizeProperty *property) {
385 setProperty(VIEW_SRCANCHORSIZE,property);
390 IntegerProperty *getElementTgtAnchorShape()
const {
391 return getProperty<IntegerProperty>(VIEW_TGTANCHORSHAPE);
396 void setElementTgtAnchorShape(IntegerProperty *property) {
397 setProperty(VIEW_TGTANCHORSHAPE,property);
402 SizeProperty *getElementTgtAnchorSize()
const {
403 return getProperty<SizeProperty>(VIEW_TGTANCHORSIZE);
408 void setElementTgtAnchorSize(SizeProperty *property) {
409 setProperty(VIEW_TGTANCHORSIZE,property);
414 IntegerProperty *getElementAnimationFrame()
const {
415 return getProperty<IntegerProperty>(VIEW_ANIMATIONFRAME);
420 void setElementAnimationFrame(IntegerProperty *property) {
421 setProperty(VIEW_ANIMATIONFRAME,property);
427 StringProperty *getElementFontAwesomeIcon()
const {
428 return getProperty<StringProperty>(VIEW_FONTAWESOMEICON);
433 void setElementFontAwesomeIcon(StringProperty *property) {
434 setProperty(VIEW_FONTAWESOMEICON,property);
437 std::set<tlp::PropertyInterface*> properties()
const {
444 void reloadGraphProperties();
450 GlGraphRenderingParameters* renderingParameters()
const {
458 void setRenderingParameters(GlGraphRenderingParameters* newParameters) {
459 parameters = newParameters;
466 GlGraphRenderingParameters* parameters;
468 MutableContainer<Glyph *> glyphs;
469 MutableContainer<EdgeExtremityGlyph *> extremityGlyphs;
473 std::set<PropertyInterface*> _properties;
475 PropertyInterface* _propertiesMap[NB_PROPS];
476 static std::map<std::string,PropertyName> _propertiesNameMap;
478 GlMetaNodeRenderer *_metaNodeRenderer;
479 GlVertexArrayManager *_glVertexArrayManager;
480 GlGlyphRenderer *_glGlyphRenderer;
PropertyInterface describes the interface of a graph property.
virtual void erase(const node)=0
Erases the value stored for the given node. The new value for the node is the default value...