Skip to content

Commit

Permalink
Another GEOT-3407 related fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aaime committed Nov 10, 2013
1 parent 15f286f commit 9baf94a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2764,8 +2764,9 @@ private static MultiPoint createMultiPoint(GeometryFactory gf,
final int STARTING_OFFSET = STARTING_OFFSET(elemInfo, triplet);
final int eTYPE = ETYPE(elemInfo, triplet);
final int INTERPRETATION = INTERPRETATION(elemInfo, triplet);

if (!(STARTING_OFFSET >= 1) || !(STARTING_OFFSET <= coords.size()))
final int LENGTH = coords.size() * D(GTYPE);

if (!(STARTING_OFFSET >= 1) || !(STARTING_OFFSET <= LENGTH))
throw new IllegalArgumentException("ELEM_INFO STARTING_OFFSET "+STARTING_OFFSET+" inconsistent with ORDINATES length "+coords.size());
if(!(eTYPE == ETYPE.POINT))
throw new IllegalArgumentException("ETYPE "+eTYPE+" inconsistent with expected POINT");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,16 @@
import java.sql.Connection;
import java.sql.SQLException;

import junit.framework.TestCase;
import oracle.jdbc.OracleConnection;
import oracle.sql.STRUCT;

import org.geotools.data.jdbc.datasource.DataSourceFinder;
import org.geotools.data.jdbc.datasource.UnWrapper;
import org.geotools.data.oracle.Oracle3DTestSetup;
import org.geotools.data.oracle.OracleTestSetup;
import org.geotools.jdbc.JDBC3DTestSetup;
import org.geotools.jdbc.JDBCTestSetup;
import org.geotools.jdbc.JDBCTestSupport;

import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.io.ParseException;
import com.vividsolutions.jts.io.WKTReader;

/**
Expand Down Expand Up @@ -342,6 +338,19 @@ final public void testGeometryCollection3() throws Exception {
assertEquals(4326, geom.getSRID());
assertEquals(original, geom);
}

final public void testGeometryCollectionMultipoint() throws Exception {
if(this.connection == null)
return;

String wkt = "GEOMETRYCOLLECTION (POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0)), MULTIPOINT ((5 5), (10 10)))";
Geometry original = new WKTReader().read(wkt);
original.setSRID(4326);
STRUCT datum = converter.toSDO(original);
Geometry geom = (Geometry) converter.asGeometry(datum);
assertEquals(4326, geom.getSRID());
assertEquals(original, geom);
}

//
// Geometry Comparison
Expand Down

0 comments on commit 9baf94a

Please sign in to comment.