13.5.1.1-2 baseline

Former-commit-id: e19db57fe6 [formerly 9638b9e92c2d271cb804d32daba114c063aeb7f5]
Former-commit-id: 4fa273439f
This commit is contained in:
Steve Harris 2013-09-16 10:02:04 -04:00
parent b1fb0f9236
commit db270db3cb
11 changed files with 233 additions and 271 deletions

View file

@ -28,17 +28,17 @@
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 07/25/08 njensen Initial Creation. # 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 from java.util import ArrayList
def getCombinations(comboName): def getCombinations(comboName):
try:
outercombos = ArrayList() outercombos = ArrayList()
cmd = "md = __import__(\"" + comboName + "\")" md = __import__(comboName)
exec cmd
comList = md.Combinations comList = md.Combinations
for i in comList: for i in comList:
combos = ArrayList() combos = ArrayList()
@ -48,4 +48,19 @@ def getCombinations(comboName):
outercombos.add(combos) outercombos.add(combos)
return outercombos 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

View file

@ -61,6 +61,8 @@ import com.raytheon.viz.gfe.textformatter.TextProductManager;
* 26 SEP 2012 15423 ryu Fix product correction in practice mode * 26 SEP 2012 15423 ryu Fix product correction in practice mode
* 15 MAY 2013 1842 dgilling Change constructor signature to accept a * 15 MAY 2013 1842 dgilling Change constructor signature to accept a
* DataManager instance. * DataManager instance.
* 05 SEP 2013 2329 randerso Added call to ZoneCombinerComp.applyZoneCombo when
* when run formatter button is clicked.
* *
* </pre> * </pre>
* *
@ -386,12 +388,12 @@ public class ProductAreaComp extends Composite implements
// use // use
// it, else use the default // it, else use the default
String dbId = null; String dbId = null;
// zoneCombinerComp.compactList(); zoneCombiner.applyZoneCombo();
dbId = ((FormatterLauncherDialog) productTabCB) dbId = ((FormatterLauncherDialog) productTabCB)
.getSelectedDataSource(productName); .getSelectedDataSource(productName);
FormatterUtil.runFormatterScript(textProductMgr, FormatterUtil.runFormatterScript(textProductMgr,
productName, zoneCombiner.getZoneGroupings(), productName, dbId, vtecMode,
dbId, vtecMode, ProductAreaComp.this); ProductAreaComp.this);
} }
} }
}); });

View file

