From d68bb6da0d1bc636be10c1f3b8037d30a259589f Mon Sep 17 00:00:00 2001 From: Benjamin Phillippe Date: Thu, 31 Jan 2013 14:43:26 -0600 Subject: [PATCH 1/3] Issue #1525 Data Discovery Browser Performance Change-Id: I1b5405e52fa8462b562e8a56b2e544d96e9ad0f3 Former-commit-id: 25b05eada7aaf7612693a90db49c2678932d800e [formerly acb6889b1d18b23f7ecd51282b98ad197b731c45] [formerly 9806387a8b483910c982d21cc3e2d13b2605cb84 [formerly 495a30e31a16f0c595c35555e4d804585dcb5a96]] Former-commit-id: 9806387a8b483910c982d21cc3e2d13b2605cb84 Former-commit-id: db40c02bbf5296006a7ecd1b527326b8436d83d0 --- .../regrep/xsd/rim/v4/ExtensibleObjectType.java | 4 ++-- .../regrep/xsd/rim/v4/RegistryObjectType.java | 14 +++++++------- .../names/tc/ebxml/regrep/xsd/rim/v4/SlotType.java | 5 +++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ExtensibleObjectType.java b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ExtensibleObjectType.java index 037b20e33d..4907aeac36 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ExtensibleObjectType.java +++ b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ExtensibleObjectType.java @@ -87,8 +87,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL, include = "all") public abstract class ExtensibleObjectType { - @BatchSize(size = 15) - @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @BatchSize(size = 500) + @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinTable(inverseJoinColumns = @JoinColumn(name = "child_slot_key")) @XmlElement(name = "Slot") @DynamicSerializeElement diff --git a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/RegistryObjectType.java b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/RegistryObjectType.java index ddffcce84f..5e566b091f 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/RegistryObjectType.java +++ b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/RegistryObjectType.java @@ -100,45 +100,45 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; RoleType.class }) @DynamicSerialize @Entity -@Cache(region="registryObjects",usage = CacheConcurrencyStrategy.TRANSACTIONAL, include = "all") +@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL, include = "all") @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) @Table(name = "RegistryObject") public class RegistryObjectType extends IdentifiableType { @XmlElement(name = "Name") @DynamicSerializeElement - @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) protected InternationalStringType name; @XmlElement(name = "Description") @DynamicSerializeElement - @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) protected InternationalStringType description; @XmlElement(name = "VersionInfo") @DynamicSerializeElement @Cascade(value = { org.hibernate.annotations.CascadeType.DETACH }) - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) protected VersionInfoType versionInfo; @XmlElement(name = "Classification") @DynamicSerializeElement @Cascade(value = { org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.DETACH }) - @ManyToMany + @ManyToMany(fetch = FetchType.LAZY) protected Set classification; @XmlElement(name = "ExternalIdentifier") @DynamicSerializeElement @Cascade(value = { org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.DETACH }) - @ManyToMany + @ManyToMany(fetch = FetchType.LAZY) protected Set externalIdentifier; @XmlElement(name = "ExternalLink") @DynamicSerializeElement @Cascade(value = { org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.DETACH }) - @ManyToMany + @ManyToMany(fetch = FetchType.LAZY) protected Set externalLink; @XmlAttribute diff --git a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/SlotType.java b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/SlotType.java index b006e5d63b..b3416a82e8 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/SlotType.java +++ b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/SlotType.java @@ -24,6 +24,7 @@ import java.io.Serializable; import javax.persistence.CascadeType; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.ManyToOne; @@ -83,7 +84,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; // "slot_join_slot", joinColumns = @JoinColumn(name = "parent_slot_key", // referencedColumnName = "key"), inverseJoinColumns = @JoinColumn(name = // "child_slot_key", referencedColumnName = "key"))) -@Cache(region="registryObjects",usage = CacheConcurrencyStrategy.TRANSACTIONAL, include = "all") +@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL, include = "all") @Table(name = "Slot") public class SlotType extends ExtensibleObjectType implements Serializable { @@ -94,7 +95,7 @@ public class SlotType extends ExtensibleObjectType implements Serializable { @XmlTransient private Integer key; - @ManyToOne(cascade = CascadeType.ALL) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @XmlElement(name = "SlotValue") @DynamicSerializeElement protected ValueType slotValue; From ed42a6d9394c663148a728190c5d6b0c384017c2 Mon Sep 17 00:00:00 2001 From: Jonathan Sanchez Date: Thu, 31 Jan 2013 15:11:17 -0600 Subject: [PATCH 2/3] Issue #1557 Added allowDuplicates XML element to point source configuration. Change-Id: I20a05413ef93c4b1268a5b9d3d5541375a47523b Former-commit-id: b2870a012e0fdc9dba051126cc07d08baa5b70e0 [formerly da1061baa657c7471794988e8f5c4f38025ed223] [formerly f72968824a50cc591bc2f38a7b25513389fbe654 [formerly 945b2e64b971fc31691d550e6c629f43db9a9c99]] Former-commit-id: f72968824a50cc591bc2f38a7b25513389fbe654 Former-commit-id: 53eddc3ec827ec24d3ba058380f6e973c44cc53e --- .../src/com/raytheon/viz/warngen/gis/Wx.java | 84 +++++++++++++------ .../config/PointSourceConfiguration.java | 12 +++ 2 files changed, 72 insertions(+), 24 deletions(-) diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java index f80698498e..fc157905b8 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java @@ -100,7 +100,8 @@ import com.vividsolutions.jts.geom.Point; * in pathcast. * Oct 05, 2012 DR15429 Qinglu Lin Updated code to keep duplicate names of cities * which are at different locations in pathcast. - * Oct 17, 2012 jsanchez Moved the path cast data collecting to a seperate class. + * Oct 17, 2012 jsanchez Moved the path cast data collecting to a separate class. + * Jan 31, 2013 1557 jsanchez Used allowDuplicates flag to collect points with duplicate names. * * * @@ -618,6 +619,7 @@ public class Wx { // All configs should have the same "isWithinPolygon" flag boolean isWithinPolygon = pointConfigs[0].isWithinPolygon(); + boolean allowDuplicates = pointConfigs[0].isAllowDuplicates(); // Sort by fields should have been validated to be same as well List fields = pointConfigs[0].getSortBy() != null ? Arrays @@ -702,12 +704,14 @@ public class Wx { GeodeticCalculator gc = new GeodeticCalculator(); Map nameMap = new HashMap( (int) (availablePoints.size() * 1.3)); + List pointsWithinDistance = new ArrayList(); for (int i = 0; i < coords.length; ++i) { Coordinate coord = localCoords[i]; Geometry localDistanceGeom = dimensions == 1 ? localSearchArea : gf .createPoint(coord); Geometry distanceGeom = dimensions == 1 ? searchArea : gf .createPoint(coords[i]); + pointsWithinDistance.clear(); nameMap.clear(); for (ClosestPoint cp : availablePoints) { @@ -716,33 +720,31 @@ public class Wx { double distance = localDistanceGeom.distance(localPt); if (distance <= thresholdInMeters) { - // check map of currently added points for closer point with - // the same name - ClosestPoint existingPt = nameMap.get(cp.name); - if (existingPt == null || distance < existingPt.distance) { - // Set the distances - ClosestPoint cp2 = new ClosestPoint(cp); - cp2.distance = distance; - cp2.roundedDistance = (int) metersToDistance - .convert(distance); - gc.setStartingGeographicPoint(cp2.point.x, cp2.point.y); - Coordinate cen = distanceGeom.getCentroid() - .getCoordinate(); - cen = GisUtil.restoreAlaskaLon(cen); - gc.setDestinationGeographicPoint(cen.x, cen.y); - cp2.azimuth = gc.getAzimuth(); - cp2.oppositeAzimuth = ClosestPoint - .adjustAngle(cp2.azimuth + 180); - cp2.roundedAzimuth = GeoUtil.roundAzimuth(cp2.azimuth); - cp2.oppositeRoundedAzimuth = ClosestPoint - .adjustAngle(cp2.roundedAzimuth + 180); - nameMap.put(cp2.name, cp2); + if (allowDuplicates) { + // collect all points that are within the threshold + ClosestPoint cp2 = createClosestPoint(cp, distance, + metersToDistance, distanceGeom, gc); + pointsWithinDistance.add(cp2); + } else { + // check map of currently added points for closer point + // with the same name + ClosestPoint existingPt = nameMap.get(cp.name); + if (existingPt == null + || distance < existingPt.distance) { + ClosestPoint cp2 = createClosestPoint(cp, distance, + metersToDistance, distanceGeom, gc); + nameMap.put(cp2.name, cp2); + } } } } - List pts = new ArrayList( - nameMap.values()); + List pts = null; + if (allowDuplicates) { + pts = new ArrayList(pointsWithinDistance); + } else { + pts = new ArrayList(nameMap.values()); + } if (fields.isEmpty() == false) { // Sort the points based on sortBy fields Collections.sort(pts, new ClosestPointComparator(fields)); @@ -817,6 +819,40 @@ public class Wx { return null; } + /** + * Helper method to create a ClosestPoint object. + * + * @param cp + * @param distance + * between the cp to the + * @param metersToDistance + * Unit converter to calculate the rounded distance. + * @param distanceGeom + * Geometry search area. + * @param gc + * Geodetic Calculator to determine the azimuth + * @return ClosestPoint object set with roundedDistance, azimuth, etc. + */ + private ClosestPoint createClosestPoint(ClosestPoint cp, double distance, + UnitConverter metersToDistance, Geometry distanceGeom, + GeodeticCalculator gc) { + // Set the distances + ClosestPoint cp2 = new ClosestPoint(cp); + cp2.distance = distance; + cp2.roundedDistance = (int) metersToDistance.convert(distance); + gc.setStartingGeographicPoint(cp2.point.x, cp2.point.y); + Coordinate cen = GisUtil.restoreAlaskaLon(distanceGeom.getCentroid() + .getCoordinate()); + gc.setDestinationGeographicPoint(cen.x, cen.y); + cp2.azimuth = gc.getAzimuth(); + cp2.oppositeAzimuth = ClosestPoint.adjustAngle(cp2.azimuth + 180); + cp2.roundedAzimuth = GeoUtil.roundAzimuth(cp2.azimuth); + cp2.oppositeRoundedAzimuth = ClosestPoint + .adjustAngle(cp2.roundedAzimuth + 180); + + return cp2; + } + public double getMovementSpeed() { return getMovementSpeed(null); } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/PointSourceConfiguration.java b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/PointSourceConfiguration.java index 0ec069c298..c193e92ff6 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/PointSourceConfiguration.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/PointSourceConfiguration.java @@ -26,6 +26,7 @@ import com.raytheon.uf.common.dataquery.requests.RequestableMetadataMarshaller; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Aug 17, 2011 mschenke Initial creation + * Jan 31, 2013 1557 jsanchez Added the XMLElement allowDuplicates. * * * @@ -80,6 +81,9 @@ public class PointSourceConfiguration { @XmlElement private double distanceThreshold = 10; + @XmlElement + protected boolean allowDuplicates = false; + @XmlElementWrapper(name = "sortBy") @XmlElement(name = "sort") private String[] sortBy; @@ -173,4 +177,12 @@ public class PointSourceConfiguration { this.type = type; } + public boolean isAllowDuplicates() { + return allowDuplicates; + } + + public void setAllowDuplicates(boolean allowDuplicates) { + this.allowDuplicates = allowDuplicates; + } + } From 16be5e1ab524bbe566d3bb1d70316f1ba883e63c Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Fri, 1 Feb 2013 12:45:39 -0600 Subject: [PATCH 3/3] Issue #1575 apply persisted colormap attributes to grid resources Former-commit-id: f8b9b2c9870bc1951be5a3ad2ea8e64216de87e4 [formerly 07d053bb3c05dec29b384ff348b904f76d238bfb] [formerly 1884c77278fed5e51b05e6b3e594170754d755c9 [formerly 4bb77ee1763890a355a0ac5eefb8c14c12e13780]] Former-commit-id: 1884c77278fed5e51b05e6b3e594170754d755c9 Former-commit-id: a2a95a17aa0f94330bfb4fd02cef276479c2276c --- .../viz/grid/rsc/general/AbstractGridResource.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/AbstractGridResource.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/AbstractGridResource.java index ed9a9b0ae8..0b9037e1f6 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/AbstractGridResource.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/AbstractGridResource.java @@ -51,6 +51,7 @@ import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.drawables.ColorMapLoader; import com.raytheon.uf.viz.core.drawables.ColorMapParameters; +import com.raytheon.uf.viz.core.drawables.ColorMapParameters.PersistedParameters; import com.raytheon.uf.viz.core.drawables.IRenderable; import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.exception.VizException; @@ -595,6 +596,13 @@ public abstract class AbstractGridResource // reuse the old parameters. This is useful when the resource is // sharing capabilities, for example in an FFGVizGroupResource. newParameters = oldParameters; + } else if (oldParameters != null) { + newParameters.setColorMapName(oldParameters.getColorMapName()); + newParameters.setColorMap(oldParameters.getColorMap()); + PersistedParameters persisted = oldParameters.getPersisted(); + if (persisted != null) { + newParameters.applyPersistedParameters(persisted); + } } return newParameters; }