VLab Issue #4003 - NCEP CAVE Plugins delivery for 14.2.1-n

Many configuration changes. Fixes for plotmodels and world wrap for
grids

Change-Id: I8e81d9a2e33e4733448e754afc596892b01c2585

Former-commit-id: 533785a59f [formerly 740b20310395ee58d270744a7e060c127eac4c91]
Former-commit-id: 51748fdcda
This commit is contained in:
Stephen Gilbert 2014-07-08 09:54:37 -04:00
parent ff091abccd
commit f0a2dc99c3
26 changed files with 3317 additions and 3209 deletions

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType">
<resource>HIRESW_ARW_US</resource>
<attrSetGroupName>standard</attrSetGroupName>
<attrSetNames>500mb_hght_absv,500mb_hght_color,500mb_hght_wind,simulated_radar</attrSetNames>
</AttributeSetGroup>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AttributeSetGroup xmlns:ns2="http://www.example.org/productType">
<resource>HIRESW_NMM_US</resource>
<attrSetGroupName>standard</attrSetGroupName>
<attrSetNames>500mb_hght_absv,500mb_hght_color,500mb_hght_wind,simulated_radar</attrSetNames>
</AttributeSetGroup>

View file

@ -11,7 +11,7 @@ FILTER=y
SCALE=0
GDPFUN=mag(kntv(wnd)) !mag(kntv(wnd)) !sm5s(sm5s(pmsl)) !kntv(wnd)
TYPE=c/f !c !c !b
CINT=5/10/20 !5/25 !0
CINT=5/10/20 !5/25 !4
LINE=6//1/0 !32//1/0 !0
FINT=20;35;65
FLINE=0;25;17;2

View file

@ -18,11 +18,30 @@
<PlotParameterDefn plotParamName="PMSL" metParamName="MeanSeaLevelPres"
dbParamName="seaLevelPress" plotUnit="mb"
plotFormat="PMSL"/>
<PlotParameterDefn plotParamName="P03C" metParamName="PressChange3Hr"
<!-- Origianlly P03C, TTR 923, Has no sign +/- -->
<PlotParameterDefn plotParamName="P03X" metParamName="PressChange3HrAbsVal"
dbParamName="pressChange3Hour" plotUnit="Pa"
plotFormat="%+3.0f"/>
plotFormat="%+3.0f"/>
<!-- Original, TTR 923 -->
<!--PlotParameterDefn plotParamName="P03C" metParamName="PressChange3Hr"
dbParamName="pressChange3Hour" plotUnit="Pa"
plotFormat="%+3.0f"/-->
<!-- TTR 923 -->
<PlotParameterDefn plotParamName="PTND" metParamName="PressureChange3HrAndTendency"
deriveParams="pressChange3Hour,pressChangeChar" plotUnit="Pa"
plotFormat="%+3.0f"/>
<!-- TTR 923 -->
<PlotParameterDefn plotParamName="P03C" metParamName="PressChange3Hr"
deriveParams="pressChange3Hour,pressChangeChar"
plotUnit="Pa"
plotFormat="%+3.0f"/>
<!-- TTR 923 -->
<PlotParameterDefn plotParamName="PTSY" metParamName="PressureTendencySymbol" dbParamName="pressChangeChar"
plotMode="table" symbolFont="WxSymbolFont" plotLookupTable="pgen_pressure_tendency.txt"/>
@ -57,10 +76,10 @@
<PlotParameterDefn plotParamName="RSLT" metParamName="SeaLevelPressure"
dbParamName="altimeter" plotUnit="mb"
plotFormat="RSLT"/>
<PlotParameterDefn plotParamName="RELH" metParamName="RelativeHumidity"
deriveParams="all" plotUnit="%" plotFormat="%3.0f"/>
deriveParams="all" plotUnit="%" plotFormat="%3.0f"/>
<PlotParameterDefn plotParamName="HEAT" metParamName="HeatIndex"
deriveParams="all" plotUnit="°F" plotFormat="%3.0f"/>

View file

@ -7,8 +7,14 @@
Manually edit the XML file in the Eclipse IDE to remove any '&' character in the field 'geog_area_name'.
In the Eclipse IDE, after removing the '&' character, right-click and select Validate
to get rid of any error messages attributed to the '&' character. -->
to get rid of any error messages attributed to the '&' character.
Important Note: all entries here will be loaded at CAVE startup so it may take longer for CAVE to start
up if too many entries are included here. For a faster startup, make sure only the items listed in
AreaMenus.xml as "GEMPAK" sub-menu entries are activated here (uncommented).
-->
<!--
<geographical_data>
<geog_code>SHM</geog_code>
<geog_area_name>SOUTHERN_HEMISPHERE</geog_area_name>
@ -44,7 +50,7 @@
<upper_right_lon>-64.00</upper_right_lon>
<map_projection_string> STR/90;-78;-7</map_projection_string>
</geographical_data>
-->
<geographical_data>
<geog_code>TROPSFC</geog_code>
<geog_area_name>TROPICAL SURFACE </geog_area_name>
@ -56,7 +62,7 @@
<upper_right_lon>-55.00</upper_right_lon>
<map_projection_string> MER</map_projection_string>
</geographical_data>
<!--
<geographical_data>
<geog_code>EPACSFC</geog_code>
<geog_area_name>EPAC SURFACE </geog_area_name>
@ -80,7 +86,7 @@
<upper_right_lon>-80.00</upper_right_lon>
<map_projection_string> MER</map_projection_string>
</geographical_data>
-->
<geographical_data>
<geog_code>AHSF</geog_code>
<geog_area_name>ATLC HIGH SEAS </geog_area_name>
@ -104,7 +110,7 @@
<upper_right_lon>-75.00</upper_right_lon>
<map_projection_string> MER</map_projection_string>
</geographical_data>
<geographical_data>
<geog_code>SHSF</geog_code>
<geog_area_name>SPAC HIGH SEAS </geog_area_name>
@ -116,7 +122,7 @@
<upper_right_lon>-75.00</upper_right_lon>
<map_projection_string> MER</map_projection_string>
</geographical_data>
<!--
<geographical_data>
<geog_code>TROPFUL</geog_code>
<geog_area_name>TROPICAL SFC MAP </geog_area_name>
@ -5288,4 +5294,5 @@
<upper_right_lon>34.00</upper_right_lon>
<map_projection_string> MER</map_projection_string>
</geographical_data>
</geogCodeList>
-->
</geogCodeList>

View file

@ -20,7 +20,9 @@
CMAN_STATION_ID : 'stationId' in common_obs_spatial where catalogtype=33
The menuName is optional and can be set to change the menu name from the areaName. If subMenuName is
set then the menu will appear as a cascading sub menu.
-->
!Note - for sub-menu items under "GEMPAK", make sure they are also activated (uncommented) in geog.xml.
-->
<AreaMenuItem subMenuName="" menuName="BasicWX_US">
<source>PREDEFINED_AREA</source>
<areaName>BasicWX_US</areaName>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ResourceDefinition xmlns:ns2="http://www.example.org/productType">
<resourceDefnName>HIRESW_ARW_US</resourceDefnName>
<resourceCategory>GRID</resourceCategory>
<rscImplementation>ModelFcstGridContours</rscImplementation>
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
<frameSpan>60</frameSpan>
<timelineGenMethod>USE_CYCLE_TIME_FCST_HOURS</timelineGenMethod>
<dfltFrameCount>999</dfltFrameCount>
<dfltTimeRange>48</dfltTimeRange>
<dfltGeogArea>BasicWX_US</dfltGeogArea>
<resourceParameters>
pluginName=grid
GDFILE=HiResW-ARW-US
</resourceParameters>
<inventoryEnabled>true</inventoryEnabled>
</ResourceDefinition>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ResourceDefinition xmlns:ns2="http://www.example.org/productType">
<resourceDefnName>HIRESW_NMM_US</resourceDefnName>
<resourceCategory>GRID</resourceCategory>
<rscImplementation>ModelFcstGridContours</rscImplementation>
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>CLOSEST_BEFORE_OR_AFTER</timeMatchMethod>
<frameSpan>60</frameSpan>
<timelineGenMethod>USE_CYCLE_TIME_FCST_HOURS</timelineGenMethod>
<dfltFrameCount>999</dfltFrameCount>
<dfltTimeRange>48</dfltTimeRange>
<dfltGeogArea>BasicWX_US</dfltGeogArea>
<resourceParameters>
pluginName=grid
GDFILE=HiResW-NMM-US
</resourceParameters>
<inventoryEnabled>true</inventoryEnabled>
</ResourceDefinition>

View file

@ -10,10 +10,9 @@ color=RGB {155, 155, 155}
<rscImplementation>SVRL</rscImplementation>
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>EVENT</timeMatchMethod>
<frameSpan>0</frameSpan>
<timelineGenMethod>USE_MANUAL_TIMELINE</timelineGenMethod>
<dfltFrameCount>10</dfltFrameCount>
<frameSpan>10</frameSpan>
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
<dfltFrameCount>37</dfltFrameCount>
<dfltTimeRange>6</dfltTimeRange>
<dfltGeogArea>BasicWX_US</dfltGeogArea>
</ResourceDefinition>

View file

@ -10,10 +10,9 @@ color=RGB {155, 155, 155}
<rscImplementation>Warn</rscImplementation>
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>EVENT</timeMatchMethod>
<frameSpan>0</frameSpan>
<timelineGenMethod>USE_MANUAL_TIMELINE</timelineGenMethod>
<dfltFrameCount>10</dfltFrameCount>
<frameSpan>10</frameSpan>
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
<dfltFrameCount>37</dfltFrameCount>
<dfltTimeRange>6</dfltTimeRange>
<dfltGeogArea>BasicWX_US</dfltGeogArea>
</ResourceDefinition>

View file

@ -13,10 +13,9 @@ legendName=WATCH
<rscImplementation>WATCH</rscImplementation>
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>EVENT</timeMatchMethod>
<frameSpan>0</frameSpan>
<timelineGenMethod>USE_MANUAL_TIMELINE</timelineGenMethod>
<dfltFrameCount>10</dfltFrameCount>
<dfltTimeRange>24</dfltTimeRange>
<frameSpan>10</frameSpan>
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
<dfltFrameCount>37</dfltFrameCount>
<dfltTimeRange>6</dfltTimeRange>
<dfltGeogArea>BasicWX_US</dfltGeogArea>
</ResourceDefinition>

View file

@ -10,10 +10,9 @@ color=RGB {155, 155, 155}
<rscImplementation>WCN</rscImplementation>
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>EVENT</timeMatchMethod>
<frameSpan>0</frameSpan>
<timelineGenMethod>USE_MANUAL_TIMELINE</timelineGenMethod>
<dfltFrameCount>10</dfltFrameCount>
<dfltTimeRange>24</dfltTimeRange>
<frameSpan>10</frameSpan>
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
<dfltFrameCount>37</dfltFrameCount>
<dfltTimeRange>6</dfltTimeRange>
<dfltGeogArea>BasicWX_US</dfltGeogArea>
</ResourceDefinition>

View file

@ -10,10 +10,9 @@ color=RGB {0, 100, 255}
<rscImplementation>WCP</rscImplementation>
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>EVENT</timeMatchMethod>
<frameSpan>0</frameSpan>
<timelineGenMethod>USE_MANUAL_TIMELINE</timelineGenMethod>
<dfltFrameCount>10</dfltFrameCount>
<frameSpan>10</frameSpan>
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
<dfltFrameCount>37</dfltFrameCount>
<dfltTimeRange>6</dfltTimeRange>
<dfltGeogArea>BasicWX_US</dfltGeogArea>
</ResourceDefinition>

View file

@ -10,10 +10,9 @@ color=RGB {155, 155, 155}
<rscImplementation>WOU</rscImplementation>
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>EVENT</timeMatchMethod>
<frameSpan>0</frameSpan>
<timelineGenMethod>USE_MANUAL_TIMELINE</timelineGenMethod>
<dfltFrameCount>10</dfltFrameCount>
<dfltTimeRange>24</dfltTimeRange>
<frameSpan>10</frameSpan>
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
<dfltFrameCount>37</dfltFrameCount>
<dfltTimeRange>6</dfltTimeRange>
<dfltGeogArea>BasicWX_US</dfltGeogArea>
</ResourceDefinition>

View file

@ -11,10 +11,9 @@ legendColor=RGB {255, 255, 255}
<rscImplementation>WSTM</rscImplementation>
<subTypeGenerator></subTypeGenerator>
<rscTypeGenerator></rscTypeGenerator>
<timeMatchMethod>EVENT</timeMatchMethod>
<frameSpan>1</frameSpan>
<timelineGenMethod>USE_MANUAL_TIMELINE</timelineGenMethod>
<dfltFrameCount>10</dfltFrameCount>
<frameSpan>30</frameSpan>
<timelineGenMethod>USE_FRAME_INTERVAL</timelineGenMethod>
<dfltFrameCount>25</dfltFrameCount>
<dfltTimeRange>12</dfltTimeRange>
<dfltGeogArea>BasicWX_US</dfltGeogArea>
</ResourceDefinition>

View file

@ -682,7 +682,7 @@
<filters></filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="HIRESW_NMM_E">
<filters>Forecast</filters>
<filters>Forecast,NSBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="MRF">
<filters>Forecast,SBN</filters>
@ -787,7 +787,7 @@
<filters>Forecast,SBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="HIRESW_ARW_SJU">
<filters>Forecast</filters>
<filters>Forecast,NSBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="GDAS">
<filters>Forecast,Global</filters>
@ -850,7 +850,7 @@
<filters>Forecast,SBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="HIRESW_NMM_W">
<filters>Forecast</filters>
<filters>Forecast,NSBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="UKMET_SAF">
<filters>Forecast,SBN</filters>
@ -919,7 +919,7 @@
<filters>Forecast,Regional,SBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="HIRESW_NMM_HI">
<filters>Forecast</filters>
<filters>Forecast,NSBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="NAM11">
<filters>Forecast,Regional,SBN</filters>
@ -994,13 +994,19 @@
<filters>Forecast</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="HIRESW_ARW_GU">
<filters>Forecast</filters>
<filters>Forecast,NSBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="HIRESW_ARW_US">
<filters>Forecast,NSBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="HIRESW_NMM_US">
<filters>Forecast,NSBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="GFS_NH">
<filters>Forecast,SBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="HIRESW_ARW_W">
<filters>Forecast</filters>
<filters>Forecast,NSBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="AVN80US">
<filters>Forecast,SBN</filters>
@ -1009,7 +1015,7 @@
<filters>Forecast,SBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="HIRESW_NMM_GU">
<filters>Forecast</filters>
<filters>Forecast,NSBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="UKMET_SA">
<filters>Forecast,SBN</filters>
@ -1117,7 +1123,7 @@
<filters>Forecast,SBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="HIRESW_ARW_E">
<filters>Forecast</filters>
<filters>Forecast,NSBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="false" rscDefnName="HPCGUIDE_AK">
<filters>Forecast,SBN</filters>
@ -1141,7 +1147,7 @@
<filters>Forecast,Global</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="HIRESW_ARW_HI">
<filters>Forecast</filters>
<filters>Forecast,NSBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="OPCWAVE12_NPAC">
<filters>Forecast,SBN</filters>
@ -1210,7 +1216,7 @@
<filters>Forecast,Global</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="HIRESW_NMM_AK">
<filters>Forecast</filters>
<filters>Forecast,NSBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="false" rscDefnName="PROB3HR">
<filters>Forecast,SBN</filters>
@ -1240,7 +1246,7 @@
<filters>Forecast,SBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="HIRESW_NMM_SJU">
<filters>Forecast</filters>
<filters>Forecast,NSBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="WAVE10WNA">
<filters>Forecast</filters>
@ -1273,7 +1279,7 @@
<filters>Forecast,SBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="HIRESW_ARW_AK">
<filters>Forecast</filters>
<filters>Forecast,NSBN</filters>
</ResourceDefinitionFilter>
<ResourceDefinitionFilter isEnabled="true" rscDefnName="MPE_LOCAL_RHA">
<filters>Forecast,SBN</filters>

View file

@ -3771,13 +3771,13 @@
<wfo></wfo>
</station>
<station>
<stid>PDX</stid>
<stid>BTG</stid>
<stnnum>000208</stnnum>
<stnname>PORTLAND</stnname>
<state>OR</state>
<stnname>BATTLE_GROUND</stnname>
<state>WA</state>
<country>US</country>
<latitude>45.58</latitude>
<longitude>-122.60</longitude>
<latitude>45.75</latitude>
<longitude>-122.59</longitude>
<elevation>0</elevation>
<priority>0</priority>
<wfo></wfo>

View file

@ -312,7 +312,7 @@
40.10 -122.24 160 RBL
47.44 -122.31 160 SEA
48.95 -122.58 160 HUH
45.58 -122.60 160 PDX
45.75 -122.59 160 BTG
38.08 -122.87 160 PYE
42.48 -122.91 160 OED
44.12 -123.22 160 EUG

View file

