1 /*
2 drvpcbfill.cpp : This file is part of pstoedit
3 simple backend for Pcbfill format.
4 Contributed / Copyright 2004 by: Mark Rages
5
6 Copyright (C) 1993 - 2014 Wolfgang Glunz, wglunz35_AT_pstoedit.net
7 (for the skeleton and the rest of pstoedit)
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23 */
24
25 #include "drvpcbfill.h"
26
27 #include I_stdio
28 #include I_string_h
29 #include I_iostream
30
31
32
derivedConstructor(drvPCBFILL)33 drvPCBFILL::derivedConstructor(drvPCBFILL):
34 //(const char * driveroptions_p,ostream & theoutStream,ostream & theerrStream):
35 constructBase
36 {
37 // driver specific initializations
38 outf << "PCB[\"\" 600000 500000]\n\n";
39 outf << "Grid[2000.00000000 0 0 0]\n\n";
40 outf << "Layer(10 \"silk\")\n(\n";
41 }
42
43 drvPCBFILL::~drvPCBFILL()
44 {
45 outf << ")\n";
46 options=0;
47 }
48
49
close_page()50 void drvPCBFILL::close_page()
51 {
52 //outf << "#Seite beendet.\n";
53 }
54
open_page()55 void drvPCBFILL::open_page()
56 {
57 // outf << "#Neue Seite\n";
58 }
59 const float SCALE = (100000.0f/72.0f);
60
show_path()61 void drvPCBFILL::show_path()
62 {
63 // outf << "\n#Polyline:\n";
64 outf << "\tPolygon(0x00000010)\n\t(\n\t\t";
65
66 for (unsigned int n = 0; n < numberOfElementsInPath(); n++) {
67 if (pathElement(n).getType() != closepath) {
68 const Point & p = pathElement(n).getPoint(0);
69 outf << "[" << (int)(p.x_*SCALE) << " "
70 << (int)(500000-p.y_*SCALE) << "] ";
71 }
72 }
73 outf << "\n\t)\n";
74 }
75
76
77 static DriverDescriptionT < drvPCBFILL > D_pcbfill("pcbfill", "pcb format with fills",
78 "See also: \\URL{http://pcb.sourceforge.net}","pcbfill", false, // if backend supports subpathes
79 // if subpathes are supported, the backend must deal with
80 // sequences of the following form
81 // moveto (start of subpath)
82 // lineto (a line segment)
83 // lineto
84 // moveto (start of a new subpath)
85 // lineto (a line segment)
86 // lineto
87 //
88 // If this argument is set to false each subpath is drawn
89 // individually which might not necessarily represent
90 // the original drawing.
91 false, // if backend supports curves
92 false, // if backend supports elements with fill and edges
93 false, // if backend supports text
94 DriverDescription::noimage, // no support for PNG file images
95 DriverDescription::normalopen, false, // if format supports multiple pages in one file
96 false /*clipping */ );
97
98