mxGraph
|
Contains various helper methods for use with mxGraph. More...
Public Member Functions | |
String | AddStylename (String style, String stylename) |
Adds the specified stylename to the given style if it does not already contain the stylename. More... | |
String | RemoveStylename (String style, String stylename) |
Removes all occurrences of the specified stylename in the given style and returns the updated style. More... | |
Static Public Member Functions | |
static mxRectangle | GetLabelSize (string label, Dictionary< string, Object > style, int width) |
Returns the size of the given label. More... | |
static mxRectangle | GetLabelPaintBounds (String label, Dictionary< string, Object > style, bool isHtml, mxPoint offset, mxRectangle vertexBounds, double scale) |
Returns the paint bounds for the given label. More... | |
static mxRectangle | GetScaledLabelBounds (double x, double y, mxRectangle size, double outerWidth, double outerHeight, Dictionary< string, Object > style, double scale) |
Returns the bounds for a label for the given location and size, taking into account the alignment and spacing in the specified style, as well as the width and height of the rectangle that contains the label. (For edge labels this width and height is 0.) The scale is used to scale the given size and the spacings in the specified style. More... | |
static mxRectangle | GetSizeForString (String text, Font font) |
Returns the size of the given text. More... | |
static mxRectangle | GetSizeForString (String text, Font font, int width) |
Returns an mxRectangle with the size (width and height in pixels) of the given text. More... | |
static double | ToRadians (double deg) |
Converts the given degree to radians. More... | |
static double[] | ArcToCurves (double x0, double y0, double r1, double r2, double angle, double largeArcFlag, double sweepFlag, double x, double y) |
Converts the given arc to a series of curves. More... | |
static mxRectangle | GetBoundingBox (mxRectangle rect, double rotation) |
Returns the bounding box of the rotated rectangle. More... | |
static mxPoint | GetRotatedPoint (mxPoint pt, double cos, double sin) |
Rotates the given point by the given cos and sin. More... | |
static mxPoint | GetRotatedPoint (mxPoint pt, double cos, double sin, mxPoint c) |
Rotates the given point by the given cos and sin. More... | |
static void | FillClippedRect (Graphics g, Brush brush, int x, int y, int width, int height) |
static Image | CreateImage (int width, int height, Color?background) |
Creates an image for the given parameters. More... | |
static List< mxPoint > | TranslatePoints (List< mxPoint > pts, double dx, double dy) |
Creates a new list of new points obtained by translating the points in the given list by the given vector. Elements that are not mxPoints are added to the result as-is. More... | |
static mxPoint | Intersection (double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3) |
Returns the intersection of two lines as an mxPoint. More... | |
static String | GetStylename (String style) |
Returns the stylename in a style of the form stylename[;key=value] or an empty string if the given style does not contain a stylename. More... | |
static String[] | GetStylenames (String style) |
Returns the stylenames in a style of the form stylename[;key=value] or an empty array if the given style does not contain any stylenames. More... | |
static int | IndexOfStylename (String style, String stylename) |
Returns the index of the given stylename in the given style. This returns -1 if the given stylename does not occur (as a stylename) in the given style, otherwise it returns the index of the first character. More... | |
static String | RemoveAllStylenames (String style) |
Removes all stylenames from the given style and returns the updated style. More... | |
static void | SetCellStyles (mxIGraphModel model, Object[] cells, String key, String value) |
Assigns the value for the given key in the styles of the given cells, or removes the key from the styles if the value is null. More... | |
static String | SetStyle (String style, String key, String value) |
Adds or removes the given key, value pair to the style and returns the new style. If value is null or zero length then the key is removed from the style. More... | |
static void | SetCellStyleFlags (mxIGraphModel model, Object[] cells, String key, int flag, Boolean value) |
Sets or toggles the flag bit for the given key in the cell's styles. If value is null then the flag is toggled. More... | |
static String | SetStyleFlag (String style, String key, int flag, bool?value) |
Sets or removes the given key from the specified style and returns the new style. If value is null then the flag is toggled. More... | |
static bool | IsTrue (Dictionary< string, Object > dict, string key) |
Returns true if the dictionary contains true for the given key or false if no value is defined for the key. More... | |
static bool | IsTrue (Dictionary< string, Object > dict, string key, bool defaultValue) |
Returns true if the dictionary contains true for the given key or the given default value if no value is defined for the key. More... | |
static int | GetInt (Dictionary< string, Object > dict, string key) |
Returns the value for key in dictionary as an int or 0 if no value is defined for the key. More... | |
static int | GetInt (Dictionary< string, Object > dict, string key, int defaultValue) |
Returns the value for key in dictionary as an int or the given default value if no value is defined for the key. More... | |
static float | GetFloat (Dictionary< string, Object > dict, string key) |
Returns the value for key in dictionary as a float or 0 if no value is defined for the key. More... | |
static float | GetFloat (Dictionary< string, Object > dict, string key, float defaultValue) |
Returns the value for key in dictionary as a float or the given default value if no value is defined for the key. More... | |
static double | GetDouble (Dictionary< string, Object > dict, string key) |
Returns the value for key in dictionary as a double or 0 if no value is defined for the key. More... | |
static double | GetDouble (Dictionary< string, Object > dict, string key, double defaultValue) |
Returns the value for key in dictionary as a double or the given default value if no value is defined for the key. More... | |
static string | GetString (Dictionary< string, Object > dict, string key) |
Returns the value for key in dictionary as a string or null if no value is defined for the key. More... | |
static string | GetString (Dictionary< string, Object > dict, string key, string defaultValue) |
Returns the value for key in dictionary as a string or the given default value if no value is defined for the key. More... | |
static Color | GetColor (Dictionary< string, Object > dict, string key) |
Returns the value for key in dictionary as a color or null if no value is defined for the key. More... | |
static Color | GetColor (Dictionary< string, Object > dict, string key, Color?defaultValue) |
Returns the value for key in dictionary as a color or the given default value if no value is defined for the key. More... | |
static Font | GetFont (Dictionary< string, Object > style) |
static Font | GetFont (Dictionary< string, Object > style, double scale) |
static StringFormat | GetStringFormat (Dictionary< string, Object > style) |
Creates a new StringFormat object for the given style. More... | |
static string | ReadFile (string filename) |
Reads the given filename into a string. More... | |
static string | GetMd5Hash (string text) |
Returns the Md5 hash for the given text. More... | |
static bool | IsNode (Object value, String nodeName) |
Returns true if the given value is an XML node with the specified nodename. specified. More... | |
static bool | IsNode (Object value, String nodeName, String attributeName, String attributeValue) |
Returns true if the user object is an XML node with the specified type and and the optional attribute has the specified value or is not specified. More... | |
static Image | LoadImage (String url) |
Loads an image from the local filesystem, a data URI or any other URL. More... | |
static XmlDocument | CreateDocument () |
Returns a new, empty DOM document. More... | |
static XmlDocument | LoadDocument (string uri) |
Returns a new DOM document for the given URI. More... | |
static XmlDocument | ParseXml (string xml) |
Returns a document that represents the given XML string. More... | |
static XmlNode | FindNode (XmlNode node, String attr, String value) |
Returns the first node where attr equals value. This implementation does not use XPath. More... | |
static Object | Eval (string expression) |
Evaluates a Java expression to a class member using mxCodecRegistry. The range of supported expressions is limited to static class members such as mxEdgeStyle.ElbowConnector. More... | |
static String | HtmlEntities (String text) |
Converts the ampersand, quote, prime, less-than and greater-than characters to their corresponding HTML entities in the given string. More... | |
static string | GetXml (XmlNode node) |
Returns a string that represents the given node. More... | |
static string | GetPrettyXml (XmlNode node) |
Returns a pretty-printed XML string for the given node. More... | |
static string | GetXml (XmlNode node, Formatting formatting) |
Returns a pretty-printed XML string for the given node. More... | |
Contains various helper methods for use with mxGraph.
|
inline |
Adds the specified stylename to the given style if it does not already contain the stylename.
style | |
stylename |
|
inlinestatic |
Converts the given arc to a series of curves.
x0 | |
y0 | |
r1 | |
r2 | |
angle | |
largeArcFlag | |
sweepFlag | |
x | |
y |
Referenced by com.mxgraph.mxStencil.DrawElement().
|
inlinestatic |
Returns a new, empty DOM document.
Referenced by com.mxgraph.mxCodec.mxCodec().
|
inlinestatic |
Creates an image for the given parameters.
width | |
height | |
background |
Referenced by com.mxgraph.mxImageCanvas.mxImageCanvas().
|
inlinestatic |
Evaluates a Java expression to a class member using mxCodecRegistry. The range of supported expressions is limited to static class members such as mxEdgeStyle.ElbowConnector.
expression |
References com.mxgraph.mxCodecRegistry.GetTypeForName().
Referenced by com.mxgraph.mxStylesheetCodec.Decode(), com.mxgraph.mxGraphView.GetEdgeStyle(), and com.mxgraph.mxGraphView.GetPerimeterFunction().
|
inlinestatic |
g | |
brush | |
x | |
y | |
width | |
height |
|
inlinestatic |
Returns the first node where attr equals value. This implementation does not use XPath.
|
inlinestatic |
Returns the bounding box of the rotated rectangle.
References com.mxgraph.mxRectangle.Add(), com.mxgraph.mxRectangle.Height, com.mxgraph.mxRectangle.Width, com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.
Referenced by com.mxgraph.mxGraphView.UpdateBoundingBox().
|
inlinestatic |
Returns the value for key in dictionary as a color or null if no value is defined for the key.
dict | Dictionary that contains the key, value pairs. |
key | Key whose value should be returned. |
Referenced by com.mxgraph.mxGdiCanvas.DrawLine(), com.mxgraph.mxGdiCanvas.DrawShape(), and com.mxgraph.mxGdiCanvas.DrawText().
|
inlinestatic |
Returns the value for key in dictionary as a color or the given default value if no value is defined for the key.
dict | Dictionary that contains the key, value pairs. |
key | Key whose value should be returned. |
defaultValue | Default value to return if the key is undefined. |
|
inlinestatic |
Returns the value for key in dictionary as a double or 0 if no value is defined for the key.
dict | Dictionary that contains the key, value pairs. |
key | Key whose value should be returned. |
Referenced by com.mxgraph.mxGraphViewImageReader.CreateCanvas(), com.mxgraph.mxGdiCanvas.DrawCell(), com.mxgraph.mxStencil.DrawShape(), com.mxgraph.mxGraph.GetConnectionConstraint(), com.mxgraph.mxUtils.GetLabelPaintBounds(), com.mxgraph.mxGraphView.GetPerimeterBounds(), com.mxgraph.mxGraph.HitsSwimlaneContent(), com.mxgraph.mxStencil.PaintShape(), com.mxgraph.mxGraphViewReader.ParseElement(), com.mxgraph.mxGraphViewReader.ParseState(), com.mxgraph.mxGraphView.UpdateBoundingBox(), and com.mxgraph.mxGraphView.UpdateFloatingTerminalPoint().
|
inlinestatic |
Returns the value for key in dictionary as a double or the given default value if no value is defined for the key.
dict | Dictionary that contains the key, value pairs. |
key | Key whose value should be returned. |
defaultValue | Default value to return if the key is undefined. |
|
inlinestatic |
Returns the value for key in dictionary as a float or 0 if no value is defined for the key.
dict | Dictionary that contains the key, value pairs. |
key | Key whose value should be returned. |
Referenced by com.mxgraph.mxGdiCanvas.DrawCell(), com.mxgraph.mxGdiCanvas.DrawGlassEffect(), com.mxgraph.mxGdiCanvas.DrawLine(), com.mxgraph.mxGdiCanvas.DrawShape(), com.mxgraph.mxGdiCanvas.DrawText(), com.mxgraph.mxGraphView.GetRoutingCenterX(), and com.mxgraph.mxGraphView.GetRoutingCenterY().
|
inlinestatic |
Returns the value for key in dictionary as a float or the given default value if no value is defined for the key.
dict | Dictionary that contains the key, value pairs. |
key | Key whose value should be returned. |
defaultValue | Default value to return if the key is undefined. |
|
inlinestatic |
|
inlinestatic |
style | |
scale |
References com.mxgraph.mxConstants.DEFAULT_FONTFAMILY, com.mxgraph.mxConstants.DEFAULT_FONTSIZE, com.mxgraph.mxConstants.FONT_BOLD, com.mxgraph.mxConstants.FONT_ITALIC, com.mxgraph.mxConstants.FONT_SIZEFACTOR, com.mxgraph.mxConstants.FONT_UNDERLINE, com.mxgraph.mxConstants.STYLE_FONTFAMILY, com.mxgraph.mxConstants.STYLE_FONTSIZE, and com.mxgraph.mxConstants.STYLE_FONTSTYLE.
|
inlinestatic |
Returns the value for key in dictionary as an int or 0 if no value is defined for the key.
dict | Dictionary that contains the key, value pairs. |
key | Key whose value should be returned. |
Referenced by com.mxgraph.mxGdiCanvas.DrawShape(), and com.mxgraph.mxGraphView.UpdateBoundingBox().
|
inlinestatic |
Returns the value for key in dictionary as an int or the given default value if no value is defined for the key.
dict | Dictionary that contains the key, value pairs. |
key | Key whose value should be returned. |
defaultValue | Default value to return if the key is undefined. |
|
inlinestatic |
Returns the paint bounds for the given label.
References com.mxgraph.mxConstants.DEFAULT_STARTSIZE, com.mxgraph.mxRectangle.Equals(), com.mxgraph.mxUtils.GetDouble(), com.mxgraph.mxUtils.GetLabelSize(), com.mxgraph.mxUtils.GetScaledLabelBounds(), com.mxgraph.mxUtils.GetString(), com.mxgraph.mxRectangle.Height, com.mxgraph.mxUtils.IsTrue(), com.mxgraph.mxConstants.SHAPE_SWIMLANE, com.mxgraph.mxConstants.STYLE_HORIZONTAL, com.mxgraph.mxConstants.STYLE_SHAPE, com.mxgraph.mxConstants.STYLE_STARTSIZE, com.mxgraph.mxConstants.STYLE_WHITE_SPACE, com.mxgraph.mxRectangle.Width, com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.
Referenced by com.mxgraph.mxGraphViewReader.ParseState(), and com.mxgraph.mxGraphView.UpdateLabelBounds().
|
inlinestatic |
Returns the size of the given label.
Referenced by com.mxgraph.mxUtils.GetLabelPaintBounds().
|
inlinestatic |
Returns the Md5 hash for the given text.
text | String whose Md5 hash should be returned. |
|
inlinestatic |
Returns a pretty-printed XML string for the given node.
node | Node to return the XML for. |
|
inlinestatic |
Rotates the given point by the given cos and sin.
Referenced by com.mxgraph.mxStencil.DrawShadow().
|
inlinestatic |
Rotates the given point by the given cos and sin.
References com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.
|
inlinestatic |
Returns the bounds for a label for the given location and size, taking into account the alignment and spacing in the specified style, as well as the width and height of the rectangle that contains the label. (For edge labels this width and height is 0.) The scale is used to scale the given size and the spacings in the specified style.
References com.mxgraph.mxConstants.ALIGN_BOTTOM, com.mxgraph.mxConstants.ALIGN_CENTER, com.mxgraph.mxConstants.ALIGN_LEFT, com.mxgraph.mxConstants.ALIGN_MIDDLE, com.mxgraph.mxConstants.ALIGN_RIGHT, com.mxgraph.mxRectangle.Height, com.mxgraph.mxConstants.LABEL_INSET, com.mxgraph.mxConstants.STYLE_ALIGN, com.mxgraph.mxConstants.STYLE_HORIZONTAL, com.mxgraph.mxConstants.STYLE_SPACING, com.mxgraph.mxConstants.STYLE_SPACING_BOTTOM, com.mxgraph.mxConstants.STYLE_SPACING_LEFT, com.mxgraph.mxConstants.STYLE_SPACING_RIGHT, com.mxgraph.mxConstants.STYLE_SPACING_TOP, com.mxgraph.mxConstants.STYLE_VERTICAL_ALIGN, and com.mxgraph.mxRectangle.Width.
Referenced by com.mxgraph.mxUtils.GetLabelPaintBounds().
|
inlinestatic |
Returns the size of the given text.
text | String whose size should be returned. |
font | Specifies the font that should be used. |
|
inlinestatic |
Returns an mxRectangle with the size (width and height in pixels) of the given text.
text | String whose size should be returned. |
font | Specifies the font that should be used. |
width | Specifies the width of the text block for word wrapping. |
|
inlinestatic |
Returns the value for key in dictionary as a string or null if no value is defined for the key.
dict | Dictionary that contains the key, value pairs. |
key | Key whose value should be returned. |
Referenced by com.mxgraph.mxGdiCanvas.DrawCell(), com.mxgraph.mxGdiCanvas.DrawLine(), com.mxgraph.mxGdiCanvas.DrawShape(), com.mxgraph.mxStencil.DrawShape(), com.mxgraph.mxGraph.DrawState(), com.mxgraph.mxBasicCanvas.GetImageForStyle(), com.mxgraph.mxUtils.GetLabelPaintBounds(), com.mxgraph.mxUtils.GetStringFormat(), com.mxgraph.mxGraphView.GetTerminalPort(), com.mxgraph.mxGraph.IsSwimlane(), com.mxgraph.mxStencil.PaintShape(), com.mxgraph.mxGraphViewReader.ParseState(), com.mxgraph.mxGraph.PostProcessCellStyle(), com.mxgraph.mxGraphView.UpdateBoundingBox(), com.mxgraph.mxGraphView.UpdateLabelBounds(), and com.mxgraph.mxGraphView.UpdateVertexLabelOffset().
|
inlinestatic |
Returns the value for key in dictionary as a string or the given default value if no value is defined for the key.
dict | Dictionary that contains the key, value pairs. |
key | Key whose value should be returned. |
defaultValue | Default value to return if the key is undefined. |
|
inlinestatic |
Creates a new StringFormat object for the given style.
style |
References com.mxgraph.mxConstants.ALIGN_BOTTOM, com.mxgraph.mxConstants.ALIGN_CENTER, com.mxgraph.mxConstants.ALIGN_LEFT, com.mxgraph.mxConstants.ALIGN_MIDDLE, com.mxgraph.mxConstants.ALIGN_RIGHT, com.mxgraph.mxConstants.ALIGN_TOP, com.mxgraph.mxUtils.GetString(), com.mxgraph.mxConstants.STYLE_ALIGN, com.mxgraph.mxConstants.STYLE_VERTICAL_ALIGN, and com.mxgraph.mxConstants.STYLE_WHITE_SPACE.
Referenced by com.mxgraph.mxGdiCanvas.DrawText().
|
inlinestatic |
Returns the stylename in a style of the form stylename[;key=value] or an empty string if the given style does not contain a stylename.
style | String of the form stylename[;key=value]. |
|
inlinestatic |
Returns the stylenames in a style of the form stylename[;key=value] or an empty array if the given style does not contain any stylenames.
style | String of the form stylename[;stylename][;key=value]. |
|
inlinestatic |
Returns a string that represents the given node.
node | Node to return the XML for. |
|
inlinestatic |
Returns a pretty-printed XML string for the given node.
node | Node to return the XML for. |
formatting | Formatting of the string to be returned. |
|
inlinestatic |
Converts the ampersand, quote, prime, less-than and greater-than characters to their corresponding HTML entities in the given string.
text |
|
inlinestatic |
Returns the index of the given stylename in the given style. This returns -1 if the given stylename does not occur (as a stylename) in the given style, otherwise it returns the index of the first character.
style | |
stylename |
|
inlinestatic |
Returns the intersection of two lines as an mxPoint.
x0 | X-coordinate of the first line's startpoint. |
y0 | Y-coordinate of the first line's startpoint. |
x1 | X-coordinate of the first line's endpoint. |
y1 | Y-coordinate of the first line's endpoint. |
x2 | X-coordinate of the second line's startpoint. |
y2 | Y-coordinate of the second line's startpoint. |
x3 | X-coordinate of the second line's endpoint. |
y3 | Y-coordinate of the second line's endpoint. |
|
inlinestatic |
Returns true if the given value is an XML node with the specified nodename. specified.
value | Object that represents the value to be tested. |
nodeName | String that specifies the node name. |
|
inlinestatic |
Returns true if the user object is an XML node with the specified type and and the optional attribute has the specified value or is not specified.
value | Object that represents the value to be tested. |
nodeName | String that specifies the node name. |
attributeName | Optional attribute name to check. |
attributeValue | Optional attribute value to check. |
|
inlinestatic |
Returns true if the dictionary contains true for the given key or false if no value is defined for the key.
dict | Dictionary that contains the key, value pairs. |
key | Key whose value should be returned. |
Referenced by com.mxgraph.mxGdiCanvas.DrawCell(), com.mxgraph.mxGdiCanvas.DrawLine(), com.mxgraph.mxGdiCanvas.DrawShape(), com.mxgraph.mxGdiCanvas.DrawText(), com.mxgraph.mxGraph.GetConnectionConstraint(), com.mxgraph.mxGraphView.GetEdgeStyle(), com.mxgraph.mxGraph.GetLabel(), com.mxgraph.mxUtils.GetLabelPaintBounds(), com.mxgraph.mxGraph.HitsSwimlaneContent(), com.mxgraph.mxGraph.IsOrthogonal(), com.mxgraph.mxStencil.PaintShape(), com.mxgraph.mxGraphViewReader.ParseState(), and com.mxgraph.mxGraphView.UpdateBoundingBox().
|
inlinestatic |
Returns true if the dictionary contains true for the given key or the given default value if no value is defined for the key.
dict | Dictionary that contains the key, value pairs. |
key | Key whose value should be returned. |
defaultValue | Default value to return if the key is undefined. |
|
inlinestatic |
Returns a new DOM document for the given URI.
uri | URI to parse into the document. |
Referenced by com.mxgraph.mxObjectCodec.ProcessInclude().
|
inlinestatic |
Loads an image from the local filesystem, a data URI or any other URL.
Referenced by com.mxgraph.mxGdiCanvas.LoadImage(), and com.mxgraph.mxGdiCanvas2D.LoadImage().
|
inlinestatic |
Returns a document that represents the given XML string.
xml | String that contains the XML markup. |
|
inlinestatic |
Reads the given filename into a string.
filename | Name of the file to be read. |
|
inlinestatic |
Removes all stylenames from the given style and returns the updated style.
style |
|
inline |
Removes all occurrences of the specified stylename in the given style and returns the updated style.
style | |
stylename |
|
inlinestatic |
Sets or toggles the flag bit for the given key in the cell's styles. If value is null then the flag is toggled.
model | Model that contains the cells. |
cells | Array of cells to change the style for. |
key | Key of the style to be changed. |
flag | Integer for the bit to be changed. |
value | Optional boolean value for the flag. |
References com.mxgraph.mxIGraphModel.BeginUpdate(), com.mxgraph.mxIGraphModel.EndUpdate(), com.mxgraph.mxIGraphModel.GetStyle(), and com.mxgraph.mxIGraphModel.SetStyle().
|
inlinestatic |
Assigns the value for the given key in the styles of the given cells, or removes the key from the styles if the value is null.
model | Model to execute the transaction in. |
cells | Array of cells to be updated. |
key | Key of the style to be changed. |
value | New value for the given key. |
References com.mxgraph.mxIGraphModel.BeginUpdate(), com.mxgraph.mxIGraphModel.EndUpdate(), com.mxgraph.mxIGraphModel.GetStyle(), and com.mxgraph.mxIGraphModel.SetStyle().
Referenced by com.mxgraph.mxGraph.SetCellStyles().
|
inlinestatic |
Adds or removes the given key, value pair to the style and returns the new style. If value is null or zero length then the key is removed from the style.
style | String of the form stylename[;key=value]. |
key | Key of the style to be changed. |
value | New value for the given key. |
|
inlinestatic |
Sets or removes the given key from the specified style and returns the new style. If value is null then the flag is toggled.
style | String of the form stylename[;key=value]. |
key | Key of the style to be changed. |
flag | Integer for the bit to be changed. |
value | Optional boolean value for the given flag. |
|
inlinestatic |
Converts the given degree to radians.
|
inlinestatic |
Creates a new list of new points obtained by translating the points in the given list by the given vector. Elements that are not mxPoints are added to the result as-is.
pts | |
dx | |
dy |
References com.mxgraph.mxPoint.Clone(), com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.