averbraeck / opentrafficsim

Open Source Multi-Level Traffic Simulator
BSD 3-Clause "New" or "Revised" License
28 stars 8 forks source link

Transition to djutils draw objects #77

Open WJSchakel opened 1 year ago

WJSchakel commented 1 year ago

The following classes can be removed, and djutils draw objects can be used instead. If any feature is not yet present in djutils draw, this has to be implemented there before a complete removal.

Furthermore, OtsLine3d will remain, but use a PolyLine2d and different elevation information underneath.

Other relevant classes are Bezier and Clothoid. These contain features not yet placed in djutils draw. In fact, they are quite different. For now it might be better to keep them, until the editor is more developed.

Any remaining dependency on the JTS library will also be removed.

WJSchakel commented 1 year ago

What still remains is the following:

How OtsLine3d returns its information remains to be seen. For example, the get(int) method now simply returns a Point2d from the underlying PolyLine2d.

WJSchakel commented 1 year ago

Rather than adding elevation data to OtsLine3d, it is instead added to Link. Therefore OtsLine3d has also been named OtsLine2d. The class remains a valid class in OTS as it add features over an PolyLine2d, most noteworthy the fractional projection.

Link now has the following methods:

Both elevation and grade can be requested at a length, or fractional length. The class CrossSectionElement has the same methods, and refers to the link. Note that in this manner, only the link needs to store elevation data (when relevant). Elevation data may also be null, in which case the elevation and grade are always 0.