Fixed Coordinates parsing
This commit is contained in:
parent
66fcdfd72a
commit
a194811d85
|
@ -45,26 +45,42 @@ public class BBOXByCoordinatePaths extends BBOXEvaluator{
|
|||
// x
|
||||
if(bean.getX()!=null)
|
||||
// for found
|
||||
for(Double x : documentNavigator.getByPath(bean.getX(),Double.class)) {
|
||||
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);
|
||||
//TODO MANAGE integers vs double
|
||||
for(Object o : documentNavigator.getByPath(bean.getX(),Object.class)) {
|
||||
try{
|
||||
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
|
||||
if(bean.getY()!=null)
|
||||
// for found
|
||||
for(Double y : documentNavigator.getByPath(bean.getY(),Double.class)) {
|
||||
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);
|
||||
for(Object o : documentNavigator.getByPath(bean.getY(),Object.class)) {
|
||||
try{
|
||||
Double y=Double.parseDouble(o.toString());
|
||||
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
|
||||
if(bean.getZ()!=null)
|
||||
// for found
|
||||
for(Double z : documentNavigator.getByPath(bean.getZ(),Double.class)) {
|
||||
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);
|
||||
for(Object o : documentNavigator.getByPath(bean.getZ(),Object.class)) {
|
||||
try{
|
||||
Double z=Double.parseDouble(o.toString());
|
||||
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;
|
||||
|
|
|
@ -33,16 +33,26 @@ public class IndexerTest extends BasicPluginTest {
|
|||
@Test
|
||||
public void testIndexRequest() throws PluginExecutionException, JsonProcessingException {
|
||||
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
||||
UseCaseDescriptor ucd=TestProfiles.profiles.get("sdi-tests");
|
||||
Project doc= TestDocuments.documentMap.get("dummy.json");
|
||||
|
||||
doc.setProfileID(ucd.getId());
|
||||
doc.setProfileID("sdi-tests");
|
||||
doc.getTheDocument().put("coordX",10d);
|
||||
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()),
|
||||
getCurrentUser(),getTestContext(),doc);
|
||||
|
||||
Document parameters = new Document();
|
||||
parameters.put("workspace", "testing_workspace");
|
||||
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.prepareResult().getIdentificationReferenceByType(SpatialReference.SPATIAL_REFERENCE_TYPE).size()==1);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void getIndex() throws ConfigurationException, JsonProcessingException {
|
||||
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue