Fixed Coordinates parsing
This commit is contained in:
parent
66fcdfd72a
commit
a194811d85
|
@ -44,27 +44,43 @@ public class BBOXByCoordinatePaths extends BBOXEvaluator{
|
||||||
|
|
||||||
// x
|
// x
|
||||||
if(bean.getX()!=null)
|
if(bean.getX()!=null)
|
||||||
// for found
|
// for found
|
||||||
for(Double x : documentNavigator.getByPath(bean.getX(),Double.class)) {
|
//TODO MANAGE integers vs double
|
||||||
if(toSet == null) toSet = new GCubeSDILayer.BBOX();
|
for(Object o : documentNavigator.getByPath(bean.getX(),Object.class)) {
|
||||||
if (toSet.getMinX()==null || x< toSet.getMinX()) toSet.setMinX(x);
|
try{
|
||||||
if (toSet.getMaxX()==null || x> toSet.getMaxX()) toSet.setMaxX(x);
|
Double x=Double.parseDouble(o.toString());
|
||||||
|
if(toSet == null) toSet = new GCubeSDILayer.BBOX();
|
||||||
|
if (toSet.getMinX()==null || x< toSet.getMinX()) toSet.setMinX(x);
|
||||||
|
if (toSet.getMaxX()==null || x> toSet.getMaxX()) toSet.setMaxX(x);
|
||||||
|
}catch(Throwable t){
|
||||||
|
log.warn("Unable to parse X (Matched value {} from path {}",o,bean.getX(),t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// y
|
// y
|
||||||
if(bean.getY()!=null)
|
if(bean.getY()!=null)
|
||||||
// for found
|
// for found
|
||||||
for(Double y : documentNavigator.getByPath(bean.getY(),Double.class)) {
|
for(Object o : documentNavigator.getByPath(bean.getY(),Object.class)) {
|
||||||
if(toSet == null) toSet = new GCubeSDILayer.BBOX();
|
try{
|
||||||
if (toSet.getMinY()==null || y< toSet.getMinY()) toSet.setMinY(y);
|
Double y=Double.parseDouble(o.toString());
|
||||||
if (toSet.getMaxY()==null || y> toSet.getMaxY()) toSet.setMaxY(y);
|
if(toSet == null) toSet = new GCubeSDILayer.BBOX();
|
||||||
|
if (toSet.getMinY()==null || y< toSet.getMinY()) toSet.setMinY(y);
|
||||||
|
if (toSet.getMaxY()==null || y> toSet.getMaxY()) toSet.setMaxY(y);
|
||||||
|
}catch(Throwable t){
|
||||||
|
log.warn("Unable to parse Y (Matched value {} from path {}",o,bean.getY(),t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// z
|
// z
|
||||||
if(bean.getZ()!=null)
|
if(bean.getZ()!=null)
|
||||||
// for found
|
// for found
|
||||||
for(Double z : documentNavigator.getByPath(bean.getZ(),Double.class)) {
|
for(Object o : documentNavigator.getByPath(bean.getZ(),Object.class)) {
|
||||||
if(toSet == null) toSet = new GCubeSDILayer.BBOX();
|
try{
|
||||||
if (toSet.getMinZ()==null || z< toSet.getMinZ()) toSet.setMinZ(z);
|
Double z=Double.parseDouble(o.toString());
|
||||||
if (toSet.getMaxZ()==null || z> toSet.getMaxZ()) toSet.setMaxZ(z);
|
if(toSet == null) toSet = new GCubeSDILayer.BBOX();
|
||||||
|
if (toSet.getMinZ()==null || z< toSet.getMinZ()) toSet.setMinZ(z);
|
||||||
|
if (toSet.getMaxZ()==null || z> toSet.getMaxZ()) toSet.setMaxZ(z);
|
||||||
|
}catch(Throwable t){
|
||||||
|
log.warn("Unable to parse Z (Matched value {} from path {}",o,bean.getZ(),t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return toSet;
|
return toSet;
|
||||||
|
|
|
@ -33,16 +33,26 @@ public class IndexerTest extends BasicPluginTest {
|
||||||
@Test
|
@Test
|
||||||
public void testIndexRequest() throws PluginExecutionException, JsonProcessingException {
|
public void testIndexRequest() throws PluginExecutionException, JsonProcessingException {
|
||||||
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
||||||
UseCaseDescriptor ucd=TestProfiles.profiles.get("sdi-tests");
|
|
||||||
Project doc= TestDocuments.documentMap.get("dummy.json");
|
Project doc= TestDocuments.documentMap.get("dummy.json");
|
||||||
|
doc.setProfileID("sdi-tests");
|
||||||
doc.setProfileID(ucd.getId());
|
|
||||||
doc.getTheDocument().put("coordX",10d);
|
doc.getTheDocument().put("coordX",10d);
|
||||||
doc.getTheDocument().put("coordY",11d);
|
doc.getTheDocument().put("coordY",11d);
|
||||||
|
testIndexing(doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMosiIndexing() throws JsonProcessingException, PluginExecutionException {
|
||||||
|
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
||||||
|
Project doc= TestDocuments.documentMap.get("mosiDoc.json");
|
||||||
|
testIndexing(doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private IndexDocumentReport testIndexing(Project doc) throws PluginExecutionException, JsonProcessingException {
|
||||||
IndexDocumentRequest request=new IndexDocumentRequest(TestProfiles.profiles.get(doc.getProfileID()),
|
IndexDocumentRequest request=new IndexDocumentRequest(TestProfiles.profiles.get(doc.getProfileID()),
|
||||||
getCurrentUser(),getTestContext(),doc);
|
getCurrentUser(),getTestContext(),doc);
|
||||||
|
|
||||||
Document parameters = new Document();
|
Document parameters = new Document();
|
||||||
parameters.put("workspace", "testing_workspace");
|
parameters.put("workspace", "testing_workspace");
|
||||||
parameters.put("indexName", "unique_index"+System.currentTimeMillis());
|
parameters.put("indexName", "unique_index"+System.currentTimeMillis());
|
||||||
|
@ -57,13 +67,11 @@ public class IndexerTest extends BasicPluginTest {
|
||||||
|
|
||||||
assertTrue(response.getStatus().equals(Report.Status.OK));
|
assertTrue(response.getStatus().equals(Report.Status.OK));
|
||||||
assertTrue(response.prepareResult().getIdentificationReferenceByType(SpatialReference.SPATIAL_REFERENCE_TYPE).size()==1);
|
assertTrue(response.prepareResult().getIdentificationReferenceByType(SpatialReference.SPATIAL_REFERENCE_TYPE).size()==1);
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getIndex() throws ConfigurationException, JsonProcessingException {
|
public void getIndex() throws ConfigurationException, JsonProcessingException {
|
||||||
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue