Hello community,
here is the log from the commit of package pstoedit for openSUSE:Factory
checked in at Tue Jan 20 01:15:23 CET 2009.
--------
--- pstoedit/pstoedit.changes 2008-09-10 09:29:09.000000000 +0200
+++ /mounts/work_src_done/STABLE/pstoedit/pstoedit.changes 2009-01-15 13:34:57.000000000 +0100
@@ -1,0 +2,8 @@
+Thu Jan 15 12:56:24 CET 2009 - sbrabec@suse.cz
+
+- Enhanced features of PCB output.
+- Build with gd.
+- Changed BuildRequires: plotutils -> plotutils-devel.
+- Spec file cleanup.
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
New:
----
pstoedit-pcb-enhanced.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ pstoedit.spec ++++++
--- /var/tmp/diff_new_pack.M24104/_old 2009-01-20 01:14:35.000000000 +0100
+++ /var/tmp/diff_new_pack.M24104/_new 2009-01-20 01:14:35.000000000 +0100
@@ -1,7 +1,7 @@
#
# spec file for package pstoedit (Version 3.45)
#
-# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -15,28 +15,29 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
-# norootforbuild
Name: pstoedit
-BuildRequires: ImageMagick-Magick++-devel gcc-c++ ghostscript-fonts-std ghostscript-x11 pkgconfig plotutils xfig
+BuildRequires: ImageMagick-Magick++-devel gcc-c++ gd-devel ghostscript-fonts-std ghostscript-x11 pkg-config plotutils-devel xfig
%ifarch %ix86 ppc
BuildRequires: libEMF-devel
%endif
+# FIXME: Not yet in openSUSE:
+#BuildRequires: libming-devel
License: GPL v2 or later
Group: Productivity/Publishing/PS
Requires: ghostscript_any
-AutoReqProv: on
Summary: PostScript and PDF Converter
Version: 3.45
-Release: 1
-# URL for Source0: http://surfnet.dl.sourceforge.net/sourceforge/pstoedit/pstoedit-3.45.tar.gz
-Source: pstoedit-%{version}.tar.bz2
+Release: 4
+# URL for Source: http://surfnet.dl.sourceforge.net/sourceforge/pstoedit/pstoedit-3.45.tar.gz
+Source: %{name}-%{version}.tar.bz2
Patch0: pstoedit-CXXFLAGS.patch
Patch1: pstoedit-no_builddir_in_la_file.patch
#Patch2: pstoedit-codecleanup.patch
Patch3: pstoedit-manpages.patch
Patch4: fixes-for-GCC43.patch
+Patch5: pstoedit-pcb-enhanced.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Url: http://www.pstoedit.net/
@@ -114,13 +115,13 @@
Authors:
--------
- Wolfgang Glunz
+ Wolfgang Glunz
%package devel
License: GPL v2 or later
Summary: PostScript and PDF converter (development files)
Group: Productivity/Publishing/PS
-Requires: %name = %{PACKAGE_VERSION}
+Requires: %{name} = %{version}
Requires: ImageMagick-devel ImageMagick-Magick++-devel
%description devel
@@ -130,13 +131,9 @@
Authors:
--------
- Wolfgang Glunz
+ Wolfgang Glunz
G. Edward Johnson
-%define INSTALL install -m755 -s
-%define INSTALL_DIR install -d -m755
-%define INSTALL_DATA install -m644
-
%prep
%setup -q
%patch0
@@ -144,27 +141,25 @@
# %patch2
%patch3
%patch4
-%{suse_update_config -f config}
+%patch5 -p1
%build
-autoreconf -fi
-export CFLAGS="%optflags -g"
-export LDFLAGS="$LDFLAGS -g"
-export CXXFLAGS="%optflags"
+autoreconf -f -i
+export
+%configure\
%ifarch axp %ix86 ppc sparc
-CPPFLAGS="-I/usr/include/libEMF"
-EMF_OPT=--with-libemf-include=/usr/include/libEMF
+ --with-libemf-include=%{_includedir}/libEMF
%endif
-./configure --prefix=%{_prefix} --mandir=%{_mandir} --libdir=%{_libdir} $EMF_OPT
-make CXXFLAGS="%optflags -g"
+# FIXME: Final linking can fail with parallel build:
+#make %{?jobs:-j%jobs}
+make CXXFLAGS="$RPM_OPT_FLAGS"
%install
-make DESTDIR=%{buildroot} install
-make clean
-make DESTDIR=%{buildroot} install
-DESTDIR=%{buildroot} libtool --finish %{_libdir}/pstoedit
-#%clean
-#rm -rf %{buildroot}
+%makeinstall
+rm $RPM_BUILD_ROOT%{_libdir}/pstoedit/*.*a
+
+%clean
+rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
@@ -181,19 +176,22 @@
%{_libdir}/pstoedit/*.so
%{_libdir}/pstoedit/*.so.*
%{_datadir}/%{name}
-%{_mandir}/*/*
+%doc %{_mandir}/man?*/*.*
%files devel
%defattr(-, root, root)
-#%{_bindir}/pstoedit-config
%{_libdir}/*.so
%{_libdir}/*.*a
-%{_libdir}/pstoedit/*.*a
-%{_prefix}/include/pstoedit
+%{_includedir}/pstoedit
%{_libdir}/pkgconfig/*.pc
-%{_datadir}/aclocal/*
+%{_datadir}/aclocal/*.m4
%changelog
+* Thu Jan 15 2009 sbrabec@suse.cz
+- Enhanced features of PCB output.
+- Build with gd.
+- Changed BuildRequires: plotutils -> plotutils-devel.
+- Spec file cleanup.
* Wed Sep 10 2008 jsmeix@suse.de
- fixes-for-GCC43.patch applies fixes for GCC 4.3,
see http://en.opensuse.org/GCC_4.3_Transition
++++++ pstoedit-pcb-enhanced.patch ++++++
diff -urp pstoedit-3.45/src/drvpcb2.cpp pstoedit-3.45/src/drvpcb2.cpp
--- pstoedit-3.45/src/drvpcb2.cpp 2007-07-22 13:27:34.000000000 +0200
+++ pstoedit-3.45/src/drvpcb2.cpp 2009-01-15 12:52:25.000000000 +0100
@@ -2,6 +2,7 @@
drvpcb.cpp : This file is part of pstoedit
simple backend for Pcb format.
Contributed / Copyright 2004 by: Mark Rages
+ Contributed / Copyright 2008 by: Stanislav Brabec sbrabec_AT_suse.cz
Copyright (C) 1993 - 2007 Wolfgang Glunz, wglunz34_AT_pstoedit.net
(for the skeleton and the rest of pstoedit)
@@ -27,50 +28,249 @@
#include I_stdio
#include I_string_h
#include I_iostream
+#include <cmath>
+#include <iomanip>
+const double SCALE = (double)100000.0/(double)72.0;
+/* millimeter in mils/100. More exactly 3937.007874016, but pcb seems to use: */
+/* 3937.00775 */
+const double MM100 = (double)100000.0/(double)25.4;
+#define sqr(a) ((a)*(a))
+
+int drvPCB2::pcbScale_x(const Point & p)
+{
+ return (int)((double)p.x_ * SCALE + (double)options->tshiftx * unit + (double)0.5);
+}
+int drvPCB2::pcbScale_y(const Point & p)
+{
+ return (int)((double)500000.0 - (double)p.y_ * SCALE + (double)options->tshifty * unit + (double)0.5);
+}
+int drvPCB2::pcbScale(const double & f)
+{
+ return (int)((double)f * SCALE + (double)0.5);
+}
+
+static int _grid_snap (int value, double grid)
+{
+ return (int)((int)(((double)value + grid / 2) / grid) * grid + (double)0.5);
+}
+
+int drvPCB2::grid_snap(int value, bool success)
+{
+ if ((options->grid != 0.0) && success) {
+ /* pixel-exact snap to pcb grid: */
+ return _grid_snap (value, grid);
+ } else {
+ return value;
+ }
+}
+
+void drvPCB2::try_grid_snap(int value, bool * success)
+{
+ if (options->grid != 0.0) {
+ int value_snap;
+ value_snap = _grid_snap(value, grid);
+ if (abs (value_snap - value) > grid * options->snapdist) {
+ *success = false;
+ }
+ }
+}
drvPCB2::derivedConstructor(drvPCB2):
-//(const char * driveroptions_p,ostream & theoutStream,ostream & theerrStream):
constructBase
{
-// driver specific initializations
- outf << "PCB[\"\" 600000 500000]\n\n";
- outf << "Grid[2000.00000000 0 0 0]\n\n";
- outf << "Layer(10 \"silk\")\n(\n";
+ unit = (options->mm ? MM100 : 100.0);
+ grid = (double)(options->grid) * unit;
+ outf << "PCB[\"\" 600000 500000]\n\n";
+ if (options->grid != 0.0) {
+ outf << "Grid[";
+ outf << fixed << setprecision(6) << grid;
+ outf << " 0 0 1]\n\n";
+ } else {
+ outf << "Grid[1000.000000 0 0 0]\n\n";
+ }
+}
+
+static void gen_layer (ostream & outf, ostringstream & layer, const char * layer_def, const bool & force)
+{
+ if (layer.tellp() || force) {
+ outf << "Layer(" << layer_def << "\")\n(\n"
+ << layer.str()
+ << ")\n";
+ layer.str("");
+ }
}
drvPCB2::~drvPCB2()
{
- outf << ")\n";
- options=0;
+ if (options->stdnames)
+ {
+ gen_layer (outf, layer_polygons, "1 \"component", false);
+ gen_layer (outf, layer_pads, "2 \"solder", false);
+ gen_layer (outf, layer_polygons_nogrid, "3 \"GND", false);
+ gen_layer (outf, layer_pads_nogrid, "5 \"signal1", false);
+ gen_layer (outf, layer_boundaries_nogrid, "9 \"silk", false);
+ gen_layer (outf, layer_boundaries, "10 \"silk", true);
+ } else {
+ gen_layer (outf, layer_polygons, "1 \"poly", false);
+ gen_layer (outf, layer_polygons_nogrid, "2 \"poly.nogrid", false);
+ gen_layer (outf, layer_pads, "3 \"pads", false);
+ gen_layer (outf, layer_pads_nogrid, "4 \"pads.nogrid", false);
+ gen_layer (outf, layer_boundaries, "5 \"bound", false);
+ gen_layer (outf, layer_boundaries_nogrid, "6 \"bound.nogrid", false);
+ /* generate empty silk, otherwise bounds are interpreted as silk */
+ outf << "Layer(10 \"silk\")\n(\n"
+ << ")\n";
+ }
+ options=0;
}
void drvPCB2::close_page()
{
- //outf << "#Seite beendet.\n";
}
void drvPCB2::open_page()
{
- // outf << "#Neue Seite\n";
}
-const float SCALE = (100000.0f/72.0f);
void drvPCB2::show_path()
{
- // outf << "\n#Polyline:\n";
-
-
- for (unsigned int n = 1; n < numberOfElementsInPath(); n++) {
- const Point & p1 = pathElement(n-1).getPoint(0);
- const Point & p = pathElement(n).getPoint(0);
- outf << "Line[";
- outf << (int)(p1.x_*SCALE) << " "
- << (int)(500000-p1.y_*SCALE) << " "
- << (int)(p.x_*SCALE) << " "
- << (int)(500000-p.y_*SCALE) << " 1000 2000 0x00000020]\n";
+ bool round_success;
+ ostream *layer, *layer_nogrid;
+ if (isPolygon()) {
+ switch (currentShowType()) {
+ case drvbase::fill:
+ case drvbase::eofill:
+ unsigned int numberofvalidelements;
+
+ /* FIXME: How polygon with <3 vertices happen? */
+ if (numberOfElementsInPath() < 3)
+ return;
+
+ {
+ const Point & p0 = pathElement(0).getPoint(0);
+ const Point & pl = pathElement(numberOfElementsInPath()-1).getPoint(0);
+
+ /* Polygons are closed automatically. Skip last element for already closed polygons. */
+ if (p0.x_ == pl.x_ && p0.y_ == pl.y_) {
+ numberofvalidelements = numberOfElementsInPath() - 1;
+ } else {
+ numberofvalidelements = numberOfElementsInPath();
+ }
+ }
+ /* If snap to grid fails for any of points draw into layer_polygons_nogrid layer */
+ round_success = true;
+ for (unsigned int n = 0; n < numberofvalidelements; n++) {
+ try_grid_snap (pcbScale_x(pathElement(n).getPoint(0)), &round_success);
+ try_grid_snap (pcbScale_y(pathElement(n).getPoint(0)), &round_success);
+ }
+ if (round_success)
+ layer = &layer_polygons;
+ else
+ layer = &layer_polygons_nogrid;
+ /* Put polygons in grid into component layer. They may be PCB copper areas. */
+ *layer << "\tPolygon(\"clearpoly\")\n"
+ << "\t(\n";
+ for (unsigned int n = 0; n < numberofvalidelements; n++) {
+ const Point & p = pathElement(n).getPoint(0);
+ int x = grid_snap (pcbScale_x(p), round_success),
+ y = grid_snap (pcbScale_y(p), round_success);
+ *layer << "\t\t[" << x << " " << y << "]\n";
+ }
+ *layer << "\t)\n";
+
+ /* Rectangles can be also soldering pads. Create pads of proper size as duplicates.
+ User has to remove the unwanted instance. (Well, any tetragon is converted to pad)? */
+ if (numberofvalidelements == 4) {
+ Point try1_p1, try1_p2, try2_p1, try2_p2, pad_p1, pad_p2, pad_p1_corr, pad_p2_corr;
+ double lensq, widsq, try1_lensq, try2_lensq, lwidth, lratio;
+ /* Try1: line in direcion of vertices 0->1 */
+ try1_p1.x_ = (pathElement(1).getPoint(0).x_ + pathElement(2).getPoint(0).x_) / 2;
+ try1_p2.x_ = (pathElement(3).getPoint(0).x_ + pathElement(0).getPoint(0).x_) / 2;
+ try1_p1.y_ = (pathElement(1).getPoint(0).y_ + pathElement(2).getPoint(0).y_) / 2;
+ try1_p2.y_ = (pathElement(3).getPoint(0).y_ + pathElement(0).getPoint(0).y_) / 2;
+ try1_lensq = sqr(try1_p1.x_ - try1_p2.x_) + sqr(try1_p1.y_ - try1_p2.y_);
+ /* Try1: line in direcion of vertices 1->2 */
+ try2_p1.x_ = (pathElement(0).getPoint(0).x_ + pathElement(1).getPoint(0).x_) / 2;
+ try2_p2.x_ = (pathElement(2).getPoint(0).x_ + pathElement(3).getPoint(0).x_) / 2;
+ try2_p1.y_ = (pathElement(0).getPoint(0).y_ + pathElement(1).getPoint(0).y_) / 2;
+ try2_p2.y_ = (pathElement(2).getPoint(0).y_ + pathElement(3).getPoint(0).y_) / 2;
+ try2_lensq = sqr(try2_p1.x_ - try2_p2.x_) + sqr(try2_p1.y_ - try2_p2.y_);
+ /* Use the longer line from these two */
+ /* FIXME: what to do for square */
+ if (try1_lensq > try2_lensq) {
+ pad_p1.x_ = try1_p1.x_;
+ pad_p2.x_ = try1_p2.x_;
+ pad_p1.y_ = try1_p1.y_;
+ pad_p2.y_ = try1_p2.y_;
+ lensq = try1_lensq;
+ widsq = try2_lensq;
+ } else {
+ pad_p1.x_ = try2_p1.x_;
+ pad_p2.x_ = try2_p2.x_;
+ pad_p1.y_ = try2_p1.y_;
+ pad_p2.y_ = try2_p2.y_;
+ lensq = try2_lensq;
+ widsq = try1_lensq;
+ }
+ /* pcb adds line width to lenght. Subtract it. */
+ lwidth = sqrt(widsq);
+ lratio = sqrt(widsq/lensq/4);
+ pad_p1_corr.x_ = pad_p1.x_ - lratio*(pad_p1.x_-pad_p2.x_);
+ pad_p2_corr.x_ = pad_p2.x_ + lratio*(pad_p1.x_-pad_p2.x_);
+ pad_p1_corr.y_ = pad_p1.y_ - lratio*(pad_p1.y_-pad_p2.y_);
+ pad_p2_corr.y_ = pad_p2.y_ + lratio*(pad_p1.y_-pad_p2.y_);
+ round_success = true;
+ try_grid_snap (pcbScale_x(pad_p1_corr), &round_success);
+ try_grid_snap (pcbScale_y(pad_p1_corr), &round_success);
+ try_grid_snap (pcbScale_x(pad_p2_corr), &round_success);
+ try_grid_snap (pcbScale_y(pad_p2_corr), &round_success);
+ try_grid_snap (pcbScale(lwidth), &round_success);
+ if (round_success)
+ layer = &layer_pads;
+ else
+ layer = &layer_pads_nogrid;
+ *layer << "\tLine["
+ << grid_snap (pcbScale_x(pad_p1_corr), round_success) << " "
+ << grid_snap (pcbScale_y(pad_p1_corr), round_success) << " "
+ << grid_snap (pcbScale_x(pad_p2_corr), round_success) << " "
+ << grid_snap (pcbScale_y(pad_p2_corr), round_success) << " "
+ << grid_snap (pcbScale(lwidth), round_success) << " 200 \"clearline\"]\n";
+ }
+ break;
+
+ case drvbase::stroke:
+ /* Put lines with polygon inside to silk layer, as they cannot be component lines. */
+ layer = &layer_boundaries;
+ layer_nogrid = &layer_boundaries_nogrid;
+ goto polyline;
+ break;
+ }
+ } else {
+ /* Put lines that are not associated with polygon into component layer. They are probably PCB traces. */
+ layer = &layer_polygons;
+ layer_nogrid = &layer_polygons_nogrid;
+ polyline:
+ round_success = true;
+ for (unsigned int n = 1; n < numberOfElementsInPath(); n++) {
+ try_grid_snap (pcbScale_x(pathElement(n).getPoint(0)), &round_success);
+ try_grid_snap (pcbScale_y(pathElement(n).getPoint(0)), &round_success);
+ }
+ if (!round_success)
+ layer = layer_nogrid;
+ for (unsigned int n = 1; n < numberOfElementsInPath(); n++) {
+ const Point & p1 = pathElement(n-1).getPoint(0);
+ const Point & p = pathElement(n).getPoint(0);
+ *layer << "\tLine["
+ << grid_snap (pcbScale_x(p1), round_success) << " "
+ << grid_snap (pcbScale_y(p1), round_success) << " "
+ << grid_snap (pcbScale_x(p), round_success) << " "
+ << grid_snap (pcbScale_y(p), round_success) << " "
+ << grid_snap (pcbScale(currentLineWidth()), round_success)
+ << " 2000 0x00000020]\n";
+ }
}
}
diff -urp pstoedit-3.45/src/drvpcb2.h pstoedit-3.45/src/drvpcb2.h
--- pstoedit-3.45/src/drvpcb2.h 2007-07-22 13:27:44.000000000 +0200
+++ pstoedit-3.45/src/drvpcb2.h 2009-01-15 12:52:25.000000000 +0100
@@ -4,6 +4,7 @@
/*
drvPCB2.h : This file is part of pstoedit
Contributed / Copyright 2004 by: Mark Rages
+ Contributed / Copyright 2008 by: Stanislav Brabec sbrabec_AT_suse.cz
Copyright (C) 1993 - 2006 Wolfgang Glunz, wglunz@pstoedit.net
@@ -23,6 +24,7 @@
*/
#include "drvbase.h"
+#include <sstream>
class drvPCB2 : public drvbase {
@@ -35,17 +37,43 @@ public:
class DriverOptions : public ProgramOptions {
public:
- DriverOptions()
+ Option < double, DoubleValueExtractor > grid;
+ Option < double, DoubleValueExtractor > snapdist;
+ Option < double, DoubleValueExtractor > tshiftx;
+ Option < double, DoubleValueExtractor > tshifty;
+ Option < bool, BoolTrueExtractor > mm;
+ Option < bool, BoolTrueExtractor > stdnames;
+
+ DriverOptions():
+ grid(true,"-grid",0,0,"attempt to snap relevant output to grid (mils) and put failed objects to a different layer",0,0),
+ snapdist(true,"-snapdist",0,0,"grid snap distance ratio (0 < snapdist <= 0.5, default 0.1)",0,0.1),
+ tshiftx(true,"-tshiftx",0,0,"additional x shift measured in target units (mils)",0,0),
+ tshifty(true,"-tshifty",0,0,"additional y shift measured in target units (mils)",0,0),
+ mm(true,"-mm",0,0,"Switch to metric units (mm)",0,false),
+ stdnames(true,"-stdnames",0,0,"use standard layer names instead of descriptive names",0,false)
{
+ ADD(grid);
+ ADD(snapdist);
+ ADD(tshiftx);
+ ADD(tshifty);
+ ADD(grid);
+ ADD(mm);
+ ADD(stdnames);
}
}*options;
-private:
-
#include "drvfuncs.h"
+private:
+ int pcbScale_x(const Point & p);
+ int pcbScale_y(const Point & p);
+ int pcbScale(const double & f);
+ void try_grid_snap(int value, bool * success);
+ int grid_snap(int value, bool success);
+
+ ostringstream layer_polygons, layer_polygons_nogrid;
+ ostringstream layer_pads, layer_pads_nogrid;
+ ostringstream layer_boundaries_nogrid, layer_boundaries;
+ double unit, grid;
};
#endif
-
-
-
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org