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