Revision 42346

View differences:

tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/aggregate/MultiCurve.java
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.fmap.geom.aggregate;
25

  
26
import org.gvsig.fmap.geom.primitive.Curve;
27
import org.gvsig.fmap.geom.primitive.OrientableCurve;
28

  
29
/**
30
 * <p>
31
 * This interface is equivalent to the GM_Curve specified in 
32
 * <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>.
33
 * MultiCurve is an aggregate class containing only instances of {@link OrientableCurve}.  
34
 * The association role "element" shall be the set of {@link OrientableCurve}'s contained in 
35
 * this MultiCurve.
36
 * </p>
37
 * @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>
38
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
39
 */
40
public interface MultiCurve extends MultiPrimitive{
41
	
42
	/**
43
	 * Adds a new curve to the  multi curve
44
	 * @param curve
45
	 * The curve to add
46
	 */
47
	void addCurve(Curve curve);
48
	
49
	/**
50
	 * Gets the curve that is on a concrete position
51
	 * inside the multi curve 
52
	 * @param index
53
	 * The position
54
	 * @return
55
	 * The selected curve
56
	 */
57
	Curve getCurveAt(int index);
58
        
59
}
0 60

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/aggregate/MultiLine.java
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6

  
7
package org.gvsig.fmap.geom.aggregate;
8

  
9
import org.gvsig.fmap.geom.GeometryException;
10

  
11
/**
12
 *
13
 * @author jjdelcerro
14
 */
15
public interface MultiLine extends MultiCurve {
16

  
17
}
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/aggregate/MultiPolygon.java
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6

  
7
package org.gvsig.fmap.geom.aggregate;
8

  
9
import org.gvsig.fmap.geom.Geometry;
10
import org.gvsig.fmap.geom.GeometryException;
11

  
12
/**
13
 *
14
 * @author jjdelcerro
15
 */
16
public interface MultiPolygon extends MultiSurface {
17
}
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/aggregate/MultiPrimitive.java
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

  
25
package org.gvsig.fmap.geom.aggregate;
26

  
27
import org.gvsig.fmap.geom.primitive.Primitive;
28

  
29
/**
30
 * <p>
31
 * This interface is equivalent to the GM_MultiPrimitive specified in 
32
 * <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>.
33
 * MultiPrimitive is the root class for all primitive aggregates. 
34
 * The association role "element" shall be the set of {@link Primitive}'s contained 
35
 * in this MultiPrimitive.
36
 * </p>
37
 * @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>
38
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
39
 */
40
public interface MultiPrimitive extends Aggregate {
41

  
42
	/**
43
	 * Adds a new primitive to the primitive
44
	 * @param primitive
45
	 * The primitive to add
46
	 */
47
	void addPrimitive(Primitive primitive);
48
	
49
	public void ensureCapacity(int capacity);
50
}
0 51

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/aggregate/MultiSurface.java
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

  
25
package org.gvsig.fmap.geom.aggregate;
26

  
27
import org.gvsig.fmap.geom.primitive.OrientableSurface;
28
import org.gvsig.fmap.geom.primitive.Surface;
29

  
30
/**
31
 * <p>
32
 * This interface is equivalent to the GM_MultiSurface specified in 
33
 * <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>.
34
 * MultiSurface is an aggregate class containing only instances of {@link OrientableSurface}. 
35
 * The association role "element" shall be the set of {@link OrientableSurface}'s 
36
 * contained in this GMultiSurface.
37
 * </p>
38
 * @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>
39
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
40
 */
