MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / toShape

Method toShape

ij/src/main/java/ij/gui/Plot.java:879–930  ·  view source on GitHub ↗

Returns the number for a given plot symbol shape, -1 for xError and -2 for yError (all case-insensitive)

(String str)

Source from the content-addressed store, hash-verified

877
878 /** Returns the number for a given plot symbol shape, -1 for xError and -2 for yError (all case-insensitive) */
879 @AstroImageJ(reason = "Custom plot shape", modified = true)
880 public static int toShape(String str) {
881 str = str.toLowerCase(Locale.US);
882 int shape = Plot.CIRCLE;
883 if (str.contains("curve") || str.contains("line"))
884 shape = Plot.LINE;
885 else if (str.contains("connected"))
886 shape = Plot.CONNECTED_CIRCLES;
887 else if (str.contains("filled"))
888 shape = Plot.FILLED;
889 else if (str.contains("circle"))
890 shape = Plot.CIRCLE;
891 else if (str.contains("box"))
892 shape = Plot.BOX;
893 else if (str.contains("triangle"))
894 shape = Plot.TRIANGLE;
895 else if (str.contains("cross") || str.contains("+"))
896 shape = Plot.CROSS;
897 else if (str.contains("diamond"))
898 shape = Plot.DIAMOND;
899 else if (str.contains("dot"))
900 shape = Plot.DOT;
901 else if (str.contains("xerror"))
902 shape = -2;
903 else if (str.contains("error"))
904 shape = -1;
905 else if (str.contains("x"))
906 shape = Plot.X;
907 else if (str.contains("separate"))
908 shape = Plot.SEPARATED_BAR;
909 else if (str.contains("bar"))
910 shape = Plot.BAR;
911 else if (str.contains("arrow_down"))
912 shape = ARROW_DOWN;
913 else if (str.contains("arrow_up"))
914 shape = ARROW_UP;
915 else if (str.contains("arrow_left"))
916 shape = ARROW_LEFT;
917 else if (str.contains("arrow_right"))
918 shape = ARROW_RIGHT;
919 else if (str.contains("arrow_se"))
920 shape = ARROW_SOUTH_EAST;
921 else if (str.contains("arrow_sw"))
922 shape = ARROW_SOUTH_WEST;
923 else if (str.contains("arrow_ne"))
924 shape = ARROW_NORTH_EAST;
925 else if (str.contains("arrow_nw"))
926 shape = ARROW_NORTH_WEST;
927 if (str.startsWith("code:"))
928 shape = CUSTOM;
929 return shape;
930 }
931
932 /** Adds a set of points to the plot using double ArrayLists.
933 * Must be called before the plot is displayed. */

Callers 4

addToPlotMethod · 0.95
addMethod · 0.95
setPlotObjectStyleMethod · 0.95
addObjectFromTableMethod · 0.95

Calls 2

startsWithMethod · 0.80
containsMethod · 0.45

Tested by

no test coverage detected