Revision 34633
branches/dal_time_support/libraries/libFMap_mapcontext/resources-test/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
3 |
|
|
4 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
5 |
|
|
6 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
7 |
<layout class="org.apache.log4j.PatternLayout"> |
|
8 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
9 |
</layout> |
|
10 |
</appender> |
|
11 |
|
|
12 |
<category name="org.gvsig.tools"> |
|
13 |
<priority value="DEBUG" /> |
|
14 |
</category> |
|
15 |
<category name="org.gvsig.fmap.mapcontext"> |
|
16 |
<priority value="DEBUG" /> |
|
17 |
</category> |
|
18 |
|
|
19 |
<root> |
|
20 |
<priority value="INFO" /> |
|
21 |
<appender-ref ref="CONSOLE" /> |
|
22 |
</root> |
|
23 |
</log4j:configuration> |
branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/AggregateDrawInts.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 IVER T.I {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
/** |
|
29 |
* |
|
30 |
*/ |
|
31 |
package org.gvsig.fmap.geom.operation; |
|
32 |
|
|
33 |
import org.gvsig.fmap.geom.Geometry; |
|
34 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
35 |
import org.gvsig.fmap.geom.GeometryManager; |
|
36 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
|
37 |
import org.gvsig.fmap.geom.aggregate.Aggregate; |
|
38 |
import org.slf4j.Logger; |
|
39 |
import org.slf4j.LoggerFactory; |
|
40 |
|
|
41 |
/** |
|
42 |
* @author jmvivo |
|
43 |
* |
|
44 |
*/ |
|
45 |
public class AggregateDrawInts extends GeometryOperation { |
|
46 |
public static final String NAME = "drawInts"; |
|
47 |
public static int CODE = Integer.MIN_VALUE; |
|
48 |
|
|
49 |
|
|
50 |
final static private Logger logger = LoggerFactory |
|
51 |
.getLogger(DrawInts.class); |
|
52 |
|
|
53 |
/* (non-Javadoc) |
|
54 |
* @see org.gvsig.fmap.geom.operation.GeometryOperation#getOperationIndex() |
|
55 |
*/ |
|
56 |
public int getOperationIndex() { |
|
57 |
return CODE; |
|
58 |
} |
|
59 |
|
|
60 |
/* (non-Javadoc) |
|
61 |
* @see org.gvsig.fmap.geom.operation.GeometryOperation#invoke(org.gvsig.fmap.geom.Geometry, org.gvsig.fmap.geom.operation.GeometryOperationContext) |
|
62 |
*/ |
|
63 |
public Object invoke(Geometry geom, GeometryOperationContext ctx) |
|
64 |
throws GeometryOperationException { |
|
65 |
|
|
66 |
Aggregate aggregate = (Aggregate) geom; |
|
67 |
for (int i=0;i<aggregate.getPrimitivesNumber();i++){ |
|
68 |
Geometry prim = aggregate.getPrimitiveAt(i); |
|
69 |
try { |
|
70 |
prim.invokeOperation(CODE, ctx); |
|
71 |
} catch (GeometryOperationNotSupportedException e) { |
|
72 |
throw new GeometryOperationException(e); |
|
73 |
} |
|
74 |
} |
|
75 |
return null; |
|
76 |
} |
|
77 |
|
|
78 |
public static void register() { |
|
79 |
GeometryManager geoMan = GeometryLocator.getGeometryManager(); |
|
80 |
|
|
81 |
CODE = geoMan.getGeometryOperationCode(NAME); |
|
82 |
|
|
83 |
geoMan.registerGeometryOperation(NAME, new AggregateDrawInts(), |
|
84 |
TYPES.AGGREGATE); |
|
85 |
geoMan.registerGeometryOperation(NAME, new AggregateDrawInts(), |
|
86 |
TYPES.MULTIPOINT); |
|
87 |
geoMan.registerGeometryOperation(NAME, new AggregateDrawInts(), |
|
88 |
TYPES.MULTICURVE); |
|
89 |
geoMan.registerGeometryOperation(NAME, new AggregateDrawInts(), |
|
90 |
TYPES.MULTISURFACE); |
|
91 |
geoMan.registerGeometryOperation(NAME, new AggregateDrawInts(), |
|
92 |
TYPES.MULTISOLID); |
|
93 |
|
|
94 |
} |
|
95 |
|
|
96 |
} |
|
0 | 97 |
branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/DrawOperationContext.java | ||
---|---|---|
1 |
package org.gvsig.fmap.geom.operation; |
|
2 |
|
|
3 |
import java.awt.Graphics2D; |
|
4 |
|
|
5 |
import org.gvsig.fmap.dal.feature.Feature; |
|
6 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
7 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
8 |
import org.gvsig.tools.task.Cancellable; |
|
9 |
|
|
10 |
|
|
11 |
public class DrawOperationContext extends GeometryOperationContext{ |
|
12 |
private ISymbol symbol=null; |
|
13 |
private Graphics2D graphics=null; |
|
14 |
private Cancellable cancellable; |
|
15 |
private double dpi; |
|
16 |
private double scale; |
|
17 |
private boolean hasDPI=false; |
|
18 |
private ViewPort viewPort; |
|
19 |
private Feature feature; |
|
20 |
|
|
21 |
public ViewPort getViewPort() { |
|
22 |
return viewPort; |
|
23 |
} |
|
24 |
public void setViewPort(ViewPort viewPort) { |
|
25 |
this.viewPort = viewPort; |
|
26 |
} |
|
27 |
public Graphics2D getGraphics() { |
|
28 |
return graphics; |
|
29 |
} |
|
30 |
public void setGraphics(Graphics2D graphics) { |
|
31 |
this.graphics = graphics; |
|
32 |
} |
|
33 |
public ISymbol getSymbol() { |
|
34 |
return symbol; |
|
35 |
} |
|
36 |
public void setSymbol(ISymbol symbol) { |
|
37 |
this.symbol = symbol; |
|
38 |
} |
|
39 |
public void setCancellable(Cancellable cancel) { |
|
40 |
this.cancellable=cancel; |
|
41 |
|
|
42 |
} |
|
43 |
public Cancellable getCancellable() { |
|
44 |
return cancellable; |
|
45 |
} |
|
46 |
public void setDPI(double dpi) { |
|
47 |
this.hasDPI=true; |
|
48 |
this.dpi=dpi; |
|
49 |
} |
|
50 |
public double getDPI(){ |
|
51 |
return dpi; |
|
52 |
} |
|
53 |
public boolean hasDPI() { |
|
54 |
return hasDPI; |
|
55 |
} |
|
56 |
/** |
|
57 |
* @param scale the scale to set |
|
58 |
*/ |
|
59 |
public void setScale(double scale) { |
|
60 |
this.scale = scale; |
|
61 |
} |
|
62 |
/** |
|
63 |
* @return the scale |
|
64 |
*/ |
|
65 |
public double getScale() { |
|
66 |
return scale; |
|
67 |
} |
|
68 |
public Feature getFeature() { |
|
69 |
return feature; |
|
70 |
} |
|
71 |
public void setFeature(Feature feature) { |
|
72 |
this.feature = feature; |
|
73 |
} |
|
74 |
|
|
75 |
} |
branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/MapContextGeomOperationsLibrary.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 IVER T.I {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
/** |
|
29 |
* |
|
30 |
*/ |
|
31 |
package org.gvsig.fmap.geom.operation; |
|
32 |
|
|
33 |
import org.gvsig.fmap.mapcontext.MapContextLibrary; |
|
34 |
import org.gvsig.tools.library.AbstractLibrary; |
|
35 |
import org.gvsig.tools.library.Library; |
|
36 |
import org.gvsig.tools.library.LibraryException; |
|
37 |
|
|
38 |
/** |
|
39 |
* @author jmvivo |
|
40 |
* |
|
41 |
*/ |
|
42 |
public class MapContextGeomOperationsLibrary extends AbstractLibrary { |
|
43 |
|
|
44 |
public MapContextGeomOperationsLibrary() { |
|
45 |
super(MapContextGeomOperationsLibrary.class, Library.TYPE.IMPL); |
|
46 |
require(MapContextLibrary.class); |
|
47 |
} |
|
48 |
|
|
49 |
protected void doInitialize() throws LibraryException { |
|
50 |
} |
|
51 |
|
|
52 |
protected void doPostInitialize() throws LibraryException { |
|
53 |
// Register Draw Operations |
|
54 |
Draw.register(); |
|
55 |
DrawInts.register(); |
|
56 |
AggregateDrawInts.register(); |
|
57 |
AggregateDraw.register(); |
|
58 |
} |
|
59 |
|
|
60 |
} |
|
0 | 61 |
branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/AggregateDraw.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 IVER T.I {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
/** |
|
29 |
* |
|
30 |
*/ |
|
31 |
package org.gvsig.fmap.geom.operation; |
|
32 |
|
|
33 |
import org.gvsig.fmap.geom.Geometry; |
|
34 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
35 |
import org.gvsig.fmap.geom.GeometryManager; |
|
36 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
|
37 |
import org.gvsig.fmap.geom.aggregate.Aggregate; |
|
38 |
import org.slf4j.Logger; |
|
39 |
import org.slf4j.LoggerFactory; |
|
40 |
|
|
41 |
/** |
|
42 |
* @author Vicente Caballero Navarro |
|
43 |
* |
|
44 |
*/ |
|
45 |
public class AggregateDraw extends GeometryOperation { |
|
46 |
|
|
47 |
public static final String NAME = "draw"; |
|
48 |
public static int CODE = Integer.MIN_VALUE; |
|
49 |
|
|
50 |
final static private Logger logger = LoggerFactory |
|
51 |
.getLogger(AggregateDraw.class); |
|
52 |
|
|
53 |
/* (non-Javadoc) |
|
54 |
* @see org.gvsig.fmap.geom.operation.GeometryOperation#getOperationIndex() |
|
55 |
*/ |
|
56 |
public int getOperationIndex() { |
|
57 |
return CODE; |
|
58 |
} |
|
59 |
|
|
60 |
/* (non-Javadoc) |
|
61 |
* @see org.gvsig.fmap.geom.operation.GeometryOperation#invoke(org.gvsig.fmap.geom.Geometry, org.gvsig.fmap.geom.operation.GeometryOperationContext) |
|
62 |
*/ |
|
63 |
public Object invoke(Geometry geom, GeometryOperationContext ctx) |
|
64 |
throws GeometryOperationException { |
|
65 |
|
|
66 |
Aggregate aggregate = (Aggregate) geom; |
|
67 |
for (int i=0;i<aggregate.getPrimitivesNumber();i++){ |
|
68 |
Geometry prim = aggregate.getPrimitiveAt(i); |
|
69 |
try { |
|
70 |
prim.invokeOperation(CODE, ctx); |
|
71 |
} catch (GeometryOperationNotSupportedException e) { |
|
72 |
throw new GeometryOperationException(e); |
|
73 |
} |
|
74 |
} |
|
75 |
return null; |
|
76 |
} |
|
77 |
|
|
78 |
public static void register() { |
|
79 |
GeometryManager geoMan = GeometryLocator.getGeometryManager(); |
|
80 |
|
|
81 |
CODE = geoMan.getGeometryOperationCode(NAME); |
|
82 |
|
|
83 |
geoMan.registerGeometryOperation(NAME, new AggregateDraw(), |
|
84 |
TYPES.AGGREGATE); |
|
85 |
geoMan.registerGeometryOperation(NAME, new AggregateDraw(), |
|
86 |
TYPES.MULTIPOINT); |
|
87 |
geoMan.registerGeometryOperation(NAME, new AggregateDraw(), |
|
88 |
TYPES.MULTICURVE); |
|
89 |
geoMan.registerGeometryOperation(NAME, new AggregateDraw(), |
|
90 |
TYPES.MULTISURFACE); |
|
91 |
geoMan.registerGeometryOperation(NAME, new AggregateDraw(), |
|
92 |
TYPES.MULTISOLID); |
|
93 |
|
|
94 |
} |
|
95 |
|
|
96 |
} |
branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/DrawInts.java | ||
---|---|---|
1 |
package org.gvsig.fmap.geom.operation; |
|
2 |
|
|
3 |
import java.awt.Graphics2D; |
|
4 |
import java.awt.geom.AffineTransform; |
|
5 |
import java.awt.geom.PathIterator; |
|
6 |
|
|
7 |
import org.gvsig.fmap.geom.Geometry; |
|
8 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
9 |
import org.gvsig.fmap.geom.GeometryManager; |
|
10 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
11 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
12 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
|
13 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
14 |
import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport; |
|
15 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
16 |
import org.gvsig.tools.task.Cancellable; |
|
17 |
import org.slf4j.Logger; |
|
18 |
import org.slf4j.LoggerFactory; |
|
19 |
|
|
20 |
public class DrawInts extends GeometryOperation { |
|
21 |
private static final GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
22 |
public static final String NAME = "drawInts"; |
|
23 |
public static int CODE = Integer.MIN_VALUE; |
|
24 |
|
|
25 |
final static private Logger logger = LoggerFactory.getLogger(DrawInts.class); |
|
26 |
|
|
27 |
public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException{ |
|
28 |
DrawOperationContext doc=(DrawOperationContext)ctx; |
|
29 |
ViewPort viewPort = doc.getViewPort(); |
|
30 |
ISymbol symbol = doc.getSymbol(); |
|
31 |
Graphics2D g=doc.getGraphics(); |
|
32 |
Cancellable cancel=doc.getCancellable(); |
|
33 |
// make the symbol to resize itself with the current rendering context |
|
34 |
try { |
|
35 |
if (doc.hasDPI()){ |
|
36 |
double previousSize = ((CartographicSupport)symbol). |
|
37 |
toCartographicSize(viewPort, doc.getDPI(), geom); |
|
38 |
// draw it as normally |
|
39 |
Geometry decimatedShape = transformToInts(geom, viewPort.getAffineTransform()); |
|
40 |
symbol.draw(g, viewPort.getAffineTransform(), decimatedShape, |
|
41 |
doc.getFeature(), cancel); |
|
42 |
// restore previous size |
|
43 |
((CartographicSupport)symbol).setCartographicSize(previousSize, geom); |
|
44 |
}else{ |
|
45 |
Geometry decimatedShape = transformToInts(geom, viewPort.getAffineTransform()); |
|
46 |
symbol.draw(g, viewPort.getAffineTransform(), decimatedShape, |
|
47 |
doc.getFeature(), cancel); |
|
48 |
} |
|
49 |
} catch (CreateGeometryException e) { |
|
50 |
e.printStackTrace(); |
|
51 |
throw new GeometryOperationException(e); |
|
52 |
} |
|
53 |
|
|
54 |
return null; |
|
55 |
} |
|
56 |
|
|
57 |
public int getOperationIndex() { |
|
58 |
return CODE; |
|
59 |
} |
|
60 |
|
|
61 |
private Geometry transformToInts(Geometry gp, AffineTransform at) throws CreateGeometryException { |
|
62 |
GeneralPathX newGp = new GeneralPathX(); |
|
63 |
double[] theData = new double[6]; |
|
64 |
double[] aux = new double[6]; |
|
65 |
|
|
66 |
// newGp.reset(); |
|
67 |
PathIterator theIterator; |
|
68 |
int theType; |
|
69 |
int numParts = 0; |
|
70 |
|
|
71 |
java.awt.geom.Point2D ptDst = new java.awt.geom.Point2D.Double(); |
|
72 |
java.awt.geom.Point2D ptSrc = new java.awt.geom.Point2D.Double(); |
|
73 |
boolean bFirst = true; |
|
74 |
int xInt, yInt, antX = -1, antY = -1; |
|
75 |
|
|
76 |
|
|
77 |
theIterator = gp.getPathIterator(null); //, flatness); |
|
78 |
int numSegmentsAdded = 0; |
|
79 |
while (!theIterator.isDone()) { |
|
80 |
theType = theIterator.currentSegment(theData); |
|
81 |
|
|
82 |
switch (theType) { |
|
83 |
case PathIterator.SEG_MOVETO: |
|
84 |
numParts++; |
|
85 |
ptSrc.setLocation(theData[0], theData[1]); |
|
86 |
at.transform(ptSrc, ptDst); |
|
87 |
antX = (int) ptDst.getX(); |
|
88 |
antY = (int) ptDst.getY(); |
|
89 |
newGp.moveTo(antX, antY); |
|
90 |
numSegmentsAdded++; |
|
91 |
bFirst = true; |
|
92 |
break; |
|
93 |
|
|
94 |
case PathIterator.SEG_LINETO: |
|
95 |
ptSrc.setLocation(theData[0], theData[1]); |
|
96 |
at.transform(ptSrc, ptDst); |
|
97 |
xInt = (int) ptDst.getX(); |
|
98 |
yInt = (int) ptDst.getY(); |
|
99 |
if ((bFirst) || ((xInt != antX) || (yInt != antY))) |
|
100 |
{ |
|
101 |
newGp.lineTo(xInt, yInt); |
|
102 |
antX = xInt; |
|
103 |
antY = yInt; |
|
104 |
bFirst = false; |
|
105 |
numSegmentsAdded++; |
|
106 |
} |
|
107 |
break; |
|
108 |
|
|
109 |
case PathIterator.SEG_QUADTO: |
|
110 |
at.transform(theData,0,aux,0,2); |
|
111 |
newGp.quadTo(aux[0], aux[1], aux[2], aux[3]); |
|
112 |
numSegmentsAdded++; |
|
113 |
break; |
|
114 |
|
|
115 |
case PathIterator.SEG_CUBICTO: |
|
116 |
at.transform(theData,0,aux,0,3); |
|
117 |
newGp.curveTo(aux[0], aux[1], aux[2], aux[3], aux[4], aux[5]); |
|
118 |
numSegmentsAdded++; |
|
119 |
break; |
|
120 |
|
|
121 |
case PathIterator.SEG_CLOSE: |
|
122 |
if (numSegmentsAdded < 3) { |
|
123 |
newGp.lineTo(antX, antY); |
|
124 |
} |
|
125 |
newGp.closePath(); |
|
126 |
|
|
127 |
break; |
|
128 |
} //end switch |
|
129 |
|
|
130 |
theIterator.next(); |
|
131 |
} //end while loop |
|
132 |
|
|
133 |
Geometry geom = null; |
|
134 |
switch (gp.getType()) { |
|
135 |
case Geometry.TYPES.POINT: |
|
136 |
geom = geomManager.createPoint(ptDst.getX(), ptDst.getY(), SUBTYPES.GEOM2D); |
|
137 |
break; |
|
138 |
case Geometry.TYPES.CURVE: |
|
139 |
case Geometry.TYPES.ARC: |
|
140 |
geom = geomManager.createCurve(newGp, SUBTYPES.GEOM2D); |
|
141 |
break; |
|
142 |
|
|
143 |
case Geometry.TYPES.SURFACE: |
|
144 |
case Geometry.TYPES.CIRCLE: |
|
145 |
case Geometry.TYPES.ELLIPSE: |
|
146 |
|
|
147 |
geom = geomManager.createSurface(newGp, SUBTYPES.GEOM2D); |
|
148 |
break; |
|
149 |
} |
|
150 |
return geom; |
|
151 |
} |
|
152 |
|
|
153 |
public static void register() { |
|
154 |
|
|
155 |
GeometryManager gm = GeometryLocator.getGeometryManager(); |
|
156 |
CODE = gm.getGeometryOperationCode(NAME); |
|
157 |
geomManager.registerGeometryOperation(NAME, new DrawInts()); |
|
158 |
} |
|
159 |
|
|
160 |
|
|
161 |
} |
branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/Draw.java | ||
---|---|---|
1 |
package org.gvsig.fmap.geom.operation; |
|
2 |
|
|
3 |
import java.awt.geom.AffineTransform; |
|
4 |
|
|
5 |
|
|
6 |
import org.gvsig.fmap.geom.Geometry; |
|
7 |
import org.gvsig.fmap.geom.GeometryManager; |
|
8 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
9 |
|
|
10 |
public class Draw extends GeometryOperation{ |
|
11 |
public static final String NAME = "draw"; |
|
12 |
public static int CODE = Integer.MIN_VALUE; |
|
13 |
|
|
14 |
public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException { |
|
15 |
DrawOperationContext doc=(DrawOperationContext)ctx; |
|
16 |
AffineTransform at=doc.getViewPort().getAffineTransform(); |
|
17 |
geom.transform(at); |
|
18 |
doc.getSymbol().draw(doc.getGraphics(), at, geom, doc.getFeature(), |
|
19 |
doc.getCancellable()); |
|
20 |
return null; |
|
21 |
} |
|
22 |
|
|
23 |
public int getOperationIndex() { |
|
24 |
return CODE; |
|
25 |
} |
|
26 |
|
|
27 |
public static void register() { |
|
28 |
|
|
29 |
GeometryManager geoMan = GeometryLocator.getGeometryManager(); |
|
30 |
CODE = geoMan.getGeometryOperationCode(NAME); |
|
31 |
geoMan.registerGeometryOperation(NAME, new Draw()); |
|
32 |
} |
|
33 |
|
|
34 |
} |
branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ExtentHistory.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 org.gvsig.fmap.mapcontext; |
|
42 |
|
|
43 |
import java.awt.geom.Rectangle2D; |
|
44 |
|
|
45 |
import org.gvsig.tools.ToolsLocator; |
|
46 |
import org.gvsig.tools.dynobject.DynStruct; |
|
47 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
48 |
import org.gvsig.tools.persistence.Persistent; |
|
49 |
import org.gvsig.tools.persistence.PersistentState; |
|
50 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
51 |
|
|
52 |
/** |
|
53 |
* <p><code>ExtentHistory</code> is designed for managing a history of extents.</p> |
|
54 |
* |
|
55 |
* <p>Note: An <i>extent</i> is a re.setMandatory(true)ctangular area, with information of its top-left 2D corner.</p> |
|
56 |
* |
|
57 |
* @author Vicente Caballero Navarro |
|
58 |
*/ |
|
59 |
public class ExtentHistory implements Persistent { |
|
60 |
|
|
61 |
/** |
|
62 |
* <p>Maximum number of extents that can store.</p> |
|
63 |
*/ |
|
64 |
private int NUMREC; |
|
65 |
|
|
66 |
/** |
|
67 |
* <p>Array with the extents.</p> |
|
68 |
* |
|
69 |
* @see #hasPrevious() |
|
70 |
* @see #put(Rectangle2D) |
|
71 |
* @see #get() |
|
72 |
* @see #removePrev() |
|
73 |
*/ |
|
74 |
private Rectangle2D[] extents; |
|
75 |
|
|
76 |
/** |
|
77 |
* <p>Number of extents stored.</p> |
|
78 |
* |
|
79 |
* @see #hasPrevious() |
|
80 |
* @see #put(Rectangle2D) |
|
81 |
* @see #get() |
|
82 |
* @see #removePrev() |
|
83 |
*/ |
|
84 |
private int num = 0; |
|
85 |
|
|
86 |
|
|
87 |
/** |
|
88 |
* <p>Creates a new instance of <code>ExtentsHistory</code> with an history of 10 extents.</p> |
|
89 |
*/ |
|
90 |
public ExtentHistory() { |
|
91 |
this(10); |
|
92 |
} |
|
93 |
|
|
94 |
|
|
95 |
/** |
|
96 |
* <p>Creates a new instance of <code>ExtentsHistory</code> with an history of <code>numEntries</code> extents.</p> |
|
97 |
* |
|
98 |
* @param numEntries the maximum number of extents that will store the instance |
|
99 |
*/ |
|
100 |
public ExtentHistory(int numEntries) { |
|
101 |
NUMREC = numEntries; |
|
102 |
extents = new Rectangle2D[NUMREC]; |
|
103 |
} |
|
104 |
|
|
105 |
/** |
|
106 |
* <p>Appends the specified extent to the end of this history.</p> |
|
107 |
* |
|
108 |
* @param ext the new extent |
|
109 |
* |
|
110 |
* @see #get() |
|
111 |
* @see #hasPrevious() |
|
112 |
*/ |
|
113 |
public void put(Rectangle2D ext) { |
|
114 |
if ((ext != null) && ((num < 1) || (ext != extents[num - 1]))) { |
|
115 |
if (num < (NUMREC)) { |
|
116 |
extents[num] = ext; |
|
117 |
num = num + 1; |
|
118 |
} else { |
|
119 |
for (int i = 0; i < (NUMREC - 1); i++) { |
|
120 |
extents[i] = extents[i + 1]; |
|
121 |
} |
|
122 |
|
|
123 |
extents[num - 1] = ext; |
|
124 |
} |
|
125 |
} |
|
126 |
} |
|
127 |
|
|
128 |
/** |
|
129 |
* <p>Returns <code>true</code> if there are extents registered.</p> |
|
130 |
* |
|
131 |
* @return <code>true</code> if there are extents registered; <code>false</code> otherwise |
|
132 |
* |
|
133 |
* @see #put(Rectangle2D) |
|
134 |
* @see #removePrev() |
|
135 |
* @see #get() |
|
136 |
*/ |
|
137 |
public boolean hasPrevious() { |
|
138 |
return num > 0; |
|
139 |
} |
|
140 |
|
|
141 |
/** |
|
142 |
* <p>Returns the last extent in the history.</p> |
|
143 |
* |
|
144 |
* @return the last extent in the history |
|
145 |
* |
|
146 |
* @see #put(Rectangle2D) |
|
147 |
* @see #getXMLEntity() |
|
148 |
*/ |
|
149 |
public Rectangle2D get() { |
|
150 |
if (num <= 0) { |
|
151 |
return null; |
|
152 |
} |
|
153 |
Rectangle2D ext = extents[num - 1]; |
|
154 |
|
|
155 |
return ext; |
|
156 |
} |
|
157 |
|
|
158 |
/** |
|
159 |
* <p>Extracts (removing) the last extent from the history.</p> |
|
160 |
* |
|
161 |
* @return last extent in the history |
|
162 |
* |
|
163 |
* @see #hasPrevious() |
|
164 |
*/ |
|
165 |
public Rectangle2D removePrev() { |
|
166 |
if (num <= 0) { |
|
167 |
return null; |
|
168 |
} |
|
169 |
Rectangle2D ext = extents[--num]; |
|
170 |
return ext; |
|
171 |
} |
|
172 |
|
|
173 |
public void loadFromState(PersistentState state) |
|
174 |
throws PersistenceException { |
|
175 |
|
|
176 |
num = state.getInt("num"); |
|
177 |
NUMREC = state.getInt("numrec"); |
|
178 |
extents = (Rectangle2D[]) state.getArray("extents", Rectangle2D.class); |
|
179 |
} |
|
180 |
|
|
181 |
/** |
|
182 |
* <p> |
|
183 |
* Returns information of this object. All information is stored as |
|
184 |
* properties:<br> |
|
185 |
* </p> |
|
186 |
* <p> |
|
187 |
* <b>Properties:</b> |
|
188 |
* <ul> |
|
189 |
* <li><i>className</i>: name of this class. |
|
190 |
* <li><i>num</i>: number of extents registered. |
|
191 |
* <li><i>numrec</i>: maximum number of extents that can register. |
|
192 |
* <li><i>extents</i>: . |
|
193 |
* </ul> |
|
194 |
* </p> |
|
195 |
* |
|
196 |
*/ |
|
197 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
198 |
|
|
199 |
state.set("num", num); |
|
200 |
state.set("numrec", NUMREC); |
|
201 |
state.set("extents", extents); |
|
202 |
} |
|
203 |
|
|
204 |
|
|
205 |
public static void registerPersistent() { |
|
206 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
207 |
DynStruct definition = manager.addDefinition( |
|
208 |
ExtentHistory.class, |
|
209 |
"ExtentHistory", |
|
210 |
"ExtentHistory Persistence definition", |
|
211 |
null, |
|
212 |
null |
|
213 |
); |
|
214 |
definition.addDynFieldInt("num").setMandatory(true); |
|
215 |
definition.addDynFieldInt("numrec").setMandatory(true); |
|
216 |
definition.addDynFieldArray("extents").setClassOfItems(Rectangle2D.class).setMandatory(true); |
|
217 |
} |
|
218 |
} |
branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IRasterLegend.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 org.gvsig.fmap.mapcontext.rendering.legend; |
|
42 |
|
|
43 |
|
|
44 |
/** |
|
45 |
* Interface of raster legend. |
|
46 |
*/ |
|
47 |
public interface IRasterLegend extends ILegend { |
|
48 |
|
|
49 |
} |
branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorLegend.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 org.gvsig.fmap.mapcontext.rendering.legend; |
|
42 |
|
|
43 |
import java.awt.Graphics2D; |
|
44 |
import java.awt.image.BufferedImage; |
|
45 |
import java.util.Map; |
|
46 |
|
|
47 |
import org.cresques.cts.ICoordTrans; |
|
48 |
import org.gvsig.compat.print.PrintAttributes; |
|
49 |
import org.gvsig.fmap.dal.feature.Feature; |
|
50 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
51 |
import org.gvsig.fmap.mapcontext.MapContextException; |
|
52 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
53 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
54 |
import org.gvsig.tools.task.Cancellable; |
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
/** |
|
59 |
* Interface of a vectorial legend. |
|
60 |
* |
|
61 |
* @author Vicente Caballero Navarro |
|
62 |
*/ |
|
63 |
public interface IVectorLegend extends ILegend, DrawingObservable { |
|
64 |
/** |
|
65 |
* Inserts the DataSource. |
|
66 |
* |
|
67 |
* @param ds DataSource. |
|
68 |
* @throws DataException TODO |
|
69 |
* @throws FieldNotFoundException when the field is not found. |
|
70 |
*/ |
|
71 |
// void setFeatureStore(FeatureStore fs) |
|
72 |
// throws DataException; |
|
73 |
|
|
74 |
/** |
|
75 |
* Returns the symbol to be used to represent the feature in the i-th |
|
76 |
* record in the DataSource |
|
77 |
* @param i, the record index |
|
78 |
* |
|
79 |
* @return ISymbol. |
|
80 |
*/ |
|
81 |
// ISymbol getSymbol(int i) throws ReadException; |
|
82 |
/** |
|
83 |
* Returns a symbol starting from an IFeature. |
|
84 |
* |
|
85 |
* TAKE CARE!! When we are using a feature iterator as a database |
|
86 |
* the only field that will be filled is the fieldID. |
|
87 |
* The rest of fields will be null to reduce the time of creation |
|
88 |
* |
|
89 |
* @param feat IFeature. |
|
90 |
* |
|
91 |
* @return S?mbolo. |
|
92 |
* @throws MapContextException |
|
93 |
*/ |
|
94 |
ISymbol getSymbolByFeature(Feature feat) throws MapContextException; |
|
95 |
|
|
96 |
/** |
|
97 |
* Returns the type of the shape. |
|
98 |
* |
|
99 |
* @return Returns the type of the shapes that the legend is ready to use. |
|
100 |
* |
|
101 |
*/ |
|
102 |
int getShapeType(); |
|
103 |
|
|
104 |
/** |
|
105 |
* Defines the type of the shape. |
|
106 |
* |
|
107 |
* @param shapeType type of the shape. |
|
108 |
*/ |
|
109 |
void setShapeType(int shapeType); |
|
110 |
|
|
111 |
/** |
|
112 |
* Establishes the default symbol of a legend. In a SingleSymbolLegend the symbol |
|
113 |
* is established by calling this method. |
|
114 |
* |
|
115 |
* @param s default symbol. |
|
116 |
*/ |
|
117 |
void setDefaultSymbol(ISymbol s); |
|
118 |
|
|
119 |
/** |
|
120 |
* Returns true or false depending on if the rest of values are used. |
|
121 |
* |
|
122 |
* @return True if the rest of values are used. |
|
123 |
*/ |
|
124 |
public boolean isUseDefaultSymbol(); |
|
125 |
|
|
126 |
void useDefaultSymbol(boolean b); |
|
127 |
|
|
128 |
// jjdc los eliminamos, y debe quedar dependiente de la implementacion y n de api |
|
129 |
// public ZSort getZSort(); |
|
130 |
// |
|
131 |
// public void setZSort(ZSort zSort); |
|
132 |
// |
|
133 |
public boolean isSuitableForShapeType(int shapeType); |
|
134 |
|
|
135 |
/** |
|
136 |
* Draws the {@link FeatureStore} data using this legend simbology. |
|
137 |
* |
|
138 |
* @param image |
|
139 |
* the base image to draw over |
|
140 |
* @param graphics2D |
|
141 |
* the {@link Graphics2D} to draw to |
|
142 |
* @param viewPort |
|
143 |
* the ViewPort to use |
|
144 |
* @param cancel |
|
145 |
* the {@link Cancellable} delegate object |
|
146 |
* @param scale |
|
147 |
* the scale of the view |
|
148 |
* @param queryParameters |
|
149 |
* the query parameters |
|
150 |
* @param coordTrans |
|
151 |
* the transformation coordinates to use for reprojection |
|
152 |
* @param featureStore |
|
153 |
* {@link FeatureStore} to load the data to draw from |
|
154 |
* @throws LegendException |
|
155 |
*/ |
|
156 |
void draw(BufferedImage image, Graphics2D graphics2D, ViewPort viewPort, |
|
157 |
Cancellable cancel, double scale, Map queryParameters, |
|
158 |
ICoordTrans coordTrans, FeatureStore featureStore) |
|
159 |
throws LegendException; |
|
160 |
|
|
161 |
void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, |
|
162 |
double scale, Map queryParameters, ICoordTrans coordTrans, |
|
163 |
FeatureStore featureStore, PrintAttributes properties) throws LegendException; |
|
164 |
|
|
165 |
} |
branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IInterval.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.mapcontext.rendering.legend; |
|
23 |
|
|
24 |
import org.gvsig.tools.lang.Cloneable; |
|
25 |
import org.gvsig.tools.persistence.Persistent; |
|
26 |
|
|
27 |
public interface IInterval extends Persistent, Cloneable { |
|
28 |
|
|
29 |
/** |
|
30 |
* Returns if the given value is included into the interval. |
|
31 |
* |
|
32 |
* @param v |
|
33 |
* value to check. Must be instance of {@link Number} |
|
34 |
* |
|
35 |
* @return if the given value is included into the interval |
|
36 |
*/ |
|
37 |
boolean isInInterval(Object v); |
|
38 |
|
|
39 |
/** |
|
40 |
* Returns the interval minimum included value. |
|
41 |
* |
|
42 |
* @return the minimum value |
|
43 |
*/ |
|
44 |
double getMin(); |
|
45 |
|
|
46 |
/** |
|
47 |
* Returns the interval maximum included value. |
|
48 |
* |
|
49 |
* @return the maximum value |
|
50 |
*/ |
|
51 |
double getMax(); |
|
52 |
|
|
53 |
} |
|
0 | 54 |
branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedLegend.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 org.gvsig.fmap.mapcontext.rendering.legend; |
|
42 |
|
|
43 |
|
|
44 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
45 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
46 |
|
|
47 |
|
|
48 |
/** |
|
49 |
* Information of the legend that allows to be represented graphically to the user |
|
50 |
* |
|
51 |
*/ |
|
52 |
public interface IClassifiedLegend extends ILegend { |
|
53 |
/** |
|
54 |
* Obtains the descriptions of the classes that are in the classification |
|
55 |
* @return DOCUMENT ME! |
|
56 |
*/ |
|
57 |
String[] getDescriptions(); |
|
58 |
|
|
59 |
/** |
|
60 |
* Obtains the symbols of each class of the classification for the user. |
|
61 |
* |
|
62 |
* @return DOCUMENT ME! |
|
63 |
*/ |
|
64 |
ISymbol[] getSymbols(); |
|
65 |
|
|
66 |
/** |
|
67 |
* Obtains the values in relation with each class of the classification |
|
68 |
* |
|
69 |
* @return DOCUMENT ME! |
|
70 |
*/ |
|
71 |
Object[] getValues(); |
|
72 |
} |
|
0 | 73 |
branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ISingleSymbolLegend.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {gvSIG} {{Task}} |
|
26 |
*/ |
|
27 |
package org.gvsig.fmap.mapcontext.rendering.legend; |
|
28 |
|
|
29 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend; |
|
30 |
|
|
31 |
/** |
|
32 |
* Legend based on one single symbol to use while rendering. |
|
33 |
* |
|
34 |
* @author <a href="mailto:cordinyana@gvsig.org">C?sar Ordi?ana</a> |
|
35 |
*/ |
|
36 |
public interface ISingleSymbolLegend extends IVectorLegend { |
|
37 |
|
|
38 |
public static final String LEGEND_NAME = "SingleSymbol"; |
|
39 |
|
|
40 |
ZSort getZSort(); |
|
41 |
|
|
42 |
void setZSort(ZSort zSort); |
|
43 |
|
|
44 |
} |
|
0 | 45 |
branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/DrawingObservable.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.mapcontext.rendering.legend; |
|
23 |
|
|
24 |
import org.gvsig.tools.observer.Observer; |
|
25 |
|
|
26 |
/** |
|
27 |
* Interface for observable drawing operations. |
|
28 |
* |
|
29 |
* @author <a href="mailto:cordinyana@gvsig.org">C?sar Ordi?ana</a> |
|
30 |
*/ |
|
31 |
public interface DrawingObservable { |
|
32 |
|
|
33 |
/** |
|
34 |
* Adds a new {@link Observer}. |
|
35 |
* |
|
36 |
* @param observer |
|
37 |
* the {@link Observer} to add |
|
38 |
*/ |
|
39 |
void addDrawingObserver(Observer observer); |
|
40 |
|
|
41 |
/** |
|
42 |
* Deletes a registered drawing {@link Observer} from the list of registered |
|
43 |
* ones. |
|
44 |
* |
|
45 |
* @param observer |
|
46 |
* to delete from the registered ones |
|
47 |
*/ |
|
48 |
void deleteDrawingObserver(Observer observer); |
|
49 |
|
|
50 |
/** |
|
51 |
* Deletes all the registered drawing {@link Observer} objects. |
|
52 |
*/ |
|
53 |
void deleteDrawingObservers(); |
|
54 |
} |
branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialUniqueValueLegend.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 org.gvsig.fmap.mapcontext.rendering.legend; |
|
42 |
|
|
43 |
|
|
44 |
import java.awt.Color; |
|
45 |
|
|
46 |
import org.gvsig.fmap.mapcontext.MapContextException; |
|
47 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
48 |
|
|
49 |
|
|
50 |
/** |
|
51 |
* Interface for the legend with unique values. |
|
52 |
* |
|
53 |
*/ |
|
54 |
public interface IVectorialUniqueValueLegend extends IClassifiedVectorLegend { |
|
55 |
|
|
56 |
public static final String LEGEND_NAME = "VectorialUniqueValue"; |
|
57 |
|
|
58 |
/** |
|
59 |
* Establishes the symbol for the value which is the argument of the function. |
|
60 |
* |
|
61 |
* @param id index. |
|
62 |
* @param symbol symbol. |
|
63 |
*/ |
|
64 |
void setValueSymbolByID(int id, ISymbol symbol); |
|
65 |
|
|
66 |
|
|
67 |
/** |
|
68 |
* Returns the symbols starting from an ID. It looks in m_ArrayKeys for the |
|
69 |
* element ID and with this key obtains the FSymbol. |
|
70 |
|
|
71 |
* @param key ID. |
|
72 |
* |
|
73 |
* @return symbol associated with the ID |
|
74 |
*/ |
|
75 |
|
|
76 |
// public FSymbol getSymbolByID(int ID); |
|
77 |
|
|
78 |
/** |
|
79 |
* Returns the symbols starting from its key. |
|
80 |
* |
|
81 |
* @param key ID. |
|
82 |
* |
|
83 |
* @return symbol associated with the key. |
|
84 |
* @throws MapContextException |
|
85 |
*/ |
|
86 |
public ISymbol getSymbolByValue(Object key); |
|
87 |
|
|
88 |
/** |
|
89 |
* Returns the key related to a registered {@link ISymbol} or null if it is |
|
90 |
* not registered. |
|
91 |
* |
|
92 |
* @param symbol |
|
93 |
* to look for |
|
94 |
* @return the related key |
|
95 |
*/ |
|
96 |
Object getSymbolKey(ISymbol symbol); |
|
97 |
|
|
98 |
ZSort getZSort(); |
|
99 |
|
|
100 |
void setZSort(ZSort zSort); |
|
101 |
|
|
102 |
Color[] getColorScheme(); |
|
103 |
|
|
104 |
void setColorScheme(Color[] colors); |
|
105 |
|
|
106 |
} |
|
0 | 107 |
branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ILegend.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 org.gvsig.fmap.mapcontext.rendering.legend; |
|
42 |
|
|
43 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener; |
|
44 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent; |
|
45 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
46 |
import org.gvsig.tools.lang.Cloneable; |
|
47 |
import org.gvsig.tools.persistence.Persistent; |
|
48 |
|
|
49 |
/** |
|
50 |
* Information about the legend to be represented in the interface. |
|
51 |
* |
|
52 |
*/ |
|
53 |
public interface ILegend extends Persistent, Cloneable { |
|
54 |
/** |
|
55 |
* Obtains the default symbol of the legend. |
|
56 |
* |
|
57 |
* @return default symbol. |
|
58 |
*/ |
|
59 |
ISymbol getDefaultSymbol(); |
|
60 |
|
|
61 |
/** |
|
62 |
* Clones the legend. |
|
63 |
* |
|
64 |
* @return Cloned legend. |
|
65 |
* |
|
66 |
* @throws XMLException |
|
67 |
*/ |
|
68 |
ILegend cloneLegend(); |
|
69 |
/** |
|
70 |
* Adds a new listener to the legend. |
|
71 |
* |
|
72 |
* @param listener to be added |
|
73 |
*/ |
|
74 |
void addLegendListener(LegendContentsChangedListener listener); |
Also available in: Unified diff