forked from jgraph/mxgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmxStyleRegistry.php
More file actions
70 lines (62 loc) · 1.82 KB
/
mxStyleRegistry.php
File metadata and controls
70 lines (62 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* Copyright (c) 2006-2013, Gaudenz Alder
*/
class mxStyleRegistry
{
/**
* Class: mxStyleRegistry
*
* Singleton class that acts as a global converter from string to object values
* in a style. This is currently only used to perimeters and edge styles.
*
* Variable: values
*
* Maps from strings to objects.
*/
public static $values = array();
/**
* Function: putValue
*
* Puts the given object into the registry under the given name.
*/
static function putValue($name, $value)
{
mxStyleRegistry::$values[$name] = $value;
}
/**
* Function: getValue
*
* Returns the value associated with the given name.
*/
static function getValue($name)
{
return (isset(mxStyleRegistry::$values[$name])) ? mxStyleRegistry::$values[$name] : null;
}
/**
* Function: getName
*
* Returns the name for the given value.
*/
static function getName($value)
{
foreach (mxStyleRegistry::$values as $key => $val)
{
if ($value === $val)
{
return $key;
}
}
return null;
}
}
mxStyleRegistry::putValue(mxConstants::$EDGESTYLE_ELBOW, mxEdgeStyle::$ElbowConnector);
mxStyleRegistry::putValue(mxConstants::$EDGESTYLE_ENTITY_RELATION, mxEdgeStyle::$EntityRelation);
mxStyleRegistry::putValue(mxConstants::$EDGESTYLE_LOOP, mxEdgeStyle::$Loop);
mxStyleRegistry::putValue(mxConstants::$EDGESTYLE_SIDETOSIDE, mxEdgeStyle::$SideToSide);
mxStyleRegistry::putValue(mxConstants::$EDGESTYLE_TOPTOBOTTOM, mxEdgeStyle::$TopToBottom);
mxStyleRegistry::putValue(mxConstants::$PERIMETER_ELLIPSE, mxPerimeter::$EllipsePerimeter);
mxStyleRegistry::putValue(mxConstants::$PERIMETER_RECTANGLE, mxPerimeter::$RectanglePerimeter);
mxStyleRegistry::putValue(mxConstants::$PERIMETER_RHOMBUS, mxPerimeter::$RhombusPerimeter);
mxStyleRegistry::putValue(mxConstants::$PERIMETER_TRIANGLE, mxPerimeter::$TrianglePerimeter);
?>