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,
85 GlGraphInputData(Graph* graph, GlGraphRenderingParameters* parameters,GlMetaNodeRenderer *renderer = NULL);
92 Graph* getGraph()
const {
96 void treatEvent(
const Event &ev);
102 void setMetaNodeRenderer(GlMetaNodeRenderer *renderer,
bool deleteOldMetaNodeRenderer=
true);
107 GlMetaNodeRenderer *getMetaNodeRenderer()
const {
108 return _metaNodeRenderer;
114 GlVertexArrayManager *getGlVertexArrayManager()
const {
115 return _glVertexArrayManager;
118 GlGlyphRenderer *getGlGlyphRenderer()
const {
119 return _glGlyphRenderer;
125 void setGlVertexArrayManager(GlVertexArrayManager * manager) {
126 _glVertexArrayManager=manager;
134 std::map<std::string, PropertyName>::iterator it =
135 _propertiesNameMap.find(name);
137 if (it != _propertiesNameMap.end())
138 return _propertiesMap[it->second];
148 T* getProperty(PropertyName propertyName)
const {
149 return static_cast<T*
>(_propertiesMap[propertyName]);
156 void setProperty(PropertyName propertyName, PropertyInterface *property) {
157 _properties.
erase(_propertiesMap[propertyName]);
158 _propertiesMap[propertyName]=property;
159 _properties.insert(property);
165 bool setProperty(
const std::string& name, PropertyInterface *property);
170 bool installProperties(
const std::map<std::string, tlp::PropertyInterface*>& propsMap);
175 ColorProperty * getElementColor()
const {
176 return getProperty<ColorProperty>(VIEW_COLOR);
181 void setElementColor(ColorProperty *property) {
182 setProperty(VIEW_COLOR,property);
187 ColorProperty *getElementLabelColor()
const {
188 return getProperty<ColorProperty>(VIEW_LABELCOLOR);
193 void setElementLabelColor(ColorProperty *property) {
194 setProperty(VIEW_LABELCOLOR,property);
199 ColorProperty *getElementLabelBorderColor()
const {
200 return getProperty<ColorProperty>(VIEW_LABELBORDERCOLOR);
205 void setElementLabelBorderColor(ColorProperty *property) {
206 setProperty(VIEW_LABELBORDERCOLOR,property);
211 DoubleProperty *getElementLabelBorderWidth()
const {
212 return getProperty<DoubleProperty>(VIEW_LABELBORDERWIDTH);
217 void setElementLabelBorderWidth(DoubleProperty *property) {
218 setProperty(VIEW_LABELBORDERWIDTH,property);
223 SizeProperty *getElementSize()
const {
224 return getProperty<SizeProperty>(VIEW_SIZE);
229 void setElementSize(SizeProperty *property) {
230 setProperty(VIEW_SIZE,property);
235 IntegerProperty *getElementLabelPosition()
const {
236 return getProperty<IntegerProperty>(VIEW_LABELPOSITION);
241 void setElementLabelPosition(IntegerProperty *property) {
242 setProperty(VIEW_LABELPOSITION,property);
247 IntegerProperty *getElementShape()
const {
248 return getProperty<IntegerProperty>(VIEW_SHAPE);
253 void setElementShape(IntegerProperty *property) {
254 setProperty(VIEW_SHAPE,property);
259 DoubleProperty *getElementRotation()
const {
260 return getProperty<DoubleProperty>(VIEW_ROTATION);
265 void setElementRotation(DoubleProperty *property) {
266 setProperty(VIEW_ROTATION,property);
271 BooleanProperty *getElementSelected()
const {
272 return getProperty<BooleanProperty>(VIEW_SELECTED);
277 void setElementSelected(BooleanProperty *property) {
278 setProperty(VIEW_SELECTED,property);
283 StringProperty *getElementFont()
const {
284 return getProperty<StringProperty>(VIEW_FONT);
289 void setElementFont(StringProperty *property) {
290 setProperty(VIEW_FONT,property);
295 IntegerProperty *getElementFontSize()
const {
296 return getProperty<IntegerProperty>(VIEW_FONTSIZE);
301 void setElementFontSize(IntegerProperty *property) {
302 setProperty(VIEW_FONTSIZE,property);
307 StringProperty *getElementLabel()
const {
308 return getProperty<StringProperty>(VIEW_LABEL);
313 void setElementLabel(StringProperty *property) {
314 setProperty(VIEW_LABEL,property);
319 LayoutProperty *getElementLayout()
const {
320 return getProperty<LayoutProperty>(VIEW_LAYOUT);
325 void setElementLayout(LayoutProperty *property) {
326 setProperty(VIEW_LAYOUT,property);
331 StringProperty *getElementTexture()
const {
332 return getProperty<StringProperty>(VIEW_TEXTURE);
337 void setElementTexture(StringProperty *property) {
338 setProperty(VIEW_TEXTURE,property);
343 ColorProperty *getElementBorderColor()
const {
344 return getProperty<ColorProperty>(VIEW_BORDERCOLOR);
349 void setElementBorderColor(ColorProperty *property) {
350 setProperty(VIEW_BORDERCOLOR,property);
355 DoubleProperty *getElementBorderWidth()
const {
356 return getProperty<DoubleProperty>(VIEW_BORDERWIDTH);
361 void setElementBorderWidth(DoubleProperty *property) {
362 setProperty(VIEW_BORDERWIDTH,property);
367 IntegerProperty *getElementSrcAnchorShape()
const {
368 return getProperty<IntegerProperty>(VIEW_SRCANCHORSHAPE);
373 void setElementSrcAnchorShape(IntegerProperty *property) {
374 setProperty(VIEW_SRCANCHORSHAPE,property);
379 SizeProperty *getElementSrcAnchorSize()
const {
380 return getProperty<SizeProperty>(VIEW_SRCANCHORSIZE);
385 void setElementSrcAnchorSize(SizeProperty *property) {
386 setProperty(VIEW_SRCANCHORSIZE,property);
391 IntegerProperty *getElementTgtAnchorShape()
const {
392 return getProperty<IntegerProperty>(VIEW_TGTANCHORSHAPE);
397 void setElementTgtAnchorShape(IntegerProperty *property) {
398 setProperty(VIEW_TGTANCHORSHAPE,property);
403 SizeProperty *getElementTgtAnchorSize()
const {
404 return getProperty<SizeProperty>(VIEW_TGTANCHORSIZE);
409 void setElementTgtAnchorSize(SizeProperty *property) {
410 setProperty(VIEW_TGTANCHORSIZE,property);
415 IntegerProperty *getElementAnimationFrame()
const {
416 return getProperty<IntegerProperty>(VIEW_ANIMATIONFRAME);
421 void setElementAnimationFrame(IntegerProperty *property) {
422 setProperty(VIEW_ANIMATIONFRAME,property);
430 _DEPRECATED StringProperty *getElementFontAwesomeIcon()
const {
431 return getProperty<StringProperty>(VIEW_FONTAWESOMEICON);
438 _DEPRECATED
void setElementFontAwesomeIcon(StringProperty *property) {
439 setProperty(VIEW_FONTAWESOMEICON,property);
447 StringProperty *getElementIcon()
const {
448 return getProperty<StringProperty>(VIEW_ICON);
456 void setElementIcon(StringProperty *property) {
457 setProperty(VIEW_ICON,property);
460 std::set<tlp::PropertyInterface*> properties()
const {
467 void reloadGraphProperties();
473 GlGraphRenderingParameters* renderingParameters()
const {
481 void setRenderingParameters(GlGraphRenderingParameters* newParameters) {
482 parameters = newParameters;
489 GlGraphRenderingParameters* parameters;
491 MutableContainer<Glyph *> glyphs;
492 MutableContainer<EdgeExtremityGlyph *> extremityGlyphs;
496 std::set<PropertyInterface*> _properties;
498 PropertyInterface* _propertiesMap[NB_PROPS];
499 static std::map<std::string,PropertyName> _propertiesNameMap;
501 GlMetaNodeRenderer *_metaNodeRenderer;
502 GlVertexArrayManager *_glVertexArrayManager;
503 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...