Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.geometry / org.gvsig.fmap.geometry.api / src / main / java / org / gvsig / fmap / geom / Geometry.java @ 43002

History | View | Annotate | Download (27.5 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

    
25
package org.gvsig.fmap.geom;
26

    
27
import java.awt.Shape;
28
import java.awt.geom.AffineTransform;
29
import java.awt.geom.PathIterator;
30
import java.awt.geom.Rectangle2D;
31
import java.io.Serializable;
32

    
33
import org.cresques.cts.ICoordTrans;
34

    
35
import org.gvsig.fmap.geom.aggregate.MultiLine;
36
import org.gvsig.fmap.geom.aggregate.MultiPoint;
37
import org.gvsig.fmap.geom.aggregate.MultiPolygon;
38
import org.gvsig.fmap.geom.handler.Handler;
39
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
40
import org.gvsig.fmap.geom.operation.GeometryOperationException;
41
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
42
import org.gvsig.fmap.geom.primitive.Envelope;
43
import org.gvsig.fmap.geom.primitive.GeneralPathX;
44
import org.gvsig.fmap.geom.primitive.Point;
45
import org.gvsig.fmap.geom.type.GeometryType;
46

    
47
/**
48
 * <p>
49
 * This interface is equivalent to the GM_Object specified in <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012"
50
 * >ISO 19107</a>. It is the root class of the geometric object taxonomy and
51
 * supports interfaces common to all geographically referenced geometric
52
 * objects.
53
 * </p>
54
 * <p>
55
 * Geometry instances are sets of direct positions in a particular coordinate
56
 * reference system. A Geometry can be regarded as an infinite set of points
57
 * that satisfies the set operation interfaces for a set of direct positions.
58
 * </p>
59
 * <p>
60
 * A geometric object shall be a combination of a coordinate geometry and a
61
 * coordinate reference system. In all of the operations, all geometric
62
 * calculations shall be done in the coordinate reference system of the first
63
 * geometric object accessed, which is normally the object whose operation is
64
 * being invoked. Returned objects shall be in the coordinate reference system
65
 * in which the calculations are done unless explicitly stated otherwise.
66
 * </p>
67
 * <p>
68
 * This class extends of the {@link Shape} class by historical reasons but this
69
 * inheritance will disappear in future versions.
70
 * </p>
71
 * @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012"
72
 *      >ISO 19107< /a>
73
 */
74
public interface Geometry extends Shape, Serializable, Comparable {
75

    
76
        /**
77
         * Predefined geometry types in the model.
78
         */
79
        public interface TYPES {
80

    
81
                /**
82
                 * Any geometry.
83
                 */
84

    
85
                public final static int GEOMETRY = 0;
86

    
87
                /**
88
                 * A geometric element that has zero dimensions and a location
89
                 * determinable by an ordered set of coordinates.
90
                 */
91
                public final static int POINT = 1;
92

    
93
                /**
94
                 * A straight or curved geometric element that is generated by a moving
95
                 * point and that has extension only along the path of the point.
96
                 */
97
                public final static int CURVE = 2;
98

    
99
                /**
100
                 * A closed plane figure bounded by straight lines.
101
                 */
102
                public final static int SURFACE = 3;
103

    
104
                /**
105
                 * Solids in 3D.
106
                 */
107
                public final static int SOLID = 4;
108

    
109
              /**
110
                 * A set that can contain points, lines and polygons. This is usual in
111
                 * <i>CAD</i> layers <i>(dxf, dgn, dwg)</i>.
112
                 */
113
                public final static int AGGREGATE = 6;
114
                /**
115
                 * A set of points.
116
                 */
117
                public final static int MULTIPOINT = 7;
118

    
119
                /**
120
                 * A set of lines.
121
                 */
122
                public final static int MULTICURVE = 8;
123

    
124
                /**
125
                 * A set of polygons.
126
                 */
127
                public final static int MULTISURFACE = 9;
128

    
129
                /**
130
                 * A set of solids.
131
                 */
132
                public final static int MULTISOLID = 10;
133

    
134
                /**
135
                 * A closed plane curve every point of which is equidistant from a fixed
136
                 * point within the curve.
137
                 */
138
                public final static int CIRCLE = 11;
139

    
140
                /**
141
                 * A continuous portion (as of a circle or ellipse) of a curved line.
142
                 */
143
                public final static int ARC = 12;
144

    
145
                /**
146
                 * A closed plane curve generated by a point moving in such a way that
147
                 * the sums of its distances from two fixed points is a constant : a
148
                 * plane section of a right circular cone that is a closed curve.
149
                 */
150
                public final static int ELLIPSE = 13;
151

    
152
                public final static int SPLINE = 14;
153

    
154
                public final static int ELLIPTICARC = 15;
155

    
156
                /**
157
                 * NO DATA geometry.
158
                 */
159
                public final static int NULL = 16;
160

    
161
        public final static int COMPLEX = 17;
162

    
163
                public final static int LINE = 18;
164

    
165
                public final static int POLYGON = 19;
166

    
167
                public final static int RING = 20;
168

    
169
        public final static int MULTILINE = 21;
170

    
171
        public final static int MULTIPOLYGON = 22;
172

    
173
        public final static int CIRCUMFERENCE = 23;
174

    
175
        public final static int PERIELLIPSE = 24;
176

    
177
        public final static int FILLEDSPLINE = 25;
178

    
179
}
180

    
181
        public interface DIMENSIONS {
182
                public final static int X = 0;
183
                public final static int Y = 1;
184
                public final static int Z = 2;
185
        }
186

    
187
        /**
188
         * The subtype of a geometry is related with the dimension of the geometry,
189
         * that is a combination between the spatial dimension (2D, 2ZD, 3D) and the
190
         * M coordinate or "measure".
191
         *
192
         * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
193
         */
194
        public interface SUBTYPES {
195

    
196
                /**
197
                 * Geometries with two dimensions.
198
                 */
199
                public final static int GEOM2D = 0;
200

    
201
                /**
202
                 * Geometries with three dimensions.
203
                 */
204
                public final static int GEOM3D = 1;
205

    
206
                /**
207
                 * Geometries with two dimensions and with the M coordinate.
208
                 */
209
                public final static int GEOM2DM = 2;
210

    
211
                /**
212
                 * Geometries with three dimensions and with the M coordinate.
213
                 */
214
                public final static int GEOM3DM = 3;
215

    
216
                /**
217
                 * The subtype us unknown.
218
                 */
219
                public final static int UNKNOWN = 4;
220
        }
221

    
222
        /**
223
         * Initial value for new geometry types (it must not overlap with the basic
224
         * ones defined in TYPES).
225
         */
226
        public static final int EXTENDED_GEOMTYPE_OFFSET = 17;
227

    
228
        /**
229
         * Initial value for new geometry subtypes (it must not overlap with the
230
         * basic ones defined in SUBTYPES).
231
         */
232
        public static final int EXTENDED_GEOMSUBTYPE_OFFSET = 6;
233

    
234
        public interface OPERATIONS {
235
                public final static String CONVERTTOWKT = "toWKT";
236
                public final static String CONVERTTOWKB = "toWKB";
237
                public final static String BUFFER = "buffer";
238
                public final static String DISTANCE = "Distance";
239
                public final static String CONTAINS = "Contains";
240
                public final static String OVERLAPS = "OVERLAPS";
241
                public final static String CONVEXHULL = "ConvexHull";
242
                public final static String COVERS = "Covers";
243
                public final static String CROSSES = "Crosses";
244
                public final static String DIFFERENCE = "Difference";
245
                public final static String DISJOIN = "Disjoin";
246
                public final static String INTERSECTION = "Intersaction";
247
                public final static String INTERSECTS = "Intersects";
248
                public final static String TOUCHES = "Touches";
249
                public final static String UNION = "Union";
250
                public final static String WITHIN = "Within";
251
                public final static String COVEREDBY = "CoveredBy";
252
        }
253

    
254
        public interface ValidationStatus {
255

    
256
            public static final int VALID = 0;
257
            public static final int CURRUPTED = 1;
258
            public static final int UNKNOW = 2;
259
            public static final int DISCONNECTED_INTERIOR = 10;
260
            public static final int DUPLICATE_RINGS = 11;
261
            public static final int HOLE_OUTSIDE_SHELL = 12;
262
            public static final int INVALID_COORDINATE = 13;
263
            public static final int NESTED_HOLES = 14;
264
            public static final int NESTED_SHELLS = 15;
265
            public static final int RING_NOT_CLOSED = 17;
266
            public static final int RING_SELF_INTERSECTION = 18;
267
            public static final int SELF_INTERSECTION = 19;
268
            public static final int TOO_FEW_POINTS = 20;
269

    
270
            /**
271
             * True if the geoemtry are valid.
272
             *
273
             * @return true form valid geometries
274
             */
275
            public boolean isValid();
276

    
277
            /**
278
             * Return the status code results of validate the geometry.
279
             *
280
             * @return validation code
281
             */
282
            public int getStatusCode();
283

    
284
            /**
285
             * Return the nearest point to the problem when validate the geometry.
286
             *
287
             * If the geometry is valid, this return null.
288
             *
289
             * @return the nearest point to the problem or null.
290
             */
291
            public Point getProblemLocation();
292

    
293
            /**
294
             * Return a human readable message explaining the cause of the problem.
295
             *
296
             * If the geometry is valid this is null.
297
             *
298
             * @return the message cause of the problem.
299
             */
300
            public String getMessage();
301
        }
302

    
303
        public static int BEST = 0;
304
        /**
305
         * North.
306
         */
307
        public static int N = 1;
308

    
309
        /**
310
         * North - East.
311
         */
312
        public static int NE = 2;
313

    
314
        /**
315
         * East.
316
         */
317
        public static int E = 3;
318

    
319
        /**
320
         * South - East.
321
         */
322
        public static int SE = 4;
323

    
324
        /**
325
         * South.
326
         */
327
        public static int S = 5;
328

    
329
        /**
330
         * South - West.
331
         */
332
        public static int SW = 6;
333

    
334
        /**
335
         * West.
336
         */
337
        public static int W = 7;
338

    
339
        /**
340
         * North - West.
341
         */
342
        public static int NW = 8;
343

    
344
        public static int SELECTHANDLER = 0;
345
        public static int STRETCHINGHANDLER = 1;
346

    
347
        /**
348
         * If this geometry is a predefined interface then this method returns one
349
         * of {@link Geometry.TYPES} contants.<br>
350
         * If this geometry is an extended type then this method returns a runtime
351
         * constant that identifies its type. By convention this value is stored in
352
         * a constant called .CODE within the geometry class, for instance:
353
         * Point2D.CODE.
354
         *
355
         * @return If this geometry is a predefined interface then one of
356
         *         {@link Geometry.TYPES} or a runtime constant if it is an extended
357
         *         type.
358
         */
359
        public int getType();
360

    
361
        /**
362
         * Creates a clone of this geometry.
363
         *
364
         * @return A clone of this geometry.
365
         */
366
        public Geometry cloneGeometry();
367

    
368
        /**
369
         * Returns true if this geometry intersects the rectangle passed as
370
         * parameter.
371
         *
372
         * @param r
373
         *            Rectangle.
374
         *
375
         * @return True, if <code>this</code> intersects <code>r</code>.
376
         */
377
        public boolean intersects(Rectangle2D r);
378

    
379
        /**
380
         * Used by the drawing strategies to quickly test whether this geometry
381
         * intersects with the visible rectangle.
382
         *
383
         * @param x
384
         *            The minimum X coordinate.
385
         * @param y
386
         *            The minimum Y coordinate.
387
         * @param w
388
         *            The width of the envelope.
389
         * @param h
390
         *            The height of the envelope.
391
         * @return true if <code>this</code> intersects the rectangle defined by the
392
         *         parameters.
393
         */
394
        public boolean fastIntersects(double x, double y, double w, double h);
395

    
396
        /**
397
         * <p>
398
         * Returns the minimum bounding box for this Geometry. This shall be the
399
         * coordinate region spanning the minimum and maximum value for each
400
         * ordinate taken on by DirectPositions in this Geometry. The simplest
401
         * representation for an envelope consists of two DirectPositions, the first
402
         * one containing all the minimums for each ordinate, and second one
403
         * containing all the maximums.
404
         * </p>
405
         *
406
         * @return The minimum bounding box for this Geometry.
407
         */
408
        public Envelope getEnvelope();
409

    
410
        /**
411
         * Reprojects this geometry by the coordinate transformer passed as
412
         * parameter.
413
         *
414
         * @param ct
415
         *            Coordinate Transformer.
416
         */
417
        public void reProject(ICoordTrans ct);
418

    
419
        /**
420
         * It applies an affine transformation to the geometry.
421
         * If parameter value is null, it will be considered an
422
         * empty transformation, therefore equivalent to the identity
423
         * transformation.
424
         *
425
         * @param at
426
         *            The transformation to apply.
427
         */
428
        public void transform(AffineTransform at);
429
        /**
430
         * Returns the largest number n such that each direct position in a
431
         * geometric set can be associated with a subset that has the direct
432
         * position in its interior and is similar (isomorphic) to Rn, Euclidean
433
         * n-space.
434
         *
435
         * @return The dimension.
436
         */
437
        public int getDimension();
438

    
439
        /**
440
         * Returns <code>true</code> if this Geometry has no interior point of
441
         * self-intersection or self-tangency. In mathematical formalisms, this
442
         * means that every point in the interior of the object must have a metric
443
         * neighborhood whose intersection with the object is isomorphic to an
444
         * n-sphere, where n is the dimension of this Geometry.
445
         *
446
         * @return If the geometry is simple.
447
         */
448
        public boolean isSimple();
449

    
450
        public boolean isCCW()
451
                throws GeometryOperationNotSupportedException,
452
                        GeometryOperationException;
453

    
454
        /**
455
         * Invokes a geometry operation given its index and context.
456
         *
457
         * @param index
458
         *            Unique index of the operation. Operation code.
459
         * @param ctx
460
         *            The context of the geometry operation.
461
         * @return Object returned by the operation.
462
         * @throws GeometryOperationNotSupportedException
463
         *             It is thrown when the operation has been not registered for
464
         *             this geometry.
465
         * @throws GeometryOperationException
466
         *             It is thrown when there is an error executing the operation.
467
         */
468
        public Object invokeOperation(int index, GeometryOperationContext ctx)
469
                        throws GeometryOperationNotSupportedException,
470
                        GeometryOperationException;
471

    
472
        /**
473
         * Invokes a geometry operation given its name and context.
474
         *
475
         * @param opName
476
         *            Operation name.
477
         * @param ctx
478
         *            The context of the geometry operation.
479
         * @return Object returned by the operation.
480
         * @throws GeometryOperationNotSupportedException
481
         *             It is thrown when the operation has been not registered for
482
         *             this geometry.
483
         * @throws GeometryOperationException
484
         *             It is thrown when there is an error executing the operation.
485
         */
486
        public Object invokeOperation(String opName, GeometryOperationContext ctx)
487
                        throws GeometryOperationNotSupportedException,
488
                        GeometryOperationException;
489

    
490
        /**
491
         * Instance of the GeometryType associated to this geometry.
492
         *
493
         * @return The geometry type.
494
         */
495
        public GeometryType getGeometryType();
496

    
497
        /**
498
         * Return a byte array with the equivalent in WKB format of the Geometry.
499
         *
500
         * Utility method to wrap the invocation to the operation
501
         * {@link OPERATIONS#CONVERTTOWKB}.
502
         *
503
         * @return the WKB version of the geometry
504
         */
505
        public byte[] convertToWKB() throws GeometryOperationNotSupportedException,
506
                GeometryOperationException;
507

    
508
        public byte[] convertToWKB(int srs)
509
                throws GeometryOperationNotSupportedException, GeometryOperationException;
510

    
511
        public byte[] convertToWKBForcingType(int srs, int type)
512
                throws GeometryOperationNotSupportedException, GeometryOperationException;
513

    
514
        /**
515
         * Return a byte array with the equivalent in EWKB format of the Geometry.
516
         *
517
         * Utility method to wrap the invocation to the operation
518
         * {@link OPERATIONS#CONVERTTOEWKB}.
519
         *
520
         * @return the EWKB version of the geometry
521
         */
522
        public byte[] convertToEWKB() throws GeometryOperationNotSupportedException, GeometryOperationException;
523

    
524
    public byte[] convertToEWKB(int srs)
525
                    throws GeometryOperationNotSupportedException, GeometryOperationException;
526

    
527
    public byte[] convertToEWKBForcingType(int srs, int type)
528
                    throws GeometryOperationNotSupportedException, GeometryOperationException;
529

    
530

    
531
        /**
532
         * Return a string with the equivalent in WKT format of the Geometry.
533
         *
534
         * This is a utility method to wrap the invocation to the operation
535
         * {@link OPERATIONS#CONVERTTOWKT}.
536
         *
537
         * @return the WKT version of the geometry.
538
         *
539
         * @throws GeometryOperationNotSupportedException
540
         * @throws GeometryOperationException
541
         */
542
        public String convertToWKT() throws GeometryOperationNotSupportedException,
543
                        GeometryOperationException;
544

    
545
        /**
546
         * Computes a buffer area around this geometry having the given width
547
         *
548
         * This is a utility method to wrap the invocation to the operation
549
         * {@link OPERATIONS#BUFFER}.
550
         *
551
         * @param distance
552
         *            the width of the buffer
553
         *
554
         * @return a new Geometry with the computed buffer.
555
         *
556
         * @throws GeometryOperationNotSupportedException
557
         * @throws GeometryOperationException
558
         */
559
        public Geometry buffer(double distance)
560
                        throws GeometryOperationNotSupportedException,
561
                        GeometryOperationException;
562

    
563
   public Geometry offset(double distance)
564
           throws GeometryOperationNotSupportedException,
565
           GeometryOperationException;
566

    
567
        /**
568
         * Tests whether this geometry contains the specified geometry.
569
         *
570
         * This is a utility method to wrap the invocation to the operation
571
         * {@link OPERATIONS#CONTAINS}.
572
         *
573
         * @param geometry
574
         *            the Geometry with which to compare this Geometry
575
         *
576
         * @return if this Geometry contains the specified geometry
577
         *
578
         * @throws GeometryOperationNotSupportedException
579
         * @throws GeometryOperationException
580
         */
581
        public boolean contains(Geometry geometry)
582
                        throws GeometryOperationNotSupportedException,
583
                        GeometryOperationException;
584

    
585
        /**
586
         * Returns the minimum distance between this Geometry and the specified
587
         * geometry.
588
         *
589
         * This is a utility method to wrap the invocation to the operation
590
         * {@link OPERATIONS#DISTANCE}.
591
         *
592
         * @param geometry
593
         *            the Geometry from which to compute the distance
594
         *
595
         * @return the distance between the geometries
596
         *
597
         * @throws GeometryOperationNotSupportedException
598
         * @throws GeometryOperationException
599
         */
600
        public double distance(Geometry other)
601
                        throws GeometryOperationNotSupportedException,
602
                        GeometryOperationException;
603

    
604
        public Geometry[] closestPoints(Geometry other)
605
                        throws GeometryOperationNotSupportedException,
606
                        GeometryOperationException;
607

    
608
        boolean isWithinDistance(Geometry other, double distance)
609
                        throws GeometryOperationNotSupportedException,
610
                        GeometryOperationException;
611

    
612
        /**
613
         * Tests whether this geometry overlaps the specified geometry.
614
         *
615
         * This is a utility method to wrap the invocation to the operation
616
         * {@link OPERATIONS#OVERLAPS}.
617
         *
618
         * @param geometry
619
         *            the Geometry with which to compare this Geometry
620
         *
621
         * @return true if the two geometries overlap.
622
         *
623
         * @throws GeometryOperationNotSupportedException
624
         * @throws GeometryOperationException
625
         */
626
        public boolean overlaps(Geometry geometry)
627
                        throws GeometryOperationNotSupportedException,
628
                        GeometryOperationException;
629

    
630
        public Geometry convexHull() throws GeometryOperationNotSupportedException,
631
                        GeometryOperationException;
632

    
633
        public boolean coveredBy(Geometry geometry)
634
                        throws GeometryOperationNotSupportedException,
635
                        GeometryOperationException;
636

    
637
        public boolean covers(Geometry geometry)
638
                        throws GeometryOperationNotSupportedException,
639
                        GeometryOperationException;
640

    
641
        public boolean crosses(Geometry geometry)
642
                        throws GeometryOperationNotSupportedException,
643
                        GeometryOperationException;
644

    
645
        public Geometry difference(Geometry other)
646
                        throws GeometryOperationNotSupportedException,
647
                        GeometryOperationException;
648

    
649
        public boolean disjoint(Geometry geometry)
650
                        throws GeometryOperationNotSupportedException,
651
                        GeometryOperationException;
652

    
653
        public Geometry intersection(Geometry other)
654
                        throws GeometryOperationNotSupportedException,
655
                        GeometryOperationException;
656

    
657
        public boolean intersects(Geometry geometry)
658
                        throws GeometryOperationNotSupportedException,
659
                        GeometryOperationException;
660

    
661
        public Geometry snapTo(Geometry other, double snapTolerance)
662
                        throws GeometryOperationNotSupportedException,
663
                        GeometryOperationException;
664

    
665
        public boolean touches(Geometry geometry)
666
                        throws GeometryOperationNotSupportedException,
667
                        GeometryOperationException;
668

    
669
        public Geometry union(Geometry other)
670
                        throws GeometryOperationNotSupportedException,
671
                        GeometryOperationException;
672

    
673
        public boolean within(Geometry geometry)
674
                        throws GeometryOperationNotSupportedException,
675
                        GeometryOperationException;
676

    
677
        public Point centroid() throws GeometryOperationNotSupportedException, GeometryOperationException;
678

    
679
        /**
680
         * This method returns a point which is inside the geometry.
681
         * This is useful for mathematical purposes but it is very unlikely
682
         * to be a suitable place for a label, for example.
683
         *
684
         *
685
         * @return an interior point
686
         * @throws GeometryOperationNotSupportedException
687
         * @throws GeometryOperationException
688
         */
689
        public Point getInteriorPoint() throws GeometryOperationNotSupportedException, GeometryOperationException;
690

    
691
        public double area() throws GeometryOperationNotSupportedException, GeometryOperationException;
692

    
693
        public double perimeter() throws GeometryOperationNotSupportedException, GeometryOperationException;
694

    
695

    
696

    
697

    
698
        /**
699
         * Rotates the geometry by radAngle radians using the given
700
         * coordinates as center of rotation. Rotating with a positive
701
         * angle rotates points on the positive x axis toward the
702
         * positive y axis. In most cases, we assume x increases
703
         * rightwards and y increases upwards, so in most cases,
704
         * a positive angle will mean counter-clockwise rotation.
705
         *
706
         * @param radAngle the amount of rotation, in radians
707
         * @param basex x coordinate of center of rotation
708
         * @param basey y coordinate of center of rotation
709
         */
710
        public void rotate(double radAngle, double basex, double basey);
711

    
712
        /**
713
         * Shifts geometry by given amount in x and y axes
714
         *
715
         * @param dx
716
         * @param dy
717
         */
718
        public void move(double dx, double dy);
719

    
720

    
721
        /**
722
         * Scales geometry in x and y axes by given scale factors
723
         * using the given point as center of projection.
724
         *
725
         * @param basePoint
726
         * @param sx scale factor in x axis
727
         * @param sy scale factor in y axis
728
         */
729
        public void scale(Point basePoint, double sx, double sy);
730

    
731
        /**
732
         * Check if the geometry is valid.
733
         *
734
         * @return true if the geometry is valid.
735
         */
736
        public boolean isValid();
737

    
738
        /**
739
         * Check if the geometry is valid and returns the validation status.
740
         *
741
         * @return the ValidationStatus
742
         */
743
        public ValidationStatus getValidationStatus();
744

    
745
        /**
746
         * Try to fix the geometry and return the new geometry.
747
         * If the geometry is valid return the same geometry.
748
         * If the geometry is corrupt or can't fix it, return null.
749
         *
750
         * @return the new fixed geometry
751
         */
752
        public Geometry makeValid();
753

    
754
        //
755
        // ===============================================
756
        //
757

    
758

    
759
        /**
760
     * @return  the awt shape used to display the geometry. It
761
     * applies a tranformation before to return the coordinates
762
     * of the shape
763
     * @deprecated this class inherits of {@link Shape} by historical
764
     * reasons. This method has been added just to control the usage of
765
     * the {@link Shape} class but it will removed in a future.
766
     */
767
        public Shape getShape(AffineTransform affineTransform);
768

    
769
        /**
770
     * @return  the awt shape used to display the geometry.
771
     * @deprecated this class inherits of {@link Shape} by historical
772
     * reasons. This method has been added just to control the usage of
773
     * the {@link Shape} class but it will removed in a future.
774
     */
775
        public Shape getShape();
776

    
777
        /**
778
         * Returns this geometry's boundary rectangle.
779
         *
780
         * @deprecated use getEnvelope.
781
         * @return Boundary rectangle.
782
         */
783
        public Rectangle2D getBounds2D();
784

    
785
        /**
786
         * If applies an affine transformation and returns the GeneralPathXIterator
787
         * with this geometry's information.
788
         *
789
         * @param at
790
         *            The transformation to apply.
791
         * @return The GeneralPathXIterator with this geometry's information.
792
         * @deprecated don't use PathIterator over geometries, use instead specific API for each operation. If not has API for that operation let the project team.
793
         *
794
         */
795
        public PathIterator getPathIterator(AffineTransform at);
796

    
797
        /**
798
         * It returns the handlers of the geometry, these they can be of two types
799
         * is straightening and of selection.
800
         *
801
         * @param type
802
         *            Type of handlers.
803
         *
804
         * @deprecated don't use Handlers over geometries, use instead specific API for each operation. If not has API for that operation let the project team.
805
         * @return The handlers.
806
         */
807
        public Handler[] getHandlers(int type);
808

    
809

    
810
        /**
811
         * If applies an affine transformation and returns the GeneralPathXIterator
812
         * with this geometry's information.
813
         *
814
         * @param at
815
         *            The affine transformation.
816
         * @param flatness
817
         *
818
         * @return The GeneralPathXIterator with this geometry's information.
819
         * @deprecated don't use PathIterator over geometries, use instead specific API for each operation. If not has API for that operation let the project team.
820
         */
821
        PathIterator getPathIterator(AffineTransform at, double flatness);
822

    
823
        /**
824
         * Useful to have the real shape behind the scenes. May be uses to edit it
825
         * knowing it it is a Circle, Ellipse, etc.
826
         *
827
         * @return The awt shape
828
         * @deprecated
829
         */
830
        public Shape getInternalShape();
831

    
832

    
833
        /**
834
         * Get GeneralPathIterator, to do registered operations to it.
835
         *
836
         * @return The GeneralPathX.
837
         * @deprecated don't use GeneralPathX over geometries, use instead specific API for each operation. If not has API for that operation let the project team.
838
         */
839
        public GeneralPathX getGeneralPath();
840

    
841

    
842
        /**
843
         * Converts the geometry to be points and makes with them a multiPoint
844
         *
845
         * @return MultiPoint
846
         * @throws GeometryException
847
         */
848
    public MultiPoint toPoints() throws GeometryException;
849

    
850
    /**
851
     * Converts the geometry to be lines and makes with them a multiLine
852
     * @return
853
     * @throws GeometryException
854
     */
855
    public MultiLine toLines() throws GeometryException;
856

    
857
    /**
858
     * Converts the geometry to be polygons and makes with them a multiPolygon
859
     * @return
860
     * @throws GeometryException
861
     */
862
    public MultiPolygon toPolygons() throws GeometryException;
863

    
864
    /**
865
     * Flip the coordinates of the geometry.
866
     * If the geometry is aggregate also revert the primitives collection.
867
     *
868
     * @throws GeometryOperationNotSupportedException
869
     * @throws GeometryOperationException
870
     */
871
    public void flip() throws GeometryOperationNotSupportedException, GeometryOperationException;
872

    
873
    /**
874
     * Ensures the orientation of the geometry according to the parameter, flipping it if necessary.
875
     * If the geometry is a polygon, ensures the orientation of its perimeter
876
     * and ensures the opposite orientation of their holes.
877
     *
878
     * @param ccw
879
     * @return
880
     * @throws GeometryOperationNotSupportedException
881
     * @throws GeometryOperationException
882
     */
883
    public boolean ensureOrientation(boolean ccw) throws GeometryOperationNotSupportedException, GeometryOperationException;
884

    
885
    /**
886
     * Returns true if passed as a parameter geometry is completely out of geometry.
887
     *
888
     * @param geometry
889
     * @return
890
     * @throws GeometryOperationNotSupportedException
891
     * @throws GeometryOperationException
892
     */
893
    public boolean out(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException;
894

    
895
    /**
896
     * Return true if the geometry can be transformed by the affine transform
897
     *
898
     * @param at the affine transform
899
     * @return
900
     */
901
    public boolean canBeTransformed(AffineTransform at);
902

    
903
    /**
904
     * Return true if the geometry can be reprojected by the coordinate transformation
905
     *
906
     * @param ct the coordinate transformation
907
     * @return
908
     */
909
    public boolean canBeReprojected(ICoordTrans ct);
910

    
911
}