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, 
 
   83   GlGraphInputData(Graph* graph, GlGraphRenderingParameters* parameters,GlMetaNodeRenderer *renderer = NULL);
 
   90   Graph* getGraph()
 const {
 
   94   void treatEvent(
const Event &ev);
 
  100   void setMetaNodeRenderer(GlMetaNodeRenderer *renderer,
bool deleteOldMetaNodeRenderer=
true);
 
  105   void setDeleteMetaNodeRendererAtDestructor(
bool deleteAtDestructor) {
 
  106     _deleteMetaNodeRendererAtDestructor=deleteAtDestructor;
 
  112   GlMetaNodeRenderer *getMetaNodeRenderer()
 const {
 
  113     return _metaNodeRenderer;
 
  119   GlVertexArrayManager *getGlVertexArrayManager()
 const {
 
  120     return _glVertexArrayManager;
 
  123   GlGlyphRenderer *getGlGlyphRenderer()
 const {
 
  124     return _glGlyphRenderer;
 
  130   void setGlVertexArrayManager(GlVertexArrayManager * manager) {
 
  131     _glVertexArrayManager=manager;
 
  137   void deleteGlVertexArrayManagerInDestructor(
bool del) {
 
  138     _deleteGlVertexArrayManager=del;
 
  146     std::map<std::string, PropertyName>::iterator it =
 
  147       _propertiesNameMap.find(name);
 
  149     if (it != _propertiesNameMap.end())
 
  150       return _propertiesMap[it->second];
 
  160   T* getProperty(PropertyName propertyName)
 const {
 
  161     return static_cast<T*
>(_propertiesMap[propertyName]);
 
  168   void setProperty(PropertyName propertyName, PropertyInterface *property) {
 
  169     _properties.
erase(_propertiesMap[propertyName]);
 
  170     _propertiesMap[propertyName]=property;
 
  171     _properties.insert(property);
 
  177   bool setProperty(
const std::string& name, PropertyInterface *property);
 
  182   bool installProperties(
const std::map<std::string, tlp::PropertyInterface*>& propsMap);
 
  187   ColorProperty * getElementColor()
 const {
 
  188     return getProperty<ColorProperty>(VIEW_COLOR);
 
  193   void setElementColor(ColorProperty *property) {
 
  194     setProperty(VIEW_COLOR,property);
 
  199   ColorProperty *getElementLabelColor()
 const {
 
  200     return getProperty<ColorProperty>(VIEW_LABELCOLOR);
 
  205   void setElementLabelColor(ColorProperty *property) {
 
  206     setProperty(VIEW_LABELCOLOR,property);
 
  211   ColorProperty *getElementLabelBorderColor()
 const {
 
  212     return getProperty<ColorProperty>(VIEW_LABELBORDERCOLOR);
 
  217   void setElementLabelBorderColor(ColorProperty *property) {
 
  218     setProperty(VIEW_LABELBORDERCOLOR,property);
 
  223   DoubleProperty *getElementLabelBorderWidth()
 const {
 
  224     return getProperty<DoubleProperty>(VIEW_LABELBORDERWIDTH);
 
  229   void setElementLabelBorderWidth(DoubleProperty *property) {
 
  230     setProperty(VIEW_LABELBORDERWIDTH,property);
 
  235   SizeProperty *getElementSize()
 const {
 
  236     return getProperty<SizeProperty>(VIEW_SIZE);
 
  241   void setElementSize(SizeProperty *property) {
 
  242     setProperty(VIEW_SIZE,property);
 
  247   IntegerProperty *getElementLabelPosition()
 const {
 
  248     return getProperty<IntegerProperty>(VIEW_LABELPOSITION);
 
  253   void setElementLabelPosition(IntegerProperty *property) {
 
  254     setProperty(VIEW_LABELPOSITION,property);
 
  259   IntegerProperty *getElementShape()
 const {
 
  260     return getProperty<IntegerProperty>(VIEW_SHAPE);
 
  265   void setElementShape(IntegerProperty *property) {
 
  266     setProperty(VIEW_SHAPE,property);
 
  271   DoubleProperty *getElementRotation()
 const {
 
  272     return getProperty<DoubleProperty>(VIEW_ROTATION);
 
  277   void setElementRotation(DoubleProperty *property) {
 
  278     setProperty(VIEW_ROTATION,property);
 
  283   BooleanProperty *getElementSelected()
 const {
 
  284     return getProperty<BooleanProperty>(VIEW_SELECTED);
 
  289   void setElementSelected(BooleanProperty *property) {
 
  290     setProperty(VIEW_SELECTED,property);
 
  295   StringProperty *getElementFont()
 const {
 
  296     return getProperty<StringProperty>(VIEW_FONT);
 
  301   void setElementFont(StringProperty *property) {
 
  302     setProperty(VIEW_FONT,property);
 
  307   IntegerProperty  *getElementFontSize()
 const {
 
  308     return getProperty<IntegerProperty>(VIEW_FONTSIZE);
 
  313   void setElementFontSize(IntegerProperty *property) {
 
  314     setProperty(VIEW_FONTSIZE,property);
 
  319   StringProperty *getElementLabel()
 const {
 
  320     return getProperty<StringProperty>(VIEW_LABEL);
 
  325   void setElementLabel(StringProperty *property) {
 
  326     setProperty(VIEW_LABEL,property);
 
  331   LayoutProperty *getElementLayout()
 const {
 
  332     return getProperty<LayoutProperty>(VIEW_LAYOUT);
 
  337   void setElementLayout(LayoutProperty *property) {
 
  338     setProperty(VIEW_LAYOUT,property);
 
  343   StringProperty *getElementTexture()
 const {
 
  344     return getProperty<StringProperty>(VIEW_TEXTURE);
 
  349   void setElementTexture(StringProperty *property) {
 
  350     setProperty(VIEW_TEXTURE,property);
 
  355   ColorProperty *getElementBorderColor()
 const {
 
  356     return getProperty<ColorProperty>(VIEW_BORDERCOLOR);
 
  361   void setElementBorderColor(ColorProperty *property) {
 
  362     setProperty(VIEW_BORDERCOLOR,property);
 
  367   DoubleProperty *getElementBorderWidth()
 const {
 
  368     return getProperty<DoubleProperty>(VIEW_BORDERWIDTH);
 
  373   void setElementBorderWidth(DoubleProperty *property) {
 
  374     setProperty(VIEW_BORDERWIDTH,property);
 
  379   IntegerProperty *getElementSrcAnchorShape()
 const {
 
  380     return getProperty<IntegerProperty>(VIEW_SRCANCHORSHAPE);
 
  385   void setElementSrcAnchorShape(IntegerProperty *property) {
 
  386     setProperty(VIEW_SRCANCHORSHAPE,property);
 
  391   SizeProperty *getElementSrcAnchorSize()
 const {
 
  392     return getProperty<SizeProperty>(VIEW_SRCANCHORSIZE);
 
  397   void setElementSrcAnchorSize(SizeProperty *property) {
 
  398     setProperty(VIEW_SRCANCHORSIZE,property);
 
  403   IntegerProperty *getElementTgtAnchorShape()
 const {
 
  404     return getProperty<IntegerProperty>(VIEW_TGTANCHORSHAPE);
 
  409   void setElementTgtAnchorShape(IntegerProperty *property) {
 
  410     setProperty(VIEW_TGTANCHORSHAPE,property);
 
  415   SizeProperty *getElementTgtAnchorSize()
 const {
 
  416     return getProperty<SizeProperty>(VIEW_TGTANCHORSIZE);
 
  421   void setElementTgtAnchorSize(SizeProperty *property) {
 
  422     setProperty(VIEW_TGTANCHORSIZE,property);
 
  427   IntegerProperty *getElementAnimationFrame()
 const {
 
  428     return getProperty<IntegerProperty>(VIEW_ANIMATIONFRAME);
 
  433   void setElementAnimationFrame(IntegerProperty *property) {
 
  434     setProperty(VIEW_ANIMATIONFRAME,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   bool _deleteGlVertexArrayManager;
 
  477   PropertyInterface* _propertiesMap[NB_PROPS];
 
  478   static std::map<std::string,PropertyName> _propertiesNameMap;
 
  480   bool _deleteMetaNodeRendererAtDestructor;
 
  481   GlMetaNodeRenderer *_metaNodeRenderer;
 
  482   GlVertexArrayManager *_glVertexArrayManager;
 
  483   GlGlyphRenderer *_glGlyphRenderer;