13.5.1.1-2 baseline
Former-commit-id: 9638b9e92c2d271cb804d32daba114c063aeb7f5
This commit is contained in:
parent
5b0cd7cbcc
commit
4fa273439f
11 changed files with 233 additions and 271 deletions
|
@ -28,24 +28,39 @@
|
|||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 07/25/08 njensen Initial Creation.
|
||||
#
|
||||
# 09/05/13 #2329 randerso Added error handling
|
||||
#
|
||||
#
|
||||
|
||||
import sys
|
||||
import sys, traceback, os, time, LogStream
|
||||
from java.util import ArrayList
|
||||
|
||||
def getCombinations(comboName):
|
||||
outercombos = ArrayList()
|
||||
cmd = "md = __import__(\"" + comboName + "\")"
|
||||
exec cmd
|
||||
comList = md.Combinations
|
||||
for i in comList:
|
||||
combos = ArrayList()
|
||||
innerList = i[0]
|
||||
for zone in innerList:
|
||||
combos.add(zone)
|
||||
outercombos.add(combos)
|
||||
return outercombos
|
||||
try:
|
||||
outercombos = ArrayList()
|
||||
md = __import__(comboName)
|
||||
comList = md.Combinations
|
||||
for i in comList:
|
||||
combos = ArrayList()
|
||||
innerList = i[0]
|
||||
for zone in innerList:
|
||||
combos.add(zone)
|
||||
outercombos.add(combos)
|
||||
return outercombos
|
||||
|
||||
except AttributeError as e:
|
||||
filename = md.__file__
|
||||
if filename.endswith("pyc") or filename.endswith("pyo"):
|
||||
filename = filename[:-1]
|
||||
with open(filename,'r') as fd:
|
||||
filecontents = fd.read()
|
||||
|
||||
LogStream.logProblem("\nERROR loading combinations file: "+ comboName +
|
||||
"\nmd.__file__: " + md.__file__ +
|
||||
"\ndir(md): " + str(dir(md)) +
|
||||
"\n" + md.__file__ + " last modified: " + time.strftime("%Y-%m-%d %H:%M:%S",time.gmtime(os.path.getmtime(md.__file__))) +
|
||||
"\n" + filename + " last modified: " + time.strftime("%Y-%m-%d %H:%M:%S",time.gmtime(os.path.getmtime(filename))) +
|
||||
"\nContents of " + filename + "\n" + filecontents)
|
||||
raise e
|
||||
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@ import com.raytheon.viz.gfe.textformatter.TextProductManager;
|
|||
* 26 SEP 2012 15423 ryu Fix product correction in practice mode
|
||||
* 15 MAY 2013 1842 dgilling Change constructor signature to accept a
|
||||
* DataManager instance.
|
||||
* 05 SEP 2013 2329 randerso Added call to ZoneCombinerComp.applyZoneCombo when
|
||||
* when run formatter button is clicked.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -386,12 +388,12 @@ public class ProductAreaComp extends Composite implements
|
|||
// use
|
||||
// it, else use the default
|
||||
String dbId = null;
|
||||
// zoneCombinerComp.compactList();
|
||||
zoneCombiner.applyZoneCombo();
|
||||
dbId = ((FormatterLauncherDialog) productTabCB)
|
||||
.getSelectedDataSource(productName);
|
||||
FormatterUtil.runFormatterScript(textProductMgr,
|
||||
productName, zoneCombiner.getZoneGroupings(),
|
||||
dbId, vtecMode, ProductAreaComp.this);
|
||||
productName, dbId, vtecMode,
|
||||
ProductAreaComp.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -22,16 +22,12 @@ package com.raytheon.viz.gfe.dialogs.formatterlauncher;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
@ -61,6 +57,7 @@ import org.opengis.referencing.FactoryException;
|
|||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException;
|
||||
import com.raytheon.uf.common.localization.FileUpdatedMessage;
|
||||
import com.raytheon.uf.common.localization.FileUpdatedMessage.FileChangeType;
|
||||
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
|
||||
|
@ -70,21 +67,17 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
|
|||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
import com.raytheon.uf.common.util.file.FilenameFilters;
|
||||
import com.raytheon.uf.viz.core.RGBColors;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.gfe.Activator;
|
||||
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
|
||||
import com.raytheon.viz.gfe.textformatter.CombinationsFileGenerator;
|
||||
import com.raytheon.viz.gfe.textformatter.CombinationsFileUtil;
|
||||
import com.raytheon.viz.gfe.textformatter.TextProductManager;
|
||||
import com.raytheon.viz.gfe.ui.AccessMgr;
|
||||
import com.raytheon.viz.gfe.ui.zoneselector.ZoneSelector;
|
||||
|
||||
/**
|
||||
|
@ -100,8 +93,9 @@ import com.raytheon.viz.gfe.ui.zoneselector.ZoneSelector;
|
|||
* Changes for non-blocking SaveDeleteComboDlg.
|
||||
* Changes for non-blocking ShuffleZoneGroupsDialog.
|
||||
* Changes for non-blocking ZoneColorEditorDlg.
|
||||
*
|
||||
* Mar 14, 2013 1794 djohnson Consolidate common FilenameFilter implementations.
|
||||
* Sep 05, 2013 2329 randerso Removed obsolete methods, added ApplyZoneCombo method
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -307,6 +301,8 @@ public class ZoneCombinerComp extends Composite implements
|
|||
createMapArea(theSaved);
|
||||
|
||||
createBottomControls();
|
||||
|
||||
applyButtonState(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -455,6 +451,7 @@ public class ZoneCombinerComp extends Composite implements
|
|||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
zoneSelector.updateCombos(new HashMap<String, Integer>());
|
||||
applyButtonState(false);
|
||||
}
|
||||
});
|
||||
clearMI.setText("Clear");
|
||||
|
@ -731,14 +728,7 @@ public class ZoneCombinerComp extends Composite implements
|
|||
applyZoneComboBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
try {
|
||||
CombinationsFileGenerator.generateAutoCombinationsFile(
|
||||
zoneSelector.getZoneGroupings(),
|
||||
getCombinationsFileName() + ".py");
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Unable to save "
|
||||
+ getCombinationsFileName(), e);
|
||||
}
|
||||
applyZoneCombo();
|
||||
}
|
||||
});
|
||||
Label label = new Label(controlComp, SWT.CENTER);
|
||||
|
@ -754,6 +744,25 @@ public class ZoneCombinerComp extends Composite implements
|
|||
label.setAlignment(SWT.CENTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save zone combo
|
||||
*/
|
||||
public void applyZoneCombo() {
|
||||
if (!buttonState()) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
CombinationsFileUtil.generateAutoCombinationsFile(
|
||||
zoneSelector.getZoneGroupings(), getCombinationsFileName()
|
||||
+ ".py");
|
||||
applyButtonState(false);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Unable to save "
|
||||
+ getCombinationsFileName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the Color Editor dialog.
|
||||
*/
|
||||
|
@ -845,93 +854,6 @@ public class ZoneCombinerComp extends Composite implements
|
|||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the names of the combo files at the given level. If level is null,
|
||||
* get the names of the combo files at all levels. Otherwise, only get the
|
||||
* names of the files at the given level.
|
||||
*
|
||||
* @param level
|
||||
* @return the save combo files at the given level
|
||||
*/
|
||||
public String[] getSavedCombos(LocalizationLevel level) {
|
||||
String comboDirName = "saved";
|
||||
String[] combos;
|
||||
File localFile;
|
||||
// Accept any file whose name ends with ".py".
|
||||
FilenameFilter filter = FilenameFilters.byFileExtension(".py");
|
||||
|
||||
if (level == null) {
|
||||
// Aggregate the filenames for all levels.
|
||||
// Use a set to keep names unique.
|
||||
Set<String> comboSet = new TreeSet<String>();
|
||||
LocalizationLevel[] levels = PathManagerFactory.getPathManager()
|
||||
.getAvailableLevels();
|
||||
for (int i = levels.length - 1; i >= 0; --i) {
|
||||
localFile = getLocalization(comboDirName, levels[i]);
|
||||
if ((localFile != null) && localFile.exists()) {
|
||||
comboSet.addAll(Arrays.asList(localFile.list(filter)));
|
||||
}
|
||||
}
|
||||
|
||||
combos = comboSet.toArray(new String[0]);
|
||||
} else {
|
||||
// Get only the filenames for USER level.
|
||||
localFile = getLocalization(comboDirName);
|
||||
combos = localFile.list(filter);
|
||||
}
|
||||
return combos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the combinations file called filename if it is in list or
|
||||
* filename.py is in list, and return the loaded file as a List of Lists of
|
||||
* Strings.
|
||||
*
|
||||
* @param list
|
||||
* The list of valid filenames
|
||||
* @param filename
|
||||
* The filename to load
|
||||
* @return the contents of the file, as a List of Lists of Strings.
|
||||
*/
|
||||
// public List<List<String>> findCombos(String[] list, String filename) {
|
||||
// List<List<String>> listOfCombos = null;
|
||||
// for (int i = 0; i < list.length; i++) {
|
||||
// if (list[i].equals(filename) || list[i].equals(filename + ".py")) {
|
||||
// listOfCombos = loadCombinationsFile(filename);
|
||||
// }
|
||||
// }
|
||||
// return listOfCombos;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Deletes the saved file chosen
|
||||
*
|
||||
* @param name
|
||||
* the combo file name
|
||||
* @throws LocalizationOpFailedException
|
||||
* if the server copy of the file cannot be deleted
|
||||
*/
|
||||
public void deleteSavedCombos(String name)
|
||||
throws LocalizationOpFailedException {
|
||||
String searchName = FileUtil.join(CombinationsFileUtil.COMBO_DIR_PATH,
|
||||
"saved", name + ".py");
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext userContext = pm.getContext(
|
||||
LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
|
||||
LocalizationFile userFile = pm.getLocalizationFile(userContext,
|
||||
searchName);
|
||||
|
||||
if (AccessMgr.verifyDelete(userFile.getName(),
|
||||
LocalizationType.CAVE_STATIC, false)) {
|
||||
if (userFile.isAvailableOnServer()) {
|
||||
userFile.delete();
|
||||
} else if (userFile.exists()) {
|
||||
File localFile = userFile.getFile();
|
||||
localFile.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the localization for the save and delete functions. This is a
|
||||
* wrapper around getLocalization(String, level).
|
||||
|
@ -987,34 +909,40 @@ public class ZoneCombinerComp extends Composite implements
|
|||
}
|
||||
|
||||
public Map<String, Integer> loadCombinationsFile(String comboName) {
|
||||
List<List<String>> combolist = new ArrayList<List<String>>();
|
||||
File localFile = PathManagerFactory.getPathManager().getStaticFile(
|
||||
FileUtil.join(CombinationsFileUtil.COMBO_DIR_PATH, comboName
|
||||
+ ".py"));
|
||||
if (localFile != null) {
|
||||
combolist = CombinationsFileUtil.init(comboName);
|
||||
}
|
||||
|
||||
// reformat combinations into combo dictionary
|
||||
Map<String, Integer> d = new HashMap<String, Integer>();
|
||||
Map<String, Integer> dict = new HashMap<String, Integer>();
|
||||
try {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext ctx = pm.getContext(
|
||||
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
|
||||
File localFile = pm.getFile(ctx, FileUtil.join(
|
||||
CombinationsFileUtil.COMBO_DIR_PATH, comboName + ".py"));
|
||||
|
||||
List<List<String>> combolist = new ArrayList<List<String>>();
|
||||
if (localFile != null && localFile.exists()) {
|
||||
combolist = CombinationsFileUtil.init(comboName);
|
||||
} else {
|
||||
statusHandler.error("Combinations file does not found: "
|
||||
+ comboName);
|
||||
}
|
||||
|
||||
// reformat combinations into combo dictionary
|
||||
int group = 1;
|
||||
for (List<String> zonelist : combolist) {
|
||||
for (String z : zonelist) {
|
||||
d.put(z, group);
|
||||
dict.put(z, group);
|
||||
}
|
||||
group += 1;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.SIGNIFICANT,
|
||||
"Combo file is not in combo format: " + comboName);
|
||||
} catch (GfeException e) {
|
||||
statusHandler.handle(Priority.SIGNIFICANT, e.getLocalizedMessage(),
|
||||
e);
|
||||
return new HashMap<String, Integer>();
|
||||
}
|
||||
|
||||
currentComboFile = FileUtil.join(CombinationsFileUtil.COMBO_DIR_PATH,
|
||||
comboName + ".py");
|
||||
|
||||
return d;
|
||||
return dict;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1060,11 +988,12 @@ public class ZoneCombinerComp extends Composite implements
|
|||
&& message.getFileName().equalsIgnoreCase(currentComboFile)) {
|
||||
File file = new File(message.getFileName());
|
||||
String comboName = file.getName().replace(".py", "");
|
||||
if (file.getParent().endsWith("saved")) {
|
||||
comboName = FileUtil.join("saved", comboName);
|
||||
}
|
||||
statusHandler
|
||||
.info("Received FileUpdatedMessage for combinations file: "
|
||||
+ comboName);
|
||||
Map<String, Integer> comboDict = loadCombinationsFile(comboName);
|
||||
this.zoneSelector.updateCombos(comboDict);
|
||||
applyButtonState(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1085,4 +1014,20 @@ public class ZoneCombinerComp extends Composite implements
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
private boolean buttonState() {
|
||||
final boolean[] state = { false };
|
||||
if (this.applyZoneComboBtn != null
|
||||
&& !this.applyZoneComboBtn.isDisposed()) {
|
||||
VizApp.runSync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
state[0] = ZoneCombinerComp.this.applyZoneComboBtn
|
||||
.isEnabled();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return state[0];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Creating the combinations file for the TextFormatter
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
*6/12/2008 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1
|
||||
*/
|
||||
package com.raytheon.viz.gfe.textformatter;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.SaveCombinationsFileRequest;
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
import com.raytheon.viz.gfe.core.internal.IFPClient;
|
||||
|
||||
public class CombinationsFileGenerator {
|
||||
|
||||
/**
|
||||
* Generates combinations files based on just running the formatter
|
||||
*
|
||||
* @param zoneGroupList
|
||||
* @param filename
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void generateAutoCombinationsFile(
|
||||
List<List<String>> zoneGroupList, String filename) throws Exception {
|
||||
generateCombinationsFile(zoneGroupList, filename, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates combinations files based on user wanting to save
|
||||
*
|
||||
* @param zoneGroupList
|
||||
* @param filename
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void generateSavedCombinationsFile(
|
||||
List<List<String>> zoneGroupList, String filename) throws Exception {
|
||||
|
||||
if (filename.endsWith(".py")) {
|
||||
generateCombinationsFile(zoneGroupList, filename, "saved"
|
||||
+ File.separator);
|
||||
} else {
|
||||
generateCombinationsFile(zoneGroupList, filename + ".py", "saved"
|
||||
+ File.separator);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by both auto and saved functions to actually write file
|
||||
*
|
||||
* @param zoneGroupList
|
||||
* @param filename
|
||||
* @param loc
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void generateCombinationsFile(
|
||||
List<List<String>> zoneGroupList, String filename, String loc)
|
||||
throws Exception {
|
||||
IFPClient ifpc = DataManager.getCurrentInstance().getClient();
|
||||
SaveCombinationsFileRequest req = new SaveCombinationsFileRequest();
|
||||
req.setFileName(FileUtil.join(loc, filename));
|
||||
req.setCombos(zoneGroupList);
|
||||
ifpc.makeRequest(req);
|
||||
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext ctx = pm.getContext(LocalizationType.CAVE_STATIC,
|
||||
LocalizationLevel.SITE);
|
||||
pm.getFile(ctx, FileUtil.join("gfe", "combinations", filename));
|
||||
}
|
||||
}
|
|
@ -20,6 +20,7 @@
|
|||
package com.raytheon.viz.gfe.textformatter;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -33,7 +34,9 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
|
||||
import jep.JepException;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.request.SaveCombinationsFileRequest;
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
|
@ -49,8 +52,9 @@ import com.raytheon.uf.common.serialization.SerializationException;
|
|||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
|
||||
import com.raytheon.viz.gfe.core.internal.IFPClient;
|
||||
import com.raytheon.viz.gfe.textformatter.CombinationsFileUtil.ComboData.Entry;
|
||||
|
||||
/**
|
||||
|
@ -60,7 +64,10 @@ import com.raytheon.viz.gfe.textformatter.CombinationsFileUtil.ComboData.Entry;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 25, 2008 mnash Initial creation
|
||||
* Jul 25, 2008 mnash Initial creation
|
||||
* Sep 05, 2013 #2329 randerso Moved genereateAutoCombinationsFile here
|
||||
* Cleaned up error handling
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
|
@ -200,7 +207,7 @@ public class CombinationsFileUtil {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static List<List<String>> init(String comboName) {
|
||||
public static List<List<String>> init(String comboName) throws GfeException {
|
||||
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
|
||||
|
@ -211,7 +218,6 @@ public class CombinationsFileUtil {
|
|||
File comboFile = new File(comboName);
|
||||
comboName = comboFile.getName();
|
||||
|
||||
String comboPath = GfePyIncludeUtil.getCombinationsIncludePath();
|
||||
String scriptPath = FileUtil.join(
|
||||
GfePyIncludeUtil.getUtilitiesLF(baseContext).getFile()
|
||||
.getPath(), "CombinationsInterface.py");
|
||||
|
@ -221,13 +227,15 @@ public class CombinationsFileUtil {
|
|||
map.put("comboName", comboName);
|
||||
PythonScript python = null;
|
||||
try {
|
||||
python = new PythonScript(scriptPath,
|
||||
PyUtil.buildJepIncludePath(comboPath));
|
||||
python = new PythonScript(scriptPath, PyUtil.buildJepIncludePath(
|
||||
GfePyIncludeUtil.getCombinationsIncludePath(),
|
||||
GfePyIncludeUtil.getCommonPythonIncludePath()),
|
||||
CombinationsFileUtil.class.getClassLoader());
|
||||
Object com = python.execute("getCombinations", map);
|
||||
combos = (List<List<String>>) com;
|
||||
} catch (JepException e) {
|
||||
statusHandler.handle(Priority.CRITICAL,
|
||||
"Could not get combinations", e);
|
||||
throw new GfeException("Error loading combinations file: "
|
||||
+ comboName, e);
|
||||
} finally {
|
||||
if (python != null) {
|
||||
python.dispose();
|
||||
|
@ -235,4 +243,30 @@ public class CombinationsFileUtil {
|
|||
}
|
||||
return combos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates combinations files based on just running the formatter
|
||||
*
|
||||
* @param zoneGroupList
|
||||
* @param filename
|
||||
* @throws Exception
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void generateAutoCombinationsFile(
|
||||
List<List<String>> zoneGroupList, String filename) throws Exception {
|
||||
IFPClient ifpc = DataManagerUIFactory.getCurrentInstance().getClient();
|
||||
SaveCombinationsFileRequest req = new SaveCombinationsFileRequest();
|
||||
req.setFileName(filename);
|
||||
req.setCombos(zoneGroupList);
|
||||
try {
|
||||
statusHandler.info("Saving combinations file: " + filename);
|
||||
ifpc.makeRequest(req);
|
||||
statusHandler.info("Successfully saved combinations file: "
|
||||
+ filename);
|
||||
} catch (Exception e) {
|
||||
statusHandler.error("Error saving combinations file: " + filename,
|
||||
e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package com.raytheon.viz.gfe.textformatter;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
|
@ -40,8 +39,9 @@ import com.raytheon.viz.gfe.tasks.TaskManager;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 8, 2008 njensen Initial creation
|
||||
* Jan 15, 2010 3395 ryu Fix "issued by" functionality
|
||||
* Sep 8, 2008 njensen Initial creation
|
||||
* Jan 15, 2010 3395 ryu Fix "issued by" functionality
|
||||
* Sep 05, 2013 2329 randerso Removed save of combinations file
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -63,21 +63,20 @@ public class FormatterUtil {
|
|||
* the formatter instance to use
|
||||
* @param productName
|
||||
* the name of the text product
|
||||
* @param zoneList
|
||||
* the list of zones to produce the product for
|
||||
* @param dbId
|
||||
* source database
|
||||
* @param vtecMode
|
||||
* VTEC mode
|
||||
* @param finish
|
||||
* listener to fire when formatter finishes generating product
|
||||
*/
|
||||
public static void runFormatterScript(TextProductManager productMgr,
|
||||
String productName, List<List<String>> zoneList, String dbId,
|
||||
String vtecMode, TextProductFinishListener finish) {
|
||||
String productName, String dbId, String vtecMode,
|
||||
TextProductFinishListener finish) {
|
||||
try {
|
||||
String filename = productMgr.getCombinationsFileName(productName);
|
||||
boolean mapRequired = productMgr.mapRequired(productName);
|
||||
if (filename != null && mapRequired) {
|
||||
String filenameExt = filename + ".py";
|
||||
CombinationsFileGenerator.generateAutoCombinationsFile(
|
||||
zoneList, filenameExt);
|
||||
productMgr.reloadModule(filename);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<extension
|
||||
point="org.eclipse.ui.menus">
|
||||
<menuContribution
|
||||
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
|
||||
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=d2d-3">
|
||||
<toolbar
|
||||
id="plugins">
|
||||
<command
|
||||
|
|
|
@ -144,6 +144,7 @@ import com.vividsolutions.jts.geom.Polygon;
|
|||
* Jul 16, 2013 DR 16387 Qinglu Lin Reset totalSegments for each followup product.
|
||||
* Jul 29, 2013 DR 16352 D. Friedman Move 'result' to okPressed().
|
||||
* Aug 6, 2013 2243 jsanchez Refreshed the follow up list every minute.
|
||||
* Sep 4, 2013 DR 16496 Qinglu Lin Fixed warning area expandable issue occurred after re-clicking on CON option.
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
|
@ -1431,6 +1432,8 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
* Redraw everything based on warned area
|
||||
*/
|
||||
private void redrawFromWarned() {
|
||||
warngenLayer.assignSavedWarningPolygon();
|
||||
warngenLayer.setPolygonState(false);
|
||||
try {
|
||||
warngenLayer.redrawBoxFromHatched();
|
||||
} catch (VizException e) {
|
||||
|
@ -1457,6 +1460,11 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
return;
|
||||
}
|
||||
|
||||
warngenLayer.setEquivalentString("");
|
||||
warngenLayer.setPolygonState(false);
|
||||
warngenLayer.setBoxEditable(true);
|
||||
warngenLayer.setWarningAction(WarningAction.valueOf(""));
|
||||
|
||||
String lastAreaSource = warngenLayer.getConfiguration()
|
||||
.getHatchedAreaSource().getAreaSource();
|
||||
|
||||
|
@ -1602,12 +1610,24 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
* item from update list selected
|
||||
*/
|
||||
public void updateListSelected() {
|
||||
warngenLayer.setOldWarningPolygon(null);
|
||||
FollowupData data = null;
|
||||
if (updateListCbo != null) {
|
||||
data = (FollowupData) updateListCbo.getData(updateListCbo
|
||||
.getItem(updateListCbo.getSelectionIndex()));
|
||||
if (data != null) {
|
||||
String s = data.getEquvialentString();
|
||||
if (!s.equals(warngenLayer.getEquivalentString())) {
|
||||
warngenLayer.setEquivalentString(s);
|
||||
warngenLayer.setPolygonState(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (warngenLayer.getPolygonState()) {
|
||||
return;
|
||||
}
|
||||
if (updateListCbo.getSelectionIndex() >= 0) {
|
||||
warngenLayer.setOldWarningPolygon(null);
|
||||
AbstractWarningRecord oldWarning = null;
|
||||
FollowupData data = (FollowupData) updateListCbo
|
||||
.getData(updateListCbo.getItem(updateListCbo
|
||||
.getSelectionIndex()));
|
||||
Mode currMode = warngenLayer.getStormTrackState().mode;
|
||||
if (data != null) {
|
||||
// does not refesh if user selected already highlighted option
|
||||
|
@ -1622,9 +1642,12 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
.getEquvialentString());
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
warngenLayer.setPolygonState(false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
warngenLayer.setOldWarningPolygon(null);
|
||||
if (warngenLayer.state.followupData != null) {
|
||||
// Sets the updatelist with the last selected vtec option
|
||||
for (int i = 0; i < updateListCbo.getItemCount(); i++) {
|
||||
|
@ -1643,6 +1666,7 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
return;
|
||||
}
|
||||
}
|
||||
warngenLayer.setOldWarningPolygon(null);
|
||||
if (currMode == Mode.DRAG_ME) {
|
||||
warngenLayer.setLastMode(Mode.TRACK);
|
||||
warngenLayer.getStormTrackState().mode = Mode.TRACK;
|
||||
|
@ -1658,6 +1682,15 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
totalSegments = 0;
|
||||
warngenLayer.getStormTrackState().endTime = null;
|
||||
WarningAction action = WarningAction.valueOf(data.getAct());
|
||||
|
||||
if (warngenLayer.isBoxEditable()) {
|
||||
if (action == WarningAction.CAN || action == WarningAction.COR
|
||||
|| action == WarningAction.EXT
|
||||
|| action == WarningAction.EXP) {
|
||||
warngenLayer.setPolygonState(false);
|
||||
}
|
||||
}
|
||||
|
||||
warngenLayer.setWarningAction(action);
|
||||
if (action == WarningAction.CON) {
|
||||
oldWarning = conSelected(data);
|
||||
|
@ -2196,6 +2229,11 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
shell.moveAbove(getParent());
|
||||
}
|
||||
}
|
||||
String action = warngenLayer.getEquivalentString();
|
||||
if (action.contains("CAN-") || action.contains("COR-")
|
||||
|| action.contains("EXT-") || action.contains("EXP-")) {
|
||||
warngenLayer.setBoxEditable(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void otherSelected() {
|
||||
|
|
|
@ -185,6 +185,7 @@ import com.vividsolutions.jts.io.WKTReader;
|
|||
* 07/26/2013 DR 16376 Qinglu Lin Moved adjustVertex() and computeSlope() to PolygonUtil; removed calculateDistance();
|
||||
* updated AreaHatcher's run().
|
||||
* 07/26/2013 DR 16450 D. Friedman Fix logic errors when frame count is one.
|
||||
* 09/04/2013 DR 16496 Qinglu Lin Fixed CAN polygon editable issue occurred after swapping out and in.
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
|
@ -196,6 +197,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
.getHandler(WarngenLayer.class);
|
||||
|
||||
String uniqueFip = null;
|
||||
private boolean polygonChanged = false;
|
||||
private String equivalentString = "";
|
||||
private Polygon savedWarningPolygon;
|
||||
|
||||
private static class GeospatialDataList {
|
||||
|
||||
|
@ -482,7 +486,11 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
public synchronized void hatchArea(Polygon warningPolygon,
|
||||
Geometry warningArea, Polygon oldWarningPolygon) {
|
||||
synchronized (polygonUtil) {
|
||||
this.warningPolygon = warningPolygon;
|
||||
savedWarningPolygon = warningPolygon;
|
||||
if (warningAction != WarningAction.CON ||
|
||||
(warningAction == WarningAction.CON && getPolygonState())) {
|
||||
this.warningPolygon = warningPolygon;
|
||||
}
|
||||
this.warningArea = warningArea;
|
||||
this.oldWarningPolygon = oldWarningPolygon;
|
||||
}
|
||||
|
@ -3089,4 +3097,28 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public WarningAction getWarningAction() {
|
||||
return warningAction;
|
||||
}
|
||||
|
||||
public void setPolygonState(boolean b) {
|
||||
polygonChanged = b;
|
||||
}
|
||||
|
||||
public boolean getPolygonState() {
|
||||
return polygonChanged;
|
||||
}
|
||||
|
||||
public void setEquivalentString(String s) {
|
||||
equivalentString = s;
|
||||
}
|
||||
|
||||
public String getEquivalentString() {
|
||||
return equivalentString;
|
||||
}
|
||||
|
||||
public void assignSavedWarningPolygon() {
|
||||
this.areaHatcher.warningPolygon = savedWarningPolygon;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,8 @@ import com.vividsolutions.jts.geom.Polygon;
|
|||
* when c2 is null for "case SINGLE_POINT" in move().
|
||||
* Mar 28, 2013 DR 15974 D. Friedman Do not track removed GIDs.
|
||||
* Jun 25, 2013 DR 16013 Qinglu Lin Called setUniqueFip() in handleMouseUp().
|
||||
* Sep 4, 2013 DR 16496 Qinglu Lin Fixed warning area expandable issue which occurs after re-clicking on
|
||||
* a CON option.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -137,6 +139,10 @@ public class WarngenUIManager extends InputAdapter {
|
|||
if (!handleInput || warngenLayer.isBoxEditable() == false) {
|
||||
return super.handleMouseDown(x, y, button);
|
||||
}
|
||||
if (warngenLayer.getWarningAction() == WarningAction.CON &&
|
||||
!warngenLayer.getPolygonState()) {
|
||||
warngenLayer.setPolygonState(true);
|
||||
}
|
||||
boolean rval = false;
|
||||
if (button == 1 && moveType != null) {
|
||||
return true;
|
||||
|
|
|
@ -56,7 +56,6 @@ typedef void CEdexNotification;
|
|||
#include "NotificationProtocol.h"
|
||||
|
||||
using namespace qpid::messaging;
|
||||
using namespace qpid::framing;
|
||||
using namespace std;
|
||||
using apache::thrift::transport::TMemoryBuffer;
|
||||
using boost::shared_ptr;
|
||||
|
|
Loading…
Add table
Reference in a new issue