001: /**
002: * Point.java
003: *
004: Copyright (c) 2007, Innovatics Inc.
005:
006: All rights reserved.
007:
008: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
009:
010: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
011: * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
012:
013: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
014: "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
015: LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
016: A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
017: CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
018: EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
019: PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
020: PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
021: LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
022: NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
023: SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
024: */package com.pdfjet;
025:
026: import java.lang.*;
027: import java.util.*;
028:
029: //>>>>pdfjet {
030: public class Point {
031:
032: public static final int INVISIBLE = -1;
033: public static final int CIRCLE = 0;
034: public static final int DIAMOND = 1;
035: public static final int BOX = 2;
036: public static final int PLUS = 3;
037: public static final int H_DASH = 4;
038: public static final int V_DASH = 5;
039: public static final int MULTIPLY = 6;
040: public static final int STAR = 7;
041: public static final int X_MARK = 8;
042: public static final int UP_ARROW = 9;
043: public static final int DOWN_ARROW = 10;
044: public static final int LEFT_ARROW = 11;
045: public static final int RIGHT_ARROW = 12;
046:
047: public static final boolean IS_CURVE_POINT = true;
048:
049: protected double x = 0.0;
050: protected double y = 0.0;
051: protected double r = 2.0;
052:
053: protected int shape = 0;
054: protected double[] color = { 0.0, 0.0, 0.0 };
055: protected double line_width = 0.3;
056: protected String line_pattern = "[] 0";
057: protected boolean fill_shape = false;
058:
059: protected boolean isCurvePoint = false;
060:
061: protected String text = null;
062: protected String uri = null;
063: protected List<String> info = null;
064:
065: // drawLineTo == false means:
066: // Don't draw a line to this point from the previous
067: protected boolean drawLineTo = false;
068:
069: private double box_x = 0.0;
070: private double box_y = 0.0;
071:
072: public Point() {
073: }
074:
075: public Point(double x, double y) {
076: this .x = x;
077: this .y = y;
078: }
079:
080: public Point(double x, double y, boolean isCurvePoint) {
081: this .x = x;
082: this .y = y;
083: this .isCurvePoint = isCurvePoint;
084: }
085:
086: public void setPosition(double x, double y) {
087: this .x = x;
088: this .y = y;
089: }
090:
091: public void setX(double x) {
092: this .x = x;
093: }
094:
095: public double getX() {
096: return x;
097: }
098:
099: public void setY(double y) {
100: this .y = y;
101: }
102:
103: public double getY() {
104: return y;
105: }
106:
107: public void setRadius(double r) {
108: this .r = r;
109: }
110:
111: public double getRadius() {
112: return r;
113: }
114:
115: public void setShape(int shape) {
116: this .shape = shape;
117: }
118:
119: public int getShape() {
120: return shape;
121: }
122:
123: public void setFillShape(boolean fill) {
124: this .fill_shape = fill;
125: }
126:
127: public boolean getFillShape() {
128: return fill_shape;
129: }
130:
131: public void setColor(double[] color) {
132: this .color = color;
133: }
134:
135: public double[] getColor() {
136: return color;
137: }
138:
139: public void setLineWidth(double line_width) {
140: this .line_width = line_width;
141: }
142:
143: public double getLineWidth() {
144: return line_width;
145: }
146:
147: public void setLinePattern(String line_pattern) {
148: this .line_pattern = line_pattern;
149: }
150:
151: public String getLinePattern() {
152: return line_pattern;
153: }
154:
155: public void setDrawLineTo(boolean drawLineTo) {
156: this .drawLineTo = drawLineTo;
157: }
158:
159: public boolean getDrawLineTo() {
160: return drawLineTo;
161: }
162:
163: public void setURIAction(String uri) {
164: this .uri = uri;
165: }
166:
167: public String getURIAction() {
168: return uri;
169: }
170:
171: public void setText(String text) {
172: this .text = text;
173: }
174:
175: public String getText() {
176: return text;
177: }
178:
179: public void setInfo(List<String> info) {
180: this .info = info;
181: }
182:
183: public List<String> getInfo() {
184: return info;
185: }
186:
187: public void placeIn(Box box, double x_offset, double y_offset)
188: throws Exception {
189: box_x = box.x + x_offset;
190: box_y = box.y + y_offset;
191: }
192:
193: public void drawOn(Page page) throws Exception {
194: page.setPenWidth(line_width);
195: page.setLinePattern(line_pattern);
196:
197: if (fill_shape) {
198: page.setBrushColor(color[0], color[1], color[2]);
199: } else {
200: page.setPenColor(color[0], color[1], color[2]);
201: }
202:
203: x += box_x;
204: y += box_y;
205: page.drawPoint(this );
206: x -= box_x;
207: y -= box_y;
208: }
209:
210: } // End of Point.java
211: //>>>>}
|