Shape

## class Shape : public Thing

> (abstract) shape class, superclass of all possible shapes (graphics + text).

## Inheritance:

### Public Fields

  static const int | MIN_HEIGHT minimal height of a shape.
  static const int | MIN_WIDTH minimal width of a shape.
  static const int | HANDLE_WIDTH size of selection handle.

### Public Methods

  | Shape (ShapeView *s, Grafport *g) creates a shape at position (0,0) and size (0,0).
  bool | IsShape () const
  virtual bool | IsTextShape () const
  virtual Shape* | Clone ()
  virtual void | Draw () Draws the shape: shape itself and its text and selection handles.
  virtual void | Undraw () Erases the shape: by redrawing it in XOR mode.
  virtual void | UpdatePosition (const Point *position, bool snap=True) update position and redraw.
  virtual void | UpdateSize (int w, int h) update size and redraw.
  virtual void | UpdateMove (const Point *delta) update movement and redraw.
  virtual void | UpdateSelect (bool s) update selection handles and redraw.
  virtual void | UpdateFirstSelect (bool s) update first selection handles and redraw.
  virtual void | UpdateColor (string *color) update color and redraw.
  virtual void | SetSelect (bool s)
  virtual void | SetFirstSelect (bool s)
  bool | IsFirstSelected () const
  void | SetVisible (bool s)
  void | SetSubject (Subject *s)
  virtual void | SetView (ShapeView *v)
  Subject* | GetSubject () const
  ShapeView* | GetView () const
  virtual void | SetGrafport (Grafport *g)
  void | SetColor (const string *c)
  const string* | GetColor () const
  virtual void | Move (const Point *delta) move position by delta.
  virtual void | AdjustSize () update size to make the shape fit the text shape strings.
  virtual void | DrawOutLine (const Point *center) Draw outline of the shape (when it is dragged).
  virtual Point | GiveSnp (Point) const intersection of boundary and line from given point to shape center.
  virtual Point | GiveSnp (Point, int, int, int &) As GiveSnp but takes into account distribution of multiple lines.
  virtual Point | GiveOrthoSnp (Point to) const Calc the intersection of an orthogonal line with shape boundary.
  void | SetHandles (int n) set n handle rectangles.
  virtual int | HitHandles (int x, int y) Return (x,y) handle hit (-1 if not, 0 when shape is line).
  virtual bool | ContainsPt (int x, int y) returns whether (x,y) is geometrically in the shape.
  const Point* | GetPosition () const
  const Point* | GetTopLeft () const
  bool | IsSelected () const
  bool | IsVisible () const
  bool | IsDuplicate () const
  int | GetWidth () const
  int | GetHeight () const
  virtual void | DrawDuplicate () draw duplication indicator (asterisk).
  void | UndrawDuplicate ()
  void | SetDuplicate (bool b)
  void | UpdateDuplicate (bool b) set whether shape is a duplicate shape.
  virtual bool | IsLine () const
  virtual int | GetLeftMost () const smallest x-coordinate in shape.
  virtual int | GetTopMost () const smallest y-coordinate in shape.
  virtual int | GetRightMost () const largest x-coordinate in shape.
  virtual int | GetBottomMost () const largest y-coordinate in shape.
  void | WriteMembers (OutputFile *ofile) write members of shape to file.
  bool | ReadMembers (InputFile *f, double format) read and parse shape members from file ofile.
  virtual bool | SetAssocSubject (AssocList *) update subject reference from assocList.
  bool | SetAssocView (AssocList *) update view reference from assocList.
  bool | CheckReferences () Check if subject exists as graph element and that view exists.
  virtual void | SetTextShape () update the strings of text shapes with the subject strings.
  virtual TextShape* | ChooseTextShape (int, int) return a text shape near (x,y).
  virtual TextShape* | HitTextShape (int, int) return the text shape at (x,y).
  virtual bool | InTextArea (int x, int y) Returns if (x,y) is in text-area.
  virtual bool | HasNameString (const string *, bool, bool) const true if shape's name text shape contains 's'.
  virtual bool | HasString (const string *, bool, bool) const true if some of shape's text shapes contains 's'.
  virtual bool | HasString (const string *, bool, bool, List<TextShape *> *) put all text shapes containing 's' in the list l.
  virtual bool | HasTextShape (TextShape *t) const return if it has t as one of the text shapes.
  virtual void | MoveRaw (const Point *delta) move the shape over exact delta, without snap.

### Protected Fields

  static const int | MIN_HANDLES minimal nr. of handles.

### Protected Methods

  Grafport* | GetGrafport () const
  virtual void | SetDrawAttributes () set attributes of grafport before drawing.
  void | SetOutlineAttributes () set attributes of grafport for drawing outlines.
  virtual void | SetSize (int w, int h) set the size of the shape (with a minimum).
  virtual void | SetPosition (const Point *position, bool snap=True) set the position (takes into account the grid when snap=True).
  virtual void | SnapTopleft () align the shape to the grid (by its topleft).
  virtual void | SnapPosition () align the shape to the grid (by its center).
  void | SetWidth (int w)
  void | SetHeight (int h)
  void | SetNrHandles (int n)
  DiagramViewer* | GetViewer () const
  void | PositiveCoord (const Point*) change position so that shape has only positive coordinates.
  virtual void | DrawSelect () Draw the handles if object is (first) selected.
  virtual void | DrawGraySelect () Draw grey handles if the object is selected.
  virtual void | UndrawSelect ()
  virtual void | UndrawGraySelect ()
  void | SetTopLeft (const Point *topLeft) set the top-left and position (take into account width and height).
  virtual void | SetPositionHandles () set all handle rectangles.
  void | ForcePosition (const Point *position)

### Inherited from Thing:

### Public Classes

enum AssocType

### Public Methods

unsigned long GetId()
void SetId(unsigned long val)
virtual bool IsSubject() const
virtual bool IsView() const
virtual int GetClassType() const
void Write(OutputFile *ofile)
virtual bool SetReferences(AssocList *)

## Documentation

> (abstract) shape class, superclass of all possible shapes (graphics + text).

`Shape(ShapeView *s, Grafport *g)`
  creates a shape at position (0,0) and size (0,0).

`bool IsShape() const`

`virtual bool IsTextShape() const`

`virtual Shape* Clone()`

`virtual void Draw()`
  Draws the shape: shape itself and its text and selection handles.

`virtual void Undraw()`
  Erases the shape: by redrawing it in XOR mode.

`virtual void UpdatePosition(const Point *position, bool snap=True)`
  update position and redraw.

`virtual void UpdateSize(int w, int h)`
  update size and redraw.

`virtual void UpdateMove(const Point *delta)`
  update movement and redraw.

`virtual void UpdateSelect(bool s)`
  update selection handles and redraw.

`virtual void UpdateFirstSelect(bool s)`
  update first selection handles and redraw.

`virtual void UpdateColor(string *color)`
  update color and redraw.

`virtual void SetSelect(bool s)`

`virtual void SetFirstSelect(bool s)`

`bool IsFirstSelected() const`

`void SetVisible(bool s)`

`void SetSubject(Subject *s)`

`virtual void SetView(ShapeView *v)`

`Subject* GetSubject() const`

`ShapeView* GetView() const`

`virtual void SetGrafport(Grafport *g)`

`void SetColor(const string *c)`

`const string* GetColor() const`

`virtual void Move(const Point *delta)`
  move position by delta.

`virtual void AdjustSize()`
  update size to make the shape fit the text shape strings.

`virtual void DrawOutLine(const Point *center)`
  Draw outline of the shape (when it is dragged).

`virtual Point GiveSnp(Point) const`
  intersection of boundary and line from given point to shape center.

`virtual Point GiveSnp(Point, int, int, int &)`
  As GiveSnp but takes into account distribution of multiple lines.

`virtual Point GiveOrthoSnp(Point to) const`
  Calc the intersection of an orthogonal line with shape boundary.

