Statistics
| Revision:

root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / Polyline2D.java @ 240

History | View | Annotate | Download (2.99 KB)

1
package com.iver.cit.gvsig.fmap.core;
2

    
3
import java.awt.Color;
4
import java.awt.Graphics2D;
5
import java.awt.Rectangle;
6
import java.awt.geom.AffineTransform;
7
import java.awt.geom.PathIterator;
8
import java.awt.geom.Point2D;
9
import java.awt.geom.Rectangle2D;
10

    
11
import org.geotools.geometry.Geometry;
12
import org.geotools.renderer.style.LineStyle2D;
13
import org.geotools.renderer.style.Style2D;
14

    
15
import com.iver.cit.gvsig.fmap.ViewPort;
16

    
17

    
18

    
19
public class Polyline2D implements FGeometry{
20
        private GeneralPathX gp;
21

    
22
        public Polyline2D(GeneralPathX gpx){
23
                gp = gpx;
24
        }
25

    
26
        /**
27
         * @see com.iver.cit.gvsig.fmap.core.FGeometry#draw(java.awt.Graphics2D, ViewPort, java.awt.geom.Rectangle2D)
28
         */
29
        public void draw(Graphics2D g, ViewPort vp, Style2D symbol) {
30
//                if (gp.intersects(extent)){
31
                if (symbol instanceof LineStyle2D)
32
                {
33
                        LineStyle2D style2D = (LineStyle2D) symbol;                        
34
                        
35
                        g.setPaint(Color.black);
36
                                                
37
                    gp.transform(vp.getAffineTransform());
38
                    g.draw(gp);
39
                }
40
                        
41
/*                        StyledShapePainter painter = new StyledShapePainter();
42
                        painter.paint(g, this, symbol, vp.getScale());
43
        */        
44
//                }
45
        }
46

    
47

    
48
        /**
49
         * @see com.iver.cit.gvsig.fmap.core.FGeometry#getType()
50
         */
51
        public int getType() {
52
                return FGeometry.LINE;
53
        }
54

    
55
        /**
56
         * @see com.iver.cit.gvsig.fmap.core.FGeometry#createLabels(int, boolean)
57
         */
58
        public FGeometry[] createLabels(int position, boolean duplicates) {
59
                return null;
60
        }
61

    
62
        /**
63
         * @see java.awt.Shape#contains(double, double)
64
         */
65
        public boolean contains(double x, double y) {
66
                return gp.contains(x, y);
67
        }
68

    
69
        /**
70
         * @see java.awt.Shape#contains(double, double, double, double)
71
         */
72
        public boolean contains(double x, double y, double w, double h) {
73
                return gp.contains(x, y, w, h);
74
        }
75

    
76
        /**
77
         * @see java.awt.Shape#intersects(double, double, double, double)
78
         */
79
        public boolean intersects(double x, double y, double w, double h) {
80
                return gp.intersects(x, y, w, h);
81
        }
82

    
83
        /**
84
         * @see java.awt.Shape#getBounds()
85
         */
86
        public Rectangle getBounds() {
87
                return gp.getBounds();
88
        }
89

    
90
        /**
91
         * @see java.awt.Shape#contains(java.awt.geom.Point2D)
92
         */
93
        public boolean contains(Point2D p) {
94
                return gp.contains(p);
95
        }
96

    
97
        /**
98
         * @see java.awt.Shape#getBounds2D()
99
         */
100
        public Rectangle2D getBounds2D() {
101
                return gp.getBounds2D();
102
        }
103

    
104
        /**
105
         * @see java.awt.Shape#contains(java.awt.geom.Rectangle2D)
106
         */
107
        public boolean contains(Rectangle2D r) {
108
                return gp.contains(r);
109
        }
110

    
111
        /**
112
         * @see java.awt.Shape#intersects(java.awt.geom.Rectangle2D)
113
         */
114
        public boolean intersects(Rectangle2D r) {
115
                return gp.intersects(r);
116
        }
117

    
118
        /**
119
         * @see java.awt.Shape#getPathIterator(java.awt.geom.AffineTransform)
120
         */
121
        public PathIterator getPathIterator(AffineTransform at) {
122
                return gp.getPathIterator(at);
123
        }
124

    
125
        /**
126
         * @see java.awt.Shape#getPathIterator(java.awt.geom.AffineTransform, double)
127
         */
128
        public PathIterator getPathIterator(AffineTransform at, double flatness) {
129
                return gp.getPathIterator(at, flatness);
130
        }
131

    
132
        /**
133
         * @see com.iver.cit.gvsig.fmap.core.FGeometry#toJTSGeometry()
134
         */
135
        public Geometry toJTSGeometry() {
136
                return null;
137
        }
138

    
139
}