HEX
Server: Apache
System: Linux opal14.opalstack.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User: curbgloabal_opal (1234)
PHP: 8.1.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/share/inkscape/extensions/dimension.pyo
�
��Yc@s�dZddlZy ddlmZmZeZWn
eZnXddlZddl	Z	ddl
Tde	jfd��YZe
dkr�e�Zej�ndS(s
dimension.py
An Inkscape effect for adding CAD style dimensions to selected objects
in a drawing.

It uses the selection's bounding box, so if the bounding box has empty
space in the x- or y-direction (such as with some stars) the results
will look strange.  Strokes might also overlap the edge of the 
bounding box.

The dimension arrows aren't measured: use the "Visualize Path/Measure
Path" effect to add measurements.

This code contains snippets from existing effects in the Inkscape
extensions library, and marker data from markers.svg.

Copyright (C) 2007 Peter Lewerin, peter.lewerin@tele2.se

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
i����N(tPopentPIPE(t*t	DimensioncBs5eZd�Zd�Zd�Zd�Zd�ZRS(c
Cs�tjj|�|jjddddddddd	d
dd�|jjd
dddddddd	d
dd�|jjddddddddd	ddd�dS(Ns-xs	--xoffsettactiontstorettypetfloattdesttxoffsettdefaultgY@thelps(x offset of the vertical dimension arrows-ys	--yoffsettyoffsets*y offset of the horizontal dimension arrows-ts--typetstringt	geometricsBounding box type(tinkextEffectt__init__tOptionParsert
add_option(tself((s+/usr/share/inkscape/extensions/dimension.pyR1scCsA|jd�}|dkrHtjj|jj�tjdd��}ntjj|tjdd��}|jd|�|jdd�|jdd	�|jd
d	�|jdd�|jtjd
d�|�tjj	d�}|jdd�|r|jdd�n|jdd�|jdd�|j
|�dS(Ns/svg:svg//svg:defstdefstsvgtmarkertidtorienttautotrefXs0.0trefYtstylesoverflow:visibletstockidtinkscapetpathtds7M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z t	transforms(scale(0.8) rotate(180) translate(12.5,0)sscale(0.8) translate(12.5,0)sEfill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none(txpathSingletNoneRtetreet
SubElementtdocumenttgetroottaddNStsettElementtappend(RtnametrotateRRtarrow((s+/usr/share/inkscape/extensions/dimension.pyt	addMarker@s"-!cCsqtjjd�}|jd|d|j}|jd}||d|j}|jdd|||f�|S(NR iiR!sM %f %f H %f(RR%R+tbboxR	RR*(Rtytxlattlinetx1tx2((s+/usr/share/inkscape/extensions/dimension.pytdimHLineUs
cCsqtjjd�}||d|j}|jd|d|j}|jd}|jdd|||f�|S(NR iiiiR!sM %f %f V %f(RR%R+R	R1RR*(RtxR3R4ty1ty2((s+/usr/share/inkscape/extensions/dimension.pytdimVLine]s
c	Cs�|jd�}||jj|_||jj|_t|jj�dkrjtjtd��t	�n|jj
dkr�t|jj
��|_nKidd6dd6dd6dd6}|jd	}|jjd}x�|j�D]�}trUtd
|||fdtdtd
t�}|j�}|t|jj��||<|jj�}q�tjd
|||f�d\}	}|t|	j��||<|	j�|j�q�W|d|d|d|d|d|df|_y|jd}
Wn+tk
r tjtd��t	�nX|j}|jdt �|jdt�tj!j"|d�}|j#dd�|j#dd�|j$|jdddg�}
|
j#dd�|
j#dd�|
j#dt%|��|j&|
�|j'|jdddg�}
|
j#dt%d|��|j&|
�|j'|jdddg�}
|
j#dt%d|��|j&|
�|j'|jdddg�}
|
j#dd�|
j#dd�|
j#dt%|��|j&|
�|j$|jdddg�}
|
j#dt%d|��|j&|
�|j$|jdddg�}
|
j#dt%d|��|j&|
�x*|jj(�D]\}}|j&|�qkW|j&|�dS(Nt1pxisPlease select an object.RR8R2twidththeighti����s&inkscape --query-%s --query-id=%s "%s"tshelltstdouttstderrisBUnable to process this object.  Try changing it into a path first.tArrow1Lstartt
Arrow1Lendtgtfilltnonetstroketblackismarker-startsurl(#Arrow1Lstart)s
marker-endsurl(#Arrow1Lend)sstroke-widthg�?i()tunittouutoptionsR	RtlentidsRterrormsgt_texitRtcomputeBBoxtselectedtvaluesR1targstkeystbsubprocessRtTrueRtwaitRR@treadRAtostpopen3tcloset	TypeErrort
current_layerR0tFalseR%R&R*R7tstrR,R;t	iteritems(RtscaletqtfileRtquerytptrcterrtfttesting_the_watertlayertgroupR4tnode((s+/usr/share/inkscape/extensions/dimension.pyteffectest
"
+&
5
	





(t__name__t
__module__RR0R7R;Rm(((s+/usr/share/inkscape/extensions/dimension.pyR0s
				t__main__(t__doc__tsyst
subprocessRRRVRUR^RtpathmodifiertsimpletransformtPathModifierRRntetaffect(((s+/usr/share/inkscape/extensions/dimension.pyt<module>!s


