1 | /* |
---|
2 | * $Id: SGT3DVector.java,v 1.3 2003/08/22 23:02:38 dwd Exp $ |
---|
3 | * |
---|
4 | * This software is provided by NOAA for full, free and open release. It is |
---|
5 | * understood by the recipient/user that NOAA assumes no liability for any |
---|
6 | * errors contained in the code. Although this software is released without |
---|
7 | * conditions or restrictions in its use, it is expected that appropriate |
---|
8 | * credit be given to its author and to the National Oceanic and Atmospheric |
---|
9 | * Administration should the software be included by the recipient as an |
---|
10 | * element in other product development. |
---|
11 | */ |
---|
12 | |
---|
13 | package gov.noaa.pmel.sgt.dm; |
---|
14 | |
---|
15 | import gov.noaa.pmel.sgt.SGLabel; |
---|
16 | import gov.noaa.pmel.util.SoTRange; |
---|
17 | |
---|
18 | import java.beans.PropertyChangeListener; |
---|
19 | import java.io.Serializable; |
---|
20 | |
---|
21 | /** |
---|
22 | * Defines a data object to be a Vector. Interpretation |
---|
23 | * of U and V is determined by the <code>CoordinateSystem</code>. For |
---|
24 | * <code>Cartesian</code>, U and V are the Cartesian vector |
---|
25 | * components. For <code>Polar</code> , |
---|
26 | * U and V are R (radius) and Theta (angle) vector components, |
---|
27 | * respectively. |
---|
28 | * |
---|
29 | * @author Donald Denbo |
---|
30 | * @version $Revision: 1.3 $, $Date: 2003/08/22 23:02:38 $ |
---|
31 | * @since 1.0 |
---|
32 | * @see SGTData |
---|
33 | * @see CoordinateSystem |
---|
34 | */ |
---|
35 | public class SGT3DVector extends SGTVector { |
---|
36 | /**@shapeType AggregationLink |
---|
37 | * @clientRole w comp*/ |
---|
38 | SGTGrid wComp_; |
---|
39 | /** |
---|
40 | * Default constructor. |
---|
41 | */ |
---|
42 | public SGT3DVector() { |
---|
43 | } |
---|
44 | /** |
---|
45 | * Construct a SGTVector from two components. The two components |
---|
46 | * must match in both SGTData and CoordinateSystem Interfaces. |
---|
47 | * Both components must be the same shape. |
---|
48 | * |
---|
49 | * @param uComp U component of the vector |
---|
50 | * @param vComp V component of the vector |
---|
51 | * @param vComp W component of the vector |
---|
52 | */ |
---|
53 | public SGT3DVector(SGTGrid uComp,SGTGrid vComp, SGTGrid wComp) { |
---|
54 | uComp_ = uComp; |
---|
55 | vComp_ = vComp; |
---|
56 | wComp_ = wComp; |
---|
57 | } |
---|
58 | /** |
---|
59 | * Create a copy. Creates a shallow copy. |
---|
60 | * |
---|
61 | * @see SGTData |
---|
62 | */ |
---|
63 | public SGTData copy() { |
---|
64 | SGT3DVector newSGTVector; |
---|
65 | try { |
---|
66 | newSGTVector = (SGT3DVector)clone(); |
---|
67 | } catch (CloneNotSupportedException e) { |
---|
68 | newSGTVector = new SGT3DVector(this.uComp_, this.vComp_, this.wComp_); |
---|
69 | } |
---|
70 | return (SGTData)newSGTVector; |
---|
71 | } |
---|
72 | /** |
---|
73 | * Get the W component. |
---|
74 | * |
---|
75 | * @return W component |
---|
76 | */ |
---|
77 | public SGTGrid getW() { |
---|
78 | return wComp_; |
---|
79 | } |
---|
80 | |
---|
81 | /** |
---|
82 | * Set the W component. |
---|
83 | * |
---|
84 | * @param uComp W component |
---|
85 | */ |
---|
86 | public void setU(SGTGrid wComp) { |
---|
87 | wComp_ = wComp; |
---|
88 | } |
---|
89 | |
---|
90 | /** |
---|
91 | * Set the vector components. |
---|
92 | * |
---|
93 | * @param uComp U component |
---|
94 | * @param vComp V component |
---|
95 | */ |
---|
96 | public void setComponents(SGTGrid uComp, SGTGrid vComp, SGTGrid wComp) { |
---|
97 | uComp_ = uComp; |
---|
98 | vComp_ = vComp; |
---|
99 | wComp_ = wComp; |
---|
100 | } |
---|
101 | |
---|
102 | /** |
---|
103 | * Get the unique identifier. The presence of the identifier |
---|
104 | * is optional, but if it is present it should be unique. This |
---|
105 | * field is used to search for the layer that contains the data. |
---|
106 | * |
---|
107 | * @return unique identifier |
---|
108 | * @see gov.noaa.pmel.sgt.Pane |
---|
109 | * @see gov.noaa.pmel.sgt.Layer |
---|
110 | */ |
---|
111 | public String getId() { |
---|
112 | return id_; |
---|
113 | } |
---|
114 | /** |
---|
115 | * Set the unique identifier. |
---|
116 | */ |
---|
117 | public void setId(String ident) { |
---|
118 | id_ = ident; |
---|
119 | } |
---|
120 | |
---|
121 | |
---|
122 | public void addPropertyChangeListener(PropertyChangeListener l) { |
---|
123 | uComp_.addPropertyChangeListener(l); |
---|
124 | vComp_.addPropertyChangeListener(l); |
---|
125 | wComp_.addPropertyChangeListener(l); |
---|
126 | } |
---|
127 | public void removePropertyChangeListener(PropertyChangeListener l) { |
---|
128 | uComp_.removePropertyChangeListener(l); |
---|
129 | vComp_.removePropertyChangeListener(l); |
---|
130 | wComp_.removePropertyChangeListener(l); |
---|
131 | } |
---|
132 | } |
---|