summaryrefslogtreecommitdiff
path: root/graphics/asymptote/drawlayer.h
blob: e784fa1a5c57735840f138ebeef9fe2ae9230b71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*****
 * drawlayer.h
 * John Bowman
 *
 * Start a new postscript/TeX layer in picture.
 *****/

#ifndef DRAWLAYER_H
#define DRAWLAYER_H

#include "drawelement.h"

namespace camp {

class drawLayer : public drawElement {
public:
  drawLayer() {}

  virtual ~drawLayer() {}

  bool islayer() {return true;}
};

class drawBBox : public drawLayer {
protected:
  bbox box;
public:
  drawBBox() : box() {}
  drawBBox(const bbox& box) : box(box) {}

  bool islayer() {return false;}
  virtual ~drawBBox() {}

  bool write(texfile *out, const bbox& b) {
    out->BBox(box.empty ? b : box);
    return true;
  }
};

class drawNewPage : public drawBBox {
public:
  drawNewPage() : drawBBox() {}
  drawNewPage(const bbox& box) : drawBBox(box) {}

  virtual ~drawNewPage() {}

  bool islayer() {return true;}
  bool islabel() {return true;}
  bool isnewpage() {return true;}

  bool write(texfile *out, const bbox& b) {
    out->newpage(box.empty ? b : box);
    return true;
  }
};

}

GC_DECLARE_PTRFREE(camp::drawLayer);
GC_DECLARE_PTRFREE(camp::drawBBox);
GC_DECLARE_PTRFREE(camp::drawNewPage);

#endif