/**************************************************************************************************
 **
 ** $Id: GraphicArc.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/primitive/GraphicArc.java $
 **
 ** Copyright (C) 2003-2005 Open GIS Consortium, Inc.
 ** All Rights Reserved. http://www.opengis.org/legal/
 **
 *************************************************************************************************/

package org.opengis.go.display.primitive;

import java.util.ArrayList;
import java.util.List;

import javax.units.Unit;

import org.opengis.go.display.style.PolygonSymbolizer;
import org.opengis.go.spatial.PathType;
import org.opengis.spatialschema.geometry.DirectPosition;
import org.opengis.util.CodeList;
import org.opengis.util.SimpleEnumerationType;

/**
 * A GraphicArc represents a portion of an ellipse.
 * 

* A GraphicArc is constructed from either an elliptic instance of * Conic, or the following graphical values: *

*

* The geometric shape of GraphicArc can be modified via these parameters * (the parameters are converted and passed to the underlying Conic object). * Similarly, if the underlying Conic changes shape but remains an ellipse, * then the GraphicArc reflects that behavior * (see Graphic.refresh()). If the Conic changes to a form * other than an ellipse, then the behavior of GraphicArc is undefined. *

* The ellipse is oriented by centering it at the origin of a local Cartesian plane, * with the major axis of the ellipse is aligned with the x-axis (abcissa). * Start and end points of the elliptic arc are measured positively as a counterclockwise angle * from the positive x-axis. *

* The rotation of the ellipse with respect to an external Coordinate Reference System is * measured positively as a clockwise angle, starting from a reference line within the * Coordinate Reference System and ending at the x-axis of the local Cartesian plane. *

* The external Coordinate Reference System is the Coordinate Reference System of the DirectPosition * correlating to the center of the ellipse. * * * * If the width and height parameters are specified * in com.dautelle.units.Length.Pixels, then a * GraphicArc shall retain shape and orientation regardless * of where it appears on the screen canvas. If a * setWidth or setHeight method is called * with a conflicting type of Unit, then the * GraphicArc should convert its other parameter to the new * Units. Thus, if a GraphicArc is defined in * pixels, and setWidth is called with a new value and the * com.dautelle.units.Length.Meter Unit, * then the GraphicArc should convert its height to meters as * well. * * @author Open GIS Consortium, Inc. * @version $Revision: 658 $, $Date: 2006-02-23 12:09:34 +1100 (jeu., 23 févr. 2006) $ */ public interface GraphicArc extends Graphic { /** * Sets the geometry for this GraphicArc. *

* The geometry is oriented by centering the ellipse at the origin of a local Cartesian plane, * with the major axis of the ellipse is aligned with the x-axis (abcissa). * Start and end points of the elliptic arc are measured positively as a counterclockwise angle * from the positive x-axis. *

* The rotation of the ellipse with respect to an external Coordinate Reference System is * measured positively as a clockwise angle, starting from a reference line within the * Coordinate Reference System and ending at the x-axis of the local Cartesian plane. *

* The geometric values are set on the underlying Conic geometry for this Graphic. * * @param center the location of the centerpoint of the ellipse defining this GraphicArc. * @param width the length of the major axis of the ellipse defining this GraphicArc. * @param height the length of the minor axis of the ellipse defining this GraphicArc. * @param lengthUnit the unit of width and height. * @param rotation the rotation of the ellipse defining this GraphicArc with respect to the Coordinate Reference System of the centerpoint DirectPosition. * @param start the angle of starting point of the arc, drawn clockwise from the positive side of the major axis. * @param end the angle of the ending point of the arc, drawn clockwise from the positive side of the major axis. * @param angleUnit the unit of rotation. * @throws GeometryNotSupportedException if the width value is smaller than the height value is not an ellipse. */ public void setArc( DirectPosition center, double width, double height, Unit lengthUnit, double rotation, double start, double end, Unit angleUnit); /** * Sets the center of the ellipse defining this GraphicArc. * Value is set on the underlying Conic geometry for this Graphic. */ public void setCenter(DirectPosition center); /** * Returns the center of the ellipse defining this GraphicArc. * Value is acquired from the underlying Conic geometry for this Graphic. */ public DirectPosition getCenter(); /** * Sets the size of the width axis * of the ellipse defining this GraphicArc, in terms of the given Unit. * Value is set on the underlying Conic geometry for this Graphic. * @param width Size of the width axis. * @param unit the Unit of the width value. */ public void setWidth(double width, Unit unit); /** * Returns the size of the width axis * of the ellipse defining this GraphicArc, in terms of the given Unit. * Value is acquired from the underlying Conic geometry for this Graphic. * @param unit the Unit of the width value. * @return The size of the width axis of the arc. */ public double getWidth(Unit unit); /** * Sets the size of the height axis * of the ellipse defining this GraphicArc, in terms of the given Unit. * Value is set on the underlying Conic geometry for this Graphic. * @param height Size of the height axis. * @param unit the Unit of the height value. */ public void setHeight(double height, Unit unit); /** * Returns the size of the height axis * of the ellipse defining this GraphicArc, in terms of the given Unit. * Value is acquired from the underlying Conic geometry for this Graphic. * @param unit the Unit of the height value. * @return The size of the height axis of the arc. */ public double getHeight(Unit unit); /** * Sets the orientation for the width axis. On a Canvas, this * might be the angle between the positive X axis and the width * axis of the arc. For a projected arc, this might be the angle * between due north and the width axis. * @param rotation orientation of the arc. * @param unit the Unit for the angle value. */ public void setRotation(double rotation, Unit unit); /** * Returns this GraphicArc's orientation source. * @param unit the Unit for the angle value. * @return orientation of the arc. */ public double getRotation(Unit unit); /** * Sets this GraphicArc's start bearing. The arc is stroked * counter-clockwise from start to end. * @param start the start Orientation. * @param unit the Unit for the angle value. */ public void setStart(double start, Unit unit); /** * Returns this GraphicArc's start bearing. The arc is stroked * counter-clockwise from start to end. * @param unit the Unit for the angle value. * @return the arc start Orientation. */ public double getStart(Unit unit); /** * Sets this GraphicArc's end bearing. The arc is stroked * counter-clockwise from start to end. * @param end the end orientation. * @param unit the Unit for the angle value. */ public void setEnd(double end, Unit unit); /** * Returns this GraphicArc's ending bearing. The arc is stroked * counter-clockwise from start to end. * @param unit the Unit for the angle value. * @return the arc end orientation. */ public double getEnd(Unit unit); /** * Sets the closureType, which determines how the endpoints of this * GraphicArc are connected. This is one of the constants defined in the * ArcClosure class. The integer values corresponding to * these constants are the same as the closure type values in * java.awt.geom.Arc2D. * @param closureType Closure type of the arc (one of the ArcClosure * constants: OPEN, CHORD, or PIE) */ public void setClosureType(ArcClosure closureType); /** * Returns the closureType. * @return Closure type of the arc (one of ArcClosure constants * OPEN, CHORD, or PIE). The integer values corresponding to these * constants are the same as the constants OPEN, CHORD, and PIE from * java.awt.geom.Arc2d. */ public ArcClosure getClosureType(); /** * Indicates whether this GraphicArc is displaying an anchor handle for changing * the rotation of the defining ellipse. */ public boolean isAllowingRotation(); /** * Sets the boolean that indicates whether this GraphicArc displays * an anchor handle for changing the rotation of the defining ellipse. */ public void setAllowingRotation(boolean newValue); /** * Indicates whether this GraphicArc is a circle. The implementation should * test for this based on the geometry settings. */ public boolean isCircle(); /** * Indicates whether this GraphicArc is a closed ellipse. The implementation should * test for this based on the geometry settings. */ public boolean isClosedEllipse(); //** EDITABLE/ANIMATION ** /** * Indicates whether this GraphicArc is displaying edit handles for changing * the angular extents of the defining ellipse. */ public boolean isAllowingExtentsChange(); /** * Sets the boolean that indicates whether this GraphicArc is displaying * edit handles for changing the angular extents of the defining ellipse. */ public void setAllowingExtentsChange(boolean newValue); //** PROJECTED ** /** * Returns the GraphicStyle for this GraphicPolygon, * which is required to be a PolygonSymbolizer. * @return the GraphicPolygon's GraphicStyle. */ public PolygonSymbolizer getPolygonSymbolizer(); /** * Sets the algorithm that is used in computing the "in-between" pixels * of the ArcClosure verteces when the arc is rendered. This does not * when there is no closure, i.e. when isClosedEllipse() is false, or * for ArcClosure.OPEN. * * @param pathType This must be one of the static constants in * the PathType class or one of its subclasses. */ public void setClosurePathType(PathType pathType); /** * Retrieves the algorithm that is used in computing the "in-between" pixels * of the ArcClosure verteces when the arc is rendered. This does not * when there is no closure, i.e. when isClosedEllipse() is false, or * for ArcClosure.OPEN. */ public PathType getClosurePathType(); /** * Instances of the ArcClosure class represent the various * methods of connecting the endpoints of an arc. There are three static * constants defined in this class that can be used as parameters to * the setClosureType method. * * @author Open GIS Consortium, Inc. */ public static class ArcClosure extends SimpleEnumerationType { /** * Serial number for compatibility with different versions. */ private static final long serialVersionUID = 7401948294780735937L; /** * The list of enumeration available in this virtual machine. * Must be declared first!. */ private static final List VALUES = new ArrayList(3); /** * Closure type that indicates that the endpoints of the arc * should not be connected. */ public static final ArcClosure OPEN = new ArcClosure("Open", ""); /** * Closure type that indicates that one line should be drawn between * the endpoints of the arc. */ public static final ArcClosure CHORD = new ArcClosure("Chord", ""); /** * Closure type that indicates that two lines, one from each * endpoint of the arc, should be drawn to the center of the ellipse * defining the arc. */ public static final ArcClosure PIE = new ArcClosure("Pie", ""); /** * Constructor that should only be called to create the static * constants in this class. */ private ArcClosure(String name, String description) { super(VALUES, name, description); } /** * Utility method that retrieves the list of all * ArcClosures. This is useful when making combo-boxes * with code like: *

         * JComboBox comboBox = new JComboBox(ArcClosure.getArray());
         * 

* IMPORTANT SAFETY TIP:
* Modifying the array returned is a Bad Thing. Don't do it. * * @deprecated Use {@link #values} instead. */ @Deprecated public static ArcClosure[] getArray() { return values(); } /** * Returns the list of ArcClosures. */ public static ArcClosure[] values() { synchronized (VALUES) { return (ArcClosure[]) VALUES.toArray(new ArcClosure[VALUES.size()]); } } /** * Returns the list of enumerations of the same kind than this enum. */ public /*{ArcClosure}*/ CodeList[] family() { return values(); } } // end class ArcClosure }

Ads help maintain this website.