home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 3.0 KB | 112 lines |
- // OrientPanel.java
- // 16.03.96
- //
- // the orientation screen
-
- package cybcerone.orient;
-
- import java.util.Vector;
- import java.awt.Color;
-
- import cybcerone.utils.Appletlike;
- import cybcerone.utils.SuperPanel;
- import cybcerone.utils.Mapable;
- import cybcerone.utils.MapInfoPanel;
-
- /**
- * The mapping module.
- */
- public class OrientPanel extends SuperPanel {
- public static final String id = "orient";
- public static final String imagePath = "orientation/";
- public static final String dataPath = "orientation/";
-
- private static final String statusText = "";
- private static final String bgFile = imagePath + "fond_preorientation.gif";
- private static final String dataFile = dataPath + "liste";
-
- private static OrientMap theMap;
- private static OrientZoom theZoom;
- private static OrientLegend theLegend;
- private static OrientPhotos thePhotos;
- private static OrientDesc theDesc;
- private static MapInfoPanel theInfo;
-
- private Maplikes theMaps;
- private static final String defaultMap = "BFSH2_2";
- private static final String errorMap = "RGL";
-
- public OrientPanel (Appletlike app) {
- super (id, statusText, app);
- setBackground (Color.black);
-
- add (new OrientIcon (this));
- add (theMap = new OrientMap (this));
- add (theZoom = new OrientZoom (this));
- add (theLegend = new OrientLegend (this));
- add (thePhotos = new OrientPhotos (this));
- add (theDesc = new OrientDesc (this));
-
- getData (dataFile, new NodeMap (this, imagePath), this);
- }
-
- public void update (Object updateVal) {
- if (updateVal instanceof Maplike) {
- update ((Maplike)updateVal);
- } if (updateVal instanceof Zone) {
- update ((Zone)updateVal);
- } else
- super.update (updateVal);
- }
-
- /** Done loading */
- public void update (Vector theMaps) {
- this.theMaps = new Maplikes (theMaps);
- theMap.setMaps (this.theMaps);
- reset ();
- }
-
- public void reset () {
- update (defaultMap);
- }
-
- public void update (String newMapName) {
- if (theMaps != null) {
- Maplike newMap = theMaps.findMap (newMapName);
- if (newMap == null)
- newMap = theMaps.findMap (errorMap);
- update (newMap);
- }
- }
-
- public void update (Maplike newMap) {
- theMap.update (newMap);
- theZoom.update (newMap);
- theLegend.update (newMap);
- thePhotos.update (newMap);
- theDesc.update (newMap);
- }
-
- /* find the map containing this zone, update with that and then
- * highlight this zone */
- public void update (Zone newZone) {
- Maplike oldMap = theMaps.findMap (newZone.getName ());
- update (oldMap.getParent ());
- theMap.update (newZone);
- }
-
- public void update (Mapable selected) {
- if (theInfo != null)
- remove (theInfo);
- if (theMaps != null) {
- Maplike newMap = theMaps.findMap (selected.getMapName ());
- if (newMap == null)
- newMap = theMaps.findMap (errorMap);
- update (newMap);
- add (theInfo = selected.getMapInfoPanel (this));
- if (selected.getZoneName () != null)
- theMap.update (newMap.find (selected.getZoneName ()));
- }
- }
- }
-