5555import org .scijava .service .Service ;
5656import org .scijava .tool .event .ToolActivatedEvent ;
5757import org .scijava .tool .event .ToolDeactivatedEvent ;
58- import org .scijava .util .RealCoords ;
5958
6059/**
6160 * Default service for keeping track of available tools, including which tool is
@@ -71,8 +70,6 @@ public class DefaultToolService extends AbstractSingletonService<Tool>
7170 implements ToolService
7271{
7372
74- private static final double SEPARATOR_DISTANCE = 10 ;
75-
7673 @ Parameter
7774 private EventService eventService ;
7875
@@ -96,17 +93,6 @@ public Tool getTool(final String name) {
9693 return tools ().get (name );
9794 }
9895
99- @ Override
100- public <T extends Tool > T getTool (final Class <T > toolClass ) {
101- for (final Tool tool : alwaysActiveToolList ()) {
102- if (toolClass .isInstance (tool )) return toolClass .cast (tool );
103- }
104- for (final Tool tool : toolList ()) {
105- if (toolClass .isInstance (tool )) return toolClass .cast (tool );
106- }
107- return null ;
108- }
109-
11096 @ Override
11197 public List <Tool > getTools () {
11298 return toolList ();
@@ -140,14 +126,6 @@ public void setActiveTool(final Tool activeTool) {
140126 eventService .publish (new ToolActivatedEvent (activeTool ));
141127 }
142128
143- @ Override
144- public boolean isSeparatorNeeded (final Tool tool1 , final Tool tool2 ) {
145- if (tool1 == null || tool2 == null ) return false ;
146- final double priority1 = tool1 .getInfo ().getPriority ();
147- final double priority2 = tool2 .getInfo ().getPriority ();
148- return Math .abs (priority1 - priority2 ) >= SEPARATOR_DISTANCE ;
149- }
150-
151129 @ Override
152130 public void reportRectangle (final double x , final double y , final double w ,
153131 final double h )
@@ -161,15 +139,6 @@ public void reportRectangle(final double x, final double y, final double w,
161139 fh );
162140 }
163141
164- @ Override
165- public void reportRectangle (final RealCoords p1 , final RealCoords p2 ) {
166- final double x = Math .min (p1 .x , p2 .x );
167- final double y = Math .min (p1 .y , p2 .y );
168- final double w = Math .abs (p2 .x - p1 .x );
169- final double h = Math .abs (p2 .y - p1 .y );
170- reportRectangle (x , y , w , h );
171- }
172-
173142 @ Override
174143 public void reportLine (final double x1 , final double y1 , final double x2 ,
175144 final double y2 )
@@ -193,11 +162,6 @@ public void reportLine(final double x1, final double y1, final double x2,
193162 ", length=" + fl );
194163 }
195164
196- @ Override
197- public void reportLine (final RealCoords p1 , final RealCoords p2 ) {
198- reportLine (p1 .x , p1 .y , p2 .x , p2 .y );
199- }
200-
201165 @ Override
202166 public void reportPoint (final double x , final double y ) {
203167 final DecimalFormat f = new DecimalFormat ("0.##" );
@@ -206,18 +170,6 @@ public void reportPoint(final double x, final double y) {
206170 statusService .showStatus ("x=" + fx + ", y=" + fy );
207171 }
208172
209- @ Override
210- public void reportPoint (final RealCoords p ) {
211- reportPoint (p .x , p .y );
212- }
213-
214- // -- PTService methods --
215-
216- @ Override
217- public Class <Tool > getPluginType () {
218- return Tool .class ;
219- }
220-
221173 // -- Event handlers --
222174
223175 @ EventHandler
0 commit comments