001: /* uDig - User Friendly Desktop Internet GIS client
002: * http://udig.refractions.net
003: * (C) 2004, Refractions Research Inc.
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation;
008: * version 2.1 of the License.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: */
015: package net.refractions.udig.mapgraphic.grid;
016:
017: import java.awt.Color;
018:
019: import net.refractions.udig.ui.graphics.ViewportGraphics;
020:
021: /**
022: * Style for the {@link GridMapGraphic}.
023: *
024: * @author Jesse
025: * @since 1.1.0
026: */
027: public class GridStyle {
028:
029: public enum Type {
030: SCREEN, WORLD
031: }
032:
033: public static final String ID = "net.refractions.udig.tool.edit.mapgraphic.grid.style";
034: public static final GridStyle DEFAULT_STYLE = new GridStyle(
035: Type.SCREEN, 25, 25, new Color(0, 0, 255, 100),
036: ViewportGraphics.LINE_DOT, 1);
037:
038: private double[] gridSize;
039: private Type type;
040: private Color color;
041: /**
042: * One of
043: * <ul>
044: * <li>{@link ViewportGraphics#LINE_DASH},</li>
045: * <li>{@link ViewportGraphics#LINE_DASHDOT}, </li>
046: * <li>{@link ViewportGraphics#LINE_DASHDOTDOT}, </li>
047: * <li>{@link ViewportGraphics#LINE_DOT}, </li>
048: * <li>{@link ViewportGraphics#LINE_SOLID} </li>
049: */
050: private int lineStyle;
051: /**
052: * Width of the grid line in pixels
053: */
054: private int lineWidth;
055:
056: public GridStyle(Type type, double dx, double dy, Color color,
057: int lineStyle, int lineWidth) {
058: gridSize = new double[] { dx, dy };
059: this .type = type;
060: this .color = color;
061: this .lineStyle = lineStyle;
062: this .lineWidth = lineWidth;
063: }
064:
065: public GridStyle(GridStyle oldStyle) {
066: gridSize = oldStyle.getGridSize();
067: type = oldStyle.getType();
068: color = oldStyle.getColor();
069: lineStyle = oldStyle.getLineStyle();
070: lineWidth = oldStyle.getLineWidth();
071: }
072:
073: public double[] getGridSize() {
074: return gridSize;
075:
076: }
077:
078: public Type getType() {
079: return type;
080: }
081:
082: public void setType(Type type) {
083: this .type = type;
084: }
085:
086: public void setGridSize(double dx, double dy) {
087: this .gridSize[0] = dx;
088: this .gridSize[1] = dy;
089: }
090:
091: public Color getColor() {
092: return color;
093: }
094:
095: public void setColor(Color color) {
096: this .color = color;
097: }
098:
099: public int getLineStyle() {
100: return lineStyle;
101: }
102:
103: public void setLineStyle(int lineStyle) {
104: this .lineStyle = lineStyle;
105: }
106:
107: public int getLineWidth() {
108: return lineWidth;
109: }
110:
111: public void setLineWidth(int lineWidth) {
112: this.lineWidth = lineWidth;
113: }
114:
115: }
|