-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for specifying vehicle bounding boxes
* Add support for specifying a bounding box for a vehicle via the Model Editor application. A vehicle's bounding box, which, among other things, is defined by a length, width and height, replaces the vehicle's "length" property, which could previously be specified for vehicles. * Add support for specifying a maximum vehicle bounding box for a point via the Model Editor application. * Add XML schema for v6.0.0 plant model files which allows bounding boxes for vehicles and ant points to be persisted. * Add a README file documenting some guidelines regarding the openTCS plant model XML schemas. Merged-by: Stefan Walter <[email protected]>
- Loading branch information
Showing
58 changed files
with
4,760 additions
and
198 deletions.
There are no files selected for viewing
125 changes: 125 additions & 0 deletions
125
openTCS-API-Base/src/main/java/org/opentcs/access/to/model/BoundingBoxCreationTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/** | ||
* Copyright (c) The openTCS Authors. | ||
* | ||
* This program is free software and subject to the MIT license. (For details, | ||
* see the licensing information (LICENSE.txt) you should have received with | ||
* this copy of the software.) | ||
*/ | ||
package org.opentcs.access.to.model; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static org.opentcs.util.Assertions.checkInRange; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* A transfer object describing a bounding box. | ||
*/ | ||
public class BoundingBoxCreationTO | ||
implements | ||
Serializable { | ||
|
||
private final long length; | ||
private final long width; | ||
private final long height; | ||
private final CoupleCreationTO referenceOffset; | ||
|
||
/** | ||
* Creates a new instance with a (0, 0) reference offset. | ||
* | ||
* @param length The bounding box's length. | ||
* @param width The bounding box's width. | ||
* @param height The bounding box's height. | ||
*/ | ||
public BoundingBoxCreationTO(long length, long width, long height) { | ||
this(length, width, height, new CoupleCreationTO(0, 0)); | ||
} | ||
|
||
private BoundingBoxCreationTO( | ||
long length, | ||
long width, | ||
long height, | ||
CoupleCreationTO referenceOffset | ||
) { | ||
this.length = checkInRange(length, 1, Long.MAX_VALUE, "length"); | ||
this.width = checkInRange(width, 1, Long.MAX_VALUE, "width"); | ||
this.height = checkInRange(height, 1, Long.MAX_VALUE, "height"); | ||
this.referenceOffset = requireNonNull(referenceOffset, "referenceOffset"); | ||
} | ||
|
||
/** | ||
* Returns the bounding box's length. | ||
* | ||
* @return The bounding box's length. | ||
*/ | ||
public long getLength() { | ||
return length; | ||
} | ||
|
||
/** | ||
* Creates a copy of this object, with the given length. | ||
* | ||
* @param length The value to be set in the copy. | ||
* @return A copy of this object, differing in the given value. | ||
*/ | ||
public BoundingBoxCreationTO withLength(long length) { | ||
return new BoundingBoxCreationTO(length, width, height, referenceOffset); | ||
} | ||
|
||
/** | ||
* Returns the bounding box's width. | ||
* | ||
* @return The bounding box's width. | ||
*/ | ||
public long getWidth() { | ||
return width; | ||
} | ||
|
||
/** | ||
* Creates a copy of this object, with the given width. | ||
* | ||
* @param width The value to be set in the copy. | ||
* @return A copy of this object, differing in the given value. | ||
*/ | ||
public BoundingBoxCreationTO withWidth(long width) { | ||
return new BoundingBoxCreationTO(length, width, height, referenceOffset); | ||
} | ||
|
||
/** | ||
* Returns the bounding box's height. | ||
* | ||
* @return The bounding box's height. | ||
*/ | ||
public long getHeight() { | ||
return height; | ||
} | ||
|
||
/** | ||
* Creates a copy of this object, with the given height. | ||
* | ||
* @param height The value to be set in the copy. | ||
* @return A copy of this object, differing in the given value. | ||
*/ | ||
public BoundingBoxCreationTO withHeight(long height) { | ||
return new BoundingBoxCreationTO(length, width, height, referenceOffset); | ||
} | ||
|
||
/** | ||
* Returns the bounding box's reference offset. | ||
* | ||
* @return The bounding box's reference offset. | ||
*/ | ||
public CoupleCreationTO getReferenceOffset() { | ||
return referenceOffset; | ||
} | ||
|
||
/** | ||
* Creates a copy of this object, with the given reference offset. | ||
* | ||
* @param referenceOffset The value to be set in the copy. | ||
* @return A copy of this object, differing in the given value. | ||
*/ | ||
public BoundingBoxCreationTO withReferenceOffset(CoupleCreationTO referenceOffset) { | ||
return new BoundingBoxCreationTO(length, width, height, referenceOffset); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
openTCS-API-Base/src/main/java/org/opentcs/access/to/model/CoupleCreationTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** | ||
* Copyright (c) The openTCS Authors. | ||
* | ||
* This program is free software and subject to the MIT license. (For details, | ||
* see the licensing information (LICENSE.txt) you should have received with | ||
* this copy of the software.) | ||
*/ | ||
package org.opentcs.access.to.model; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* A transfer object describing generic 2-tuple of long integer values. | ||
*/ | ||
public class CoupleCreationTO | ||
implements | ||
Serializable { | ||
|
||
private final long x; | ||
private final long y; | ||
|
||
/** | ||
* Creates a new instance. | ||
* | ||
* @param x The X coordinate. | ||
* @param y The Y coordinate. | ||
*/ | ||
public CoupleCreationTO(long x, long y) { | ||
this.x = x; | ||
this.y = y; | ||
} | ||
|
||
/** | ||
* Returns the x coordinate. | ||
* | ||
* @return The x coordinate. | ||
*/ | ||
public long getX() { | ||
return x; | ||
} | ||
|
||
/** | ||
* Creates a copy of this object, with the given x coordinate. | ||
* | ||
* @param x The value to be set in the copy. | ||
* @return A copy of this object, differing in the given value. | ||
*/ | ||
public CoupleCreationTO withX(long x) { | ||
return new CoupleCreationTO(x, y); | ||
} | ||
|
||
/** | ||
* Returns the y coordinate. | ||
* | ||
* @return The y coordinate. | ||
*/ | ||
public long getY() { | ||
return y; | ||
} | ||
|
||
/** | ||
* Creates a copy of this object, with the given y coordinate. | ||
* | ||
* @param y The value to be set in the copy. | ||
* @return A copy of this object, differing in the given value. | ||
*/ | ||
public CoupleCreationTO withY(long y) { | ||
return new CoupleCreationTO(x, y); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.