summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2013-11-19 09:45:02 +0000
committerJabiertxof <jtx@jtx.marker.es>2013-11-19 09:45:02 +0000
commit30d153156f05a2782e0713a039a9d4d888bf9b1d (patch)
treef6ecac9a5d26a21d6a613da68750c16b486f431c
parentUpdate to trunk (diff)
parentfix initialization bug, that leads to non-continuous path (diff)
downloadinkscape-30d153156f05a2782e0713a039a9d4d888bf9b1d.tar.gz
inkscape-30d153156f05a2782e0713a039a9d4d888bf9b1d.zip
Update to trunk
(bzr r11950.1.201)
-rw-r--r--share/extensions/hpgl_decoder.py2
-rw-r--r--share/extensions/hpgl_encoder.py19
-rwxr-xr-xshare/extensions/inkex.py10
-rw-r--r--share/extensions/plotter.py1
-rw-r--r--src/extension/effect.cpp2
-rw-r--r--src/sp-ellipse.cpp2
6 files changed, 20 insertions, 16 deletions
diff --git a/share/extensions/hpgl_decoder.py b/share/extensions/hpgl_decoder.py
index 0af2d5f5f..96571df94 100644
--- a/share/extensions/hpgl_decoder.py
+++ b/share/extensions/hpgl_decoder.py
@@ -33,6 +33,8 @@ class hpglDecoder:
"resolutionX":float
"resolutionY":float
"showMovements":bool
+ "docWidth":float
+ "docHeight":float
'''
self.hpglString = hpglString
self.options = options
diff --git a/share/extensions/hpgl_encoder.py b/share/extensions/hpgl_encoder.py
index b4191e7c0..692f11cd4 100644
--- a/share/extensions/hpgl_encoder.py
+++ b/share/extensions/hpgl_encoder.py
@@ -62,13 +62,14 @@ class hpglEncoder:
self.sizeY = 'False'
self.dryRun = True
self.lastPoint = [0, 0, 0]
- self.scaleX = self.options.resolutionX / 90 # inch to pixels
- self.scaleY = self.options.resolutionY / 90 # inch to pixels
- self.options.offsetX = self.options.offsetX * 3.5433070866 * self.scaleX # mm to dots (plotter coordinate system)
- self.options.offsetY = self.options.offsetY * 3.5433070866 * self.scaleY # mm to dots
- self.options.overcut = self.options.overcut * 3.5433070866 * ((self.scaleX + self.scaleY) / 2) # mm to dots
- self.options.toolOffset = self.options.toolOffset * 3.5433070866 * ((self.scaleX + self.scaleY) / 2) # mm to dots
- self.options.flat = ((self.options.resolutionX + self.options.resolutionY) / 2) * self.options.flat / 1000 # scale flatness to resolution
+ self.scaleX = self.options.resolutionX / effect.unittouu("1.0in") # dots per inch to dots per user unit
+ self.scaleY = self.options.resolutionY / effect.unittouu("1.0in") # dots per inch to dots per user unit
+ scaleXY = (self.scaleX + self.scaleY) / 2
+ self.options.offsetX = effect.unittouu(str(self.options.offsetX) + "mm") * self.scaleX # mm to dots (plotter coordinate system)
+ self.options.offsetY = effect.unittouu(str(self.options.offsetY) + "mm") * self.scaleY # mm to dots
+ self.options.overcut = effect.unittouu(str(self.options.overcut) + "mm") * scaleXY # mm to dots
+ self.options.toolOffset = effect.unittouu(str(self.options.toolOffset) + "mm") * scaleXY # mm to dots
+ self.options.flat = self.options.flat / (1016 / ((self.options.resolutionX + self.options.resolutionY) / 2)) # scale flatness to resolution
self.toolOffsetFlat = self.options.flat / self.options.toolOffset * 4.5 # scale flatness to offset
self.mirrorX = 1.0
if self.options.mirrorX:
@@ -83,8 +84,8 @@ class hpglEncoder:
if viewBox:
viewBox = string.split(viewBox, ' ')
if viewBox[2] and viewBox[3]:
- self.viewBoxTransformX = float(effect.unittouu(self.doc.get('width'))) / float(viewBox[2])
- self.viewBoxTransformY = float(effect.unittouu(self.doc.get('height'))) / float(viewBox[3])
+ self.viewBoxTransformX = effect.unittouu(self.doc.get('width')) / effect.unittouu(viewBox[2])
+ self.viewBoxTransformY = effect.unittouu(self.doc.get('height')) / effect.unittouu(viewBox[3])
def getHpgl(self):
# dryRun to find edges
diff --git a/share/extensions/inkex.py b/share/extensions/inkex.py
index 4542bc418..5333ef52b 100755
--- a/share/extensions/inkex.py
+++ b/share/extensions/inkex.py
@@ -269,11 +269,11 @@ class Effect:
return 'px'
#a dictionary of unit to user unit conversion factors
- uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'm':3543.3070866,
+ __uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'm':3543.3070866,
'km':3543307.0866, 'pc':15.0, 'yd':3240 , 'ft':1080}
def unittouu(self, string):
'''Returns userunits given a string representation of units in another system'''
- unit = re.compile('(%s)$' % '|'.join(self.uuconv.keys()))
+ unit = re.compile('(%s)$' % '|'.join(self.__uuconv.keys()))
param = re.compile(r'(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)')
p = param.match(string)
@@ -284,16 +284,16 @@ class Effect:
retval = 0.0
if u:
try:
- return retval * (self.uuconv[u.string[u.start():u.end()]] / self.uuconv[self.getDocumentUnit()])
+ return retval * (self.__uuconv[u.string[u.start():u.end()]] / self.__uuconv[self.getDocumentUnit()])
except KeyError:
pass
else: # default assume 'px' unit
- return retval / self.uuconv[self.getDocumentUnit()]
+ return retval / self.__uuconv[self.getDocumentUnit()]
return retval
def uutounit(self, val, unit):
- return val / (self.uuconv[unit] / self.uuconv[self.getDocumentUnit()])
+ return val / (self.__uuconv[unit] / self.__uuconv[self.getDocumentUnit()])
# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99
diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py
index f57057435..78d480f05 100644
--- a/share/extensions/plotter.py
+++ b/share/extensions/plotter.py
@@ -79,6 +79,7 @@ class MyEffect(inkex.Effect):
raise ValueError, ('', type, value), traceback
# TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is
# a preview or a final run. (Remember to set <effect needs-live-preview='false'> to true)
+ # This outcommented code has a user unit issue (getSvg produces px, docWidth could be mm or something else)
'''
# reparse data for preview
self.options.showMovements = True
diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp
index 1575c2b10..3c8ee5844 100644
--- a/src/extension/effect.cpp
+++ b/src/extension/effect.cpp
@@ -38,7 +38,7 @@ Inkscape::XML::Node * Effect::_filters_list = NULL;
Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp)
: Extension(in_repr, in_imp),
_id_noprefs(Glib::ustring(get_id()) + ".noprefs"),
- _name_noprefs(Glib::ustring(get_name()) + _(" (No preferences)")),
+ _name_noprefs(Glib::ustring(_(get_name())) + _(" (No preferences)")),
_verb(get_id(), get_name(), NULL, NULL, this, true),
_verb_nopref(_id_noprefs.c_str(), _name_noprefs.c_str(), NULL, NULL, this, false),
_menu_node(NULL), _workingDialog(true),
diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp
index 4cf96e432..7e5dda871 100644
--- a/src/sp-ellipse.cpp
+++ b/src/sp-ellipse.cpp
@@ -450,7 +450,7 @@ void SPGenericEllipse::set_shape()
// This code converts the circle to four elliptical arcs explicitly.
// Circle::getPath currently creates cubic bezier curves, these are not suitable here
// as a circle should have four mid markers at 0, 90, 180, 270 degrees.
- Geom::Path path;
+ Geom::Path path(Geom::Point::polar(0));
Geom::EllipticalArc* arc;
arc = circle.arc(Geom::Point::polar(0), Geom::Point::polar(M_PI / 4.0), Geom::Point::polar(M_PI / 2.0));