/**************************************************************************************************
**
** $Id: DashArray.java 831 2006-05-01 00:27:23Z Desruisseaux $
**
** $URL: http://svn.code.sf.net/p/geoapi/code/branches/2.0.x/geoapi/src/main/java/org/opengis/go/display/style/DashArray.java $
**
** Copyright (C) 2003-2005 Open GIS Consortium, Inc.
** All Rights Reserved. http://www.opengis.org/legal/
**
*************************************************************************************************/
package org.opengis.go.display.style;
// J2SE direct dependencies
import java.util.ArrayList;
import java.util.List;
// OpenGIS dependencies
import org.opengis.util.CodeList;
/**
* Indicates the various enumerations of drawing a pattern line.
* An implementor can create a DashArray by passing
* a float array in the constructor that would indicate the dash
* pattern to be drawn.
*
* @author OpenGIS® consortium
* @version $Revision: 658 $, $Date: 2006-02-23 12:09:34 +1100 (jeu., 23 févr. 2006) $
*/
public class DashArray extends LinePattern {
/**
* Serial number for compatibility with different versions.
*/
private static final long serialVersionUID = 3542251485648657363L;
//*************************************************************************
// Static Fields
//*************************************************************************
/**
* The list of enumeration available in this virtual machine.
* Must be declared first!.
*/
private static final List VALUES = new ArrayList(1);
/**
* The line should be drawn with no dash array.
*/
public static final DashArray NONE = new DashArray("NONE", "No Dash Array", new float[0]);
//*************************************************************************
// Fields
//*************************************************************************
/**
* The pattern.
*/
private float[] dashPattern;
//*************************************************************************
// Constructor
//*************************************************************************
/**
* Construct an enumeration using the specified pattern.
*/
public DashArray(String name, String description, float[] pattern) {
super(VALUES, name, description);
dashPattern = pattern;
}
//*************************************************************************
// accessor
//*************************************************************************
/**
* Returns the dash pattern.
*
* @todo Should clone the array in order to protect the enum from change.
*/
public float[] getDashPattern() {
return dashPattern;
}
/**
* Returns the list of {@code DashArray}s.
*/
public static /*{DashArray}*/ LinePattern[] values() {
synchronized (VALUES) {
return (DashArray[]) VALUES.toArray(new DashArray[VALUES.size()]);
}
}
/**
* Returns the list of enumerations of the same kind than this enum.
*/
@Override
public /*{DashArray}*/ CodeList[] family() {
return values();
}
}
Ads help maintain this website.