Free Electron
GraphDot.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __graphviz_GraphDot_h__
8 #define __graphviz_GraphDot_h__
9 namespace fe
10 {
11 namespace ext
12 {
13 
14 /**************************************************************************//**
15  @brief Converter from DAGNode to dot format
16 
17  @ingroup graphviz
18 *//***************************************************************************/
19 class FE_DL_EXPORT GraphDot: public ImageCommon,
20  public Initialize<GraphDot>
21 {
22  public:
23  GraphDot();
24 virtual ~GraphDot();
25 
26  void initialize(void);
27 
28  //* As ImageI
29 virtual I32 interpretSelect(String a_source);
30 
31 virtual BWORD save(String filename) { return FALSE; }
32 virtual void select(I32 id) {}
33 virtual I32 selected(void) const { return 0; }
34 virtual void unload(I32 id) {}
35 
36 virtual void setFormat(ImageI::Format format)
37  {
38  if(m_spDelegate.isValid())
39  {
40  m_spDelegate->setFormat(format);
41  incrementSerial();
42  }
43  }
44 virtual ImageI::Format format(void) const
45  { return m_spDelegate.isValid()?
46  m_spDelegate->format(): ImageI::e_none; }
47 
48 virtual void resize(U32 width,U32 height,U32 depth)
49  {
50  if(m_spDelegate.isValid())
51  {
52  m_spDelegate->resize(width,height,depth);
53  }
54  incrementSerial();
55  }
56 virtual void replaceRegion(U32 x,U32 y,U32 z,
57  U32 width,U32 height,U32 depth,void* data)
58  {
59  if(m_spDelegate.isValid())
60  {
61  m_spDelegate->replaceRegion(x,y,z,
62  width,height,depth,data);
63  }
64  incrementSerial();
65  }
66 
67 virtual U32 width(void) const
68  { return m_spDelegate.isValid()?
69  m_spDelegate->width(): 0; }
70 virtual U32 height(void) const
71  { return m_spDelegate.isValid()?
72  m_spDelegate->height(): 0; }
73 virtual U32 depth(void) const
74  { return m_spDelegate.isValid()?
75  m_spDelegate->depth(): 0; }
76 virtual void* raw(void) const
77  { return m_spDelegate.isValid()?
78  m_spDelegate->raw(): NULL; }
79 
80 virtual U32 regionCount(void) const;
81 virtual String regionName(U32 a_regionIndex) const;
82 virtual Box2i regionBox(String a_regionName) const;
83 virtual String pickRegion(I32 a_x,I32 a_y) const;
84 
85  private:
86 
87 virtual void render(String a_format);
88 
89  void reset(void);
90 
91  GVC_t* m_pGvc;
92  Agraph_t* m_pGraph;
93 
94  sp<ImageI> m_spDelegate;
95 
96  I32 m_offsetX;
97  I32 m_offsetY;
98  Real m_rescaleX;
99  Real m_rescaleY;
100 };
101 
102 } /* namespace ext */
103 } /* namespace fe */
104 
105 #endif /* __graphviz_GraphDot_h__ */
virtual ImageI::Format format(void) const
return the format for the selected image
Definition: GraphDot.h:44
kernel
Definition: namespace.dox:3
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
virtual void resize(U32 width, U32 height, U32 depth)
change the dimensions of the selcted image
Definition: GraphDot.h:48
virtual void setFormat(ImageI::Format format)
choose a format for the selected image
Definition: GraphDot.h:36
virtual I32 selected(void) const
return the selected image ID
Definition: GraphDot.h:33
virtual U32 depth(void) const
return the Z dimension of the image
Definition: GraphDot.h:73
Converter from DAGNode to dot format.
Definition: GraphDot.h:19
virtual void replaceRegion(U32 x, U32 y, U32 z, U32 width, U32 height, U32 depth, void *data)
replace data in part of the image
Definition: GraphDot.h:56
General functionality for image support.
Definition: ImageCommon.h:20
Automatically reference-counted string container.
Definition: String.h:128
virtual void unload(I32 id)
remove an image from memory
Definition: GraphDot.h:34
virtual U32 height(void) const
return the Y dimension of the image
Definition: GraphDot.h:70
virtual U32 width(void) const
return the X dimension of the image
Definition: GraphDot.h:67
virtual void * raw(void) const
return the raw byte buffer of the image
Definition: GraphDot.h:76
virtual BWORD save(String filename)
save the selected image to file
Definition: GraphDot.h:31
virtual void select(I32 id)
select an image for further access
Definition: GraphDot.h:32