25 |
* |
* |
26 |
* Contributors: |
* Contributors: |
27 |
* Martin O. J. Schmitz - initial API and implementation |
* Martin O. J. Schmitz - initial API and implementation |
28 |
* Stefan A. Krüger - additional utility classes |
* Stefan A. Tzeggai - additional utility classes |
29 |
******************************************************************************/ |
******************************************************************************/ |
30 |
package skrueger; |
package skrueger; |
31 |
|
|
35 |
import org.apache.log4j.Logger; |
import org.apache.log4j.Logger; |
36 |
import org.geotools.feature.NameImpl; |
import org.geotools.feature.NameImpl; |
37 |
import org.opengis.feature.type.AttributeDescriptor; |
import org.opengis.feature.type.AttributeDescriptor; |
38 |
|
import org.opengis.feature.type.Name; |
39 |
|
|
40 |
import skrueger.geotools.Copyable; |
import skrueger.geotools.Copyable; |
41 |
import skrueger.geotools.StyledLayerInterface; |
import skrueger.geotools.StyledLayerInterface; |
97 |
* @param unit |
* @param unit |
98 |
* {@link String} of the unit that the information is in |
* {@link String} of the unit that the information is in |
99 |
*/ |
*/ |
100 |
public AttributeMetadataImpl(final NameImpl name, final Boolean visible, |
public AttributeMetadataImpl(final Name name, final Boolean visible, |
101 |
final Translation title, final Translation desc, final String unit) { |
final Translation title, final Translation desc, final String unit) { |
102 |
|
|
103 |
this.setName(name); |
this.setName(name); |
119 |
* @param unit |
* @param unit |
120 |
* {@link String} of the unit that the information is in |
* {@link String} of the unit that the information is in |
121 |
*/ |
*/ |
122 |
public AttributeMetadataImpl(final NameImpl name, final Boolean visible, |
public AttributeMetadataImpl(final Name name, final Boolean visible, |
123 |
final String unit) { |
final String unit) { |
124 |
this.setName(name); |
this.setName(name); |
125 |
this.visible = visible; |
this.visible = visible; |
129 |
/** |
/** |
130 |
* Creates a new visible {@link AttributeMetadataImpl} |
* Creates a new visible {@link AttributeMetadataImpl} |
131 |
*/ |
*/ |
132 |
public AttributeMetadataImpl(final NameImpl name, final List<String> langs) { |
public AttributeMetadataImpl(final Name name, final List<String> langs) { |
133 |
this(name, true, new Translation(langs, name.getLocalPart()), |
this(name, true, new Translation(langs, name.getLocalPart()), |
134 |
new Translation(), ""); |
new Translation(), ""); |
135 |
} |
} |
137 |
/** |
/** |
138 |
* Creates a new visible {@link AttributeMetadataImpl} |
* Creates a new visible {@link AttributeMetadataImpl} |
139 |
*/ |
*/ |
140 |
public AttributeMetadataImpl(final NameImpl name, final String defaultTitle, |
public AttributeMetadataImpl(final Name name, final String defaultTitle, |
141 |
final List<String> langs) { |
final List<String> langs) { |
142 |
this(name, true, new Translation(langs, defaultTitle), |
this(name, true, new Translation(langs, defaultTitle), |
143 |
new Translation(), ""); |
new Translation(), ""); |
185 |
* further down. |
* further down. |
186 |
*/ |
*/ |
187 |
@Override |
@Override |
188 |
public int compareTo(final AttributeMetadata atm2) { |
public int compareTo(final AttributeMetadataInterface atm2) { |
189 |
return new Integer(weight).compareTo(new Double(atm2.getWeight()) |
return new Integer(weight).compareTo(new Double(atm2.getWeight()) |
190 |
.intValue()); |
.intValue()); |
191 |
} |
} |
194 |
* @see Copyable inferface |
* @see Copyable inferface |
195 |
*/ |
*/ |
196 |
@Override |
@Override |
197 |
public AttributeMetadata copy() { |
public AttributeMetadataInterface copy() { |
198 |
return copyTo(new AttributeMetadataImpl()); |
return copyTo(new AttributeMetadataImpl()); |
199 |
} |
} |
200 |
|
|
202 |
* @see Copyable inferface |
* @see Copyable inferface |
203 |
*/ |
*/ |
204 |
@Override |
@Override |
205 |
public AttributeMetadata copyTo(final AttributeMetadata amd) { |
public AttributeMetadataInterface copyTo(final AttributeMetadataInterface amd) { |
206 |
getTitle().copyTo(amd.getTitle()); |
getTitle().copyTo(amd.getTitle()); |
207 |
getDesc().copyTo(amd.getDesc()); |
getDesc().copyTo(amd.getDesc()); |
208 |
amd.setUnit(getUnit()); |
amd.setUnit(getUnit()); |