`void SetHandles(int n)`
  set n handle rectangles.

`virtual int HitHandles(int x, int y)`
  Return (x,y) handle hit (-1 if not, 0 when shape is line).

`virtual bool ContainsPt(int x, int y)`
  returns whether (x,y) is geometrically in the shape.

`const Point* GetPosition() const`

`const Point* GetTopLeft() const`

`bool IsSelected() const`

`bool IsVisible() const`

`bool IsDuplicate() const`

`int GetWidth() const`

`int GetHeight() const`

`static const int MIN_HEIGHT`
  minimal height of a shape.

`static const int MIN_WIDTH`
  minimal width of a shape.

`virtual void DrawDuplicate()`
  draw duplication indicator (asterisk).

`void UndrawDuplicate()`

`void SetDuplicate(bool b)`

`void UpdateDuplicate(bool b)`
  set whether shape is a duplicate shape.

`virtual bool IsLine() const`

`virtual int GetLeftMost() const`
  smallest x-coordinate in shape.

`virtual int GetTopMost() const`
  smallest y-coordinate in shape.

`virtual int GetRightMost() const`
  largest x-coordinate in shape.

`virtual int GetBottomMost() const`
  largest y-coordinate in shape.

`void WriteMembers(OutputFile *ofile)`
  write members of shape to file.

`bool ReadMembers(InputFile *f, double format)`
  read and parse shape members from file ofile.

`virtual bool SetAssocSubject(AssocList *)`
  update subject reference from assocList.

`bool SetAssocView(AssocList *)`
  update view reference from assocList.

`bool CheckReferences()`
  Check if subject exists as graph element and that view exists.

`virtual void SetTextShape()`
  update the strings of text shapes with the subject strings.

`virtual TextShape* ChooseTextShape(int, int)`
  return a text shape near (x,y).

`virtual TextShape* HitTextShape(int, int)`
  return the text shape at (x,y).

`virtual bool InTextArea(int x, int y)`
  Returns if (x,y) is in text-area.

`virtual bool HasNameString(const string *, bool, bool) const`
  true if shape's name text shape contains 's'.

`virtual bool HasString(const string *, bool, bool) const`
  true if some of shape's text shapes contains 's'.

`virtual bool HasString(const string *, bool, bool, List<TextShape *> *)`
  put all text shapes containing 's' in the list l.

`virtual bool HasTextShape(TextShape *t) const`
  return if it has t as one of the text shapes.

`virtual void MoveRaw(const Point *delta)`
  move the shape over exact delta, without snap.

`static const int HANDLE_WIDTH`
  size of selection handle.

`Grafport* GetGrafport() const`

`virtual void SetDrawAttributes()`
  set attributes of grafport before drawing.

`void SetOutlineAttributes()`
  set attributes of grafport for drawing outlines.

`virtual void SetSize(int w, int h)`
  set the size of the shape (with a minimum).

`virtual void SetPosition(const Point *position, bool snap=True)`
  set the position (takes into account the grid when snap=True).

`virtual void SnapTopleft()`
  align the shape to the grid (by its topleft).

`virtual void SnapPosition()`
  align the shape to the grid (by its center).

`void SetWidth(int w)`

`void SetHeight(int h)`

`void SetNrHandles(int n)`

`DiagramViewer* GetViewer() const`

`void PositiveCoord(const Point*)`
  change position so that shape has only positive coordinates.

`static const int MIN_HANDLES`
  minimal nr. of handles.

`virtual void DrawSelect()`
  Draw the handles if object is (first) selected.

`virtual void DrawGraySelect()`
  Draw grey handles if the object is selected.

`virtual void UndrawSelect()`

`virtual void UndrawGraySelect()`

`void SetTopLeft(const Point *topLeft)`
  set the top-left and position (take into account width and height).

`virtual void SetPositionHandles()`
  set all handle rectangles.

`void ForcePosition(const Point *position)`

Direct child classes:
  TextShape
  GShape

alphabetic index hierarchy of classes

this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de