As Sergey Alyoshin wrote:

> Take a look at libarchive (although zip support mentioned as read only).

My version (FreeBSD 10.4 native) has write support for Zip
(even 7-zip).  So libarchive would certainly be a good idea.

As it's wishtime :), being able to bundle entire archives would
certainly make sense, as Gerbv now already can panelize, so that
would be the final step for a production-ready archive file.

But it's certainly just a "nice to have" feature, nothing crucial, and
I guess it would make sense to think about all the file and layer
handling dialogs.  Also, the zip file ought to be recorded properly in
the project file.

Speaking of project files, I've still got this patch here which
somehow did not make it back into "master".  Without that patch, a
rotated layer cannot be handled correctly in Gerber output when
reading in a project file as the project file limits the precision of
the rotation so it's not recognized as being 90/180/270 degrees.

Is there any better way to submit the patch rather than here?

diff --git a/src/gerb_image.c b/src/gerb_image.c
index 78c90de..dc5b241 100644
--- a/src/gerb_image.c
+++ b/src/gerb_image.c
@@ -590,24 +590,21 @@ gerbv_image_copy_all_nets (gerbv_image_t *sourceImage,
                case GERBV_APTYPE_OVAL:
                        if (trans->scaleX == trans->scaleY
                        && trans->scaleX == 1.0
-                       && (fabs(trans->rotation) == M_PI
-                        || fabs(trans->rotation) == DEG2RAD(180)))
-                               break;  /* DEG2RAD for calc error */
+                       && (fabs(fabs(trans->rotation) - M_PI) < 
GERBV_PROJECT_PRECISION))
+                               break;
 
                        aper = gerbv_image_duplicate_aperture (
                                        destImage->aperture[newNet->aperture]);
                        aper->parameter[0] *= trans->scaleX;
                        aper->parameter[1] *= trans->scaleY;
 
-                       if (fabs(trans->rotation) == M_PI_2
-                        || fabs(trans->rotation) == DEG2RAD(90)
-                        || fabs(trans->rotation) == (M_PI+M_PI_2)
-                        || fabs(trans->rotation) == DEG2RAD(270)) {
-                                               /* DEG2RAD for calc error */
+                       if (fabs(fabs(trans->rotation) - M_PI_2) < 
GERBV_PROJECT_PRECISION
+                        || fabs(fabs(trans->rotation) - (M_PI+M_PI_2)) < 
GERBV_PROJECT_PRECISION) {
                                double t = aper->parameter[0];
                                aper->parameter[0] = aper->parameter[1];
                                aper->parameter[1] = t;
                        } else {
+                         printf("%.14lf\n", trans->rotation);
                                if (aper_type == GERBV_APTYPE_RECTANGLE)
                                        err_rotate_rect++;      /* TODO: make 
line21 macro */
                                else
diff --git a/src/gerbv.h b/src/gerbv.h
index 0ee7e55..7b89fff 100644
--- a/src/gerbv.h
+++ b/src/gerbv.h
@@ -108,6 +108,11 @@ extern "C" {
 #define DEG2RAD(d) ((d)*M_PI/180.0)
 #define RAD2DEG(r) ((r)*180.0*M_1_PI)
 
+/* Project files only have a limited precision in their data, so when
+   interpreting layer rotations that have been read from a project
+   file, we have to tolerate a certain amount of error. */
+#define GERBV_PROJECT_PRECISION 1E-6
+
 #define GERB_FATAL_ERROR(...) g_log(NULL, G_LOG_LEVEL_ERROR, __VA_ARGS__)
 #define GERB_COMPILE_ERROR(...)  g_log(NULL, G_LOG_LEVEL_CRITICAL, __VA_ARGS__)
 #define GERB_COMPILE_WARNING(...)  g_log(NULL, G_LOG_LEVEL_WARNING, 
__VA_ARGS__)

-- 
cheers, Joerg               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gerbv-devel mailing list
Gerbv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gerbv-devel

Reply via email to