Revision 9641
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/strategies/DefaultStrategy.java | ||
---|---|---|
55 | 55 |
import com.iver.cit.gvsig.fmap.DriverException; |
56 | 56 |
import com.iver.cit.gvsig.fmap.ViewPort; |
57 | 57 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
58 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
58 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
|
59 | 59 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
60 | 60 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
61 | 61 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/strategies/DBStrategy.java | ||
---|---|---|
53 | 53 |
import com.iver.cit.gvsig.fmap.ViewPort; |
54 | 54 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
55 | 55 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
56 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
56 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
|
57 | 57 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
58 | 58 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
59 | 59 |
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/strategies/ShpStrategy.java | ||
---|---|---|
59 | 59 |
import com.iver.cit.gvsig.fmap.ViewPort; |
60 | 60 |
import com.iver.cit.gvsig.fmap.core.FShape; |
61 | 61 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
62 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
62 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
|
63 | 63 |
import com.iver.cit.gvsig.fmap.drivers.BoundedShapes; |
64 | 64 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
65 | 65 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/strategies/AnnotationStrategy.java | ||
---|---|---|
21 | 21 |
import com.iver.cit.gvsig.fmap.core.FShape; |
22 | 22 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
23 | 23 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
24 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
25 | 24 |
import com.iver.cit.gvsig.fmap.core.ShapeFactory; |
25 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
26 | 26 |
import com.iver.cit.gvsig.fmap.core.v02.FGraphicUtilities; |
27 | 27 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
28 | 28 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/ISymbol.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package com.iver.cit.gvsig.fmap.core; |
|
42 |
|
|
43 |
import java.awt.Color; |
|
44 |
import java.awt.Graphics2D; |
|
45 |
import java.awt.Rectangle; |
|
46 |
import java.awt.Shape; |
|
47 |
import java.awt.geom.AffineTransform; |
|
48 |
import java.util.Properties; |
|
49 |
|
|
50 |
import javax.print.attribute.PrintRequestAttributeSet; |
|
51 |
|
|
52 |
import com.iver.utiles.IPersistance; |
|
53 |
import com.iver.utiles.XMLEntity; |
|
54 |
|
|
55 |
public interface ISymbol extends IPersistance, IPrintable { |
|
56 |
public final static int CHARACTER_MARKER = 1; |
|
57 |
public final static int SIMPLE_FILL = 2; |
|
58 |
public static final int MARKER_FILL = 3; |
|
59 |
|
|
60 |
/** |
|
61 |
* Returns the derived version of the symbol that will be used to draw the |
|
62 |
* feature when it is selected. |
|
63 |
* @return <b>ISymbol</b> applied to a feature when it has been selected. |
|
64 |
*/ |
|
65 |
ISymbol getSymbolForSelection(); |
|
66 |
|
|
67 |
void draw(Graphics2D g, AffineTransform affineTransform, FShape shp); |
|
68 |
|
|
69 |
// In the future, we may need something like that, but now if |
|
70 |
// I put it, we should change the rendering process, and it will |
|
71 |
// be slowly. |
|
72 |
// El problema es que antes de renderizar algo, tenemos que calcular |
|
73 |
// c?mo va a quedar en pantalla, para saber su bounding box real y si |
|
74 |
// hay que dibujarlo o no. Pasa con los textos, pero en general |
|
75 |
// con cualquier s?mbolo de tipo puntual, tambi?n. En menor medida con |
|
76 |
// l?neas y pol?gonos. |
|
77 |
// |
|
78 |
// IDEA!!!: |
|
79 |
// Para no depender de leer un shape y pedirle al s?mbolo que toca |
|
80 |
// el bounding box para ver si hay que dibujarlo, se puede hacer una |
|
81 |
// pasada previa por la leyenda y ver los pixels que a?ade al bounding |
|
82 |
// box. (Se coge un punto, una l?nea o un pol?gono, y se calcula |
|
83 |
// su bounding box para esa escala. Si es mayor que el original del |
|
84 |
// shape, se calculan los pixels. Luego se pasan esos pixels a |
|
85 |
// coordenadas de mundo real, y se le suman al visibleExtent para que |
|
86 |
// se dibujen los trozos de texto que no se pintan, etc, etc. |
|
87 |
int getPixExtentPlus(Graphics2D g, AffineTransform affineTransform, Shape shp); |
|
88 |
/** |
|
89 |
* Devuelve el rgb del s?mbolo cuando se dibuja como un punto. |
|
90 |
* |
|
91 |
* @return rgb del s?mbolo. |
|
92 |
*/ |
|
93 |
public int getOnePointRgb(); |
|
94 |
|
|
95 |
/** |
|
96 |
* Use it to specify how do you want to write the symbol in .gvp project |
|
97 |
* @return |
|
98 |
*/ |
|
99 |
XMLEntity getXMLEntity(); |
|
100 |
|
|
101 |
/** |
|
102 |
* The description is a human-readable text used to label it when show in a |
|
103 |
* symbol menu or something like that. |
|
104 |
* |
|
105 |
* @return description of this symbol. |
|
106 |
*/ |
|
107 |
String getDescription(); |
|
108 |
|
|
109 |
/** |
|
110 |
* Tells whether the shape of the symbol will be drawn or not. |
|
111 |
* |
|
112 |
* @return <b>true</b> if Shape must be drawn. Useful if you are labelling |
|
113 |
*/ |
|
114 |
boolean isShapeVisible(); |
|
115 |
|
|
116 |
/** |
|
117 |
* Sets the description of this symbol |
|
118 |
* @param desc, a string with the description |
|
119 |
* @see ISymbol.getDescription(); |
|
120 |
*/ |
|
121 |
void setDescription(String desc); |
|
122 |
|
|
123 |
/** |
|
124 |
* The use of this method -and its mechanism- is being valorated. It probably |
|
125 |
* will be <b>deprecated</b>. |
|
126 |
* @return FSymbol constants. I think it is better to use isSuitableFor |
|
127 |
* |
|
128 |
*/ |
|
129 |
int getSymbolType(); |
|
130 |
|
|
131 |
/** |
|
132 |
* True if this symbol is ok for the geometry. For example, a FillSymbol will |
|
133 |
* be suitable for a Polygon. |
|
134 |
* @param geom |
|
135 |
* @return |
|
136 |
*/ |
|
137 |
boolean isSuitableFor(IGeometry geom); |
|
138 |
|
|
139 |
/** |
|
140 |
* Useful to render the symbol inside the TOC, or inside little |
|
141 |
* rectangles. For example, think about rendering a Label with size |
|
142 |
* in meters => You will need to specify a size in pixels. |
|
143 |
* Of course, you can also to choose to render a prepared image, etc. |
|
144 |
* @param g2 |
|
145 |
* @param scaleInstance |
|
146 |
* @param r |
|
147 |
*/ |
|
148 |
void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r); |
|
149 |
} |
|
150 |
|
|
151 |
|
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/adapter/PolygonAdapter.java | ||
---|---|---|
47 | 47 |
import com.iver.cit.gvsig.fmap.core.FPolygon2D; |
48 | 48 |
import com.iver.cit.gvsig.fmap.core.FShape; |
49 | 49 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
50 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
50 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
|
51 | 51 |
|
52 | 52 |
|
53 | 53 |
/** |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/adapter/PointAdapter.java | ||
---|---|---|
46 | 46 |
import com.iver.cit.gvsig.fmap.core.FPoint2D; |
47 | 47 |
import com.iver.cit.gvsig.fmap.core.FShape; |
48 | 48 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
49 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
49 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
|
50 | 50 |
|
51 | 51 |
|
52 | 52 |
/** |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/adapter/GeometryAdapter.java | ||
---|---|---|
48 | 48 |
|
49 | 49 |
import com.iver.cit.gvsig.fmap.core.FShape; |
50 | 50 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
51 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
51 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
|
52 | 52 |
import com.iver.utiles.XMLEntity; |
53 | 53 |
|
54 | 54 |
|
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/adapter/PolyLineAdapter.java | ||
---|---|---|
48 | 48 |
import com.iver.cit.gvsig.fmap.core.FPolyline2D; |
49 | 49 |
import com.iver.cit.gvsig.fmap.core.FShape; |
50 | 50 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
51 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
51 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
|
52 | 52 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
53 | 53 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
54 | 54 |
|
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/adapter/CircleAdapter.java | ||
---|---|---|
49 | 49 |
import com.iver.cit.gvsig.fmap.core.FPolygon2D; |
50 | 50 |
import com.iver.cit.gvsig.fmap.core.FShape; |
51 | 51 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
52 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
52 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
|
53 | 53 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
54 | 54 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
55 | 55 |
|
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FMultiPoint2D.java | ||
---|---|---|
54 | 54 |
import org.geotools.data.postgis.attributeio.WKBEncoder; |
55 | 55 |
|
56 | 56 |
import com.iver.cit.gvsig.fmap.ViewPort; |
57 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
57 | 58 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
58 | 59 |
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D; |
59 | 60 |
import com.vividsolutions.jts.geom.Coordinate; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/IGeometry.java | ||
---|---|---|
51 | 51 |
import org.cresques.cts.ICoordTrans; |
52 | 52 |
|
53 | 53 |
import com.iver.cit.gvsig.fmap.ViewPort; |
54 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
54 | 55 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
55 | 56 |
import com.iver.cit.gvsig.fmap.rendering.FStyledShapePainter; |
56 | 57 |
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FGeometryCollection.java | ||
---|---|---|
54 | 54 |
import org.geotools.data.postgis.attributeio.WKBEncoder; |
55 | 55 |
|
56 | 56 |
import com.iver.cit.gvsig.fmap.ViewPort; |
57 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
57 | 58 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
58 | 59 |
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D; |
59 | 60 |
import com.vividsolutions.jts.geom.Geometry; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/v02/FLabel.java | ||
---|---|---|
59 | 59 |
import com.iver.cit.gvsig.fmap.ViewPort; |
60 | 60 |
import com.iver.cit.gvsig.fmap.core.FPoint2D; |
61 | 61 |
import com.iver.cit.gvsig.fmap.core.FShape; |
62 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
62 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
|
63 | 63 |
import com.iver.utiles.XMLEntity; |
64 | 64 |
import com.vividsolutions.jts.geom.Geometry; |
65 | 65 |
import com.vividsolutions.jts.geom.Point; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/v02/FArrowSymbol.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 25-oct-2006 by azabala |
|
3 |
* |
|
4 |
*/ |
|
5 |
package com.iver.cit.gvsig.fmap.core.v02; |
|
6 |
|
|
7 |
import java.awt.BasicStroke; |
|
8 |
import java.awt.Color; |
|
9 |
import java.awt.Graphics2D; |
|
10 |
import java.awt.Rectangle; |
|
11 |
import java.awt.Shape; |
|
12 |
import java.awt.Stroke; |
|
13 |
import java.awt.geom.AffineTransform; |
|
14 |
import java.awt.geom.PathIterator; |
|
15 |
import java.awt.image.BufferedImage; |
|
16 |
import java.util.ArrayList; |
|
17 |
|
|
18 |
import javax.print.attribute.PrintRequestAttributeSet; |
|
19 |
|
|
20 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
21 |
import com.iver.cit.gvsig.fmap.core.FPolygon2D; |
|
22 |
import com.iver.cit.gvsig.fmap.core.FPolyline2D; |
|
23 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
24 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
|
25 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
|
26 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
27 |
import com.iver.utiles.StringUtilities; |
|
28 |
import com.iver.utiles.XMLEntity; |
|
29 |
|
|
30 |
/** |
|
31 |
* Symbol to draw a line with an arrow at the end. |
|
32 |
* @author alzabord |
|
33 |
*/ |
|
34 |
public class FArrowSymbol implements ISymbol { |
|
35 |
|
|
36 |
protected static Color selectionColor = Color.YELLOW; |
|
37 |
|
|
38 |
protected static BufferedImage img = new BufferedImage(1, 1, |
|
39 |
BufferedImage.TYPE_INT_ARGB); |
|
40 |
|
|
41 |
protected static Rectangle rect = new Rectangle(0, 0, 1, 1); |
|
42 |
|
|
43 |
protected Color symColor; |
|
44 |
|
|
45 |
protected Stroke m_Stroke; |
|
46 |
|
|
47 |
protected int m_symbolType = FConstant.SYMBOL_TYPE_LINE; |
|
48 |
|
|
49 |
protected String m_Descrip; |
|
50 |
|
|
51 |
protected int rgb; |
|
52 |
|
|
53 |
protected boolean m_bDrawShape = true; |
|
54 |
|
|
55 |
protected int lenghtArrow = 15; |
|
56 |
protected int widthArrow = 10; |
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
public FArrowSymbol(Color symColor){ |
|
62 |
this.symColor = symColor; |
|
63 |
calculateRgb(); |
|
64 |
} |
|
65 |
|
|
66 |
public void calculateRgb() { |
|
67 |
// Recalculamos el RGB |
|
68 |
Graphics2D g2 = img.createGraphics(); |
|
69 |
drawInsideRectangle(g2, g2.getTransform(), rect); |
|
70 |
rgb = img.getRGB(0, 0); |
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* Devuelve el color que se aplica a los shapes seleccionados. |
|
75 |
* |
|
76 |
* @return DOCUMENT ME! |
|
77 |
*/ |
|
78 |
public static Color getSelectionColor() { |
|
79 |
return selectionColor; |
|
80 |
} |
|
81 |
|
|
82 |
|
|
83 |
public Color getColor(){ |
|
84 |
return symColor; |
|
85 |
} |
|
86 |
|
|
87 |
public Stroke getStroke(){ |
|
88 |
return m_Stroke; |
|
89 |
} |
|
90 |
|
|
91 |
public void setStroke(Stroke stroke){ |
|
92 |
this.m_Stroke = stroke; |
|
93 |
} |
|
94 |
|
|
95 |
|
|
96 |
/* (non-Javadoc) |
|
97 |
* @see com.iver.cit.gvsig.fmap.core.ISymbol#getSymbolForSelection() |
|
98 |
*/ |
|
99 |
public ISymbol getSymbolForSelection() { |
|
100 |
FArrowSymbol solution = new FArrowSymbol(selectionColor); |
|
101 |
solution.m_bDrawShape = m_bDrawShape; |
|
102 |
solution.m_Stroke = m_Stroke; |
|
103 |
return solution; |
|
104 |
} |
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
public void draw(Graphics2D g, AffineTransform affineTransform, FShape shp) { |
|
111 |
|
|
112 |
//1? dibujamos la linea |
|
113 |
if (shp == null || (! isShapeVisible())) { |
|
114 |
return; |
|
115 |
} |
|
116 |
g.setColor(getColor()); |
|
117 |
if (getStroke() != null) { |
|
118 |
g.setStroke(getStroke()); |
|
119 |
} |
|
120 |
g.draw(shp); |
|
121 |
|
|
122 |
/* |
|
123 |
* Ahora intentamos obtener el ultimo segmento |
|
124 |
* */ |
|
125 |
PathIterator theIterator; |
|
126 |
theIterator = shp.getPathIterator(null, 0.8); |
|
127 |
int theType; |
|
128 |
double[] theData = new double[2]; |
|
129 |
ArrayList arrayCoords = new ArrayList(); |
|
130 |
while (!theIterator.isDone()) { |
|
131 |
theType = theIterator.currentSegment(theData); |
|
132 |
if(theType == PathIterator.SEG_LINETO || theType == PathIterator.SEG_MOVETO) |
|
133 |
arrayCoords.add(theData); |
|
134 |
theData = new double[2]; |
|
135 |
theIterator.next(); |
|
136 |
} //end while loop |
|
137 |
|
|
138 |
double length = 0d; |
|
139 |
double[] previous = null; |
|
140 |
for(int i = 0; i < arrayCoords.size(); i++ ){ |
|
141 |
double[] coords = (double[]) arrayCoords.get(i); |
|
142 |
if(previous == null) |
|
143 |
previous = coords; |
|
144 |
else{ |
|
145 |
double dx = coords[0] - previous[0]; |
|
146 |
double dy = coords[1] - previous[1]; |
|
147 |
double dist = Math.sqrt( ( dx * dx ) + (dy * dy)); |
|
148 |
length += dist; |
|
149 |
}//else |
|
150 |
}//for |
|
151 |
|
|
152 |
if(lenghtArrow > (0.5 * length))//to avoid arrows collisions |
|
153 |
return; |
|
154 |
|
|
155 |
double[] last = (double[]) arrayCoords.get(arrayCoords.size() -1); |
|
156 |
double[] prevLast = (double[]) arrayCoords.get(arrayCoords.size() -2); |
|
157 |
|
|
158 |
|
|
159 |
double mx = last[0]; |
|
160 |
double my = last[1]; |
|
161 |
double Mx = prevLast[0]; |
|
162 |
double My = prevLast[1]; |
|
163 |
// |
|
164 |
|
|
165 |
// tama?o de la flecha |
|
166 |
double tipLength = lenghtArrow; |
|
167 |
double tipWidth = widthArrow; |
|
168 |
|
|
169 |
double tip1x = mx + (((Mx - mx) * tipLength + ( tipWidth / 2)*(my - My))/ |
|
170 |
Math.sqrt(( my - My) * (my - My)+(mx-Mx)*(mx-Mx))); |
|
171 |
|
|
172 |
double tip2x = mx + (((Mx-mx) * tipLength-(tipWidth/2)*(my-My))/ |
|
173 |
Math.sqrt((my-My)*(my-My)+(mx-Mx)*(mx-Mx))); |
|
174 |
|
|
175 |
double tip1y = my + (((My-my)*tipLength-(tipWidth/2)*(mx-Mx))/ |
|
176 |
Math.sqrt((my-My)*(my-My)+(mx-Mx)*(mx-Mx))); |
|
177 |
|
|
178 |
double tip2y = my + (((My-my)*tipLength+(tipWidth/2)*(mx-Mx))/ |
|
179 |
Math.sqrt((my-My)*(my-My)+(mx-Mx)*(mx-Mx))); |
|
180 |
|
|
181 |
GeneralPathX path = new GeneralPathX(); |
|
182 |
path.moveTo(mx, my); |
|
183 |
path.lineTo(tip1x, tip1y); |
|
184 |
path.lineTo(tip2x, tip2y); |
|
185 |
path.closePath(); |
|
186 |
FPolygon2D arrow = new FPolygon2D(path); |
|
187 |
g.fill(arrow); |
|
188 |
} |
|
189 |
|
|
190 |
|
|
191 |
public int getPixExtentPlus(Graphics2D g, AffineTransform affineTransform, Shape shp) { |
|
192 |
// TODO Auto-generated method stub |
|
193 |
return 0; |
|
194 |
} |
|
195 |
|
|
196 |
|
|
197 |
|
|
198 |
|
|
199 |
|
|
200 |
public int getOnePointRgb() { |
|
201 |
return rgb; |
|
202 |
} |
|
203 |
|
|
204 |
|
|
205 |
public XMLEntity getXMLEntity() { |
|
206 |
XMLEntity xml = new XMLEntity(); |
|
207 |
xml.putProperty("className",this.getClass().getName()); |
|
208 |
xml.putProperty("m_symbolType", getSymbolType()); |
|
209 |
if (getColor() != null) { |
|
210 |
xml.putProperty("m_Color", StringUtilities.color2String(getColor())); |
|
211 |
} |
|
212 |
xml.putProperty("m_bDrawShape", isShapeVisible()); |
|
213 |
|
|
214 |
|
|
215 |
//Ancho del stroke en float |
|
216 |
if (getStroke() != null) { |
|
217 |
xml.putProperty("m_stroke", |
|
218 |
((BasicStroke) getStroke()).getLineWidth()); |
|
219 |
} else { |
|
220 |
xml.putProperty("m_stroke", 0f); |
|
221 |
} |
|
222 |
xml.putProperty("rgb", rgb); |
|
223 |
|
|
224 |
return xml; |
|
225 |
} |
|
226 |
|
|
227 |
|
|
228 |
|
|
229 |
public String getDescription() { |
|
230 |
return null; |
|
231 |
} |
|
232 |
|
|
233 |
|
|
234 |
|
|
235 |
|
|
236 |
|
|
237 |
public boolean isShapeVisible() { |
|
238 |
return m_bDrawShape; |
|
239 |
} |
|
240 |
|
|
241 |
|
|
242 |
|
|
243 |
public void setDescription(String m_Descrip) { |
|
244 |
this.m_Descrip = m_Descrip; |
|
245 |
} |
|
246 |
|
|
247 |
|
|
248 |
public int getSymbolType() { |
|
249 |
return m_symbolType; |
|
250 |
} |
|
251 |
|
|
252 |
|
|
253 |
|
|
254 |
public boolean isSuitableFor(IGeometry geom) { |
|
255 |
return true; |
|
256 |
} |
|
257 |
|
|
258 |
//TODO Copypasteado de graphics utilities para symboltype LINE |
|
259 |
public void drawInsideRectangle(Graphics2D g, |
|
260 |
AffineTransform scaleInstance, |
|
261 |
Rectangle r) { |
|
262 |
|
|
263 |
FShape shp; |
|
264 |
AffineTransform mT = new AffineTransform(); |
|
265 |
mT.setToIdentity(); |
|
266 |
|
|
267 |
Rectangle rect = mT.createTransformedShape(r).getBounds(); |
|
268 |
GeneralPathX line = new GeneralPathX(); |
|
269 |
|
|
270 |
|
|
271 |
|
|
272 |
line.moveTo(rect.x, rect.y + (rect.height / 2)); |
|
273 |
line.curveTo(rect.x + (rect.width / 3), |
|
274 |
rect.y + (2 * rect.height), |
|
275 |
rect.x + ((2 * rect.width) / 3), rect.y - rect.height, |
|
276 |
rect.x + rect.width, rect.y + (rect.height / 2)); |
|
277 |
|
|
278 |
shp = new FPolyline2D(line); |
|
279 |
draw(g, mT, shp); |
|
280 |
} |
|
281 |
|
|
282 |
|
|
283 |
|
|
284 |
|
|
285 |
|
|
286 |
public void setXMLEntity(XMLEntity xml) { |
|
287 |
|
|
288 |
|
|
289 |
} |
|
290 |
|
|
291 |
|
|
292 |
public String getClassName() { |
|
293 |
// TODO Auto-generated method stub |
|
294 |
return null; |
|
295 |
} |
|
296 |
|
|
297 |
|
|
298 |
/** |
|
299 |
* @return Returns the m_bDrawShape. |
|
300 |
*/ |
|
301 |
public boolean isM_bDrawShape() { |
|
302 |
return m_bDrawShape; |
|
303 |
} |
|
304 |
/** |
|
305 |
* @param drawShape The m_bDrawShape to set. |
|
306 |
*/ |
|
307 |
public void setM_bDrawShape(boolean drawShape) { |
|
308 |
m_bDrawShape = drawShape; |
|
309 |
} |
|
310 |
|
|
311 |
public void setPrintingProperties(PrintRequestAttributeSet printProperties) { |
|
312 |
// TODO Auto-generated method stub |
|
313 |
|
|
314 |
} |
|
315 |
|
|
316 |
public void print(Graphics2D g, AffineTransform at, FShape shape) throws DriverException { |
|
317 |
// TODO Implement it |
|
318 |
throw new Error("Not yet implemented!"); |
|
319 |
|
|
320 |
} |
|
321 |
} |
|
0 | 322 |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/v02/FSymbol.java | ||
---|---|---|
71 | 71 |
import com.iver.cit.gvsig.fmap.core.FShape; |
72 | 72 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
73 | 73 |
import com.iver.cit.gvsig.fmap.core.ISLDCompatible; |
74 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
75 | 74 |
import com.iver.cit.gvsig.fmap.core.SLDTags; |
76 | 75 |
import com.iver.cit.gvsig.fmap.core.SLDUtils; |
76 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
77 | 77 |
import com.iver.cit.gvsig.fmap.rendering.XmlBuilder; |
78 | 78 |
import com.iver.utiles.StringUtilities; |
79 | 79 |
import com.iver.utiles.XMLEntity; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/v02/FGraphicUtilities.java | ||
---|---|---|
63 | 63 |
import com.iver.cit.gvsig.fmap.core.FShape; |
64 | 64 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
65 | 65 |
import com.iver.cit.gvsig.fmap.core.Handler; |
66 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
66 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
|
67 | 67 |
import com.vividsolutions.jts.geom.Geometry; |
68 | 68 |
import com.vividsolutions.jts.geom.Point; |
69 | 69 |
|
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FNullGeometry.java | ||
---|---|---|
41 | 41 |
package com.iver.cit.gvsig.fmap.core; |
42 | 42 |
|
43 | 43 |
import com.iver.cit.gvsig.fmap.ViewPort; |
44 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
44 | 45 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
45 | 46 |
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D; |
46 | 47 |
|
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FGeometry.java | ||
---|---|---|
59 | 59 |
import org.geotools.data.postgis.attributeio.WKBEncoder; |
60 | 60 |
|
61 | 61 |
import com.iver.cit.gvsig.fmap.ViewPort; |
62 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
62 | 63 |
import com.iver.cit.gvsig.fmap.core.v02.FConverter; |
63 | 64 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
64 | 65 |
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/SLDUtils.java | ||
---|---|---|
14 | 14 |
import org.geotools.styling.StyleFactory; |
15 | 15 |
import org.geotools.styling.Symbolizer; |
16 | 16 |
|
17 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
17 | 18 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
18 | 19 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
19 | 20 |
|
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/Gt2Geometry.java | ||
---|---|---|
57 | 57 |
|
58 | 58 |
import com.iver.cit.gvsig.fmap.ViewPort; |
59 | 59 |
import com.iver.cit.gvsig.fmap.core.gt2.FLiteShape; |
60 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
60 | 61 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
61 | 62 |
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D; |
62 | 63 |
import com.vividsolutions.jts.geom.Geometry; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/SimpleMarkerSymbol.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.1 2007-01-10 16:31:36 jaume |
|
46 |
* Revision 1.2 2007-01-10 16:39:41 jaume |
|
47 |
* ISymbol now belongs to com.iver.cit.gvsig.fmap.core.symbols package |
|
48 |
* |
|
49 |
* Revision 1.1 2007/01/10 16:31:36 jaume |
|
47 | 50 |
* *** empty log message *** |
48 | 51 |
* |
49 | 52 |
* Revision 1.1 2006/11/14 11:10:27 jaume |
... | ... | |
59 | 62 |
import java.awt.Shape; |
60 | 63 |
import java.awt.geom.AffineTransform; |
61 | 64 |
|
65 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
62 | 66 |
import com.iver.cit.gvsig.fmap.core.FShape; |
63 | 67 |
import com.iver.cit.gvsig.fmap.core.SymbolFactory; |
64 | 68 |
import com.iver.utiles.StringUtilities; |
... | ... | |
123 | 127 |
|
124 | 128 |
} |
125 | 129 |
|
130 |
public void print(Graphics2D g, AffineTransform at, FShape shape) throws DriverException { |
|
131 |
// TODO Implement it |
|
132 |
throw new Error("Not yet implemented!"); |
|
133 |
|
|
134 |
} |
|
135 |
|
|
126 | 136 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/DotDensityFillSymbol.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.1 2007-01-10 16:31:36 jaume |
|
46 |
* Revision 1.2 2007-01-10 16:39:41 jaume |
|
47 |
* ISymbol now belongs to com.iver.cit.gvsig.fmap.core.symbols package |
|
48 |
* |
|
49 |
* Revision 1.1 2007/01/10 16:31:36 jaume |
|
47 | 50 |
* *** empty log message *** |
48 | 51 |
* |
49 | 52 |
* Revision 1.4 2006/11/14 11:10:27 jaume |
... | ... | |
70 | 73 |
import java.awt.geom.AffineTransform; |
71 | 74 |
import java.util.Random; |
72 | 75 |
|
76 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
73 | 77 |
import com.iver.cit.gvsig.fmap.core.FShape; |
74 | 78 |
import com.iver.utiles.StringUtilities; |
75 | 79 |
import com.iver.utiles.XMLEntity; |
... | ... | |
230 | 234 |
this.color = dotColor; |
231 | 235 |
} |
232 | 236 |
|
237 |
public void print(Graphics2D g, AffineTransform at, FShape shape) throws DriverException { |
|
238 |
// TODO Implement it |
|
239 |
throw new Error("Not yet implemented!"); |
|
240 |
|
|
241 |
} |
|
242 |
|
|
233 | 243 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/CharacterMarkerSymbol.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.1 2007-01-10 16:31:36 jaume |
|
46 |
* Revision 1.2 2007-01-10 16:39:41 jaume |
|
47 |
* ISymbol now belongs to com.iver.cit.gvsig.fmap.core.symbols package |
|
48 |
* |
|
49 |
* Revision 1.1 2007/01/10 16:31:36 jaume |
|
47 | 50 |
* *** empty log message *** |
48 | 51 |
* |
49 | 52 |
* Revision 1.6 2006/12/04 17:13:39 fjp |
... | ... | |
102 | 105 |
|
103 | 106 |
import org.apache.batik.ext.awt.geom.PathLength; |
104 | 107 |
|
108 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
105 | 109 |
import com.iver.cit.gvsig.fmap.core.FPoint2D; |
106 | 110 |
import com.iver.cit.gvsig.fmap.core.FShape; |
107 | 111 |
import com.iver.cit.gvsig.fmap.core.SymbolFactory; |
... | ... | |
307 | 311 |
|
308 | 312 |
} |
309 | 313 |
|
314 |
public void print(Graphics2D g, AffineTransform at, FShape shape) throws DriverException { |
|
315 |
// TODO Implement it |
|
316 |
throw new Error("Not yet implemented!"); |
|
317 |
|
|
318 |
} |
|
319 |
|
|
310 | 320 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/SimpleFillSymbol.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.1 2007-01-10 16:31:36 jaume |
|
46 |
* Revision 1.2 2007-01-10 16:39:41 jaume |
|
47 |
* ISymbol now belongs to com.iver.cit.gvsig.fmap.core.symbols package |
|
48 |
* |
|
49 |
* Revision 1.1 2007/01/10 16:31:36 jaume |
|
47 | 50 |
* *** empty log message *** |
48 | 51 |
* |
49 | 52 |
* Revision 1.7 2006/11/14 11:10:27 jaume |
... | ... | |
78 | 81 |
import java.awt.Shape; |
79 | 82 |
import java.awt.geom.AffineTransform; |
80 | 83 |
|
84 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
81 | 85 |
import com.iver.cit.gvsig.fmap.core.FShape; |
82 | 86 |
import com.iver.cit.gvsig.fmap.core.SymbolFactory; |
83 | 87 |
import com.iver.utiles.StringUtilities; |
... | ... | |
175 | 179 |
// is shape visible |
176 | 180 |
setIsShapeVisible(xml.getBooleanProperty("isShapeVisible")); |
177 | 181 |
} |
182 |
|
|
183 |
public void print(Graphics2D g, AffineTransform at, FShape shape) throws DriverException { |
|
184 |
// TODO Implement it |
|
185 |
throw new Error("Not yet implemented!"); |
|
186 |
|
|
187 |
} |
|
178 | 188 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/MultiLayerSymbol.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.1 2007-01-10 16:31:36 jaume |
|
46 |
* Revision 1.2 2007-01-10 16:39:41 jaume |
|
47 |
* ISymbol now belongs to com.iver.cit.gvsig.fmap.core.symbols package |
|
48 |
* |
|
49 |
* Revision 1.1 2007/01/10 16:31:36 jaume |
|
47 | 50 |
* *** empty log message *** |
48 | 51 |
* |
49 | 52 |
* |
... | ... | |
159 | 162 |
} |
160 | 163 |
} |
161 | 164 |
|
165 |
public void print(Graphics2D g, AffineTransform at, FShape shape) throws com.iver.cit.gvsig.fmap.DriverException { |
|
166 |
// TODO Implement it |
|
167 |
throw new Error("Not yet implemented!"); |
|
162 | 168 |
|
169 |
} |
|
170 |
|
|
171 |
|
|
163 | 172 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/ISymbol.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package com.iver.cit.gvsig.fmap.core.symbols; |
|
42 |
|
|
43 |
import java.awt.Graphics2D; |
|
44 |
import java.awt.Rectangle; |
|
45 |
import java.awt.Shape; |
|
46 |
import java.awt.geom.AffineTransform; |
|
47 |
|
|
48 |
import javax.print.attribute.PrintRequestAttributeSet; |
|
49 |
|
|
50 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
51 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
|
52 |
import com.iver.cit.gvsig.fmap.core.IPrintable; |
|
53 |
import com.iver.utiles.IPersistance; |
|
54 |
import com.iver.utiles.XMLEntity; |
|
55 |
|
|
56 |
public interface ISymbol extends IPersistance, IPrintable{ |
|
57 |
public final static int CHARACTER_MARKER = 1; |
|
58 |
public final static int SIMPLE_FILL = 2; |
|
59 |
public static final int MARKER_FILL = 3; |
|
60 |
|
|
61 |
/** |
|
62 |
* Returns the derived version of the symbol that will be used to draw the |
|
63 |
* feature when it is selected. |
|
64 |
* @return <b>ISymbol</b> applied to a feature when it has been selected. |
|
65 |
*/ |
|
66 |
ISymbol getSymbolForSelection(); |
|
67 |
|
|
68 |
void draw(Graphics2D g, AffineTransform affineTransform, FShape shp); |
|
69 |
|
|
70 |
// In the future, we may need something like that, but now if |
|
71 |
// I put it, we should change the rendering process, and it will |
|
72 |
// be slowly. |
|
73 |
// El problema es que antes de renderizar algo, tenemos que calcular |
|
74 |
// c?mo va a quedar en pantalla, para saber su bounding box real y si |
|
75 |
// hay que dibujarlo o no. Pasa con los textos, pero en general |
|
76 |
// con cualquier s?mbolo de tipo puntual, tambi?n. En menor medida con |
|
77 |
// l?neas y pol?gonos. |
|
78 |
// |
|
79 |
// IDEA!!!: |
|
80 |
// Para no depender de leer un shape y pedirle al s?mbolo que toca |
|
81 |
// el bounding box para ver si hay que dibujarlo, se puede hacer una |
|
82 |
// pasada previa por la leyenda y ver los pixels que a?ade al bounding |
|
83 |
// box. (Se coge un punto, una l?nea o un pol?gono, y se calcula |
|
84 |
// su bounding box para esa escala. Si es mayor que el original del |
|
85 |
// shape, se calculan los pixels. Luego se pasan esos pixels a |
|
86 |
// coordenadas de mundo real, y se le suman al visibleExtent para que |
|
87 |
// se dibujen los trozos de texto que no se pintan, etc, etc. |
|
88 |
int getPixExtentPlus(Graphics2D g, AffineTransform affineTransform, Shape shp); |
|
89 |
/** |
|
90 |
* Devuelve el rgb del s?mbolo cuando se dibuja como un punto. |
|
91 |
* |
|
92 |
* @return rgb del s?mbolo. |
|
93 |
*/ |
|
94 |
public int getOnePointRgb(); |
|
95 |
|
|
96 |
/** |
|
97 |
* Use it to specify how do you want to write the symbol in .gvp project |
|
98 |
* @return |
|
99 |
*/ |
|
100 |
XMLEntity getXMLEntity(); |
|
101 |
|
|
102 |
/** |
|
103 |
* The description is a human-readable text used to label it when show in a |
|
104 |
* symbol menu or something like that. |
|
105 |
* |
|
106 |
* @return description of this symbol. |
|
107 |
*/ |
|
108 |
String getDescription(); |
|
109 |
|
|
110 |
/** |
|
111 |
* Tells whether the shape of the symbol will be drawn or not. |
|
112 |
* |
|
113 |
* @return <b>true</b> if Shape must be drawn. Useful if you are labelling |
|
114 |
*/ |
|
115 |
boolean isShapeVisible(); |
|
116 |
|
|
117 |
/** |
|
118 |
* Sets the description of this symbol |
|
119 |
* @param desc, a string with the description |
|
120 |
* @see ISymbol.getDescription(); |
|
121 |
*/ |
|
122 |
void setDescription(String desc); |
|
123 |
|
|
124 |
/** |
|
125 |
* The use of this method -and its mechanism- is being valorated. It probably |
|
126 |
* will be <b>deprecated</b>. |
|
127 |
* @return FSymbol constants. I think it is better to use isSuitableFor |
|
128 |
* |
|
129 |
*/ |
|
130 |
int getSymbolType(); |
|
131 |
|
|
132 |
/** |
|
133 |
* True if this symbol is ok for the geometry. For example, a FillSymbol will |
|
134 |
* be suitable for a Polygon. |
|
135 |
* @param geom |
|
136 |
* @return |
|
137 |
*/ |
|
138 |
boolean isSuitableFor(IGeometry geom); |
|
139 |
|
|
140 |
/** |
|
141 |
* Useful to render the symbol inside the TOC, or inside little |
|
142 |
* rectangles. For example, think about rendering a Label with size |
|
143 |
* in meters => You will need to specify a size in pixels. |
|
144 |
* Of course, you can also to choose to render a prepared image, etc. |
|
145 |
* @param g2 |
|
146 |
* @param scaleInstance |
|
147 |
* @param r |
|
148 |
*/ |
|
149 |
void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r); |
|
150 |
|
|
151 |
/** |
|
152 |
* |
|
153 |
* @param printProperties |
|
154 |
*/ |
|
155 |
void setPrintingProperties(PrintRequestAttributeSet printProperties); |
|
156 |
} |
|
157 |
|
|
158 |
|
|
0 | 159 |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/MarkerFillSymbol.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.1 2007-01-10 16:31:36 jaume |
|
46 |
* Revision 1.2 2007-01-10 16:39:41 jaume |
|
47 |
* ISymbol now belongs to com.iver.cit.gvsig.fmap.core.symbols package |
|
48 |
* |
|
49 |
* Revision 1.1 2007/01/10 16:31:36 jaume |
|
47 | 50 |
* *** empty log message *** |
48 | 51 |
* |
49 | 52 |
* Revision 1.10 2006/11/09 18:39:05 jaume |
... | ... | |
94 | 97 |
import java.awt.image.BufferedImage; |
95 | 98 |
import java.util.ArrayList; |
96 | 99 |
|
100 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
97 | 101 |
import com.iver.cit.gvsig.fmap.core.FShape; |
98 | 102 |
import com.iver.cit.gvsig.fmap.core.SymbolFactory; |
99 | 103 |
import com.iver.utiles.StringUtilities; |
... | ... | |
278 | 282 |
this.markerSymbol = marker; |
279 | 283 |
} |
280 | 284 |
|
285 |
public void print(Graphics2D g, AffineTransform at, FShape shape) throws DriverException { |
|
286 |
// TODO Implement it |
|
287 |
throw new Error("Not yet implemented!"); |
|
288 |
|
|
289 |
} |
|
290 |
|
|
281 | 291 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/SymbolFactory.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
|
|
42 |
/* CVS MESSAGES: |
|
43 |
* |
|
44 |
* $Id$ |
|
45 |
* $Log$ |
|
46 |
* Revision 1.1 2007-01-10 16:39:41 jaume |
|
47 |
* ISymbol now belongs to com.iver.cit.gvsig.fmap.core.symbols package |
|
48 |
* |
|
49 |
* Revision 1.3 2006/11/06 16:06:52 jaume |
|
50 |
* *** empty log message *** |
|
51 |
* |
|
52 |
* Revision 1.2 2006/11/06 07:33:54 jaume |
|
53 |
* javadoc, source style |
|
54 |
* |
|
55 |
* Revision 1.1 2006/10/30 19:30:35 jaume |
|
56 |
* *** empty log message *** |
|
57 |
* |
|
58 |
* |
|
59 |
*/ |
|
60 |
package com.iver.cit.gvsig.fmap.core; |
|
61 |
|
|
62 |
import org.apache.log4j.Logger; |
|
63 |
|
|
64 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
65 |
import com.iver.utiles.NotExistInXMLEntity; |
|
66 |
import com.iver.utiles.XMLEntity; |
|
67 |
|
|
68 |
/** |
|
69 |
* Factory for obtaining ISymbols of any kind from several sources like. |
|
70 |
* <ol> |
|
71 |
* <li> |
|
72 |
* <b>XMLEntity's</b> that, at least, contains a full class name |
|
73 |
* string property that defines which class handles such symbol. |
|
74 |
* </li> |
|
75 |
* </ol> |
|
76 |
* |
|
77 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
|
78 |
*/ |
|
79 |
public class SymbolFactory { |
|
80 |
private static Logger logger = Logger.getLogger(SymbolFactory.class.getName()); |
|
81 |
/** |
|
82 |
* Factory that allows to create ISymbol from an ISymbol xml |
|
83 |
* descriptor. A barely specific XMLEntity object. The string passed in the |
|
84 |
* second argument is the description text that will be used in case no description |
|
85 |
* is supplied by the symbol |
|
86 |
*/ |
|
87 |
public static ISymbol createFromXML(XMLEntity xml, String defaultDescription) { |
|
88 |
String className = null; |
|
89 |
try { |
|
90 |
className = xml.getStringProperty("className"); |
|
91 |
} catch (NotExistInXMLEntity e) { |
|
92 |
logger.error("Symbol class name not set.\n" + |
|
93 |
" Maybe you forgot to add the" + |
|
94 |
" putProperty(\"className\", yourClassName)" + |
|
95 |
" call in the getXMLEntity method of your symbol", e); |
|
96 |
} |
|
97 |
|
|
98 |
if (!xml.contains("desc")) |
|
99 |
xml.putProperty("desc", defaultDescription); |
|
100 |
|
|
101 |
Class clazz = null; |
|
102 |
ISymbol sym = null; |
|
103 |
|
|
104 |
try { |
|
105 |
clazz = Class.forName(className); |
|
106 |
sym = (ISymbol) clazz.newInstance(); |
|
107 |
sym.setXMLEntity(xml); |
|
108 |
} catch (InstantiationException e) { |
|
109 |
logger.error("Trying to instantiate an interface" + |
|
110 |
" or abstract class + "+className, e); |
|
111 |
} catch (IllegalAccessException e) { |
|
112 |
logger.error(null, e); |
|
113 |
} catch (ClassNotFoundException e) { |
|
114 |
logger.error("No class called " + className + |
|
115 |
" was found.\nCheck the following.\n<br>" + |
|
116 |
"\t- The fullname of the class you're looking " + |
|
117 |
"for matches the value in the className " + |
|
118 |
"property of the XMLEntity ("+className+").\n<br>" + |
|
119 |
"\t- The jar file containing your symbol class is in" + |
|
120 |
"the application classpath<br>", e); |
|
121 |
} |
|
122 |
return sym; |
|
123 |
} |
|
124 |
} |
|
0 | 125 |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/UniqueValueLegend.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
import com.hardcode.gdbms.engine.values.Value; |
44 | 44 |
|
45 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
45 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
|
46 | 46 |
|
47 | 47 |
|
48 | 48 |
/** |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/FGraphic.java | ||
---|---|---|
47 | 47 |
|
48 | 48 |
import com.iver.cit.gvsig.fmap.ViewPort; |
49 | 49 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
50 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
50 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
|
51 | 51 |
|
52 | 52 |
public class FGraphic { |
53 | 53 |
int idSymbol; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/SingleSymbolLegend.java | ||
---|---|---|
46 | 46 |
import com.iver.cit.gvsig.fmap.core.FShape; |
47 | 47 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
48 | 48 |
import com.iver.cit.gvsig.fmap.core.ISLDCompatible; |
49 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
50 | 49 |
import com.iver.cit.gvsig.fmap.core.SLDTags; |
50 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
51 | 51 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
52 | 52 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
53 | 53 |
import com.iver.cit.gvsig.fmap.layers.XMLException; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/VectorialUniqueValueLegend.java | ||
---|---|---|
71 | 71 |
import com.iver.cit.gvsig.fmap.core.FShape; |
72 | 72 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
73 | 73 |
import com.iver.cit.gvsig.fmap.core.ISLDCompatible; |
74 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
75 | 74 |
import com.iver.cit.gvsig.fmap.core.SLDTags; |
76 | 75 |
import com.iver.cit.gvsig.fmap.core.SLDUtils; |
76 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
77 | 77 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
78 | 78 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
79 | 79 |
import com.iver.cit.gvsig.fmap.layers.XMLException; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/sld2gvl/Rule.java | ||
---|---|---|
3 | 3 |
|
4 | 4 |
|
5 | 5 |
import com.iver.cit.gvsig.fmap.core.FShape; |
6 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
6 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
|
7 | 7 |
import com.iver.cit.gvsig.fmap.rendering.sld2gvl.filters.Filter; |
8 | 8 |
|
9 | 9 |
public class Rule { |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/sld2gvl/SLD2GVL.java | ||
---|---|---|
31 | 31 |
import com.hardcode.gdbms.engine.values.ValueFactory; |
32 | 32 |
import com.iver.cit.gvsig.fmap.core.FShape; |
33 | 33 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
34 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
35 | 34 |
import com.iver.cit.gvsig.fmap.core.SLDTags; |
36 | 35 |
import com.iver.cit.gvsig.fmap.core.SLDUtils; |
36 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
37 | 37 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
38 | 38 |
import com.iver.cit.gvsig.fmap.rendering.FInterval; |
39 | 39 |
import com.iver.cit.gvsig.fmap.rendering.Legend; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/Legend.java | ||
---|---|---|
41 | 41 |
package com.iver.cit.gvsig.fmap.rendering; |
42 | 42 |
|
43 | 43 |
import com.iver.cit.gvsig.fmap.DriverException; |
44 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
44 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
|
45 | 45 |
import com.iver.cit.gvsig.fmap.layers.XMLException; |
46 | 46 |
import com.iver.utiles.XMLEntity; |
47 | 47 |
|
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/ClassifiedLegendInfo.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig.fmap.rendering; |
42 | 42 |
|
43 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
43 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
|
44 | 44 |
|
45 | 45 |
|
46 | 46 |
/** |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/IntervalLegend.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig.fmap.rendering; |
42 | 42 |
|
43 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
|
43 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
|
44 | 44 |
|
45 | 45 |
|
46 | 46 |
/** |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/DotDensityLegend.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
|
|
42 |
/* CVS MESSAGES: |
|
43 |
* |
|
44 |
* $Id$ |
|
45 |
* $Log$ |
|
46 |
* Revision 1.1 2007-01-10 16:39:41 jaume |
|
47 |
* ISymbol now belongs to com.iver.cit.gvsig.fmap.core.symbols package |
|
48 |
* |
|
49 |
* Revision 1.2 2006/11/17 12:49:58 jaume |
|
50 |
* *** empty log message *** |
|
51 |
* |
|
52 |
* Revision 1.1 2006/11/14 12:30:26 jaume |
|
53 |
* *** empty log message *** |
|
54 |
* |
|
55 |
* |
|
56 |
*/ |
|
57 |
package com.iver.cit.gvsig.fmap.rendering; |
|
58 |
|
|
59 |
import java.awt.Color; |
|
60 |
|
|
61 |
import com.hardcode.gdbms.engine.values.NumericValue; |
|
62 |
import com.hardcode.gdbms.engine.values.Value; |
|
63 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
|
64 |
import com.iver.cit.gvsig.fmap.core.SymbolFactory; |
|
65 |
import com.iver.cit.gvsig.fmap.core.symbols.DotDensityFillSymbol; |
|
66 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
67 |
import com.iver.cit.gvsig.fmap.core.symbols.SimpleFillSymbol; |
|
68 |
import com.iver.utiles.StringUtilities; |
|
69 |
import com.iver.utiles.XMLEntity; |
|
70 |
|
|
71 |
|
|
72 |
public class DotDensityLegend extends VectorialUniqueValueLegend { |
|
73 |
private double dotValue; |
|
74 |
|
|
75 |
public ISymbol getSymbolByValue(Value key) { |
|
76 |
DotDensityFillSymbol sym = (DotDensityFillSymbol) getDefaultSymbol(); |
|
77 |
sym.setDotCount((int) (((NumericValue) key).doubleValue()/dotValue)); |
|
78 |
return sym; |
|
79 |
} |
|
80 |
|
|
81 |
public ISymbol getSymbolByFeature(IFeature feat) { |
|
82 |
return getSymbolByValue(feat.getAttribute(fieldId)); |
|
83 |
} |
|
84 |
|
|
85 |
public void setDotValue(double dotValue) { |
|
86 |
this.dotValue = dotValue; |
|
87 |
} |
|
88 |
|
|
89 |
public XMLEntity getXMLEntity() { |
|
90 |
XMLEntity xml = new XMLEntity(); |
|
91 |
xml.putProperty("className", getClass().getName()); |
|
92 |
xml.putProperty("dotValue", dotValue); |
|
93 |
xml.putProperty("fieldName", getFieldName()); |
|
94 |
xml.addChild(getDefaultSymbol().getXMLEntity()); |
|
95 |
return xml; |
|
96 |
} |
|
97 |
|
|
98 |
public void setXMLEntity(XMLEntity xml) { |
|
99 |
dotValue = xml.getDoubleProperty("dotValue"); |
|
100 |
setFieldName(xml.getStringProperty("fieldName")); |
|
101 |
setDefaultSymbol(SymbolFactory.createFromXML(xml.getChild(0), null)); |
|
102 |
} |
|
103 |
|
|
104 |
public Color getOutlineColor() { |
|
105 |
try { |
|
106 |
XMLEntity xml = getDefaultSymbol().getXMLEntity(); |
|
107 |
return StringUtilities.string2Color(xml.getStringProperty("outline")); |
|
108 |
} catch (NullPointerException npE) { |
|
109 |
return null; |
|
110 |
} |
|
111 |
} |
|
112 |
|
|
113 |
public Color getDotColor() { |
|
114 |
try { |
|
115 |
XMLEntity xml = getDefaultSymbol().getXMLEntity().getChild(0); |
|
116 |
return StringUtilities.string2Color(xml.getStringProperty("color")); |
|
117 |
} catch (NullPointerException npE) { |
|
118 |
return null; |
|
119 |
} |
|
120 |
} |
|
121 |
|
|
122 |
public Color getBGColor() { |
|
123 |
try { |
|
124 |
XMLEntity xml = getDefaultSymbol().getXMLEntity(); |
|
125 |
return StringUtilities.string2Color(xml.getStringProperty("color")); |
|
126 |
} catch (NullPointerException npE) { |
|
127 |
return null; |
|
128 |
} |
Also available in: Unified diff