@ -22,16 +22,12 @@ package com.raytheon.viz.gfe.dialogs.formatterlauncher;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.FilenameFilter;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.IPreferenceStore;
@ -61,6 +57,7 @@ import org.opengis.referencing.FactoryException;
import org.opengis.referencing.operation.TransformException; import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation; 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;
import com.raytheon.uf.common.localization.FileUpdatedMessage.FileChangeType; import com.raytheon.uf.common.localization.FileUpdatedMessage.FileChangeType;
import com.raytheon.uf.common.localization.ILocalizationFileObserver; 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.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory; 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.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.FileUtil; 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.RGBColors;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.gfe.Activator; import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.core.DataManagerUIFactory; 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.CombinationsFileUtil;
import com.raytheon.viz.gfe.textformatter.TextProductManager; import com.raytheon.viz.gfe.textformatter.TextProductManager;
import com.raytheon.viz.gfe.ui.AccessMgr;
import com.raytheon.viz.gfe.ui.zoneselector.ZoneSelector; 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 SaveDeleteComboDlg.
* Changes for non-blocking ShuffleZoneGroupsDialog. * Changes for non-blocking ShuffleZoneGroupsDialog.
* Changes for non-blocking ZoneColorEditorDlg. * Changes for non-blocking ZoneColorEditorDlg.
*
* Mar 14, 2013 1794 djohnson Consolidate common FilenameFilter implementations. * Mar 14, 2013 1794 djohnson Consolidate common FilenameFilter implementations.
* Sep 05, 2013 2329 randerso Removed obsolete methods, added ApplyZoneCombo method
*
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -307,6 +301,8 @@ public class ZoneCombinerComp extends Composite implements
createMapArea(theSaved); createMapArea(theSaved);
createBottomControls(); createBottomControls();
applyButtonState(false);
} }
/** /**
@ -455,6 +451,7 @@ public class ZoneCombinerComp extends Composite implements
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
zoneSelector.updateCombos(new HashMap<String, Integer>()); zoneSelector.updateCombos(new HashMap<String, Integer>());
applyButtonState(false);
} }
}); });
clearMI.setText("Clear"); clearMI.setText("Clear");
@ -731,14 +728,7 @@ public class ZoneCombinerComp extends Composite implements
applyZoneComboBtn.addSelectionListener(new SelectionAdapter() { applyZoneComboBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
try { applyZoneCombo();
CombinationsFileGenerator.generateAutoCombinationsFile(
zoneSelector.getZoneGroupings(),
getCombinationsFileName() + ".py");
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, "Unable to save "
+ getCombinationsFileName(), e);
}
} }
}); });
Label label = new Label(controlComp, SWT.CENTER); Label label = new Label(controlComp, SWT.CENTER);
@ -754,6 +744,25 @@ public class ZoneCombinerComp extends Composite implements
label.setAlignment(SWT.CENTER); 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. * Display the Color Editor dialog.
*/ */
@ -845,93 +854,6 @@ public class ZoneCombinerComp extends Composite implements
return file; 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 * Returns the localization for the save and delete functions. This is a
* wrapper around getLocalization(String, level). * wrapper around getLocalization(String, level).
@ -987,34 +909,40 @@ public class ZoneCombinerComp extends Composite implements
} }
public Map<String, Integer> loadCombinationsFile(String comboName) { public Map<String, Integer> loadCombinationsFile(String comboName) {
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>>(); List<List<String>> combolist = new ArrayList<List<String>>();
File localFile = PathManagerFactory.getPathManager().getStaticFile( if (localFile != null && localFile.exists()) {
FileUtil.join(CombinationsFileUtil.COMBO_DIR_PATH, comboName
+ ".py"));
if (localFile != null) {
combolist = CombinationsFileUtil.init(comboName); combolist = CombinationsFileUtil.init(comboName);
} else {
statusHandler.error("Combinations file does not found: "
+ comboName);
} }
// reformat combinations into combo dictionary // reformat combinations into combo dictionary
Map<String, Integer> d = new HashMap<String, Integer>();
try {
int group = 1; int group = 1;
for (List<String> zonelist : combolist) { for (List<String> zonelist : combolist) {
for (String z : zonelist) { for (String z : zonelist) {
d.put(z, group); dict.put(z, group);
} }
group += 1; group += 1;
} }
} catch (Exception e) { } catch (GfeException e) {
statusHandler.handle(Priority.SIGNIFICANT, statusHandler.handle(Priority.SIGNIFICANT, e.getLocalizedMessage(),
"Combo file is not in combo format: " + comboName); e);
return new HashMap<String, Integer>(); return new HashMap<String, Integer>();
} }
currentComboFile = FileUtil.join(CombinationsFileUtil.COMBO_DIR_PATH, currentComboFile = FileUtil.join(CombinationsFileUtil.COMBO_DIR_PATH,
comboName + ".py"); comboName + ".py");
return d; return dict;
} }
/** /**
@ -1060,11 +988,12 @@ public class ZoneCombinerComp extends Composite implements
&& message.getFileName().equalsIgnoreCase(currentComboFile)) { && message.getFileName().equalsIgnoreCase(currentComboFile)) {
File file = new File(message.getFileName()); File file = new File(message.getFileName());
String comboName = file.getName().replace(".py", ""); String comboName = file.getName().replace(".py", "");
if (file.getParent().endsWith("saved")) { statusHandler
comboName = FileUtil.join("saved", comboName); .info("Received FileUpdatedMessage for combinations file: "
} + comboName);
Map<String, Integer> comboDict = loadCombinationsFile(comboName); Map<String, Integer> comboDict = loadCombinationsFile(comboName);
this.zoneSelector.updateCombos(comboDict); 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];
}
} }

View file

@ -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));
}
}

View file

@ -20,6 +20,7 @@
package com.raytheon.viz.gfe.textformatter; package com.raytheon.viz.gfe.textformatter;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -33,7 +34,9 @@ import javax.xml.bind.annotation.XmlRootElement;
import jep.JepException; 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.python.GfePyIncludeUtil;
import com.raytheon.uf.common.dataplugin.gfe.request.SaveCombinationsFileRequest;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; 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.serialization.SerializationUtil;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; 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.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; import com.raytheon.viz.gfe.textformatter.CombinationsFileUtil.ComboData.Entry;
/** /**
@ -61,6 +65,9 @@ import com.raytheon.viz.gfe.textformatter.CombinationsFileUtil.ComboData.Entry;
* Date Ticket# Engineer Description * 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> * </pre>
* *
* @author mnash * @author mnash
@ -200,7 +207,7 @@ public class CombinationsFileUtil {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static List<List<String>> init(String comboName) { public static List<List<String>> init(String comboName) throws GfeException {
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
@ -211,7 +218,6 @@ public class CombinationsFileUtil {
File comboFile = new File(comboName); File comboFile = new File(comboName);
comboName = comboFile.getName(); comboName = comboFile.getName();
String comboPath = GfePyIncludeUtil.getCombinationsIncludePath();
String scriptPath = FileUtil.join( String scriptPath = FileUtil.join(
GfePyIncludeUtil.getUtilitiesLF(baseContext).getFile() GfePyIncludeUtil.getUtilitiesLF(baseContext).getFile()
.getPath(), "CombinationsInterface.py"); .getPath(), "CombinationsInterface.py");
@ -221,13 +227,15 @@ public class CombinationsFileUtil {
map.put("comboName", comboName); map.put("comboName", comboName);
PythonScript python = null; PythonScript python = null;
try { try {
python = new PythonScript(scriptPath, python = new PythonScript(scriptPath, PyUtil.buildJepIncludePath(
PyUtil.buildJepIncludePath(comboPath)); GfePyIncludeUtil.getCombinationsIncludePath(),
GfePyIncludeUtil.getCommonPythonIncludePath()),
CombinationsFileUtil.class.getClassLoader());
Object com = python.execute("getCombinations", map); Object com = python.execute("getCombinations", map);
combos = (List<List<String>>) com; combos = (List<List<String>>) com;
} catch (JepException e) { } catch (JepException e) {
statusHandler.handle(Priority.CRITICAL, throw new GfeException("Error loading combinations file: "
"Could not get combinations", e); + comboName, e);
} finally { } finally {
if (python != null) { if (python != null) {
python.dispose(); python.dispose();
@ -235,4 +243,30 @@ public class CombinationsFileUtil {
} }
return combos; 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;
}
}
} }

View file

@ -20,7 +20,6 @@
package com.raytheon.viz.gfe.textformatter; package com.raytheon.viz.gfe.textformatter;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.List;
import java.util.TimeZone; import java.util.TimeZone;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
@ -42,6 +41,7 @@ import com.raytheon.viz.gfe.tasks.TaskManager;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 8, 2008 njensen Initial creation * Sep 8, 2008 njensen Initial creation
* Jan 15, 2010 3395 ryu Fix &quot;issued by&quot; functionality * Jan 15, 2010 3395 ryu Fix &quot;issued by&quot; functionality
* Sep 05, 2013 2329 randerso Removed save of combinations file
* *
* </pre> * </pre>
* *
@ -63,21 +63,20 @@ public class FormatterUtil {
* the formatter instance to use * the formatter instance to use
* @param productName * @param productName
* the name of the text product * the name of the text product
* @param zoneList * @param dbId
* the list of zones to produce the product for * source database
* @param vtecMode
* VTEC mode
* @param finish * @param finish
* listener to fire when formatter finishes generating product * listener to fire when formatter finishes generating product
*/ */
public static void runFormatterScript(TextProductManager productMgr, public static void runFormatterScript(TextProductManager productMgr,
String productName, List<List<String>> zoneList, String dbId, String productName, String dbId, String vtecMode,
String vtecMode, TextProductFinishListener finish) { TextProductFinishListener finish) {
try { try {
String filename = productMgr.getCombinationsFileName(productName); String filename = productMgr.getCombinationsFileName(productName);
boolean mapRequired = productMgr.mapRequired(productName); boolean mapRequired = productMgr.mapRequired(productName);
if (filename != null && mapRequired) { if (filename != null && mapRequired) {
String filenameExt = filename + ".py";
CombinationsFileGenerator.generateAutoCombinationsFile(
zoneList, filenameExt);
productMgr.reloadModule(filename); productMgr.reloadModule(filename);
} }
} catch (Exception e) { } catch (Exception e) {

View file

@ -48,7 +48,7 @@
<extension <extension
point="org.eclipse.ui.menus"> point="org.eclipse.ui.menus">
<menuContribution <menuContribution
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions"> locationURI="toolbar:org.eclipse.ui.main.toolbar?after=d2d-3">
<toolbar <toolbar
id="plugins"> id="plugins">
<command <command

View file

@ -144,6 +144,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Jul 16, 2013 DR 16387 Qinglu Lin Reset totalSegments for each followup product. * Jul 16, 2013 DR 16387 Qinglu Lin Reset totalSegments for each followup product.
* Jul 29, 2013 DR 16352 D. Friedman Move 'result' to okPressed(). * Jul 29, 2013 DR 16352 D. Friedman Move 'result' to okPressed().
* Aug 6, 2013 2243 jsanchez Refreshed the follow up list every minute. * 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> * </pre>
* *
* @author chammack * @author chammack
@ -1431,6 +1432,8 @@ public class WarngenDialog extends CaveSWTDialog implements
* Redraw everything based on warned area * Redraw everything based on warned area
*/ */
private void redrawFromWarned() { private void redrawFromWarned() {
warngenLayer.assignSavedWarningPolygon();
warngenLayer.setPolygonState(false);
try { try {
warngenLayer.redrawBoxFromHatched(); warngenLayer.redrawBoxFromHatched();
} catch (VizException e) { } catch (VizException e) {
@ -1457,6 +1460,11 @@ public class WarngenDialog extends CaveSWTDialog implements
return; return;
} }
warngenLayer.setEquivalentString("");
warngenLayer.setPolygonState(false);
warngenLayer.setBoxEditable(true);
warngenLayer.setWarningAction(WarningAction.valueOf(""));
String lastAreaSource = warngenLayer.getConfiguration() String lastAreaSource = warngenLayer.getConfiguration()
.getHatchedAreaSource().getAreaSource(); .getHatchedAreaSource().getAreaSource();
@ -1602,12 +1610,24 @@ public class WarngenDialog extends CaveSWTDialog implements
* item from update list selected * item from update list selected
*/ */
public void updateListSelected() { 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) { if (updateListCbo.getSelectionIndex() >= 0) {
warngenLayer.setOldWarningPolygon(null);
AbstractWarningRecord oldWarning = null; AbstractWarningRecord oldWarning = null;
FollowupData data = (FollowupData) updateListCbo
.getData(updateListCbo.getItem(updateListCbo
.getSelectionIndex()));
Mode currMode = warngenLayer.getStormTrackState().mode; Mode currMode = warngenLayer.getStormTrackState().mode;
if (data != null) { if (data != null) {
// does not refesh if user selected already highlighted option // does not refesh if user selected already highlighted option
@ -1622,9 +1642,12 @@ public class WarngenDialog extends CaveSWTDialog implements
.getEquvialentString()); .getEquvialentString());
} }
return; return;
} else {
warngenLayer.setPolygonState(false);
} }
} }
} else { } else {
warngenLayer.setOldWarningPolygon(null);
if (warngenLayer.state.followupData != null) { if (warngenLayer.state.followupData != null) {
// Sets the updatelist with the last selected vtec option // Sets the updatelist with the last selected vtec option
for (int i = 0; i < updateListCbo.getItemCount(); i++) { for (int i = 0; i < updateListCbo.getItemCount(); i++) {
@ -1643,6 +1666,7 @@ public class WarngenDialog extends CaveSWTDialog implements
return; return;
} }
} }
warngenLayer.setOldWarningPolygon(null);
if (currMode == Mode.DRAG_ME) { if (currMode == Mode.DRAG_ME) {
warngenLayer.setLastMode(Mode.TRACK); warngenLayer.setLastMode(Mode.TRACK);
warngenLayer.getStormTrackState().mode = Mode.TRACK; warngenLayer.getStormTrackState().mode = Mode.TRACK;
@ -1658,6 +1682,15 @@ public class WarngenDialog extends CaveSWTDialog implements
totalSegments = 0; totalSegments = 0;
warngenLayer.getStormTrackState().endTime = null; warngenLayer.getStormTrackState().endTime = null;
WarningAction action = WarningAction.valueOf(data.getAct()); 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); warngenLayer.setWarningAction(action);
if (action == WarningAction.CON) { if (action == WarningAction.CON) {
oldWarning = conSelected(data); oldWarning = conSelected(data);
@ -2196,6 +2229,11 @@ public class WarngenDialog extends CaveSWTDialog implements
shell.moveAbove(getParent()); 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() { private void otherSelected() {

View file

@ -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(); * 07/26/2013 DR 16376 Qinglu Lin Moved adjustVertex() and computeSlope() to PolygonUtil; removed calculateDistance();
* updated AreaHatcher's run(). * updated AreaHatcher's run().
* 07/26/2013 DR 16450 D. Friedman Fix logic errors when frame count is one. * 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> * </pre>
* *
* @author mschenke * @author mschenke
@ -196,6 +197,9 @@ public class WarngenLayer extends AbstractStormTrackResource {
.getHandler(WarngenLayer.class); .getHandler(WarngenLayer.class);
String uniqueFip = null; String uniqueFip = null;
private boolean polygonChanged = false;
private String equivalentString = "";
private Polygon savedWarningPolygon;
private static class GeospatialDataList { private static class GeospatialDataList {
@ -482,7 +486,11 @@ public class WarngenLayer extends AbstractStormTrackResource {
public synchronized void hatchArea(Polygon warningPolygon, public synchronized void hatchArea(Polygon warningPolygon,
Geometry warningArea, Polygon oldWarningPolygon) { Geometry warningArea, Polygon oldWarningPolygon) {
synchronized (polygonUtil) { synchronized (polygonUtil) {
savedWarningPolygon = warningPolygon;
if (warningAction != WarningAction.CON ||
(warningAction == WarningAction.CON && getPolygonState())) {
this.warningPolygon = warningPolygon; this.warningPolygon = warningPolygon;
}
this.warningArea = warningArea; this.warningArea = warningArea;
this.oldWarningPolygon = oldWarningPolygon; 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;
}
} }

View file

@ -65,6 +65,8 @@ import com.vividsolutions.jts.geom.Polygon;
* when c2 is null for "case SINGLE_POINT" in move(). * when c2 is null for "case SINGLE_POINT" in move().
* Mar 28, 2013 DR 15974 D. Friedman Do not track removed GIDs. * Mar 28, 2013 DR 15974 D. Friedman Do not track removed GIDs.
* Jun 25, 2013 DR 16013 Qinglu Lin Called setUniqueFip() in handleMouseUp(). * 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> * </pre>
* *
@ -137,6 +139,10 @@ public class WarngenUIManager extends InputAdapter {
if (!handleInput || warngenLayer.isBoxEditable() == false) { if (!handleInput || warngenLayer.isBoxEditable() == false) {
return super.handleMouseDown(x, y, button); return super.handleMouseDown(x, y, button);
} }
if (warngenLayer.getWarningAction() == WarningAction.CON &&
!warngenLayer.getPolygonState()) {
warngenLayer.setPolygonState(true);
}
boolean rval = false; boolean rval = false;
if (button == 1 && moveType != null) { if (button == 1 && moveType != null) {
return true; return true;

View file

@ -56,7 +56,6 @@ typedef void CEdexNotification;
#include "NotificationProtocol.h" #include "NotificationProtocol.h"
using namespace qpid::messaging; using namespace qpid::messaging;
using namespace qpid::framing;
using namespace std; using namespace std;
using apache::thrift::transport::TMemoryBuffer; using apache::thrift::transport::TMemoryBuffer;
using boost::shared_ptr; using boost::shared_ptr;