Source Code Cross Referenced for ViewportGraphics.java in  » GIS » udig-1.1 » net » refractions » udig » ui » graphics » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » udig 1.1 » net.refractions.udig.ui.graphics 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    uDig - User Friendly Desktop Internet GIS client
003:         *    http://udig.refractions.net
004:         *    (C) 2004, Refractions Research Inc.
005:         *
006:         *    This library is free software; you can redistribute it and/or
007:         *    modify it under the terms of the GNU Lesser General Public
008:         *    License as published by the Free Software Foundation;
009:         *    version 2.1 of the License.
010:         *
011:         *    This library is distributed in the hope that it will be useful,
012:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *    Lesser General Public License for more details.
015:         *
016:         */
017:        package net.refractions.udig.ui.graphics;
018:
019:        import java.awt.Color;
020:        import java.awt.Image;
021:        import java.awt.Point;
022:        import java.awt.Rectangle;
023:        import java.awt.Shape;
024:        import java.awt.geom.AffineTransform;
025:        import java.awt.geom.Rectangle2D;
026:        import java.awt.image.RenderedImage;
027:
028:        import org.eclipse.swt.graphics.Path;
029:
030:        /**
031:         * An adapter that allows uDig and plugin writers to write to AWT components and images or SWT
032:         * Drawable objects by using this common interface.
033:         * 
034:         * @author jeichar
035:         */
036:        public interface ViewportGraphics {
037:            /**
038:             * Line drawing style for solid lines (value is 1).
039:             */
040:            public static final int LINE_SOLID = 1;
041:
042:            /**
043:             * Line drawing style for dashed lines (value is 2).
044:             */
045:            public static final int LINE_DASH = 2;
046:
047:            /**
048:             * Line drawing style for dotted lines (value is 3).
049:             */
050:            public static final int LINE_DOT = 3;
051:
052:            /**
053:             * Line drawing style for alternating dash-dot lines (value is 4).
054:             */
055:            public static final int LINE_DASHDOT = 4;
056:
057:            /**
058:             * Line drawing style for dash-dot-dot lines (value is 5).
059:             */
060:            public static final int LINE_DASHDOTDOT = 5;
061:
062:            /** <code>ALIGN_TOP</code> field used to align text */
063:            public static final int ALIGN_TOP = 1;
064:            /** <code>ALIGN_MIDDLE</code> field used to align text */
065:            public static final int ALIGN_MIDDLE = 0;
066:            /** <code>ALIGN_BOTTOM</code> field used to align text */
067:            public static final int ALIGN_BOTTOM = -1;
068:            /** <code>ALIGN_LEFT</code> field used to align text */
069:            public static final int ALIGN_LEFT = -1;
070:            /** <code>ALIGN_RIGHT</code> field used to align text */
071:            public static final int ALIGN_RIGHT = 1;
072:
073:            /**
074:             * Fills the interior of the path with the forground color.
075:             *
076:             * @param path the path to fill.
077:             */
078:            public void fillPath(Path path);
079:
080:            /**
081:             * Fills the interior of a <code>Shape</code> using the foreground color, clip & transform.
082:             * <p>
083:             * Reference description from Graphics2d: <bq> Fills the interior of a <code>Shape</code>
084:             * using the settings of the <code>Graphics2D</code> context. The rendering attributes applied
085:             * include the <code>Clip</code>, <code>Transform</code>, <code>Paint</code>, and
086:             * <code>Composite</code>.
087:             * 
088:             * @param s the <code>Shape</code> to be filled <bq>
089:             *        </p>
090:             * @param s the <code>Shape</code> to be rendered
091:             * @see fill
092:             */
093:            public void fill(Shape s);
094:
095:            /**
096:             * Fills an Oval
097:             *
098:             * @param x the starting x coordinate
099:             * @param y the starting y coordinate
100:             * @param width the width of the Oval.
101:             * @param height the height of the Oval.
102:             */
103:            public void fillOval(int x, int y, int width, int height);
104:
105:            /**
106:             * Fills a rectangle.
107:             * 
108:             * @param x the starting x coordinate
109:             * @param y the starting y coordinate
110:             * @param width the width of the rectangle.
111:             * @param height the height of the rectangle.
112:             */
113:            public void fillRect(int x, int y, int width, int height);
114:
115:            /**
116:             * Fills the specified rectangle with the background color.
117:             * 
118:             * @param x The starting corner's x-coordinate.
119:             * @param y The starting corner's y-coordinate.
120:             * @param width the width of the rectangle
121:             * @param height the height of the rectangle
122:             */
123:            public void clearRect(int x, int y, int width, int height);
124:
125:            /**
126:             * Draws the outline of the path using the color, clip and transform.
127:             * 
128:             * @path the path to draw.
129:             */
130:            public void drawPath(Path path);
131:
132:            /**
133:             * Draws the outline of <code>shape</code> using the color, clip & transform.
134:             * <p>
135:             * Reference description from Graphics2d: <bq> Strokes the outline of a <code>Shape</code>
136:             * using the settings of the current <code>Graphics2D</code> context. The rendering attributes
137:             * applied include the <code>Clip</code>, <code>Transform</code>, <code>Paint</code>,
138:             * <code>Composite</code> and <code>Stroke</code> attributes. <bq>
139:             * </p>
140:             * 
141:             * @param s the <code>Shape</code> to be rendered
142:             * @see fill
143:             */
144:            public void draw(Shape s);
145:
146:            /**
147:             * Draws a rectangle - only the boundary.
148:             * 
149:             * @param x the starting x coordinate
150:             * @param y the starting y coordinate
151:             * @param width the width of the rectangle.
152:             * @param height the height of the rectangle.
153:             */
154:            public void drawRect(int x, int y, int width, int height);
155:
156:            /**
157:             * Draws a line from x1,y1 to x2,y2
158:             * 
159:             * @param x1
160:             * @param y1
161:             * @param x2
162:             * @param y2
163:             */
164:            public void drawLine(int x1, int y1, int x2, int y2);
165:
166:            /**
167:             * Draws an Oval - only the boundary
168:             *
169:             * @param x the starting x coordinate
170:             * @param y the starting y coordinate
171:             * @param width the width of the Oval.
172:             * @param height the height of the Oval.
173:             */
174:            public void drawOval(int x, int y, int width, int height);
175:
176:            /**
177:             * Draws a string. Alignment parameters specify where the string should be located relative to
178:             * coordinate (x,y).  
179:             * 
180:             * @param string The string to draw.
181:             * @param x the x coordinate of the location where the of the string will be placed.
182:             * @param y the y coordinate of the location where the of the string will be placed.
183:             * @param alignx horizontal alignment, {@link #ALIGN_LEFT}, {@link #ALIGN_MIDDLE} or {@link #ALIGN_RIGHT}
184:             * @param aligny vertical alignment, {@link #ALIGN_BOTTOM}, {@link #ALIGN_MIDDLE} or {@link #ALIGN_TOP}
185:             */
186:            public void drawString(String string, int x, int y, int alignx,
187:                    int aligny);
188:
189:            /**
190:             * Sets the foreground color to draw with.
191:             * 
192:             * @param c The new color.
193:             */
194:            public void setColor(Color c);
195:
196:            /**
197:             * Sets the background color to draw with.
198:             * 
199:             * @param c The new color.
200:             */
201:            public void setBackground(Color c);
202:
203:            /**
204:             * Sets the stroke color to draw with.
205:             * 
206:             * @param strokeStyle The style of line to draw.
207:             * @param strokeWidth the width, in pixels, to draw lines with.
208:             */
209:            public void setStroke(int strokeStyle, int strokeWidth);
210:
211:            /**
212:             * Sets the clip.
213:             * 
214:             * @param r the rectangle to clip to.
215:             */
216:            public void setClip(Rectangle r);
217:
218:            /**
219:             * Sets the draw offset.
220:             * 
221:             * @param offset The amount the draw is offset in the graphics.
222:             */
223:            public void translate(Point offset);
224:
225:            /**
226:             * Draws an image.
227:             * 
228:             * @param image The image to draw.
229:             * @param x The x coordinate of the image top left corner of the image.
230:             * @param y The y coordinate of the image top left corner of the image.
231:             */
232:            public void drawImage(RenderedImage renderedImage, int x, int y);
233:
234:            /**
235:             * Draws an {@link Image}.
236:             * 
237:             * @param image The {@link Image} to draw.
238:             * @param x The x coordinate of the image top left corner of the image.
239:             * @param y The y coordinate of the image top left corner of the image.
240:             */
241:            public void drawImage(Image awtImage, int x, int y);
242:
243:            /**
244:             * Draws a portion of the image to the target location on the viewport graphics.
245:             * 
246:             * @param image {@link Image} to draw
247:             * @param dx1 - the x coordinate of the first corner of the destination rectangle.
248:             * @param dy1 - the y coordinate of the first corner of the destination rectangle.
249:             * @param dx2 - the x coordinate of the second corner of the destination rectangle.
250:             * @param dy2 - the y coordinate of the second corner of the destination rectangle.
251:             * @param sx1 - the x coordinate of the first corner of the source rectangle.
252:             * @param sy1 - the y coordinate of the first corner of the source rectangle.
253:             * @param sx2 - the x coordinate of the second corner of the source rectangle.
254:             * @param sy2 - the y coordinate of the second corner of the source rectangle.
255:             */
256:            public void drawImage(Image awtImage, int dx1, int dy1, int dx2,
257:                    int dy2, int sx1, int sy1, int sx2, int sy2);
258:
259:            /**
260:             * Copies a rectangular area from the source image into a (potentially
261:             * different sized) rectangular area in the receiver. If the source
262:             * and destination areas are of differing sizes, then the source
263:             * area will be stretched or shrunk to fit the destination area
264:             * as it is copied. The copy fails if any part of the source rectangle
265:             * lies outside the bounds of the source image, or if any of the width
266:             * or height arguments are negative.
267:             *
268:             * @param image the source image
269:             * @param dx1 - the x coordinate of the first corner of the destination rectangle.
270:             * @param dy1 - the y coordinate of the first corner of the destination rectangle.
271:             * @param dx2 - the x coordinate of the second corner of the destination rectangle.
272:             * @param dy2 - the y coordinate of the second corner of the destination rectangle.
273:             * @param sx1 - the x coordinate of the first corner of the source rectangle.
274:             * @param sy1 - the y coordinate of the first corner of the source rectangle.
275:             * @param sx2 - the x coordinate of the second corner of the source rectangle.
276:             * @param sy2 - the y coordinate of the second corner of the source rectangle.
277:             */
278:            public void drawImage(org.eclipse.swt.graphics.Image swtImage,
279:                    int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
280:                    int sx2, int sy2);
281:
282:            /**
283:             * Draws an {@link org.eclipse.swt.graphics.Image}.
284:             * 
285:             * @param image The {@link org.eclipse.swt.graphics.Image} to draw.
286:             * @param x The x coordinate of the image top left corner of the image.
287:             * @param y The y coordinate of the image top left corner of the image.
288:             */
289:            public void drawImage(org.eclipse.swt.graphics.Image swtImage,
290:                    int x, int y);
291:
292:            /**
293:             * Modifies the graphics so that further draws us minX,minY as the origin and maxX and maxY as
294:             * the width and height of the display area.
295:             * 
296:             * @param minX The x-coord that will be used as the origin.
297:             * @param minY The y-coord that will be used as the origin.
298:             * @param width The width that will be used to draws.
299:             * @param height The height that will be used to draws.
300:             */
301:            public void setTransform(AffineTransform transform);
302:
303:            /**
304:             * Gets the height of the current font TODO at some point maybe this could be broken out to
305:             * getFontMetrics(), and a create FontMetrics object that maps between SWT and AWT.
306:             * 
307:             * @return the height of the current font
308:             */
309:            public int getFontHeight();
310:
311:            /**
312:             * Returns the length in pixels of the given string, or -1 if this operation is not available.
313:             * 
314:             * @param str
315:             * @return
316:             */
317:            public int stringWidth(String str);
318:
319:            /**
320:             * Gets the <code>ascent</code> of the current font, which is the distance the font rises
321:             * above its <code>baseline</code>.
322:             * 
323:             * @return
324:             */
325:            public int getFontAscent();
326:
327:            /**
328:             * Returns the bounds of a String. Does not expand tabs or newlines  
329:             * 
330:             * @param str
331:             * @return
332:             */
333:            public Rectangle2D getStringBounds(String str);
334:
335:            public AffineTransform getTransform();
336:
337:            /**
338:             * Disposes of any resources the graphics might be hanging on to.
339:             */
340:            public void dispose();
341:
342:            /**
343:             * Gets the area that can be drawn in.
344:             *
345:             * @return the area that can be drawn in.
346:             */
347:            Shape getClip();
348:
349:            /**
350:             * Sets the clip area.
351:             *
352:             * @param newBounds new clip area
353:             */
354:            void setClipBounds(Rectangle newBounds);
355:
356:            /**
357:             * Gets the current Color value
358:             * @return the current Color value
359:             */
360:            Color getColor();
361:
362:            /**
363:             * Gets the current background color value
364:             * @return the current background color value
365:             */
366:            Color getBackgroundColor();
367:
368:            /**
369:             * Draws a round cornered rectangle
370:             *
371:             * @param x the x component of the upper left corner
372:             * @param y the y component of the upper left corner
373:             * @param width the width of the rectangle
374:             * @param height the height of the rectangle
375:             * @param arcWidth the horizontal diameter of the arc 
376:             *                    at the four corners.
377:             * @param arcHeight the vertical diameter of the arc 
378:             *                    at the four corners
379:             */
380:            public void drawRoundRect(int x, int y, int width, int height,
381:                    int arcWidth, int arcHeight);
382:
383:            /**
384:             * Fills a round cornered rectangle using the foreground color
385:             *
386:             * @param x the x component of the upper left corner
387:             * @param y the y component of the upper left corner
388:             * @param width the width of the rectangle
389:             * @param height the height of the rectangle
390:             * @param arcWidth the horizontal diameter of the arc 
391:             *                    at the four corners.
392:             * @param arcHeight the vertical diameter of the arc 
393:             *                    at the four corners
394:             */
395:            public void fillRoundRect(int x, int y, int width, int height,
396:                    int arcWidth, int arcHeight);
397:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.