@ -66,6 +66,7 @@ import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.geospatial.CRSCache;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.geospatial.util.WorldWrapChecker;
import com.raytheon.uf.common.geospatial.util.WorldWrapCorrector;
import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget;
@ -82,6 +83,7 @@ import com.raytheon.viz.core.contours.util.StreamLineContainer;
import com.raytheon.viz.core.contours.util.StreamLineContainer.StreamLinePoint;
import com.raytheon.viz.core.contours.util.StrmPak;
import com.raytheon.viz.core.contours.util.StrmPakConfig;
import com.raytheon.viz.core.rsc.jts.JTSCompiler;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.CoordinateArrays;
import com.vividsolutions.jts.geom.CoordinateList;
@ -131,7 +133,7 @@ import com.vividsolutions.jts.linearref.LocationIndexedLine;
* Aug 27, 2013 2262 bsteffen Convert to use new StrmPak.
* Apr 23, 2014 #856 pswamy Missing color fill in grid diagnostics.
* Apr 30, 2014 862 pswamy Grid Precipitable Water Contour Labels needs two decimal points
*
* Jun 26, 2014 sgilbert Change world wrap processing.
* </pre>
*
* @author chammack
@ -190,12 +192,11 @@ public class ContourSupport {
private boolean globalData = false;
// world map with central meridian at 180 degree
private boolean isWorld180;
// return value from raytheon's worlWrapChecker
private boolean worldWrapChecker;
private WorldWrapCorrector corrector;
// flag that indicates world wrap is needed
private boolean worldWrap;
@ -270,6 +271,8 @@ public class ContourSupport {
public HashMap<String, Geometry> data;
public HashMap<String, Geometry> latlonContours;
public LinearRing grid;
public CLRBAR clrbar;
@ -467,10 +470,12 @@ public class ContourSupport {
this.centralMeridian = getCentralMeridian(descriptor);
if (centralMeridian == -180)
centralMeridian = 180;
this.isWorld180 = (centralMeridian == 180.0);
this.worldWrapChecker = new WorldWrapChecker(descriptor
.getGridGeometry().getEnvelope()).needsChecking();
// this.worldWrapChecker = false;
this.corrector = new WorldWrapCorrector(descriptor.getGridGeometry());
this.worldWrap = needWrap(imageGridGeometry, rastPosToLatLon);
// this.worldWrap = false;
mapScreenWidth = this.getMapWidth();
maxGridX = this.getMaxGridX(imageGridGeometry);
initContourGroup(target, contourGp);
@ -650,58 +655,6 @@ public class ContourSupport {
}
private double[][] toScreen(Coordinate[] coords, MathTransform xform,
int minX, int minY) {
int size = coords.length;
// remove points on longitude 360 degree. to avoid long cross lines
if (isWorld180) {
for (Coordinate pt : coords) {
if (pt.x == maxGridX)
size--;
}
}
double[][] out = new double[size][3];
long nx = records.getSizes()[0] - 1;
for (int i = 0, jj = 0; i < coords.length; i++, jj++) {
if (isWorld180 && coords[i].x == maxGridX) {
jj--;
continue;
}
double[] tmp = new double[2];
tmp[0] = coords[i].x + minX;
tmp[1] = coords[i].y + minY;
// if (tmp[0] > 180) tmp[0] -= 360;
try {
xform.transform(tmp, 0, out[jj], 0, 1);
} catch (TransformException e) {
// TODO Auto-generated catch block
// e.printStackTrace();
return null;
}
if (worldWrap) {
if (tmp[0] > (nx - 1) && out[jj][0] < 0) {
out[jj][0] = mapScreenWidth;
} else if (tmp[0] < 1 && out[jj][0] > mapScreenWidth * 0.9) {
out[jj][0] = 0;
}
}
}
if (out.length > 0) {
return out;
} else {
return null;
}
}
private double[][] toScreenRightOfZero(Coordinate[] coords,
MathTransform xform, int minX, int minY) {
// Coordinate[] out = new Coordinate[coords.length];
@ -733,40 +686,6 @@ public class ContourSupport {
}
}
private LineString toScreenLSRightOfZero(Coordinate[] coords,
MathTransform xform, int minX, int minY) {
GeometryFactory gf = new GeometryFactory();
Coordinate[] out = new Coordinate[coords.length];
double[] tmpout = new double[3];
for (int i = 0; i < coords.length; i++) {
double[] tmp = new double[2];
tmp[0] = coords[i].x + minX;
tmp[1] = coords[i].y + minY;
try {
xform.transform(tmp, 0, tmpout, 0, 1);
} catch (TransformException e) {
// e.printStackTrace();
return null;
}
if (tmpout[0] < zeroLonOnScreen
|| (tmp[0] == maxGridX && tmpout[0] == zeroLonOnScreen)) {
tmpout[0] += mapScreenWidth;
}
out[i] = new Coordinate(tmpout[0], tmpout[1]);
}
if (out.length >= 2) {
return gf.createLineString(out);
} else {
return null;
}
}
private double[][] toScreenLeftOfZero(Coordinate[] coords,
MathTransform xform, int minX, int minY) {
// Coordinate[] out = new Coordinate[coords.length];
@ -802,94 +721,7 @@ public class ContourSupport {
}
}
private LineString toScreenLSLeftOfZero(Coordinate[] coords,
MathTransform xform, int minX, int minY) {
GeometryFactory gf = new GeometryFactory();
Coordinate[] out = new Coordinate[coords.length];
double[] tmpout = new double[3];
for (int i = 0; i < coords.length; i++) {
double[] tmp = new double[2];
tmp[0] = coords[i].x + minX;
tmp[1] = coords[i].y + minY;
try {
xform.transform(tmp, 0, tmpout, 0, 1);
} catch (TransformException e) {
// e.printStackTrace();
return null;
}
if (tmpout[0] > zeroLonOnScreen
|| (tmp[0] == 0 && tmpout[0] == zeroLonOnScreen)) {
tmpout[0] -= mapScreenWidth;
}
out[i] = new Coordinate(tmpout[0], tmpout[1]);
}
if (out.length >= 2) {
return gf.createLineString(out);
} else {
return null;
}
}
private LineString toScreenLS(Coordinate[] coords, MathTransform xform,
int minX, int minY) {
GeometryFactory gf = new GeometryFactory();
long nx = records.getSizes()[0] - 1;
int size = coords.length;
// remove points on 360. to avoid long cross lines
if (isWorld180) {
for (Coordinate pt : coords) {
if (pt.x == maxGridX)
size--;
}
}
Coordinate[] out = new Coordinate[size];
double[] tmpout = new double[3];
for (int i = 0, jj = 0; i < coords.length; i++, jj++) {
if (isWorld180 && coords[i].x == maxGridX) {
jj--;
continue;
}
double[] tmp = new double[2];
tmp[0] = coords[i].x + minX;
tmp[1] = coords[i].y + minY;
// if (tmp[0] > 180) tmp[0] -= 360;
try {
xform.transform(tmp, 0, tmpout, 0, 1);
} catch (TransformException e) {
// TODO Auto-generated catch block
// e.printStackTrace();
return null;
}
if (worldWrap) {
if (tmp[0] > (nx - 1) && tmpout[0] < 0) {
tmpout[0] = extent.getMaxX();
} else if (tmp[0] < 1 && tmpout[0] > extent.getMaxX() * 0.9) {
tmpout[0] = 0;
}
}
out[jj] = new Coordinate(tmpout[0], tmpout[1]);
}
if (out.length >= 2) {
return gf.createLineString(out);
} else {
return null;
}
}
@SuppressWarnings("unused")
private static Geometry polyToLine(Polygon poly) {
GeometryFactory gf = new GeometryFactory();
@ -905,8 +737,7 @@ public class ContourSupport {
TreeMap<Coordinate, LineString> orderedHoles = new TreeMap<Coordinate, LineString>();
for (int i = 0; i < poly.getNumInteriorRing(); i++) {
LineString hole = poly.getInteriorRingN(i);
// if ( hole.getArea() == 8.0 )
// System.out.println("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFound");
Coordinate min = CoordinateArrays.minCoordinate(hole
.getCoordinates());
orderedHoles.put(min, hole);
@ -1034,8 +865,8 @@ public class ContourSupport {
descriptor);
contourGroup.negValueShape = target.createWireframeShape(false,
descriptor);
contourGroup.fillShapes = target.createShadedShape(false, descriptor,
true);
contourGroup.fillShapes = target.createShadedShape(false,
descriptor.getGridGeometry(), true);
contourGroup.zoomLevel = 1.0 / Math.pow(2.0, level);
@ -1044,6 +875,7 @@ public class ContourSupport {
contourGroup.fvalues = new ArrayList<Double>();
contourGroup.data = new HashMap<String, Geometry>();
contourGroup.latlonContours = new HashMap<String, Geometry>();
contourGroup.grid = null;
@ -1057,6 +889,10 @@ public class ContourSupport {
if (contourGp.data != null && contourGp.data.size() > 0) {
contourGroup.data.putAll(contourGp.data);
}
if (contourGp.latlonContours != null
&& contourGp.latlonContours.size() > 0) {
contourGroup.latlonContours.putAll(contourGp.latlonContours);
}
if (contourGp.grid != null)
contourGroup.grid = contourGp.grid;
}
@ -1214,7 +1050,7 @@ public class ContourSupport {
}
}
int n = 0, minX = 0, minY = 0;
int n = 0;
double[][] screen = null;
double[][] screenx = null;
@ -1238,42 +1074,20 @@ public class ContourSupport {
toLabel = (n % labelFreq == 0) ? true : false;
}
Geometry g = contourGroup.data.get(cval.toString());
Geometry g = contourGroup.latlonContours.get(cval.toString());
if (g == null)
continue;
for (int i = 0; i < g.getNumGeometries(); i++) {
Geometry gn = g.getGeometryN(i);
if (worldWrap) {
// screen = toScreenRightPart( gn.getCoordinates(), 0,
// rastPosToLatLon,rastPosLatLonToWorldGrid, minX, minY
// );
// if ( screen != null )
// contourGroup.negValueShape.addLineSegment(screen);
Geometry correctedGeom = corrector.correct(g);
// Geometry correctedGeom = g;
screen = toScreenRightOfZero(gn.getCoordinates(),
rastPosToWorldGrid, minX, minY);
if (screen != null)
contourGroup.negValueShape.addLineSegment(screen);
for (int i = 0; i < correctedGeom.getNumGeometries(); i++) {
Geometry gn = correctedGeom.getGeometryN(i);
// System.out.println("GEOMETRY " + i + ":");
// System.out.println(gn.toString());
contourGroup.negValueShape.addLineSegment(gn
.getCoordinates());
screenx = toScreenLeftOfZero(gn.getCoordinates(),
rastPosToWorldGrid, minX, minY);
if (screenx != null)
contourGroup.negValueShape.addLineSegment(screenx);
} else {
screen = toScreen(gn.getCoordinates(),
rastPosToWorldGrid, minX, minY);
if (screen != null)
contourGroup.negValueShape.addLineSegment(screen);
}
/*
* if ( isWorld0 ) { screen1 = toScreenSubtract360(
* gn.getCoordinates(),
* rastPosToLatLon,rastPosLatLonToWorldGrid, minX, minY );
* if ( screen1 != null )
* contourGroup.negValueShape.addLineSegment(screen1); }
*/
if (toLabel) {
long tl0 = System.currentTimeMillis();
// prepareLabel(contourGroup, zoom, fval,
@ -1310,6 +1124,9 @@ public class ContourSupport {
if (type.trim().toUpperCase().contains("F")
&& contourGroup.fvalues.size() > 0) {
JTSCompiler jts = new JTSCompiler(contourGroup.fillShapes, null,
descriptor);
try {
// Prepare colors for color fills
@ -1325,19 +1142,6 @@ public class ContourSupport {
FLine flineInfo = new FLine(fline.trim());
fillColorsIndex = flineInfo.getFillColorList();
// /*
// * Apply last color if not enough input color.
// */
// if (contourGroup.fvalues != null
// && fillColorsIndex.size() < (contourGroup.fvalues
// .size() + 1)) {
// for (int i = fillColorsIndex.size(); i <
// contourGroup.fvalues
// .size() + 2; i++) {
// fillColorsIndex.add(i);
// }
// }
/*
* Repeat colors if not enough input color(s) provided.
*/
@ -1349,7 +1153,6 @@ public class ContourSupport {
}
}
int minX = 0, minY = 0;
long t11 = System.currentTimeMillis();
FillGenerator fgen = new FillGenerator(contourGroup.grid);
long t12 = System.currentTimeMillis();
@ -1386,43 +1189,13 @@ public class ContourSupport {
}
for (int j = 0; j < fillPolys.getNumGeometries(); j++) {
Geometry g = fillPolys.getGeometryN(j);
if (g instanceof Polygon)
g = polyToLine((Polygon) g);
if (worldWrap) {
LineString ls = toScreenLSRightOfZero(
g.getCoordinates(), rastPosToWorldGrid,
minX, minY);
if (ls != null)
contourGroup.fillShapes
.addPolygonPixelSpace(
new LineString[] { ls },
color);
ls = toScreenLSLeftOfZero(g.getCoordinates(),
rastPosToWorldGrid, minX, minY);
if (ls != null)
contourGroup.fillShapes
.addPolygonPixelSpace(
new LineString[] { ls },
color);
} else {
LineString ls = toScreenLS(g.getCoordinates(),
rastPosToWorldGrid, minX, minY);
if (ls != null)
contourGroup.fillShapes
.addPolygonPixelSpace(
new LineString[] { ls },
color);
if (g instanceof Polygon) {
// g = polyToLine((Polygon) g);
Geometry llgeom = transformGeometry(g,
rastPosToLatLon);
jts.handle(llgeom, color, true);
}
// if ( isWorld0 ) {
// ls = toScreenLSSubtract360( g.getCoordinates(),
// rastPosToLatLon,rastPosLatLonToWorldGrid, minX,
// minY);
// if ( ls != null )
// contourGroup.fillShapes.addPolygonPixelSpace(new
// LineString[]{ls}, color);
// }
}
} catch (FillException e) {
// e.printStackTrace();
@ -1756,24 +1529,108 @@ public class ContourSupport {
if (cvalues != null) {
for (Double cval : cvalues) {
float fval = (float) (cval * 1.0f);
contourGroup.data.put(cval.toString(), cgen.getContours(fval));
// System.out.println("Contour Value = " + fval);
Geometry geom = cgen.getContours(fval);
contourGroup.data.put(cval.toString(), geom);
Geometry llgeom = transformGeometry(geom, rastPosToLatLon);
contourGroup.latlonContours.put(cval.toString(), llgeom);
// System.out.println(" "
// + contourGroup.data.get(cval.toString()));
}
}
if (fvalues != null) {
for (Double cval : fvalues) {
float fval = (float) (cval * 1.0f);
// System.out.println("Fill Value = " + fval);
contourGroup.data.put(cval.toString(), cgen.getContours(fval));
// System.out.println(" "
// + contourGroup.data.get(cval.toString()));
}
}
if (contourGroup.grid == null) {
// System.out.println("EDGES:");
contourGroup.grid = cgen.getEdges();
// System.out.println(" " + contourGroup.grid);
}
cgen.dispose();
ContourCalculationReentrantLock.releaseReentrantLock();
// }
}
private Geometry transformGeometry(Geometry geom, MathTransform xform) {
GeometryFactory gf = geom.getFactory();
List<Geometry> llgeoms = new ArrayList<Geometry>();
for (int i = 0; i < geom.getNumGeometries(); i++) {
Geometry gn = geom.getGeometryN(i);
if (gn instanceof LineString) {
Coordinate[] llcoords = transformCoordinates(
gn.getCoordinates(), xform);
LineString ls = gf.createLineString(llcoords);
llgeoms.add(ls);
} else if (gn instanceof Polygon) {
Polygon poly = transformPolygon((Polygon) gn, xform);
llgeoms.add(poly);
}
}
return gf.createGeometryCollection(llgeoms.toArray(new Geometry[] {}));
}
private Polygon transformPolygon(Polygon pgn, MathTransform xform) {
GeometryFactory gf = pgn.getFactory();
Polygon poly;
int numInterior;
// Transform exterior ring
Coordinate[] llcoords = transformCoordinates(pgn.getExteriorRing()
.getCoordinates(), xform);
LinearRing lr = gf.createLinearRing(llcoords);
numInterior = pgn.getNumInteriorRing();
if (numInterior == 0) {
poly = gf.createPolygon(lr, null);
return poly;
}
// Transform all interior rings
LinearRing[] holes = new LinearRing[numInterior];
for (int n = 0; n < numInterior; n++) {
llcoords = transformCoordinates(pgn.getInteriorRingN(n)
.getCoordinates(), xform);
holes[n] = gf.createLinearRing(llcoords);
}
poly = gf.createPolygon(lr, holes);
return poly;
}
private Coordinate[] transformCoordinates(Coordinate[] coordinates,
MathTransform xform) {
CoordinateList clist = new CoordinateList();
double[] tmp = new double[2];
double[] out = new double[2];
for (Coordinate loc : coordinates) {
tmp[0] = loc.x;
tmp[1] = loc.y;
try {
xform.transform(tmp, 0, out, 0, 1);
clist.add(new Coordinate(out[0], out[1]), true);
} catch (TransformException e) {
}
}
return clist.toCoordinateArray();
}
public ContourGroup getContours() {
if (!isCntrsCreated)
return null;

View file

@ -72,6 +72,12 @@ import com.vividsolutions.jts.geom.Coordinate;
* ------------ ---------- ----------- --------------------------
* 05/20/2013 988 Archana.S Initial creation.
* 02/26/2014 1061 B. Hebbard Relax tolerance for extent/zoom compare to avoid infinite loop.
* 04/23/2014 922-923 S. Russell Modified getDrawableStringForStation()
* 06/10/2014 932 D. Sushon Fix Symbol background mask to not obscure underlying imagery.
* 06/17/2014 923 S. Russell added method adjustForPTSYSymbol()
* 06/17/2014 923 S. Russell added method getLastCharInPosition()
* 06/17/2014 923 S. Russell altered method setUpSymbolMappingTables()
* 06/17/2014 923 S. Russell altered method createRenderableData()
*/
public class NcPlotImageCreator {
@ -278,6 +284,7 @@ public class NcPlotImageCreator {
setUpPlotPositionToPlotModelElementMapping(plotModel);
setUpSymbolMappingTables();
plotDensity = initialDensity;
initializeFonts();
Tracer.print("< Exit");
@ -307,14 +314,14 @@ public class NcPlotImageCreator {
private void runCreateImageTask(double thePlotDensity) {
Tracer.print("> Entry");
if (queueOfStations.peek() == null)
if (queueOfStations.peek() == null) {
return;
}
while (queueOfStations.peek() != null) {
QueueEntry qe = queueOfStations.poll();
Tracer.print("About to schedule image drawing task for "
+ qe.getStations().size() + " stations from frame "
+ qe.getDataTime().toString() + "\n");
CreateDrawableStringsTask task = new CreateDrawableStringsTask(
qe.getDataTime(), qe.getStations(), thePlotDensity);
imageCreationJobPool.schedule(task);
@ -406,6 +413,7 @@ public class NcPlotImageCreator {
} else if (plotModelElementPosition.compareTo("SC") == 0) {
position = Position.SC;
}
Tracer.print("< Exit");
return position;
}
@ -413,7 +421,9 @@ public class NcPlotImageCreator {
private void setUpPlotModelElementToPlotColorMapping(Position p,
PlotModelElement pme) {
Tracer.print("> Entry");
if (pme != null) {
gov.noaa.nws.ncep.viz.rsc.plotdata.plotModels.elements.Color pmeColor = pme
.getColor();
RGB oldColor = plotPosToColorMap.get(p);
@ -437,8 +447,9 @@ public class NcPlotImageCreator {
Double oldSymbolSize = plotPosToSymbolSizeMap.get(p);
if (oldSymbolSize == null
|| (Math.abs(oldSymbolSize.doubleValue()
- newSymbolSize.doubleValue()) > 0.001))
- newSymbolSize.doubleValue()) > 0.001)) {
plotPosToSymbolSizeMap.put(p, newSymbolSize);
}
}
Tracer.print("< Exit");
}
@ -452,8 +463,9 @@ public class NcPlotImageCreator {
String fontName = pme.getTextFont();
String fontStyle = pme.getTextStyle();
IFont font = null;
if (prevFontStyle == null || prevFontStyle.isEmpty())
if (prevFontStyle == null || prevFontStyle.isEmpty()) {
prevFontStyle = new String(fontStyle);
}
if (prevFont == null) {
font = getFont(fontName, fontSize, fontStyle);
@ -477,8 +489,9 @@ public class NcPlotImageCreator {
}
}
if (plotPosToFontMap.get(p) == null
|| !plotPosToFontMap.get(p).equals(prevFont))
|| !plotPosToFontMap.get(p).equals(prevFont)) {
plotPosToFontMap.put(p, prevFont);
}
}
Tracer.print("< Exit");
}
@ -526,8 +539,9 @@ public class NcPlotImageCreator {
}
}
}
if (!matchFound)
if (!matchFound) {
posToRemove.add(pos);
}
}
}
synchronized (posToRemove) {
@ -613,8 +627,9 @@ public class NcPlotImageCreator {
|| SERIF_NORMAL_FONT == null || SANS_SERIF_ITALIC_FONT == null
|| SANS_SERIF_BOLD_ITALIC_FONT == null
|| SANS_SERIF_NORMAL_FONT == null
|| SANS_SERIF_BOLD_FONT == null)
|| SANS_SERIF_BOLD_FONT == null) {
initializeFonts();
}
if (fontName.compareTo("Courier") == 0) {
if (fontStyle.compareTo("Bold") == 0) {
@ -623,8 +638,9 @@ public class NcPlotImageCreator {
font = COURIER_ITALIC_FONT;
} else if (fontStyle.compareTo("Bold-Italic") == 0) {
font = COURIER_BOLD_ITALIC_FONT;
} else
} else {
font = COURIER_NORMAL_FONT;
}
}
else if (fontName.compareTo("Times") == 0) {
@ -634,8 +650,9 @@ public class NcPlotImageCreator {
font = SERIF_ITALIC_FONT;
} else if (fontStyle.compareTo("Bold-Italic") == 0) {
font = SERIF_BOLD_ITALIC_FONT;
} else
} else {
font = SERIF_NORMAL_FONT;
}
} else {
if (fontStyle.compareTo("Bold") == 0) {
font = SANS_SERIF_BOLD_FONT;
@ -643,12 +660,14 @@ public class NcPlotImageCreator {
font = SANS_SERIF_ITALIC_FONT;
} else if (fontStyle.compareTo("Bold-Italic") == 0) {
font = SANS_SERIF_BOLD_ITALIC_FONT;
} else
} else {
font = SANS_SERIF_NORMAL_FONT;
}
}
if (font != null && fontSize != initialFontSize)
if (font != null && fontSize != initialFontSize) {
font = font.deriveWithSize(fontSize);
}
if (font != null) {
font.setMagnification(1);
@ -670,6 +689,14 @@ public class NcPlotImageCreator {
for (Position position : positionSet) {
PlotModelElement pme = plotModelPositionMap.get(position);
String plotParamName = pme.getParamName();
// TTR 923 Temporarily change the name of the combination
// element, the PTND button, to get the PTSY symbol part of it
// to process
if (plotParamName.equalsIgnoreCase("PTND")) {
plotParamName = "PTSY";
}
PlotParameterDefn thisPlotParamDefn = plotParameterDefinitions
.getPlotParamDefn(plotParamName);
if (thisPlotParamDefn == null) {
@ -681,12 +708,17 @@ public class NcPlotImageCreator {
if (thisPlotParamDefn.getPlotMode()
.compareToIgnoreCase("table") == 0) {
PlotSymbolType symbolType = getPlotSymbolType(pme
.getParamName());
// TTR 923 - use plotParamName to get the PTND button
// processed as a PTSY symbol
// PlotSymbolType symbolType =
// getPlotSymbolType(pme.getParamName());
PlotSymbolType symbolType = getPlotSymbolType(plotParamName);
if (symbolType != PlotSymbolType.INVALID) {
posToSymbolTypeMap.put(position, symbolType);
if (symbolExistsMap.get(symbolType) == null)
if (symbolExistsMap.get(symbolType) == null) {
symbolExistsMap.put(symbolType, Boolean.FALSE);
}
StringLookup lookupTable = StringLookup
.readS2SFile(thisPlotParamDefn
.getPlotLookupTable());
@ -739,13 +771,14 @@ public class NcPlotImageCreator {
.get(symbolName);
if (symbol == null) {
symbol = new Symbol(null, colorArray,
symbolSize, symbolSize, true,
symbolSize, symbolSize, false,
dummyCoordinate, "Symbol",
symbolName);
} else {
if (!symbolColor.equals(symbol
.getColors()[0]))
.getColors()[0])) {
symbol.setColors(colorArray);
}
if (Math.abs(symbolSize
- symbol.getSizeScale()) > 0.01) {
symbol.setSizeScale(symbolSize);
@ -792,9 +825,7 @@ public class NcPlotImageCreator {
else if (symbolGEMPAKName.compareTo("TBSY") == 0) {
symbolType = PlotSymbolType.TBSY;
}
else if (symbolGEMPAKName.compareTo("PTSY") == 0) {
} else if (symbolGEMPAKName.compareTo("PTSY") == 0) {
symbolType = PlotSymbolType.PTSY;
} else if (symbolGEMPAKName.compareTo("SKYC") == 0) {
symbolType = PlotSymbolType.SKYC;
@ -899,11 +930,11 @@ public class NcPlotImageCreator {
}
private String createKeyFromTextCoordinates(DrawableBasics db) {
if (db == null)
if (db == null) {
return null;
}
String key = new String("" + Math.round(db.x * 10000) + ","
+ Math.round(db.y * 10000));
// System.out.println("Created key = " + key);
return key;
}
@ -927,7 +958,7 @@ public class NcPlotImageCreator {
Collection<Station> stnColl, String plotUnit,
double symbolSize, Color[] windVectorColorArray,
String metPrm1, String metPrm2, PlotModelElement pme) {
Tracer.printX("> Entry " + Tracer.shortTimeString(this.dataTime)
Tracer.print("> Entry " + Tracer.shortTimeString(this.dataTime)
+ " with " + stnColl.size() + " stations" + " metPrm1 "
+ metPrm1 + " metPrm2 " + metPrm2);
Map<Coordinate, IVector> localVectorPosToVectorMap = new HashMap<Coordinate, IVector>(
@ -959,12 +990,14 @@ public class NcPlotImageCreator {
+ " for "
+ currentStation.info.stationId);
if (metPrm.getMetParamName()
.compareToIgnoreCase(metPrm1) == 0)
.compareToIgnoreCase(metPrm1) == 0) {
vectorParam1 = metPrm;
}
if (metPrm.getMetParamName()
.compareToIgnoreCase(metPrm2) == 0)
.compareToIgnoreCase(metPrm2) == 0) {
vectorParam2 = metPrm;
}
if (vectorParam1 != null
&& vectorParam2 != null) {
@ -1040,7 +1073,7 @@ public class NcPlotImageCreator {
}
}
ss.release();
Tracer.printX("< Exit " + Tracer.shortTimeString(this.dataTime));
Tracer.print("< Exit " + Tracer.shortTimeString(this.dataTime));
return localVectorPosToVectorMap;
}
@ -1050,7 +1083,7 @@ public class NcPlotImageCreator {
double symbolSize, Color[] windVectorColorArray,
double[] stationLoc) {
Tracer.printX("> Entry");
Tracer.print("> Entry");
AbstractMetParameter windSpeed = null, windDir = null;
Vector vector = null;
@ -1077,8 +1110,9 @@ public class NcPlotImageCreator {
double cWindSpeedThresh = WIND_SPD_3KNOTS.getValueAs(unit)
.doubleValue();
if (cWindSpeed >= cWindSpeedThresh)
if (cWindSpeed >= cWindSpeedThresh) {
dWindSpeed = windNormalizer(cWindSpeed);
}
vector = new Vector(null, windVectorColorArray, 1.0f,
symbolSize, false, new Coordinate(stationLoc[0],
@ -1089,7 +1123,7 @@ public class NcPlotImageCreator {
e.printStackTrace();
}
Tracer.printX("< Exit" + " returning "
Tracer.print("< Exit" + " returning "
+ ((vector == null) ? "NULL" : "a vector"));
return vector;
@ -1098,8 +1132,9 @@ public class NcPlotImageCreator {
private final synchronized void createRenderableData() {
Tracer.print("> Entry " + Tracer.shortTimeString(this.dataTime));
if (listOfStations == null || listOfStations.isEmpty())
if (listOfStations == null || listOfStations.isEmpty()) {
return;
}
Tracer.print(Tracer.shortTimeString(this.dataTime)
+ " listOfStations has " + listOfStations.size()
+ " stations after entry");
@ -1113,11 +1148,12 @@ public class NcPlotImageCreator {
0);
Map<Coordinate, IVector> vectorPosToVectorMap = null;
if (dataTimeToText.get(dataTime) != null)
if (dataTimeToText.get(dataTime) != null) {
localDMap = new HashMap<Position, Map<String, DrawableString>>(
dataTimeToText.get(dataTime));
else
} else {
localDMap = new HashMap<Position, Map<String, DrawableString>>();
}
Set<Position> positionSet = plotModelPositionMap.keySet();
Map<String, Station> stationMap = new HashMap<String, Station>(
@ -1187,8 +1223,9 @@ public class NcPlotImageCreator {
+ " prevStationMap has " + prevStationMap.size()
+ " stations");
}
if (lastView == null)
if (lastView == null) {
lastView = view.clone();
}
Rectangle2D r = aTarget.getStringsBounds(new DrawableString("M",
defaultColor));
@ -1662,8 +1699,9 @@ public class NcPlotImageCreator {
*/
|| (font.getStyle() != null && (strToReposition.font
.getStyle() == null || strToReposition.font
.getStyle().length == 0)))
.getStyle().length == 0))) {
strToReposition.font = font;
}
synchronized (strToReposition.basics) {
@ -1826,8 +1864,9 @@ public class NcPlotImageCreator {
*/
|| (font.getStyle() != null && (drawableString.font
.getStyle() == null || drawableString.font
.getStyle().length == 0)))
.getStyle().length == 0))) {
drawableString.font = font;
}
synchronized (drawableString.basics) {
@ -1918,8 +1957,9 @@ public class NcPlotImageCreator {
}
if (drawVector) {
if (mapOfWindBarbsPerFrame == null)
if (mapOfWindBarbsPerFrame == null) {
mapOfWindBarbsPerFrame = new HashMap<DataTime, Map<Coordinate, IVector>>();
}
vectorPosToVectorMap = mapOfWindBarbsPerFrame.get(dataTime);
drawVectorsFirstTime = (vectorPosToVectorMap == null);
String[] vectorPrmNames = plotParamDefn
@ -2074,20 +2114,39 @@ public class NcPlotImageCreator {
* attributes change. Hence the symbols get recreated afresh
* each time.
*/
boolean wasPTND = false;
mapOfAllSymbolsAtEachPlotPosition = mapOfSymbolsPerPlotPosPerFrame
.get(dataTime);
PlotSymbolType symbolType = posToSymbolTypeMap
.get(position);
// TTR 923 Temporarily change the name of the combination
// element, the PTND button, to get the PTSY symbol part of
// it
// to process. To this end also set a flag to let us know
// this temporarly name change, PTND processing is happening
if (plotParamDefn.getMetParamName().equalsIgnoreCase(
"PressureChange3HrAndTendency")) {
plotParamDefn = plotParameterDefinitions
.getPlotParamDefn("PTSY");
wasPTND = true;
}
String metParamName = plotParamDefn.getMetParamName();
// TTR 923: Holder for the P03C value in the combination
// PTND element which holds values for P03C and PTSY
AbstractMetParameter ptnd = null;
if (symbolType != null) {
StringLookup lookupTable = symbolLookupTable
.get(symbolType);
symbolExistsMap.put(symbolType, Boolean.TRUE);
if (mapOfAllSymbolsAtEachPlotPosition == null)
if (mapOfAllSymbolsAtEachPlotPosition == null) {
mapOfAllSymbolsAtEachPlotPosition = new HashMap<Position, List<SymbolLocationSet>>();
}
List<Coordinate> listOfCoords = null;
Map<Symbol, List<Coordinate>> symbolToSetOfCoordsMap = new HashMap<Symbol, List<Coordinate>>();
@ -2104,6 +2163,18 @@ public class NcPlotImageCreator {
synchronized (station.listOfParamsToPlot) {
try {
// TTR 923 Temporarily change the name
// of the combination
// element, the PTND button, to get
// the PTSY symbol part of it
// to process.
if (wasPTND) {
// TTR 923 temporarily change back
// to PTND to match condition
// in next for loop
metParamName = "PressureChange3HrAndTendency";
}
for (AbstractMetParameter metPrm : station.listOfParamsToPlot) {
if (metParamName.compareTo(metPrm
.getMetParamName()) == 0) {
@ -2112,14 +2183,41 @@ public class NcPlotImageCreator {
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (tableParamToPlot != null) {
// TTR 923 Temporarily change the name of
// the combination
// element, the PTND button, to get the PTSY
// symbol part of it
// to process.
if (wasPTND
&& tableParamToPlot
.getMetParamName()
.equalsIgnoreCase(
"PressureChange3HrAndTendency")) {
if (tableParamToPlot
.getAssociatedMetParam() != null
&& tableParamToPlot
.hasValidValue()) {
// Save a copy of the P03C values
// from the PTND metparameter
ptnd = tableParamToPlot;
// Get the stored PTSY metparameter
tableParamToPlot = tableParamToPlot
.getAssociatedMetParam();
} else {
tableParamToPlot = null;
}
}
String formattedString = null;
try {
formattedString = getFormattedValueToPlot(
plotParamDefn, tableParamToPlot);
@ -2153,14 +2251,24 @@ public class NcPlotImageCreator {
pme);
}
if (symbol == null)
if (symbol == null) {
continue;
}
double worldLoc[] = new double[] {
station.info.longitude,
station.info.latitude };
double[] tempPixLoc = mapDescriptor
.worldToPixel(worldLoc);
// TTR 922-923 Add a horizontal offset
// to the PTSY symbol so it doesn't
// overwrite the P03C number
tempPixLoc[0] = adjustForPTSYSymbol(
ptnd, symbol, position,
textBounds, tempPixLoc[0],
view, canvasBounds);
tempPixLoc = getUpdatedCoordinates(
textBounds, tempPixLoc[0],
tempPixLoc[1], view,
@ -2169,6 +2277,7 @@ public class NcPlotImageCreator {
.pixelToWorld(tempPixLoc);
listOfCoords = symbolToSetOfCoordsMap
.get(symbol);
if (listOfCoords == null) {
listOfCoords = new ArrayList<Coordinate>();
}
@ -2185,7 +2294,7 @@ public class NcPlotImageCreator {
// Color[]{ new Color( rgb.red,
// rgb.blue, rgb.green ) },
// symbol.getLineWidth(),
// symbol.getSizeScale(), true, new
// symbol.getSizeScale(), false, new
// Coordinate(0,0,0),
// "Symbol", symbol.getPatternName()
// );
@ -2206,7 +2315,7 @@ public class NcPlotImageCreator {
// pmeColor.red, pmeColor.blue,
// pmeColor.green ) },
// symbol.getLineWidth(),
// symbol.getSizeScale(), true,
// symbol.getSizeScale(), false,
// new Coordinate(0,0,0),
// "Symbol",
// symbol.getPatternName() );
@ -2218,18 +2327,19 @@ public class NcPlotImageCreator {
double expectedSymbolSize = plotPosToSymbolSizeMap
.get(position).doubleValue();
if (Math.abs(expectedSymbolSize
- prevSizeOfSymbol) > TOLERANCE)
- prevSizeOfSymbol) > TOLERANCE) {
symbol.setSizeScale(expectedSymbolSize);
}
symbolToSetOfCoordsMap.put(symbol,
listOfCoords);
} catch (VizException e) {
e.printStackTrace();
}
}
}
}
ss.release();
Set<Symbol> symSet = symbolToSetOfCoordsMap.keySet();
@ -2238,8 +2348,9 @@ public class NcPlotImageCreator {
for (Symbol symbol : symSet) {
List<Coordinate> coordSet = symbolToSetOfCoordsMap
.get(symbol);
if (symbol == null)
if (symbol == null) {
continue;
}
SymbolLocationSet sset = new SymbolLocationSet(
symbol, coordSet.toArray(new Coordinate[0]));
listOfSymLocSet.add(sset);
@ -2301,13 +2412,15 @@ public class NcPlotImageCreator {
synchronized (symLocSetList) {
for (Position pos : positionSet) {
if (mapOfAllSymbolsAtEachPlotPosition == null
|| mapOfAllSymbolsAtEachPlotPosition.get(pos) == null)
|| mapOfAllSymbolsAtEachPlotPosition.get(pos) == null) {
continue;
}
synchronized (mapOfAllSymbolsAtEachPlotPosition) {
List<SymbolLocationSet> symbolLocSetList = new ArrayList<SymbolLocationSet>(
mapOfAllSymbolsAtEachPlotPosition.get(pos));
if (!symbolLocSetList.isEmpty())
if (!symbolLocSetList.isEmpty()) {
symLocSetList.addAll(symbolLocSetList);
}
}
}
@ -2351,8 +2464,9 @@ public class NcPlotImageCreator {
}
/* Update the map of text entries for the current frame */
if (dataTimeToText != null && localDMap != null)
if (dataTimeToText != null && localDMap != null) {
dataTimeToText.put(dataTime, localDMap);
}
/*
* Update the map of wind-barbs with the latest list of wind barbs
@ -2391,16 +2505,20 @@ public class NcPlotImageCreator {
private DrawableString getDrawableStringForStation(Station station,
PlotParameterDefn plotParamDefn, IFont font, RGB textColor,
Position position, IGraphicsTarget aTarget, PlotModelElement pme) {
Tracer.printX("> Entry");
DrawableString drawableString = null;
String metParamName = plotParamDefn.getMetParamName();
Semaphore sm = new Semaphore(1);
String PTNDSign = null;
synchronized (station.listOfParamsToPlot) {
sm.acquireUninterruptibly();
try {
if (pme.hasAdvancedSettings())
if (pme.hasAdvancedSettings()) {
textColor = getConditionalColor(station, pme);
}
for (AbstractMetParameter metParamToPlot : station.listOfParamsToPlot) {
if (metParamToPlot.getMetParamName().compareTo(
@ -2412,6 +2530,9 @@ public class NcPlotImageCreator {
if (formattedString == null) {
return null;
}
// TTR 923 remove sign for specific values
formattedString = removeSign(metParamToPlot,
formattedString);
drawableString = new DrawableString(
formattedString, textColor);
@ -2435,13 +2556,14 @@ public class NcPlotImageCreator {
textBounds, station.pixelLocation.x,
station.pixelLocation.y, lastView,
canvasBounds, position);
if (pixLoc != null)
if (pixLoc != null) {
drawableString.setCoordinates(pixLoc[0],
pixLoc[1]);
else
} else {
drawableString.setCoordinates(
station.pixelLocation.x,
station.pixelLocation.y);
}
return drawableString;
@ -2461,6 +2583,39 @@ public class NcPlotImageCreator {
return drawableString;
}
}
/*
* TTR 923 remove the sign on pressure tendency values of zero or where the
* value of PTSY was 4
*/
private String removeSign(AbstractMetParameter metParamToPlot,
String formattedString) {
if (!metParamToPlot.getMetParamName()
.equalsIgnoreCase("PressChange3Hr")
&& !metParamToPlot.getMetParamName().equalsIgnoreCase(
"PressureChange3HrAndTendency")) {
return formattedString;
}
String str = formattedString;
AbstractMetParameter amp = metParamToPlot.getAssociatedMetParam();
String sPTSY = amp.getStringValue();
int iPTSY = 0;
double iP03C = 0.0d;
iP03C = metParamToPlot.getValue().doubleValue();
iPTSY = Integer.parseInt(sPTSY);
// If zero pressure tendency value or ptsy symbol is 4 - neutral
if (iP03C == 0.0 || iPTSY == 4) {
// Remove the sign
if (formattedString.contains("+") || formattedString.contains("-")) {
str = formattedString.substring(1);
}
}
return str;
}
@ -2470,60 +2625,149 @@ public class NcPlotImageCreator {
Tracer.printX("> Entry");
String formattedStringToPlot = null;
// No value, abort.
if (metPrm == null) {
return null;
}
// No value, abort.
if (!metPrm.hasValidValue()) {
return formattedStringToPlot;
} else {
String plotUnit = plotParamDefn.getPlotUnit();
if (plotUnit == null) {
if (metPrm.hasStringValue()) {
if (metPrm.getStringValue() != null
&& !metPrm.getStringValue().isEmpty())
formattedStringToPlot = new String(
metPrm.getStringValue());
}
String plotUnit = plotParamDefn.getPlotUnit();
if (plotUnit == null) {
if (metPrm.hasStringValue()) {
if (metPrm.getStringValue() != null
&& !metPrm.getStringValue().isEmpty()) {
formattedStringToPlot = new String(metPrm.getStringValue());
}
} else {
}
}
try {
Unit<?> newUnit = new UnitAdapter().unmarshal(plotUnit);
try {
Unit<?> newUnit = new UnitAdapter().unmarshal(plotUnit);
if (newUnit.isCompatible(metPrm.getUnit())
|| newUnit.equals(metPrm.getUnit())) {
if (newUnit.isCompatible(metPrm.getUnit())
|| newUnit.equals(metPrm.getUnit())) {
metPrm.setValue(metPrm.getValueAs(newUnit), newUnit);
metPrm.setValue(metPrm.getValueAs(newUnit), newUnit);
if (!metPrm.hasValidValue())
return null;
if (!metPrm.hasValidValue()) {
return null;
}
String formattedStr = new String(metPrm
.getFormattedString(
plotParamDefn.getPlotFormat()).trim());
String plotTrim = plotParamDefn.getPlotTrim();
if (plotTrim != null && !plotTrim.isEmpty()) {
int plotTrimVal = Integer.parseInt(plotTrim);
formattedStringToPlot = new String(
formattedStr.substring(plotTrimVal));
} else
formattedStringToPlot = new String(formattedStr);
String formattedStr = new String(metPrm.getFormattedString(
plotParamDefn.getPlotFormat()).trim());
String plotTrim = plotParamDefn.getPlotTrim();
}
} catch (Exception e) {
e.printStackTrace();
return plotUnit;
if (plotTrim != null && !plotTrim.isEmpty()) {
int plotTrimVal = Integer.parseInt(plotTrim);
formattedStringToPlot = new String(
formattedStr.substring(plotTrimVal));
} else { // just use the formattedString without trimming it
formattedStringToPlot = new String(formattedStr);
}
}
} catch (Exception e) {
e.printStackTrace();
return plotUnit;
}
Tracer.printX("< Exit");
return formattedStringToPlot;
}
/*
* TTR 923, calculate a horizontal offset for the PTSY symbol so tht it does
* not overwrite the P03C value
*/
private double adjustForPTSYSymbol(AbstractMetParameter ptnd,
Symbol symbol, Position position, Rectangle textBounds,
double xPos, IView view, Rectangle canvasSize) {
String symbol_name = symbol.getName();
// NOT PTSY, return
if (!symbol_name.startsWith("PRESSURE_TENDENCY_")) {
return xPos;
}
// Extract the number "00 - 08" from the end
String PTSYvaluestr = symbol_name.substring(18, symbol_name.length());
int PTSYvalue = new Integer(PTSYvaluestr).intValue();
// PTSY, but not between 00 - 08, return
if (PTSYvalue < 0 || PTSYvalue > 8) {
return xPos;
}
// Is the symbol place Left (L),Center (C), or Right (R) ?
String positionLastLetter = getLastCharInPosition(position);
int numPreceedingChars = 1;
double offsetXpos = 0.0D;
double charWidth = textBounds.width;
double xScale = (view.getExtent().getWidth() / canvasSize.width);
double adjustedWidth = charWidth * 0.625 * xScale;
int m = 0;
// If the PTSY symbol is part of a PTND button
if (ptnd != null) {
int iP03C = ptnd.getValue().intValue();
int length_P03C = 0;
String sP03C = Integer.toString(iP03C);
length_P03C = sP03C.length();
numPreceedingChars = numPreceedingChars * length_P03C;
// Always put the PTSY symbol to the right of the P03C value
// by adding the adjustedWidth to the xPos
if (positionLastLetter.equalsIgnoreCase("C")) {
offsetXpos = xPos + (3 * adjustedWidth);
} else if (positionLastLetter.equalsIgnoreCase("R")) {
if (numPreceedingChars == 1) {
m = 3;
} else if (numPreceedingChars == 2) {
m = 4;
} else if (numPreceedingChars == 3) {
m = 5;
}
offsetXpos = xPos + (m * adjustedWidth);
} else if (positionLastLetter.equalsIgnoreCase("L")) {
offsetXpos = xPos + adjustedWidth;
}
}// end if PTND
// PTSY symbol independent of a PTND button combination
else if (ptnd == null) {
if (positionLastLetter.equalsIgnoreCase("C")) {
offsetXpos = xPos + (1 * adjustedWidth);
} else if (positionLastLetter.equalsIgnoreCase("R")) {
offsetXpos = xPos + (2 * adjustedWidth);
} else if (positionLastLetter.equalsIgnoreCase("L")) {
offsetXpos = xPos - (1 * adjustedWidth);
}
}
return offsetXpos;
}
/*
* TTR 923 Get the last letter of the position in the plot model. "LC"
* becomes "C" (center)
*/
private String getLastCharInPosition(Position position) {
String lastLetter = null;
String sPosition = position.name();
int length = sPosition.length();
length = length - 1;
lastLetter = sPosition.substring(length);
return lastLetter;
}
public synchronized double[] getUpdatedCoordinates(Rectangle textBounds,
double xPos, double yPos, IView view, Rectangle canvasSize,
Position position) {
@ -2588,7 +2832,6 @@ public class NcPlotImageCreator {
break;
case BC:
canvasX1 = xPos;
canvasY1 = yPos + 2 * adjustedHeight;
break;
@ -2632,7 +2875,8 @@ public class NcPlotImageCreator {
if (condColorMetPrm.getMetParamName().compareTo(
condPlotParamDefn.getMetParamName()) == 0) {
String condParamValue = getConditionalParameterValue(
condPlotParamDefn, condColorMetPrm);
condPlotParamDefn, condColorMetPrm,
currentStation);
if (condParamValue != null
&& !condColorMetPrm.hasStringValue()) {
float value = Float.parseFloat(condParamValue);
@ -2653,7 +2897,8 @@ public class NcPlotImageCreator {
}
private String getConditionalParameterValue(
PlotParameterDefn plotParamDefn, AbstractMetParameter metPrm) {
PlotParameterDefn plotParamDefn, AbstractMetParameter metPrm,
Station station) {
try {
return getFormattedValueToPlot(plotParamDefn, metPrm);
} catch (VizException e) {
@ -2858,6 +3103,7 @@ public class NcPlotImageCreator {
for (Position p : posSet) {
PlotModelElement pme = plotModelPositionMap.get(p);
if (plotParameterDefinitions != null) {
String plotMode = plotParameterDefinitions
.getPlotParamDefn(pme.getParamName()).getPlotMode();
@ -2879,4 +3125,4 @@ public class NcPlotImageCreator {
&& !mapOfWindBarbsPerFrame.isEmpty() && mapOfWindBarbsPerFrame
.get(dt) != null));
}
}
}

View file

@ -21,6 +21,7 @@ import gov.noaa.nws.ncep.viz.rsc.plotdata.plotModels.elements.PlotModelElement;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import org.eclipse.jface.util.IPropertyChangeListener;
@ -53,9 +54,9 @@ import org.eclipse.swt.widgets.Scale;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 10/15/2009 172 M. Li Initial creation.
* 10/15/2009 172 M. Li Initial creation.
* 12/05/2009 217 Greg Hull broke out from plot manager dialog and reworked.
* 08/09/2010 291 G. Zhang add support for more data resources
* 08/09/2010 291 G. Zhang add support for more data resources
* 03/07/2011 Greg Hull remove duplicate topComposite which created a
* blank area at top of dialog.
* 03/31/2011 425 Greg Hull Refactor and created PlotModelElemCenterButton
@ -67,11 +68,12 @@ import org.eclipse.swt.widgets.Scale;
* 04/16/2012 615 S. Gurung Adjusted size for PlotModelElemButton
* 05/02/2012 778 Q. Zhou Changed scale from integer to double
* 05/29/2012 654 S. Gurung Added option "Apply to All" to apply text changes to all parameters;
* Added additional options to textFontOptions and textStyleOptions;
* Fixed the issue of Sky Coverage parameters not appearing in the Sky Coverage drop-down list.
* Added additional options to textFontOptions and textStyleOptions;
* Fixed the issue of Sky Coverage parameters not appearing in the Sky Coverage drop-down list.
* 07/24/2012 431 S. Gurung Added code for editing advanced settings
* 02/26/2013 936 Archana Removed references to the 'Standard' font.
* 03/10/2014 921 S. Russell TTR 921: implemented the Clear & Reset buttons
* 06/17/2014 923 S. Russell TTR 923: altered method initWidgets()
*
* </pre>
*
@ -166,11 +168,10 @@ public class EditPlotModelComposite extends Composite {
createParmListControls();
initWidgets();
}
/*
* Create text attributes -- size, font and style
*/
/* Create text attributes -- size, font and style */
private void createTextAttrControls() {
Group textAttrGrp = new Group(topComposite, SWT.SHADOW_NONE);
GridLayout gl = new GridLayout(7, false);
@ -249,9 +250,7 @@ public class EditPlotModelComposite extends Composite {
}
/*
* Create Parameter List, symbol size and color picker
*/
/* Create Parameter List, symbol size and color picker */
private void createParmListControls() {
Composite comp = new Composite(topComposite, SWT.NONE);
GridLayout gl = new GridLayout(3, false);
@ -273,7 +272,12 @@ public class EditPlotModelComposite extends Composite {
if (!seldPlotModelElemButton.isParamNameSelected()) {
// seldPlotModelElemButton.setColor( )
}
//if (selectedParm.equalsIgnoreCase("PTND")) {
// swapInAComboBtn("PTND");
//}// else a regular button
//else {
seldPlotModelElemButton.setParmName(selectedParm);
//}
}
}
});
@ -318,8 +322,17 @@ public class EditPlotModelComposite extends Composite {
public void propertyChange(PropertyChangeEvent event) {
if (seldPlotModelElemButton != null) {
RGB rgb = cms.getColorValue();
//if (seldPlotModelElemButton instanceof PlotModelElemComboButton) {
//System.out.println("==> listener using combo btn");
//((PlotModelElemComboButton) seldPlotModelElemButton).setColor(rgb);
//((PlotModelElemComboButton) seldPlotModelElemButton).setButtonAsSelected();
//} else {
//System.out.println("==> listener using single btn");
seldPlotModelElemButton.setColor(rgb);
seldPlotModelElemButton.setButtonAsSelected();
//}
}
}
});
@ -408,26 +421,32 @@ public class EditPlotModelComposite extends Composite {
comp.setLayoutData(gd);
// 9 Param Buttons
// 9 Param Buttons
for (int i = 1; i <= 9; i++) {
pme = editedPlotModel.getPlotModelElement(plotModelElementPositions[i]);
if (pme == null) {
pme = new PlotModelElement();
pme.setPosition(plotModelElementPositions[i]);
}
// the center button stores the sky coverage and wind barb params
// too.
if (plotModelElementPositions[i].equals("MC")) {
PlotModelElemCenterButton cntrBtn = new PlotModelElemCenterButton(comp, pme, editedPlotModel.getSkyCoverageElement(), editedPlotModel.getWindBarbElement());
cntrBtn.init();
try {
plotModelElementsUIMap.put(plotModelElementPositions[i], cntrBtn);
} else {
pmeBtn = new PlotModelElemButton(comp, pme);
pmeBtn.init();
// the center button stores the sky coverage and wind barb params
if (plotModelElementPositions[i].equals("MC")) {
PlotModelElemCenterButton cntrBtn = new PlotModelElemCenterButton(comp, pme, editedPlotModel.getSkyCoverageElement(), editedPlotModel.getWindBarbElement());
cntrBtn.init();
plotModelElementsUIMap.put(plotModelElementPositions[i], cntrBtn);
} else {
pmeBtn = new PlotModelElemButton(comp, pme);
pmeBtn.init();
plotModelElementsUIMap.put(plotModelElementPositions[i], pmeBtn);
}
}// end try
catch (Exception e) {
e.printStackTrace();
plotModelElementsUIMap.put(plotModelElementPositions[i], pmeBtn);
}
}
@ -554,13 +573,10 @@ public class EditPlotModelComposite extends Composite {
// to the
// plotModel when the param is selected.
System.out.println("check called");
if (!checkBtn.getSelection()) {
editedPlotModel.removePlotModelElement(pltMdlElmt);
System.out.println("check unchecked");
} else if (pltMdlElmt.getParamName() != null) {
editedPlotModel.putPlotModelElement(pltMdlElmt);
System.out.println("check check parmaname not null");
}
}
@ -749,7 +765,6 @@ public class EditPlotModelComposite extends Composite {
}
}
//
private class PlotModelElemCenterButton extends PlotModelElemButton {
private PlotModelElement skyCovElmt = null;
@ -912,13 +927,6 @@ public class EditPlotModelComposite extends Composite {
// wndBrbElmt = wbe;
// }
@Override
public void setSymbolSize(Double size) {
super.setSymbolSize(size);
wndBrbElmt.setSymbolSize(size);
skyCovElmt.setSymbolSize(size);
}
@Override
public Double getSymbolSize() {
if (pltMdlElmt.getParamName() != null) {
@ -989,6 +997,14 @@ public class EditPlotModelComposite extends Composite {
public boolean isParamNameSelected() {
return (wndBrbElmt.getParamName() != null || skyCovElmt.getParamName() != null || pltMdlElmt.getParamName() != null);
}
@Override
public void setSymbolSize(Double size) {
super.setSymbolSize(size);
this.wndBrbElmt.setSymbolSize(size);
this.skyCovElmt.setSymbolSize(size);
}
}
public void initWidgets() {
@ -1007,14 +1023,23 @@ public class EditPlotModelComposite extends Composite {
textStyleCombo.select(0); // to be replaced by init
String[] strArray = plotParamDefns.getAllParameterNames(false, false);
//TTR 923 remove "P03X" from the menu ( the dummy XML it comes from in
// plotParameters_obs.xml is needed to make the code run without a
// a significant amount of reworking
ArrayList<String> parameterNames = new ArrayList<String>();
Collections.addAll(parameterNames, strArray);
parameterNames.remove("P03X");
strArray = parameterNames.toArray(new String[parameterNames.size()]);
Arrays.sort(strArray);
availParamsList.setItems(strArray);
availParamsList.setEnabled(false);
}
/*
* create widgets for center position only parameters
*/
/* create widgets for center position only parameters */
private void createCtrParamControls() {
availWindBarpParams = plotParamDefns.getWindBarbParams();
@ -1235,7 +1260,7 @@ public class EditPlotModelComposite extends Composite {
comboBrbk.setEnabled(enable);
}
// ttr 921 changed to protected
// TTR 921 changed to protected
public PlotModel getEditedPlotModel() {
return this.editedPlotModel;
}
@ -1351,22 +1376,8 @@ public class EditPlotModelComposite extends Composite {
// Clear Plot Model Buttons, make them all vanilla "Parm" buttons
for (String position : plotModelElementPositions) {
// NOT special middle center button
if (!position.equalsIgnoreCase("MC")) {
pmeBtn = plotModelElementsUIMap.get(position);
pmeBtn.parmBtn.setText("Parm");
pmeBtn.parmBtn.setSelection(false);
pmeBtn.checkBtn.setSelection(false);
pmeBtn.checkBtn.setEnabled(false);
pmeBtn.grp.setBackground(widget_background);
pmeBtn.parmBtn.setBackground(widget_background);
pmeBtn.parmBtn.setForeground(widget_foreground);
editedPlotModel.removePlotModelElement(pmeBtn.getPlotModelElement());
pmeBtn.pltMdlElmt = new PlotModelElement();
pmeBtn.pltMdlElmt.setPosition(position);
} else if (position.equalsIgnoreCase("MC")) {
// Clear special middle center button
// Clear special middle center button
if (position.equalsIgnoreCase("MC")) {
pmecb = (PlotModelElemCenterButton) plotModelElementsUIMap.get("MC");
pmecb.parmBtn.setText("Parm");
pmecb.parmBtn.setSelection(false);
@ -1378,22 +1389,36 @@ public class EditPlotModelComposite extends Composite {
editedPlotModel.removePlotModelElement(pmecb.getPlotModelElement());
editedPlotModel.removePlotModelElement(pmecb.getSkyCoveragePlotModelElement());
editedPlotModel.removePlotModelElement(pmecb.getWindBarbPlotModelElement());
pmecb.pltMdlElmt = new PlotModelElement();
pmecb.pltMdlElmt.setPosition(position);
pmecb.skyCovElmt.setColorRGB(new RGB(255, 255, 255));
pmecb.wndBrbElmt.setColorRGB(new RGB(255, 255, 255));
}// all other positions
else {
pmeBtn = plotModelElementsUIMap.get(position);
pmeBtn.parmBtn.setText("Parm");
pmeBtn.parmBtn.setSelection(false);
pmeBtn.checkBtn.setSelection(false);
pmeBtn.checkBtn.setEnabled(false);
pmeBtn.grp.setBackground(widget_background);
pmeBtn.parmBtn.setBackground(widget_background);
pmeBtn.parmBtn.setForeground(widget_foreground);
editedPlotModel.removePlotModelElement(pmeBtn.getPlotModelElement());
pmeBtn.pltMdlElmt = new PlotModelElement();
pmeBtn.pltMdlElmt.setPosition(position);
}
}// end for-loop
}// end method clearPlotModel()
// TTR 921
private void resetPlotModel() {
PlotModel origPlotModel = new PlotModel(this.getOriginalPlotModel());
PlotModelElement opme, oskypme, owindpme, tpme = null;
PlotModelElement opme = null;
PlotModelElement oskypme, owindpme, tpme = null;
PlotModelElement oprimepme = null;
PlotModelElement osecondpme = null;
PlotModelElemButton pmeBtn = null;
PlotModelElemCenterButton cntrBtn = null;
RGB rgb = null;
@ -1409,23 +1434,8 @@ public class EditPlotModelComposite extends Composite {
opme.setPosition(position);
}
// All buttons except the special center button
if (!position.equalsIgnoreCase("MC")) {
// Get the original button color
red = opme.getColor().getRed();
green = opme.getColor().getGreen();
blue = opme.getColor().getBlue();
rgb = new RGB(red, green, blue);
pmeBtn = origPltMdlElmntsUIMap.get(position);
pmeBtn.setColor(rgb);
pmeBtn.setParmName(opme.getParamName());
pmeBtn.pltMdlElmt = opme;
pmeBtn.init();
}// end if not MC /*
else if (position.equalsIgnoreCase("MC")) {
// Reset the special center button
if (position.equalsIgnoreCase("MC")) {
oskypme = origPlotModel.getSkyCoverageElement();
owindpme = origPlotModel.getWindBarbElement();
@ -1469,17 +1479,34 @@ public class EditPlotModelComposite extends Composite {
}
cntrBtn.init();
}
if (opme.getParamName() == null) {
editedPlotModel.removePlotModelElement(opme);
} else {
}// reset all other positions
else {
// Get the original button color
red = opme.getColor().getRed();
green = opme.getColor().getGreen();
blue = opme.getColor().getBlue();
rgb = new RGB(red, green, blue);
pmeBtn = origPltMdlElmntsUIMap.get(position);
pmeBtn.setColor(rgb);
pmeBtn.setParmName(opme.getParamName());
pmeBtn.pltMdlElmt = opme;
pmeBtn.init();
}// end all other positions
if (opme.getParamName() != null) {
editedPlotModel.putPlotModelElement(opme);
}// opme null paramname
else {
editedPlotModel.removePlotModelElement(opme);
}
}// end for-loop
}// end method resetPlotModel()
}
// TTR 921
private PlotModel getOriginalPlotModel() {
@ -1509,7 +1536,6 @@ public class EditPlotModelComposite extends Composite {
plugin = editedPlotModel.getPlugin();
plotmodelname = editedPlotModel.getName();
origPlotModel = PlotModelMngr.getInstance().getPlotModel(plugin, plotmodelname);
}
} catch (Exception e) {
@ -1520,4 +1546,4 @@ public class EditPlotModelComposite extends Composite {
}
}
}

View file

@ -130,6 +130,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 05/20/2013 988 Archana.S Refactored this class for performance improvement
* 11/07/2013 sgurung Added fix for "no data for every other frame" issue (earlier fix was added to 13.5.2 on 10/24/2013)
* 03/18/2013 1064 B. Hebbard Added handling of matrixType request constraint, for PAFM
* 06/24/2014 1009 kbugenhagen Reload framedata if no stations found
* </pre>
*
* @author brockwoo
@ -243,7 +244,7 @@ public class NcPlotResource2 extends
@Override
public void run() {
Tracer.print("> Entry START TASK "
Tracer.print("> Entry START FcstFrameLoaderTask TASK "
+ Tracer.shortTimeString(frameTime));
Semaphore sm = new Semaphore(1);
sm.acquireUninterruptibly();
@ -334,7 +335,7 @@ public class NcPlotResource2 extends
@Override
public void run() {
Tracer.print("> Entry START TASK "
Tracer.print("> Entry START FrameLoaderTask TASK "
+ Tracer.shortTimeString(dataTime));
Tracer.print("About to run postgres query for frame: "
+ Tracer.shortTimeString(dataTime));
@ -717,7 +718,7 @@ public class NcPlotResource2 extends
}
public boolean calcStaticStationInfo(Station station) {
Tracer.printX("> Entry");
Tracer.print("> Entry");
SPIEntry obsStation = null;
Coordinate thisLocation = null;
Coordinate thisPixelLocation = null;
@ -1065,7 +1066,10 @@ public class NcPlotResource2 extends
frameData.stationMap.values());
} else {
Tracer.print("Calling from paintFrame() - no stations in stationMap for frame: "
+ frameData.getShortFrameTime());
+ frameData.getShortFrameTime()
+ ". Loading frame data again.");
loadFrameData();
issueRefresh();
}
// TODO??CHECK frameData.progressiveDisclosureInProgress = true;
@ -1591,35 +1595,40 @@ public class NcPlotResource2 extends
sm.acquireUninterruptibly(1);
FrameData fd = ((FrameData) getFrame(time));
if (listOfStringsToDraw != null && !listOfStringsToDraw.isEmpty())
fd.drawableStrings = new ArrayList<DrawableString>(
listOfStringsToDraw);
else
fd.drawableStrings = new ArrayList<DrawableString>(0);
if (fd != null) {
if (listOfStringsToDraw != null && !listOfStringsToDraw.isEmpty())
fd.drawableStrings = new ArrayList<DrawableString>(
listOfStringsToDraw);
else
fd.drawableStrings = new ArrayList<DrawableString>(0);
if (listOfVectors != null && !listOfVectors.isEmpty())
fd.listOfWindVectors = new ArrayList<IVector>(listOfVectors);
else
fd.listOfWindVectors = new ArrayList<IVector>(0);
if (listOfVectors != null && !listOfVectors.isEmpty())
fd.listOfWindVectors = new ArrayList<IVector>(listOfVectors);
else
fd.listOfWindVectors = new ArrayList<IVector>(0);
if (listOfSymbolLocSet != null && !listOfSymbolLocSet.isEmpty()) {
fd.listOfSymbolLocSet = new ArrayList<SymbolLocationSet>(
listOfSymbolLocSet);
} else
fd.listOfSymbolLocSet = new ArrayList<SymbolLocationSet>(0);
if (listOfSymbolLocSet != null && !listOfSymbolLocSet.isEmpty()) {
fd.listOfSymbolLocSet = new ArrayList<SymbolLocationSet>(
listOfSymbolLocSet);
} else
fd.listOfSymbolLocSet = new ArrayList<SymbolLocationSet>(0);
fd.setOfStationsLastRendered = new HashSet<Station>();
fd.setOfStationsLastRendered.addAll(collectionOfStationsToBeRendered);
fd.setOfStationsLastRendered = new HashSet<Station>();
fd.setOfStationsLastRendered
.addAll(collectionOfStationsToBeRendered);
for (Station stn : collectionOfStationsToBeRendered) {
String stnKey = getStationMapKey(stn.info.latitude.doubleValue(),
stn.info.longitude.doubleValue());
synchronized (fd.stationMap) {
fd.stationMap.put(stnKey, stn);
for (Station stn : collectionOfStationsToBeRendered) {
String stnKey = getStationMapKey(
stn.info.latitude.doubleValue(),
stn.info.longitude.doubleValue());
synchronized (fd.stationMap) {
fd.stationMap.put(stnKey, stn);
}
}
fd.progressiveDisclosureInProgress = false;
}
fd.progressiveDisclosureInProgress = false;
Tracer.print("renderingComplete() called for the frame "
+ Tracer.shortTimeString(time) + " with "
+ collectionOfStationsToBeRendered.size() + " stations");

View file

@ -1,4 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
.,\
plugin.xml