Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ncphp
/
mcClasses
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 08779a1b
authored
Nov 28, 2013
by
sn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
einheiten
1 parent
365df977
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
2 deletions
D/class_D.inc.php
class_mcUnityCalculator.inc.php
file/class_mcInkscape.inc.php
include.php
D/class_D.inc.php
View file @
08779a1
...
@@ -148,10 +148,10 @@ class D {
...
@@ -148,10 +148,10 @@ class D {
// self::new_echo("<br>______________________<br>", $param_print, $param_force);
// self::new_echo("<br>______________________<br>", $param_print, $param_force);
self
::
printCurrentFunction
(
$param_print
,
"<br>______________________<br>"
);
self
::
printCurrentFunction
(
$param_print
,
"<br>______________________<br>"
,
true
);
// self::new_echo("<b>show(".$param_string.")</b>", $param_print, $param_force);
// self::new_echo("<b>show(".$param_string.")</b>", $param_print, $param_force);
$string_show
=
"<br /><b>show("
.
$param_string
.
")</b><br />"
;
$string_show
=
"<br /><b>show("
.
$param_string
.
")
--
</b><br />"
;
if
(
is_object
(
$param_val
)
&&
get_class
(
$param_val
)
==
'DOMElement'
)
{
if
(
is_object
(
$param_val
)
&&
get_class
(
$param_val
)
==
'DOMElement'
)
{
D
::
showdomelement
(
$param_val
,
$string_show
.
$param_string
,
$param_print
,
$param_force
);
D
::
showdomelement
(
$param_val
,
$string_show
.
$param_string
,
$param_print
,
$param_force
);
...
...
class_mcUnityCalculator.inc.php
0 → 100644
View file @
08779a1
<?php
class
mcUnityCalculator
{
public
static
$UNITS
=
array
(
'in'
=>
array
(
'mm'
=>
25.4
,
'cm'
=>
2.54
,
'in'
=>
1
,
'pt'
=>
72
,
'pc'
=>
6
,
'px'
=>
false
,
)
);
/**
* transform $param_in_number $param_in_unit to $param_out_unit
*
* @param number $param_in_number
* @param string $param_in_unit
* @param string $param_out_unit
* @return number
*/
public
static
function
to
(
$param_in_number
,
$param_in_unit
,
$param_out_unit
){
$inchNumber
=
mcUnityCalculator
::
toInch
(
$param_in_number
,
$param_in_unit
);
$outNumber
=
mcUnityCalculator
::
inchTo
(
$inchNumber
,
$param_out_unit
);
return
$outNumber
;
}
public
static
function
calculateDpi
(
$param_px_number
,
$param_number
,
$param_unit
)
{
$inch_outNumber
=
mcUnityCalculator
::
toInch
(
$param_number
,
$param_unit
);
$dpi
=
$param_px_number
/
$inch_outNumber
;
return
$dpi
;
}
/**
*
* @param type $param_number - number in inch / zahl in zoll
* @param string $param_unit - mm / cm / in / pt / pc / px
* @return type
*/
private
static
function
inchTo
(
$param_number
,
$param_unit
,
$param_dpi
=
300
)
{
if
(
array_key_exists
(
$param_unit
,
mcUnityCalculator
::
$UNITS
[
'in'
]))
{
if
(
$param_unit
!=
'px'
)
{
return
$param_number
*
mcUnityCalculator
::
$UNITS
[
'in'
][
$param_unit
];
}
else
{
return
mcUnityCalculator
::
inchToPx
(
$param_number
,
$param_dpi
);
}
}
else
{
return
Error
::
newError
(
'falsche Einheit'
,
''
);
}
}
/**
*
* @param type $param_number - number in inch / zahl in zoll
* @param string $param_unit - mm / cm / in / pt / pc / px
* @return type
*/
private
static
function
toInch
(
$param_number
,
$param_unit
,
$param_dpi
=
300
)
{
if
(
array_key_exists
(
$param_unit
,
mcUnityCalculator
::
$UNITS
[
'in'
]))
{
if
(
$param_unit
!=
'px'
)
{
return
$param_number
/
mcUnityCalculator
::
$UNITS
[
'in'
][
$param_unit
];
}
else
{
return
mcUnityCalculator
::
pxToInch
(
$param_number
,
$param_dpi
);
}
}
else
{
return
Error
::
newError
(
'falsche Einheit'
,
''
);
}
}
// /**
// *
// * @param type $param_number
// * @param type $param_unit
// * @param type $param_dpi
// * @return type
// */
// public static function toPx($param_number, $param_unit, $param_dpi) {
// $inch = mcUnityCalculator::toInch($param_number, $param_unit);
// $px = mcUnityCalculator::inchToPx($inch, $param_dpi);
// return $px;
// }
private
static
function
pxToInch
(
$param_px
,
$param_dpi
)
{
return
$param_px
/
$param_dpi
;
}
private
static
function
inchToPx
(
$param_inch
,
$param_dpi
)
{
return
$param_inch
*
$param_dpi
;
}
}
?>
file/class_mcInkscape.inc.php
View file @
08779a1
...
@@ -65,6 +65,7 @@ class mcCairoSvg {
...
@@ -65,6 +65,7 @@ class mcCairoSvg {
$inkscape_order
=
"cairosvg.sh
$param_in_svg
$param_out_pdf
"
;
$inkscape_order
=
"cairosvg.sh
$param_in_svg
$param_out_pdf
"
;
$shell_exec
=
shell_exec
(
$inkscape_order
);
$shell_exec
=
shell_exec
(
$inkscape_order
);
D
::
show
(
$shell_exec
,
$inkscape_order
);
return
$param_out_pdf
;
return
$param_out_pdf
;
}
}
...
...
include.php
View file @
08779a1
...
@@ -75,4 +75,6 @@ require_once $__PATH_to_mcClasses . 'mcPUIX/class_mcPUIX_CONFIG.inc.php';
...
@@ -75,4 +75,6 @@ require_once $__PATH_to_mcClasses . 'mcPUIX/class_mcPUIX_CONFIG.inc.php';
require_once
$__PATH_to_mcClasses
.
'mcPUIX/class_mcPUIX_DOM.inc.php'
;
require_once
$__PATH_to_mcClasses
.
'mcPUIX/class_mcPUIX_DOM.inc.php'
;
require_once
$__PATH_to_mcClasses
.
'mcPUIX/class_Converter.inc.php'
;
require_once
$__PATH_to_mcClasses
.
'mcPUIX/class_Converter.inc.php'
;
require_once
$__PATH_to_mcClasses
.
'class_mcUnityCalculator.inc.php'
;
?>
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment