root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / FGeometry.java @ 379
History | View | Annotate | Download (2.81 KB)
1 |
/*
|
---|---|
2 |
* Created on 25-nov-2004
|
3 |
*
|
4 |
* TODO To change the template for this generated file go to
|
5 |
* Window - Preferences - Java - Code Generation - Code and Comments
|
6 |
*/
|
7 |
package com.iver.cit.gvsig.fmap.core; |
8 |
|
9 |
import java.awt.Graphics2D; |
10 |
import java.awt.geom.AffineTransform; |
11 |
import java.awt.geom.Rectangle2D; |
12 |
|
13 |
import org.geotools.geometry.Geometry; |
14 |
|
15 |
import com.iver.cit.gvsig.fmap.ViewPort; |
16 |
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D; |
17 |
|
18 |
/**
|
19 |
* @author FJP
|
20 |
*
|
21 |
* TODO To change the template for this generated type comment go to
|
22 |
* Window - Preferences - Java - Code Generation - Code and Comments
|
23 |
*/
|
24 |
public class FGeometry implements IGeometry { |
25 |
|
26 |
private FShape shp;
|
27 |
|
28 |
/* (non-Javadoc)
|
29 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#draw(java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort, org.geotools.renderer.style.Style2D)
|
30 |
*/
|
31 |
public void draw(Graphics2D g, ViewPort vp, FStyle2D symbol) { |
32 |
// OJO CON LA PRECISION. DEBERIAMOS USAR: ((GeneralPathX) shp.m_Polyline).transform(mT);
|
33 |
// O HACER UNA FUNCION DE TRANSFORMACI?N QUE USE LOS DOUBLES DEL
|
34 |
// SHAPE
|
35 |
// Shape shpTrans = vp.getAffineTransform().createTransformedShape(shp);
|
36 |
transform(vp.getAffineTransform()); |
37 |
switch (shp.getShapeType()){
|
38 |
case FShape.POINT:
|
39 |
shpPainter.paint(g, shp, symbol.getPointStyle2D(), 0);
|
40 |
break;
|
41 |
case FShape.LINE:
|
42 |
shpPainter.paint(g, shp, symbol.getLineStyle2D(), 0);
|
43 |
break;
|
44 |
case FShape.POLYGON:
|
45 |
shpPainter.paint(g, shp, symbol.getPolygonStyle2D(), 0);
|
46 |
break;
|
47 |
case FShape.TEXT:
|
48 |
shpPainter.paint(g, shp, symbol.getTextStyle2D(), 0);
|
49 |
} |
50 |
|
51 |
|
52 |
} |
53 |
|
54 |
public void transform(AffineTransform at) |
55 |
{ |
56 |
|
57 |
if (shp instanceof FPolyline2D) { |
58 |
((FPolyline2D)shp).transform(at); |
59 |
} |
60 |
if (shp instanceof FPoint2D) { |
61 |
((FPoint2D) shp).transform(at); |
62 |
} |
63 |
if (shp instanceof FLabel){ |
64 |
((FLabel)shp).transform(at); |
65 |
} |
66 |
|
67 |
} |
68 |
|
69 |
FGeometry(FShape shp) |
70 |
{ |
71 |
this.shp = shp;
|
72 |
} |
73 |
|
74 |
/* (non-Javadoc)
|
75 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#intersects(java.awt.geom.Rectangle2D)
|
76 |
*/
|
77 |
public boolean intersects(Rectangle2D r) { |
78 |
return shp.intersects(r);
|
79 |
} |
80 |
|
81 |
/* (non-Javadoc)
|
82 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#getBounds2D()
|
83 |
*/
|
84 |
public Rectangle2D getBounds2D() { |
85 |
return shp.getBounds2D();
|
86 |
} |
87 |
|
88 |
/* (non-Javadoc)
|
89 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#toJTSGeometry()
|
90 |
*/
|
91 |
public Geometry toJTSGeometry() {
|
92 |
// TODO Auto-generated method stub
|
93 |
return null; |
94 |
} |
95 |
|
96 |
/* (non-Javadoc)
|
97 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#createLabels(int, boolean)
|
98 |
*/
|
99 |
public IGeometry[] createLabels(int position, boolean duplicates) { |
100 |
// TODO Auto-generated method stub
|
101 |
return null; |
102 |
} |
103 |
|
104 |
/**
|
105 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#getGeometryType()
|
106 |
*/
|
107 |
public int getGeometryType() { |
108 |
return shp.getShapeType();
|
109 |
} |
110 |
|
111 |
} |