📄 scenariographicloader.java
字号:
+ name); } } catch (ClassCastException cce) { Object obj0 = record.elementAt(activityNameIndex); Object obj1 = record.elementAt(latIndex); Object obj2 = record.elementAt(lonIndex); Object obj3 = record.elementAt(timeIndex); Debug.error("ScenarioGraphicLoader(" + getName() + ") has problem with indexes in activity file for " + obj0 + " (" + obj0.getClass().getName() + ")" + ":\n\tlat index = " + latIndex + ", value = " + obj1 + " (" + obj1.getClass().getName() + ")\n\t lon index = " + lonIndex + ", value = " + obj2 + " (" + obj2.getClass().getName() + ")\n\t time index = " + timeIndex + ", value = " + obj3 + " (" + obj3.getClass().getName() + ")"); } catch (ParseException pe) { Debug.output("ScenarioGraphicLoader(" + getName() + ") has problem with time format. " + pe.getMessage()); } } } catch (MalformedURLException murle) { Debug.error("ScenarioGraphicLoader: problem with activity file: " + activityFile); return list; } catch (NullPointerException npe) { Debug.error("ScenarioGraphicLoader (" + getName() + ") null pointer exception, most likely a problem finding the activites data file"); } } else { Debug.error("ScenarioGraphicLoader(" + getName() + "): Activity file (" + activityFile + ") not configured."); return list; } this.time = startTime; Debug.message("scenario", "Reading files OK"); return list; } /** * The properties and prefix are managed and decoded here, for the * standard uses of the ScenarioGraphicLoader. * * @param prefix string prefix used in the properties file for * this layer. * @param properties the properties set in the properties file. */ public void setProperties(String prefix, Properties properties) { super.setProperties(prefix, properties); drawingAttributes.setProperties(prefix, properties); prefix = PropUtils.getScopedPropertyPrefix(prefix); locationFile = properties.getProperty(prefix + LocationFileProperty); iconIndex = PropUtils.intFromProperties(properties, prefix + IconIndexProperty, -1); nameIndex = PropUtils.intFromProperties(properties, prefix + NameIndexProperty, -1); activityNameIndex = PropUtils.intFromProperties(properties, prefix + ActivityNameIndexProperty, -1); activityFile = properties.getProperty(prefix + ActivityFileProperty); latIndex = PropUtils.intFromProperties(properties, prefix + LatIndexProperty, -1); lonIndex = PropUtils.intFromProperties(properties, prefix + LonIndexProperty, -1); timeIndex = PropUtils.intFromProperties(properties, prefix + TimeIndexProperty, -1); eastIsNeg = PropUtils.booleanFromProperties(properties, prefix + EastIsNegProperty, eastIsNeg); showNames = PropUtils.booleanFromProperties(properties, prefix + ShowNamesProperty, showNames); defaultIconURL = properties.getProperty(prefix + DefaultIconURLProperty); locationHeader = PropUtils.booleanFromProperties(properties, prefix + LocationHeaderProperty, false); activityHeader = PropUtils.booleanFromProperties(properties, prefix + ActivityHeaderProperty, false); String timeFormatString = properties.getProperty(prefix + TimeFormatProperty, ((SimpleDateFormat) timeFormat).toPattern()); timeFormat = new SimpleDateFormat(timeFormatString); String timerIntervalFormatString = properties.getProperty(prefix + TimerIntervalFormatProperty, ((SimpleDateFormat) timerIntervalFormat).toPattern()); timerPaceBaselineString = properties.getProperty(prefix + TimerPaceBaselineProperty, timerPaceBaselineString); timerIntervalFormat = new SimpleDateFormat(timerIntervalFormatString); if (Debug.debugging("scenario")) { Debug.output("ScenarioGraphicLoader timer rate pace pattern: " + timerIntervalFormatString); } String timerRatesString = properties.getProperty(prefix + TimerRatesProperty); timerRates = new LinkedList(); if (timerRatesString != null) { if (Debug.debugging("scenario")) { Debug.output("ScenarioGraphicLoader reading timer rates: " + timerRatesString); } Vector rates = PropUtils.parseSpacedMarkers(timerRatesString); Iterator it = rates.iterator(); while (it.hasNext()) { String ratePrefix = (String) it.next(); TimerRateHolder trh = new TimerRateHolder(timerIntervalFormat, timerPaceBaselineString); trh.setProperties(prefix + ratePrefix, properties); if (trh.valid) { timerRates.add(trh); if (Debug.debugging("scenario")) { Debug.output("ScenarioGraphicLoader adding " + trh); } } else { if (Debug.debugging("scenario")) { Debug.output("ScenarioGraphicLoader NOT adding " + ratePrefix); } } } } else { if (Debug.debugging("scenario")) { Debug.output("ScenarioGraphicLoader has no timer rate information"); } } if (Debug.debugging("scenario")) { Debug.output("ScenarioGraphicLoader indexes:" + "\n\tlocation file: " + locationFile + "\n\tlocation file has header: " + locationHeader + "\n\tnameIndex = " + nameIndex + "\n\ticonIndex = " + iconIndex + "\n\tactivity file: " + activityFile + "\n\tactivity file has header: " + activityHeader + "\n\tlatIndex = " + latIndex + "\n\tlonIndex = " + lonIndex + "\n\ttimeIndex = " + timeIndex); } } /** * PropertyConsumer method, to fill in a Properties object, * reflecting the current values of the layer. If the layer has a * propertyPrefix set, the property keys should have that prefix * plus a separating '.' prepended to each propery key it uses for * configuration. * * @param props a Properties object to load the PropertyConsumer * properties into. * @return Properties object containing PropertyConsumer property * values. If getList was not null, this should equal * getList. Otherwise, it should be the Properties object * created by the PropertyConsumer. */ public Properties getProperties(Properties props) { props = super.getProperties(props); String prefix = PropUtils.getScopedPropertyPrefix(this); props.put(prefix + LocationFileProperty, PropUtils.unnull(locationFile)); props.put(prefix + LocationHeaderProperty, new Boolean(locationHeader).toString()); props.put(prefix + NameIndexProperty, (nameIndex != -1 ? Integer.toString(nameIndex) : "")); props.put(prefix + ActivityFileProperty, PropUtils.unnull(activityFile)); props.put(prefix + ActivityHeaderProperty, new Boolean(activityHeader).toString()); props.put(prefix + ActivityNameIndexProperty, (activityNameIndex != -1 ? Integer.toString(activityNameIndex) : "")); props.put(prefix + EastIsNegProperty, new Boolean(eastIsNeg).toString()); props.put(prefix + ShowNamesProperty, new Boolean(showNames).toString()); props.put(prefix + LatIndexProperty, (latIndex != -1 ? Integer.toString(latIndex) : "")); props.put(prefix + LonIndexProperty, (lonIndex != -1 ? Integer.toString(lonIndex) : "")); props.put(prefix + TimeIndexProperty, (timeIndex != -1 ? Integer.toString(timeIndex) : "")); props.put(prefix + IconIndexProperty, (iconIndex != -1 ? Integer.toString(iconIndex) : "")); props.put(prefix + DefaultIconURLProperty, PropUtils.unnull(defaultIconURL)); drawingAttributes.getProperties(props); return props; } /** * Method to fill in a Properties object with values reflecting * the properties able to be set on this PropertyConsumer. The key * for each property should be the raw property name (without a * prefix) with a value that is a String that describes what the * property key represents, along with any other information about * the property that would be helpful (range, default value, * etc.). This method takes care of the basic LocationHandler * parameters, so any LocationHandlers that extend the * AbstractLocationHandler should call this method, too, before * adding any specific properties. * * @param list a Properties object to load the PropertyConsumer * properties into. If getList equals null, then a new * Properties object should be created. * @return Properties object containing PropertyConsumer property * values. If getList was not null, this should equal * getList. Otherwise, it should be the Properties object * created by the PropertyConsumer. */ public Properties getPropertyInfo(Properties list) { list = super.getPropertyInfo(list); list.put(LocationFileProperty, "URL of file containing location information."); list.put(LocationFileProperty + ScopedEditorProperty, "com.bbn.openmap.util.propertyEditor.FUPropertyEditor"); list.put(LocationHeaderProperty, "Location file has a header row to be ignored."); list.put(LocationHeaderProperty + ScopedEditorProperty, "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor"); list.put(ActivityFileProperty, "URL of file containing scenario activity information."); list.put(ActivityFileProperty + ScopedEditorProperty, "com.bbn.openmap.util.propertyEditor.FUPropertyEditor"); list.put(ActivityHeaderProperty, "Activity file has a header row to be ignored."); list.put(ActivityHeaderProperty + ScopedEditorProperty, "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor"); list.put(EastIsNegProperty, "Flag to note that negative latitude are over the eastern hemisphere."); list.put(EastIsNegProperty + ScopedEditorProperty, "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor"); list.put(ShowNamesProperty, "Flag to note that locations should display their names."); list.put(ShowNamesProperty + ScopedEditorProperty, "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor"); list.put(NameIndexProperty, "The column index, in the location file, of the location label text."); list.put(ActivityNameIndexProperty, "The column index, in the activity file, of the location label text."); list.put(LatIndexProperty, "The column index, in the activity file, of the latitudes."); list.put(LonIndexProperty, "The column index, in the activity file, of the longitudes."); list.put(TimeIndexProperty, "The column index, in the activity file, of the time of the activity."); list.put(IconIndexProperty, "The column index, in the location file, of the icon for locations (optional)."); list.put(DefaultIconURLProperty, "The URL of an image file to use as a default for the location markers (optional)."); drawingAttributes.getPropertyInfo(list); return list; } // /** // * Tool Method. The retrieval tool's interface. This is added to // the // * tool bar. // * // * @return String The key for this tool. // */ // public Container getFace() { // JToolBar jtb = new JToolBar(); // jtb.setFloatable(false); // // TimerToggleButton ttb = new TimerToggleButton(this); // // ttb.setToolTipText("Start/Stop Scenario Timer"); // // jtb.add(ttb); // // pcs.addPropertyChangeListener(TIMER_RUNNING_STATUS, ttb); // try { // URL url = PropUtils.getResourceOrFileOrURL(this, // snapshotIconName); // ImageIcon snapshotIcon = new ImageIcon(url); // url = PropUtils.getResourceOrFileOrURL(this, // totalScenarioIconName); // ImageIcon totalScenarioIcon = new ImageIcon(url); // timeWrapToggle = new JToggleButton(totalScenarioIcon, // timeWrap); // timeWrapToggle.setSelectedIcon(snapshotIcon); // timeWrapToggle.setActionCommand(SCENARIO_MODE_CMD); // timeWrapToggle.addActionListener(this); // timeWrapToggle.setToolTipText("Wrap Scenario Time Scale"); // jtb.add(timeWrapToggle);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -