    001/* ===========================================================
    002 * Orson Charts : a 3D chart library for the Java(tm) platform
    003 * ===========================================================
    004 *
    005 * (C)opyright 2013-2016, by Object Refinery Limited.  All rights reserved.
    006 *
    007 * http://www.object-refinery.com/orsoncharts/index.html
    008 *
    009 * This program is free software: you can redistribute it and/or modify
    010 * it under the terms of the GNU General Public License as published by
    011 * the Free Software Foundation, either version 3 of the License, or
    012 * (at your option) any later version.
    013 *
    014 * This program is distributed in the hope that it will be useful,
    015 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    017 * GNU General Public License for more details.
    018 *
    019 * You should have received a copy of the GNU General Public License
    020 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    021 *
    022 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    023 * Other names may be trademarks of their respective owners.]
    024 *
    025 * If you do not wish to be bound by the terms of the GPL, an alternative
    026 * commercial license can be purchased.  For details, please see visit the
    027 * Orson Charts home page:
    028 *
    029 * http://www.object-refinery.com/orsoncharts/index.html
    030 *
    031 */
    032
    033package com.orsoncharts.marker;
    034
    035import java.awt.BasicStroke;
    036import java.awt.Color;
    037import java.awt.Font;
    038import java.awt.Graphics2D;
    039import java.awt.Stroke;
    040import com.orsoncharts.ChartElement;
    041
    042/**
    043 * A base interface for all markers.
    044 *
    045 * @since 1.2
    046 */
    047public interface Marker extends ChartElement {
    048
    049    /** The default line stroke for markers. */
    050    public static final Stroke DEFAULT_LINE_STROKE = new BasicStroke(0f,
    051            BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
    052
    053    /** The default line color for markers. */
    054    public static final Color DEFAULT_LINE_COLOR = Color.DARK_GRAY;
    055
    056    /** The default fill color for markers. */
    057    public static final Color DEFAULT_FILL_COLOR = new Color(128, 128, 192, 64);
    058
    059    /** The default font for marker labels. */
    060    public static final Font DEFAULT_MARKER_FONT = new Font(Font.DIALOG,
    061            Font.PLAIN, 10);
    062
    063    /** The default color for the marker labels. */
    064    public static final Color DEFAULT_LABEL_COLOR = Color.BLACK;
    065
    066    /**
    067     * Draws the marker based on the {@code markerData} which has been
    068     * passed to the 3D engine to generate the required 2D projection points.
    069     *
    070     * @param g2  the graphics target ({@code null} not permitted).
    071     * @param markerData  transient data for the marker ({@code null} not
    072     *     permitted).
    073     * @param reverse  a flag to indicate reverse orientation.
    074     */
    075    void draw(Graphics2D g2, MarkerData markerData, boolean reverse);
    076
    077    /**
    078     * Registers a listener to receive notification of changes to the marker.
    079     *
    080     * @param listener  the listener ({@code null} not permitted).
    081     */
    082    void addChangeListener(MarkerChangeListener listener);
    083
    084    /**
    085     * Deregisters a listener so that it no longer receives notification of
    086     * changes to the marker.
    087     *
    088     * @param listener  the listener ({@code null} not permitted).
    089     */
    090    void removeChangeListener(MarkerChangeListener listener);
    091
    092}