Skip to content

Commit

Permalink
added: test of issue: INTERLIS.areAreas() not finding overlap (claeis…
Browse files Browse the repository at this point in the history
  • Loading branch information
renato1987 committed Apr 24, 2017
1 parent 1d780ce commit e301c6c
Showing 1 changed file with 130 additions and 0 deletions.
130 changes: 130 additions & 0 deletions src/test/java/ch/interlis/iox_j/validator/Area23Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -2553,4 +2553,134 @@ public void area3d1AreaArcPointOther_Fail(){
assertTrue(logger.getErrs().size()==1);
assertEquals("failed to validate AREA Datatypes23.Topic.ClassD.area3d", logger.getErrs().get(0).getEventMsg());
}

// Es wird ein äusseres Objekt (externalObject) mit einem äusseren und einem inneren Boundary erstellt.
// Danach wird ein zweites inneres Objekt (internalObject) mit nur einem äusseren Boundary, innerhalb dem äusseren Objekt erstellt.
// Das innere Objekt überlapped an nur einem Punkt, dem Innerboundary des äusseren Objektes.
@Test
public void area2dIntersectionOfBoundaries_False(){
// external object
Iom_jObject externalObject=new Iom_jObject(ILI_CLASSD, OID1);
IomObject externalMultisurface=externalObject.addattrobj("area2d", "MULTISURFACE");
IomObject surfaceValue = externalMultisurface.addattrobj("surface", "SURFACE");
{
// outer boundary of external object
IomObject outerBoundaryExternalObj = surfaceValue.addattrobj("boundary", "BOUNDARY");
// polyline 1
IomObject polyline1 = outerBoundaryExternalObj.addattrobj("polyline", "POLYLINE");
IomObject segments=polyline1.addattrobj("sequence", "SEGMENTS");
IomObject startSegment=segments.addattrobj("segment", "COORD");
startSegment.setattrvalue("C1", "500000.000");
startSegment.setattrvalue("C2", "100000.000");
IomObject endSegment=segments.addattrobj("segment", "COORD");
endSegment.setattrvalue("C1", "600000.000");
endSegment.setattrvalue("C2", "100000.000");
// polyline 2
IomObject polyline2 = outerBoundaryExternalObj.addattrobj("polyline", "POLYLINE");
IomObject segments2=polyline2.addattrobj("sequence", "SEGMENTS");
IomObject startSegment2=segments2.addattrobj("segment", "COORD");
startSegment2.setattrvalue("C1", "600000.000");
startSegment2.setattrvalue("C2", "100000.000");
IomObject endSegment2=segments2.addattrobj("segment", "COORD");
endSegment2.setattrvalue("C1", "600000.000");
endSegment2.setattrvalue("C2", "200000.000");
// polyline 3
IomObject polyline3 = outerBoundaryExternalObj.addattrobj("polyline", "POLYLINE");
IomObject segments3=polyline3.addattrobj("sequence", "SEGMENTS");
IomObject startSegment3=segments3.addattrobj("segment", "COORD");
startSegment3.setattrvalue("C1", "600000.000");
startSegment3.setattrvalue("C2", "200000.000");
IomObject endSegment3=segments3.addattrobj("segment", "COORD");
endSegment3.setattrvalue("C1", "500000.000");
endSegment3.setattrvalue("C2", "200000.000");
// polyline 4
IomObject polyline4 = outerBoundaryExternalObj.addattrobj("polyline", "POLYLINE");
IomObject segments4=polyline4.addattrobj("sequence", "SEGMENTS");
IomObject startSegment4=segments4.addattrobj("segment", "COORD");
startSegment4.setattrvalue("C1", "500000.000");
startSegment4.setattrvalue("C2", "200000.000");
IomObject endSegment4=segments4.addattrobj("segment", "COORD");
endSegment4.setattrvalue("C1", "500000.000");
endSegment4.setattrvalue("C2", "100000.000");
}
// inner boundary of external object
IomObject innerBoundaryExternalObj = surfaceValue.addattrobj("boundary", "BOUNDARY");
{
// polyline 1
IomObject polyline1 = innerBoundaryExternalObj.addattrobj("polyline", "POLYLINE");
IomObject segmentsInner=polyline1.addattrobj("sequence", "SEGMENTS");
IomObject startSegmentInner=segmentsInner.addattrobj("segment", "COORD");
startSegmentInner.setattrvalue("C1", "545000.000");
startSegmentInner.setattrvalue("C2", "110000.000");
IomObject endSegmentInner=segmentsInner.addattrobj("segment", "COORD");
endSegmentInner.setattrvalue("C1", "585000.000");
endSegmentInner.setattrvalue("C2", "185000.000");
// polyline 2
IomObject polyline2 = innerBoundaryExternalObj.addattrobj("polyline", "POLYLINE");
IomObject segments2Inner=polyline2.addattrobj("sequence", "SEGMENTS");
IomObject startSegment2Inner=segments2Inner.addattrobj("segment", "COORD");
startSegment2Inner.setattrvalue("C1", "585000.000");
startSegment2Inner.setattrvalue("C2", "185000.000");
IomObject endSegment2Inner=segments2Inner.addattrobj("segment", "COORD");
endSegment2Inner.setattrvalue("C1", "515000.000");
endSegment2Inner.setattrvalue("C2", "185000.000");
// polyline 3
IomObject polyline3 = innerBoundaryExternalObj.addattrobj("polyline", "POLYLINE");
IomObject segments3Inner=polyline3.addattrobj("sequence", "SEGMENTS");
IomObject startSegment3Inner=segments3Inner.addattrobj("segment", "COORD");
startSegment3Inner.setattrvalue("C1", "515000.000");
startSegment3Inner.setattrvalue("C2", "185000.000");
IomObject endSegment3Inner=segments3Inner.addattrobj("segment", "COORD");
endSegment3Inner.setattrvalue("C1", "545000.000");
endSegment3Inner.setattrvalue("C2", "110000.000");
}
// internal object
Iom_jObject internalObject=new Iom_jObject(ILI_CLASSD, OID2);
IomObject internalMultisurface=internalObject.addattrobj("area2d", "MULTISURFACE");
IomObject internalSurface = internalMultisurface.addattrobj("surface", "SURFACE");
// outer boundary of internal object
IomObject outerBoundaryInternalObj = internalSurface.addattrobj("boundary", "BOUNDARY");
{
// polyline 1
IomObject polyline1 = outerBoundaryInternalObj.addattrobj("polyline", "POLYLINE");
IomObject segments=polyline1.addattrobj("sequence", "SEGMENTS");
IomObject startSegment=segments.addattrobj("segment", "COORD");
startSegment.setattrvalue("C1", "545000.000");
startSegment.setattrvalue("C2", "130000.000");
IomObject endSegment=segments.addattrobj("segment", "COORD");
endSegment.setattrvalue("C1", "585000.000");
endSegment.setattrvalue("C2", "185000.000");
// polyline 2
IomObject polyline2 = outerBoundaryInternalObj.addattrobj("polyline", "POLYLINE");
IomObject segments2=polyline2.addattrobj("sequence", "SEGMENTS");
IomObject startSegment2=segments2.addattrobj("segment", "COORD");
startSegment2.setattrvalue("C1", "585000.000");
startSegment2.setattrvalue("C2", "185000.000");
IomObject endSegment2=segments2.addattrobj("segment", "COORD");
endSegment2.setattrvalue("C1", "515000.000");
endSegment2.setattrvalue("C2", "185000.000");
// polyline 3
IomObject polyline3 = outerBoundaryInternalObj.addattrobj("polyline", "POLYLINE");
IomObject segments3=polyline3.addattrobj("sequence", "SEGMENTS");
IomObject startSegment3=segments3.addattrobj("segment", "COORD");
startSegment3.setattrvalue("C1", "515000.000");
startSegment3.setattrvalue("C2", "185000.000");
IomObject endSegment3=segments3.addattrobj("segment", "COORD");
endSegment3.setattrvalue("C1", "545000.000");
endSegment3.setattrvalue("C2", "130000.000");
}
ValidationConfig modelConfig=new ValidationConfig();
LogCollector logger=new LogCollector();
LogEventFactory errFactory=new LogEventFactory();
Settings settings=new Settings();
Validator validator=new Validator(td, modelConfig,logger,errFactory,settings);
validator.validate(new StartTransferEvent());
validator.validate(new StartBasketEvent(ILI_TOPIC,BID));
validator.validate(new ObjectEvent(externalObject));
validator.validate(new ObjectEvent(internalObject));
validator.validate(new EndBasketEvent());
validator.validate(new EndTransferEvent());
// Asserts
assertTrue(logger.getErrs().size()==1);
}
}

0 comments on commit e301c6c

Please sign in to comment.