41
public interface MultiSurface extends MultiPrimitive{
42
	
43
	/**
44
	 * Adds a new surface to the  multi surface
45
	 * @param surface
46
	 * The surface to add
47
	 */
48
	void addSurface(Surface surface);
49
	
50
	/**
51
	 * Gets the surface that is on a concrete position
52
	 * inside the multi surface 
53
	 * @param index
54
	 * The position
55
	 * @return
56
	 * The selected surface
57
	 */
58
	Surface getSurfaceAt(int index);
59
}
0 60

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/aggregate/MultiPoint.java
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

  
25
package org.gvsig.fmap.geom.aggregate;
26

  
27
import org.gvsig.fmap.geom.primitive.Curve;
28
import org.gvsig.fmap.geom.primitive.Point;
29
import org.gvsig.fmap.geom.primitive.Surface;
30

  
31
/**
32
 * <p>
33
 * This interface is equivalent to the GM_MultiPoint specified in 
34
 * <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>.
35
 * MultiPoint is an aggregate class containing only points. 
36
 * The association role "element" shall be the set of {@link Point}'s contained in 
37
 * this MultiPoint.
38
 * </p>
39
 * @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>
40
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
41
 */
42
public interface MultiPoint extends MultiPrimitive {
43
	
44
	/**
45
	 * Adds a new point to the multipoint
46
	 * @param point
47
	 * The point to add
48
	 */
49
	void addPoint(Point point);
50
	
51
	/**
52
	 * Gets the point that is on a concrete position
53
	 * inside the multi point 
54
	 * @param index
55
	 * The position
56
	 * @return
57
	 * The selected point
58
	 */
59
	Point getPointAt(int index);
60
}
0 61

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/aggregate/MultiSolid.java
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

  
25
package org.gvsig.fmap.geom.aggregate;
26

  
27
import org.gvsig.fmap.geom.primitive.Solid;
28

  
29
/**
30
 * <p>
31
 * This interface is equivalent to the GM_MultiSolid specified in 
32
 * <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>.
33
 * MultiSolid is an aggregate class containing only solids. The association role "element" 
34
 * shall be the set of {@link Solid}'s contained in this MultiSolid.
35
 * </p>
36
 * @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>
37
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
38
 */
39
public interface MultiSolid extends MultiPrimitive{
40
	
41
	/**
42
	 * Adds a new solid to the  multi solid
43
	 * @param solid
44
	 * The solid to add
45
	 */
46
	void addSolid(Solid solid);
47
	
48
	/**
49
	 * Gets the solid that is on a concrete position
50
	 * inside the multi solid 
51
	 * @param index
52
	 * The position
53
	 * @return
54
	 * The selected solid
55
	 */
56
	Solid getSolidAt(int index);
57
}
0 58

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/aggregate/Aggregate.java
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

  
25
package org.gvsig.fmap.geom.aggregate;
26

  
27
import org.gvsig.fmap.geom.Geometry;
28
import org.gvsig.fmap.geom.operation.GeometryOperationException;
29
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
30
import org.gvsig.fmap.geom.primitive.Curve;
31
import org.gvsig.fmap.geom.primitive.Primitive;
32

  
33
/**
34
 * <p>
35
 * This interface is equivalent to the GM_Aggregate specified in 
36
 * <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>.
37
 * The aggregates gather geometric objects. Since they will often use orientation 
38
 * modification, the curve reference and surface references do not go directly to 
39
 * the {@link Curve} and {@link Surface}, but are directed to {@link OrientableCurve} 
40
 * and {@link OrientableSurface}.
41
 * </p>
42
 * <p>
43
 * Most geometric objects are contained in features, and cannot be held in 
44
 * collections that are strong aggregations. For this reason, the collections 
45
 * described on this package are all weak aggregations, and shall use 
46
 * references to include geometric objects. 
47
 * </p> 
48
 * @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO 19107</a>
49
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
50
 */
51
public interface Aggregate extends Geometry{	
52
	
53
	/**
54
	 * Returns the number of {@link Primitive}'s that composes
55
	 * this multi geometry.
56
	 * @return the number of {@link Primitive}'s that composes
57
	 * this multi geometry.
58
	 */
59
	public int getPrimitivesNumber();
60
			
61
	/**
62
	 * Returns one of the {@link Primitive}'s that is in
63
	 * a concrete position.
64
	 * @param i
65
	 * Geometry position.
66
	 * @return
67
	 * A simple geometry.
68
	 */
69
	public Primitive getPrimitiveAt(int i);
70
        
71
                
72
        /**
73
         * Returns a Primitive that is the union of all the geometries of the Aggregate.
74
         * 
75
         * @return the union of all aggregteds
76
         * 
77
         */
78
        Geometry union() throws GeometryOperationException, GeometryOperationNotSupportedException;
79
        
80
        /**
81
         * Returns a Primitive that is the intersection of all the geometries of the Aggregate.
82
         * 
83
         * @return the union of all aggregteds
84
         * 
85
         */
86
        Geometry intersection() throws GeometryOperationException, GeometryOperationNotSupportedException;
87
	
88
}
0 89

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/GeometryException.java
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.fmap.geom;
25

  
26
import org.gvsig.tools.exception.BaseException;
27

  
28
/**
29
 * Parent exception for the geometry library.
30
 * 
31
 * @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team
32
 */
33
public class GeometryException extends BaseException {
34

  
35
	private static final long serialVersionUID = -8382242322162454758L;
36

  
37
	/**
38
	 * @see BaseException#BaseException(String, String, long).
39
	 */
40
	protected GeometryException(String message, String key, long code) {
41
		super(message, key, code);
42
	}
43

  
44
	/**
45
	 * @see BaseException#BaseException(String, Throwable, String, long)
46
	 */
47
	protected GeometryException(String message, Throwable cause, String key,
48
			long code) {
49
		super(message, cause, key, code);
50
	}
51
	
52
	public GeometryException(Throwable cause) {
53
		super(
54
			"Error managing geometries", 
55
			cause, 
56
			"_Error_managing_geometries", 
57
			serialVersionUID
58
		);
59
	}
60
}
0 61

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/SpatialIndexFactory.java
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

  
25
package org.gvsig.fmap.geom;
26

  
27
import org.gvsig.tools.dynobject.DynObject;
28
import org.gvsig.tools.service.Service;
29
import org.gvsig.tools.service.ServiceException;
30
import org.gvsig.tools.service.spi.ServiceFactory;
31
import org.gvsig.tools.service.spi.ServiceManager;
32

  
33

  
34
public interface SpatialIndexFactory extends ServiceFactory {
35

  
36
    public String getName();
37
    
38
    Service create(DynObject parameters, ServiceManager serviceManager)
39
			throws ServiceException;
40
    
41
    public DynObject createParameters();
42
    
43
    public boolean isNearestQuerySupported();
44

  
45
    public boolean canUseToleranzeInNearestQuery();
46
    
47
    public boolean canLimitResults();
48
    
49
    public int getDataTypeSupported();
50
    
51
    public boolean isInMemory();
52
    
53
    public boolean allowNullData();
54
}
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/exception/ReprojectionRuntimeException.java
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.fmap.geom.exception;
25

  
26
import java.awt.geom.Point2D;
27

  
28
import org.cresques.cts.IProjection;
29

  
30

  
31
/**
32
 * 
33
 * This exception is thrown when the reprojection library is unable to
34
 * reproject and we need to notify that there was a problem
35
 * (so far, the reproject method in Geometry API does not
36
 * throw a standard exception)
37
 * 
38
 * @author jldominguez
39
 *
40
 */
41
public class ReprojectionRuntimeException extends RuntimeException {
42
    
43
    public ReprojectionRuntimeException(
44
        IProjection from_p, IProjection to_p,
45
        Point2D from_point, Throwable cause) {
46
        
47
        super("Error while reprojecting point " + from_point.toString()
48
            + " (" + from_p.getAbrev() + " to " + to_p.getAbrev() + ")",
49
            cause);
50
    }
51

  
52
}
0 53

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/exception/CreateGeometryException.java
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
 
25
package org.gvsig.fmap.geom.exception;
26

  
27
import org.gvsig.fmap.geom.Geometry;
28
import org.gvsig.fmap.geom.GeometryException;
29

  
30
/**
31
 * Exception thrown when there is an error creating a new {@link Geometry}.
32
 * 
33
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
34
 */
35
public class CreateGeometryException extends GeometryException {
36
	private static final long serialVersionUID = -9092927920296656571L;
37
	private final static String MESSAGE_FORMAT = "Exception creating the geometry with " +
38
			"type '%(type)' and subType '%(subType)'.";
39
	private final static String MESSAGE_KEY = "_CreateGeometryException";
40
	
41
	public CreateGeometryException(int type, int subType, Throwable cause){
42
		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
43
		setValue("type", new Integer(type));
44
		setValue("subType", new Integer(subType));
45
	}
46
	
47
}
0 48

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/exception/CreateEnvelopeException.java
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
 
25
package org.gvsig.fmap.geom.exception;
26

  
27
import org.gvsig.tools.exception.BaseException;
28

  
29
/**
30
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
31
 */
32
public class CreateEnvelopeException extends BaseException{
33
	private static final long serialVersionUID = -8080549653325427654L;
34
	private final static String MESSAGE_FORMAT = "Exception creating the envelope with " +
35
			"subType '%(subType)'.";
36
	private final static String MESSAGE_KEY = "_CreateEnvelopeException";
37
	
38
	public CreateEnvelopeException(int subType, Throwable cause){
39
		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
40
		setValue("subType", new Integer(subType));
41
	}
42
}
43

  
0 44

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/GeometryLocator.java
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
 
25
package org.gvsig.fmap.geom;
26

  
27
import org.gvsig.tools.locator.AbstractLocator;
28
import org.gvsig.tools.locator.Locator;
29
import org.gvsig.tools.locator.LocatorException;
30

  
31
/**
32
 * This Locator provides the entry point for the gvSIG 
33
 * {@link GeometryManager}. 
34
 * @see {@link Locator}
35
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
36
 */
37
public class GeometryLocator extends AbstractLocator {
38

  
39
	private static final String LOCATOR_NAME = "GeometryLocator";
40
	
41
	/**
42
	 * GeometryManager name used by the locator to access the instance
43
	 */
44
	public static final String GEOMETRY_MANAGER_NAME = "GeometryManager";
45
	
46
	private static final String GEOMETRY_MANAGER_DESCRIPTION = "GeometryManager of gvSIG";
47
	
48
	/**
49
	 * Unique instance.
50
	 */
51
	private static final GeometryLocator instance = new GeometryLocator();
52

  
53
	/**
54
	 * Return the singleton instance.
55
	 *
56
	 * @return the singleton instance
57
	 */
58
	public static GeometryLocator getInstance() {
59
		return instance;
60
	}
61
	
62
	/* (non-Javadoc)
63
	 * @see org.gvsig.tools.locator.Locator#getLocatorName()
64
	 */
65
	public String getLocatorName() {
66
		return LOCATOR_NAME;
67
	}
68
	
69
	/**
70
	 * Return a reference to {@link GeometryManager}.
71
	 *
72
	 * @return a reference to GeometryManager
73
	 * @throws LocatorException
74
	 *             if there is no access to the class or the class cannot be
75
	 *             instantiated
76
	 * @see Locator#get(String)
77
	 */
78
	public static GeometryManager getGeometryManager() throws LocatorException {
79
		return (GeometryManager) getInstance().get(GEOMETRY_MANAGER_NAME);
80
	}
81
	
82
	/**
83
	 * Registers the Class implementing the {@link GeometryManager} interface.
84
	 *
85
	 * @param clazz
86
	 *            implementing the GeometryManager interface
87
	 */
88
	public static void registerGeometryManager(Class clazz) {
89
		getInstance().register(GEOMETRY_MANAGER_NAME, GEOMETRY_MANAGER_DESCRIPTION,
90
				clazz);
91
	}
92
}
93

  
0 94

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/GeometryLibrary.java
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

  
25
package org.gvsig.fmap.geom;
26

  
27
import org.cresques.ProjectionLibrary;
28

  
29
import org.gvsig.fmap.geom.primitive.Envelope;
30
import org.gvsig.tools.ToolsLibrary;
31
import org.gvsig.tools.ToolsLocator;
32
import org.gvsig.tools.dataTypes.DataTypesManager;
33
import org.gvsig.tools.library.AbstractLibrary;
34
import org.gvsig.tools.library.LibraryException;
35
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
36

  
37
/**
38
 * Registers the default implementation for {@link GeometryManager}.
39
 *
40
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
41
 */
42
public class GeometryLibrary extends AbstractLibrary {
43

  
44
    public void doRegistration() {
45
        registerAsAPI(GeometryLibrary.class);
46
        require(ToolsLibrary.class);
47
        require(ProjectionLibrary.class);
48
    }
49

  
50
    protected void doInitialize() throws LibraryException {
51
        // Validate there is any implementation registered.
52
        if(! GeometryLocator.getInstance().exists(GeometryLocator.GEOMETRY_MANAGER_NAME)) {
53
            throw new ReferenceNotRegisteredException(
54
                GeometryLocator.GEOMETRY_MANAGER_NAME,
55
                GeometryLocator.getInstance());
56
        }
57
    }
58

  
59
    protected void doPostInitialize() throws LibraryException {
60
        DataTypesManager dataTypesManager = ToolsLocator.getDataTypesManager();
61
        dataTypesManager.addtype(DataTypes.GEOMETRY, "Geometry", "Geometry",
62
            Geometry.class, null);
63
        dataTypesManager.addtype(DataTypes.ENVELOPE, "Envelope", "Envelope",
64
            Envelope.class, null);
65

  
66
    }
67
}
0 68

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/operation/GeometryOperationException.java
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.fmap.geom.operation;
25

  
26
import java.util.HashMap;
27
import java.util.Map;
28

  
29
import org.gvsig.tools.exception.BaseException;
30

  
31
/**
32
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
33
 */
34
public class GeometryOperationException extends BaseException {
35

  
36
	/**
37
	 * Generated serial version UID
38
	 */
39
	private static final long serialVersionUID = 8230919748601156772L;
40
	private static final String MESSAGE_KEY = "geometry_operation_exception";
41
	private static final String FORMAT_STRING =
42
		"Exception executing the operation with code %(operationCode) for the geometry with type %(geometryType).";
43

  
44
	private int geometryType = -1;
45
	private int operationCode = -1;
46

  
47
	/**
48
	 * Constructor with some context data for cases in which the root cause of
49
	 * <code>this</code> is internal (usually an unsatisfied logic rule).
50
	 * @param geometryType
51
	 * @param operationCode
52
	 */
53
	public GeometryOperationException(int geometryType, int operationCode){
54
		this(geometryType, operationCode, null);
55
	}
56

  
57
	/**
58
	 * Constructor to use when <code>this</code> is caused by another Exception
59
	 * but there is not further context data available.
60
	 * @param e
61
	 */
62
	public GeometryOperationException(Exception e) {
63
		this(-1, -1, e);
64
	}
65

  
66
	/**
67
	 * Main constructor that provides both context data and a cause Exception
68
	 * @param geometryType
69
	 * @param operationCode
70
	 * @param exp
71
	 */
72
	public GeometryOperationException(int geometryType, int operationCode, Exception e) {
73
		super(FORMAT_STRING, e, MESSAGE_KEY, serialVersionUID);
74

  
75
		this.geometryType = geometryType;
76
		this.operationCode = operationCode;
77
	}
78

  
79
	protected Map values() {
80
		HashMap map = new HashMap();
81
		map.put("geometryType", String.valueOf(geometryType));
82
		map.put("operationCode", String.valueOf(operationCode));
83
		return map;
84
	}
85
}
86

  
0 87

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/operation/GeometryOperation.java
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.fmap.geom.operation;
25

  
26
import org.gvsig.fmap.geom.Geometry;
27
import org.gvsig.fmap.geom.GeometryLocator;
28

  
29
/**
30
 * Every geometry operation that is registered dynamically must extend this class.<br>
31
 *
32
 * The following example shows how to implement and register a custom operation:
33
 *  
34
 * <pre>
35
 * public class MyOperation extends GeometryOperation {
36
 * 
37
 *   // Check GeometryManager for alternative methods to register an operation  
38
 *   public static final int CODE = 
39
 *     GeometryManager.getInstance()
40
 *        .registerGeometryOperation("MyOperation", new MyOperation(), geomType);
41
 *   
42
 *   public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException {
43
 *        // Operation logic goes here
44
 *   }     
45
 *   
46
 *   public int getOperationIndex() {
47
 *      return CODE;
48
 *   }
49
 *   
50
 * }
51
 * </pre>
52
 *
53
 * @author jiyarza
54
 *
55
 */
56
public abstract class GeometryOperation {
57
	
58
	
59
	// Constants for well-known operations to avoid dependency between geometry model and
60
	// operations.
61
	public static final String OPERATION_INTERSECTS_NAME = "intersects";
62
	public static final String OPERATION_CONTAINS_NAME = "contains";
63
	
64
	public static int OPERATION_INTERSECTS_CODE = Integer.MIN_VALUE;
65
	public static int OPERATION_CONTAINS_CODE = Integer.MIN_VALUE;
66

  
67
	
68
	
69
	
70
	/**
71
	 * Invokes this operation given the geometry and context 
72
	 * @param geom Geometry to which apply this operation
73
	 * @param ctx Parameter container
74
	 * @return Place-holder object that may contain any specific return value. 
75
	 * @throws GeometryOperationException The implementation is responsible to throw this exception when needed.
76
	 */
77
	public abstract Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException;
78

  
79
	/**
80
	 * Returns the constant value that identifies this operation and that was obtained upon registering it. 
81
	 * @return operation unique index 
82
	 */
83
	public abstract int getOperationIndex();
84
}
0 85

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/operation/GeometryOperationContext.java
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.fmap.geom.operation;
25

  
26
import java.util.HashMap;
27
import java.util.Map;
28

  
29
/**
30
 * This class is a default parameter container for geometry operation.<br>
31
 * 
32
 * Normally every GeometryOperation will extend this class and identify
33
 * its parameters publicly with getters/setters
34
 *
35
 * For those operations that need high performance, parameters should be declared as class 
36
 * members instead of using the setAttribute/getAttribute mechanism. This way you avoid a hash
37
 * and a cast operation.
38
 * 
39
 * @author jyarza
40
 *
41
 */
42
public class GeometryOperationContext {
43
	
44
	private Map ctx = new HashMap();
45
	
46
	/**
47
	 * Returns an attribute given its name.
48
	 * If it does not exist returns <code>null</code>
49
	 * @param name
50
	 * @return attribute
51
	 */
52
	public Object getAttribute(String name) {
53
		return ctx.get(name.toLowerCase());
54
	}
55
	
56
	/**
57
	 * Sets an attribute
58
	 * @param name
59
	 * @param value
60
	 */
61
	public GeometryOperationContext setAttribute(String name, Object value) {
62
		ctx.put(name.toLowerCase(), value);
63
		return this;
64
	}
65

  
66
}
0 67

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/operation/GeometryOperationNotSupportedException.java
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.fmap.geom.operation;
25

  
26
import java.util.HashMap;
27
import java.util.Map;
28

  
29
import org.gvsig.fmap.geom.type.GeometryType;
30
import org.gvsig.tools.exception.BaseException;
31

  
32
public class GeometryOperationNotSupportedException extends BaseException {
33

  
34
	/**
35
	 * Generated UID
36
	 */
37
	private static final long serialVersionUID = -8394502194572892834L;
38

  
39
	/**
40
	 * Constants specific to this BaseException subclass
41
	 */
42
	private static final String MESSAGE_KEY = "Operation_opCode_is_not_registered_for_geomTypeName_type";
43
	private static final String FORMAT_STRING = "Operation %(opCode)s is not registered for '%(geomTypeName)s' type.";
44
	
45
	private String geomTypeName = null;
46
	private int opCode = -1;
47
	
48
	/**
49
	 * Constructor with the operation code of a common operation.
50
	 * @param opCode
51
	 */	
52
	public GeometryOperationNotSupportedException(int opCode) {
53
		this(opCode, null);
54
	}
55
	
56
	/**
57
	 * Constructor with the operation code related to a geometry type
58
	 * @param opCode
59
	 * @param geomType
60
	 */
61
	public GeometryOperationNotSupportedException(int opCode, GeometryType geomType) {
62
		this(opCode, geomType, null);
63
	}
64

  
65
	/**
66
	 * Constructor to use when <code>this</code> is caused by another Exception 
67
	 * but there is not further context data available.
68
	 * @param e
69
	 */
70
	public GeometryOperationNotSupportedException(Exception e) {
71
		this(-1, null, e);
72
	}
73
	
74
	/**
75
	 * Main constructor
76
	 * @param opCode
77
	 * @param geomType
78
	 * @param e
79
	 */
80
	public GeometryOperationNotSupportedException(int opCode, GeometryType geomType, Exception e) {
81
		messageKey = MESSAGE_KEY;
82
		formatString = FORMAT_STRING;
83
		code = serialVersionUID;
84

  
85
		if (e != null) {
86
			initCause(e);
87
		}
88
		if (geomType != null) {
89
			geomTypeName = geomType.getName();
90
		} else {
91
			geomTypeName = "ANY";
92
		}
93
		this.opCode = opCode;
94
	}
95
		
96
	protected Map values() {
97
		HashMap map = new HashMap();
98
		map.put("opCode", Integer.toString(opCode));
99
		map.put("geomTypeName", geomTypeName);
100
		return map;
101
	}
102
	
103
}
0 104

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/SpatialIndex.java
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.fmap.geom;
25

  
26
import java.util.Iterator;
27
import java.util.List;
28

  
29
import org.gvsig.fmap.geom.primitive.Envelope;
30
import org.gvsig.tools.service.Service;
31
import org.gvsig.tools.visitor.Visitor;
32

  
33
public 	interface SpatialIndex extends Service {
34
    
35
        public SpatialIndexFactory getFactory();
36
        
37
        public void open();
38
        public void close();
39
    
40
	public void query(Envelope envelope, Visitor visitor);
41
	public void query(Geometry geom, Visitor visitor);
42
        
43
	public Iterator query(Envelope envelope, long limit);
44
	public Iterator query(Envelope envelope);
45
	public Iterator query(Geometry geom, long limit);
46
	public Iterator query(Geometry geom);
47

  
48
       	public Iterator queryNearest(Envelope envelope, long limit);
49
        public Iterator queryNearest(Envelope envelope);
50
	public Iterator queryNearest(Geometry geom, long limit);
51
	public Iterator queryNearest(Geometry geom);
52

  
53
        public Iterator queryAll();
54
	
55
        public List queryAsList(Envelope envelope);
56
	public List queryAsList(Geometry geom);
57
	public List queryAllAsList();
58
	
59
	public void insert(Envelope envelope, Object data);
60
	public void insert(Geometry geom, Object data);
61
        public void insert(Geometry geom);
62

  
63
	public boolean remove(Envelope envelope, Object data);
64
	public boolean remove(Geometry geom, Object data);
65
        public boolean remove(Geometry geom);
66

  
67
        public void removeAll();
68

  
69
        public long size();
70
        
71
        public void flush();
72
}
0 73

  
tags/org.gvsig.desktop-2.0.103/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/GeometryManager.java
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.fmap.geom;
25

  
26
import java.awt.geom.PathIterator;
27
import java.util.List;
28

  
29
import org.gvsig.fmap.geom.aggregate.MultiCurve;
30
import org.gvsig.fmap.geom.aggregate.MultiLine;
31
import org.gvsig.fmap.geom.aggregate.MultiPoint;
32
import org.gvsig.fmap.geom.aggregate.MultiPolygon;
33
import org.gvsig.fmap.geom.aggregate.MultiPrimitive;
34
import org.gvsig.fmap.geom.aggregate.MultiSurface;
35
import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
36
import org.gvsig.fmap.geom.exception.CreateGeometryException;
37
import org.gvsig.fmap.geom.operation.GeometryOperation;
38
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
39
import org.gvsig.fmap.geom.operation.GeometryOperationException;
40
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff