svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.symbology / org.gvsig.symbology.lib / org.gvsig.symbology.lib.impl / src / main / java / org / gvsig / symbology / fmap / mapcontext / rendering / legend / strategies / MemoryShapeInfo.java @ 40560
History | View | Annotate | Download (3.05 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
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 3
|
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 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.symbology.fmap.mapcontext.rendering.legend.strategies; |
25 |
|
26 |
import java.awt.geom.Rectangle2D; |
27 |
import java.util.ArrayList; |
28 |
import java.util.List; |
29 |
|
30 |
|
31 |
|
32 |
/**
|
33 |
* Estructura de datos con la informaci?n relativa a las geometr?as de una
|
34 |
* fuente de datos necesaria para acelerar el procesado de la capa en memoria.
|
35 |
*
|
36 |
* @author Vicente Caballero Navarro
|
37 |
*/
|
38 |
public class MemoryShapeInfo implements ShapeInfo { |
39 |
List<Info> infos = new ArrayList<Info>(); |
40 |
|
41 |
/**
|
42 |
* @see org.gvsig.symbology.fmap.mapcontext.rendering.legend.strategies.ShapeInfo#addShapeInfo(java.awt.geom.Rectangle2D,
|
43 |
* int)
|
44 |
*/
|
45 |
public void addShapeInfo(Rectangle2D boundingBox, int type) { |
46 |
infos.add(new Info(boundingBox, type));
|
47 |
} |
48 |
|
49 |
/**
|
50 |
* @see org.gvsig.symbology.fmap.mapcontext.rendering.legend.strategies.ShapeInfo#addShapeInfo(int,
|
51 |
* java.awt.geom.Rectangle2D, int)
|
52 |
*/
|
53 |
public void setShapeInfo(int index, Rectangle2D boundingBox, int type) |
54 |
throws ArrayIndexOutOfBoundsException { |
55 |
infos.set(index, new Info(boundingBox, type));
|
56 |
} |
57 |
|
58 |
/**
|
59 |
* @see org.gvsig.symbology.fmap.mapcontext.rendering.legend.strategies.ShapeInfo#getBoundingBox(int)
|
60 |
*/
|
61 |
public Rectangle2D getBoundingBox(int index) { |
62 |
return ((Info) infos.get(index)).getRect();
|
63 |
} |
64 |
|
65 |
/**
|
66 |
* @see org.gvsig.symbology.fmap.mapcontext.rendering.legend.strategies.ShapeInfo#getType(int)
|
67 |
*/
|
68 |
public int getType(int index) { |
69 |
return ((Info) infos.get(index)).getType();
|
70 |
} |
71 |
|
72 |
/**
|
73 |
* Clase con el rect?ngulo y el tipo de shape.
|
74 |
*
|
75 |
* @author Vicente Caballero Navarro
|
76 |
*/
|
77 |
class Info { |
78 |
private Rectangle2D rect; |
79 |
private int type; |
80 |
|
81 |
/**
|
82 |
* Crea un nuevo Info.
|
83 |
*
|
84 |
* @param rect Extent del shape.
|
85 |
* @param type Tipo de shape.
|
86 |
*/
|
87 |
public Info(Rectangle2D rect, int type) { |
88 |
this.rect = rect;
|
89 |
this.type = type;
|
90 |
} |
91 |
|
92 |
/**
|
93 |
* Devuelve el extent del shape.
|
94 |
*
|
95 |
* @return Extent del shape.
|
96 |
*/
|
97 |
public Rectangle2D getRect() { |
98 |
return rect;
|
99 |
} |
100 |
|
101 |
/**
|
102 |
* Devuelve el tipo de shape.
|
103 |
*
|
104 |
* @return Tipo de shape.
|
105 |
*/
|
106 |
public int getType() { |
107 |
return type;
|
108 |
} |
109 |
} |
110 |
} |