@@ -1150,7 +1150,50 @@ public void actionPerformed(ActionEvent e) {
1150
1150
};
1151
1151
copy .putValue (AbstractAction .SMALL_ICON , new ImageIcon (ImageUtils .getImage ("images/menus/editcopy.png" )));
1152
1152
popup .add (copy );
1153
-
1153
+
1154
+ if (planElem .getPlan () != null && !planElem .getPlan ().isEmpty ()) {
1155
+ AbstractAction focusPlan = new AbstractAction (I18n .text ("Focus plan" )) {
1156
+ @ Override
1157
+ public void actionPerformed (ActionEvent e ) {
1158
+ if (planElem .getPlan () == null || planElem .getPlan ().isEmpty ())
1159
+ return ;
1160
+
1161
+ Maneuver [] mansList = planElem .getPlan ().getGraph ().getAllManeuvers ();
1162
+ if (mansList .length == 0 )
1163
+ return ;
1164
+
1165
+ double nlat = 0 , slat = 0 ;
1166
+ double wlon = 0 , elon = 0 ;
1167
+
1168
+ for (Maneuver man : mansList ) {
1169
+ if (man instanceof LocatedManeuver ) {
1170
+ Collection <ManeuverLocation > wpslst = ((LocatedManeuver ) man ).getWaypoints ();
1171
+ for (ManeuverLocation wp : wpslst ) {
1172
+ if (wp .getLatitudeDegs () == 0 && wp .getLongitudeDegs () == 0 )
1173
+ continue ;
1174
+ LocationType absll = wp .getNewAbsoluteLatLonDepth ();
1175
+ if (nlat == 0 || absll .getLatitudeDegs () > nlat )
1176
+ nlat = absll .getLatitudeDegs ();
1177
+ if (slat == 0 || absll .getLatitudeDegs () < slat )
1178
+ slat = absll .getLatitudeDegs ();
1179
+ if (wlon == 0 || absll .getLongitudeDegs () < wlon )
1180
+ wlon = absll .getLongitudeDegs ();
1181
+ if (elon == 0 || absll .getLongitudeDegs () > elon )
1182
+ elon = absll .getLongitudeDegs ();
1183
+ }
1184
+ }
1185
+ }
1186
+ double clat = (nlat + slat ) / 2.0 ;
1187
+ double clon = (wlon + elon ) / 2.0 ;
1188
+ renderer .setCenter (new LocationType (clat , clon ));
1189
+
1190
+ CoordinateUtil .copyToClipboard (renderer .getRealWorldLocation (mousePoint ));
1191
+ }
1192
+ };
1193
+ focusPlan .putValue (AbstractAction .SMALL_ICON , new ImageIcon (ImageUtils .getImage ("images/menus/zoom.png" )));
1194
+ popup .add (focusPlan );
1195
+ }
1196
+
1154
1197
JCheckBoxMenuItem showSim = new JCheckBoxMenuItem (I18n .text ("View Simulation" ));
1155
1198
showSim .setSelected (showSimulation );
1156
1199
0 commit comments