* 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);
/** * Function: getPerimeterFunction * * Returns the perimeter function for the given state. */ function getPerimeterFunction($state) { $perimeter = mxUtils::getValue($state->style, mxConstants::$STYLE_PERIMETER); // Converts string values to objects if (is_string($perimeter)) { $tmp = mxStyleRegistry::getValue($perimeter); if ($tmp == null && strpos($perimeter, ".") !== false) { $tmp = mxUtils::evaluate($perimeter); } $perimeter = $tmp; } if ($perimeter instanceof mxPerimeterFunction) { return $perimeter; } return null; }