Returns only indexed and sorted plot objects, if at least one label is indexed like "1__MyLabel"
()
| 3972 | |
| 3973 | /** Returns only indexed and sorted plot objects, if at least one label is indexed like "1__MyLabel" */ |
| 3974 | @AstroImageJ(reason = "Access widen for Vector Plot saving", modified = true) |
| 3975 | public Vector<PlotObject> getIndexedPlotObjects(){ |
| 3976 | boolean withIndex = false; |
| 3977 | int len = allPlotObjects.size(); |
| 3978 | String[] labels = new String[len]; |
| 3979 | Vector<PlotObject> indexedObjects = new Vector<PlotObject>(); |
| 3980 | for(int jj = 0; jj < len; jj++){ |
| 3981 | PlotObject plotObject = allPlotObjects.get(jj); |
| 3982 | labels[jj] = ""; |
| 3983 | if (plotObject.type == PlotObject.XY_DATA && !plotObject.hasFlag(PlotObject.HIDDEN) && plotObject.label != null) { |
| 3984 | String label = plotObject.label; |
| 3985 | if(label.indexOf("__") >=0 && label.indexOf("__") <= 2){ |
| 3986 | labels[jj]= plotObject.label; |
| 3987 | withIndex = true; |
| 3988 | } |
| 3989 | } |
| 3990 | } |
| 3991 | int[] ranks = Tools.rank(labels); |
| 3992 | for(int jj = 0; jj < len; jj++){ |
| 3993 | if(labels[ranks[jj]] != ""){ |
| 3994 | int index = ranks[jj]; |
| 3995 | indexedObjects.add(allPlotObjects.get(index)); |
| 3996 | } |
| 3997 | } |
| 3998 | if(!withIndex) |
| 3999 | return null; |
| 4000 | return indexedObjects; |
| 4001 | } |
| 4002 | |
| 4003 | /** Draw the legend */ |
| 4004 | void drawLegend(PlotObject legendObject, ImageProcessor ip) { |