|
| 1 | +/* |
| 2 | + * Copyright 2019-2024 Chair of Geoinformatics, Technical University of Munich |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package io.rtron.model.roadspaces.roadspace.objects |
| 18 | + |
| 19 | +import arrow.core.Option |
| 20 | +import arrow.core.toOption |
| 21 | + |
| 22 | +/** |
| 23 | + * Represents a subtype of a road object, providing additional classification and context. |
| 24 | + * |
| 25 | + * @property identifier A unique string that identifies the specific road object subtype. |
| 26 | + * |
| 27 | + * @see <a href="https://publications.pages.asam.net/standards/ASAM_OpenDRIVE/ASAM_OpenDRIVE_Specification/latest/specification/13_objects/13_14_object_examples.html">ASAM OpenDRIVE Object Examples</a> |
| 28 | + */ |
| 29 | +sealed interface RoadObjectSubType { |
| 30 | + val identifier: String |
| 31 | + |
| 32 | + companion object { |
| 33 | + inline fun <reified T> fromIdentifier(identifier: String): Option<T> where T : RoadObjectSubType, T : Enum<T> { |
| 34 | + return enumValues<T>().find { it.identifier == identifier }.toOption() |
| 35 | + } |
| 36 | + } |
| 37 | +} |
| 38 | + |
| 39 | +enum class RoadObjectBarrierSubType(override val identifier: String) : RoadObjectSubType { |
| 40 | + /** common hedge made out of vegetation and bushes without gaps */ |
| 41 | + HEDGE("hedge"), |
| 42 | + |
| 43 | + /** metal guard rail along the side of the road (without the vertical poles) */ |
| 44 | + GUARD_RAIL("guardRail"), |
| 45 | + |
| 46 | + /** lower wall mostly made out of concrete to separate driving lanes */ |
| 47 | + JERSEY_BARRIER("jerseyBarrier"), |
| 48 | + |
| 49 | + /** higher wall out of concrete, bricks, stones ... */ |
| 50 | + WALL("wall"), |
| 51 | + |
| 52 | + /** any kind of railing along the roadside */ |
| 53 | + RAILING("railing"), |
| 54 | + |
| 55 | + /** metal or wooden fence */ |
| 56 | + FENCE("fence"), |
| 57 | + |
| 58 | + /** higher wall for noise protection */ |
| 59 | + NOISE_PROTECTIONS("noiseProtections"), |
| 60 | +} |
| 61 | + |
| 62 | +enum class RoadObjectBuildingSubType(override val identifier: String) : RoadObjectSubType { |
| 63 | + /** regular building like a house or office */ |
| 64 | + BUILDING("building"), |
| 65 | + |
| 66 | + /** bus stop with little roof and sign */ |
| 67 | + BUS_STOP("busStop"), |
| 68 | + |
| 69 | + /** small building with a barrier to collect tolls or charges */ |
| 70 | + TOLL_BOOTH("tollBooth"), |
| 71 | +} |
| 72 | + |
| 73 | +enum class RoadObjectCrosswalkSubType(override val identifier: String) : RoadObjectSubType { |
| 74 | + /** pedestrian crosswalk without zebra markings */ |
| 75 | + PEDESTRIAN("pedestrian"), |
| 76 | + |
| 77 | + /** bicycle crossing, in Germany normally with red paint */ |
| 78 | + BICYCLE("bicycle"), |
| 79 | + |
| 80 | + /** zebra crossing */ |
| 81 | + ZEBRA("zebra"), |
| 82 | + |
| 83 | + /** invisible crosswalk */ |
| 84 | + VIRTUAL("virtual"), |
| 85 | +} |
| 86 | + |
| 87 | +enum class RoadObjectGantrySubType(override val identifier: String) : RoadObjectSubType { |
| 88 | + /** has poles on either side of lanes and an overhead construction between them */ |
| 89 | + GANTRY("gantry"), |
| 90 | + |
| 91 | + /** has a pole on one side of the road and an overhead construction attached to it */ |
| 92 | + GANTRY_HALF("gantryHalf"), |
| 93 | +} |
| 94 | + |
| 95 | +enum class RoadObjectObstacleSubType(override val identifier: String) : RoadObjectSubType { |
| 96 | + ADVERTISING_COLUMN("advertisingColumn"), |
| 97 | + ART("art"), |
| 98 | + SEATING("seating"), |
| 99 | + PICK_NICK("picknick"), |
| 100 | + BOX("box"), |
| 101 | + PHONE_BOOTH("phonebooth"), |
| 102 | + CHARGING_STATION("chargingStation"), |
| 103 | + |
| 104 | + /** for example, electrical, communication */ |
| 105 | + DISTRIBUTION_BOX("distributionBox"), |
| 106 | + CRASH_BOX("crashBox"), |
| 107 | + DUMPSTER("dumpster"), |
| 108 | + DUST_BIN("dustbin"), |
| 109 | + FOUNTAIN("fountain"), |
| 110 | + GRIT_CONTAINER("gritContainer"), |
| 111 | + HYDRANT("hydrant"), |
| 112 | + PARKING_METER("parkingMeter"), |
| 113 | + |
| 114 | + /** for example, bridge pillars */ |
| 115 | + PILLAR("pillar"), |
| 116 | + PLANT_POT("plantPot"), |
| 117 | + POST_BOX("postBox"), |
| 118 | + |
| 119 | + /** for example, bicycle stand, handrail */ |
| 120 | + RAILING("railing"), |
| 121 | + ROCK("rock"), |
| 122 | + ROAD_BLOCKAGE("roadBlockage"), |
| 123 | + WALL("wall"), |
| 124 | + FENCE("fence"), |
| 125 | +} |
| 126 | + |
| 127 | +enum class RoadObjectParkingSpaceSubType(override val identifier: String) : RoadObjectSubType { |
| 128 | + /** typically outdoors, no limit to the top */ |
| 129 | + OPEN_SPACE("openSpace"), |
| 130 | + |
| 131 | + /** typically indoors, limit to the top for example, inside a building */ |
| 132 | + CLOSED_SPACE("closedSpace"), |
| 133 | +} |
| 134 | + |
| 135 | +enum class RoadObjectPoleSubType(override val identifier: String) : RoadObjectSubType { |
| 136 | + EMERGENCY_CALL_BOX("emergencyCallBox"), |
| 137 | + PERMANENT_DELINEATOR("permanentDelineator"), |
| 138 | + BOLLARD("bollard"), |
| 139 | + |
| 140 | + /** pole for Traffic Signs */ |
| 141 | + TRAFFIC_SIGN("trafficSign"), |
| 142 | + |
| 143 | + /** pole for trafficLight and trafficSign objects */ |
| 144 | + TRAFFIC_LIGHT("trafficLight"), |
| 145 | + |
| 146 | + /** has power cables attached */ |
| 147 | + POWER_POLE("powerPole"), |
| 148 | + |
| 149 | + /** has a light source. Might also have trafficSigns or trafficLights attached to it */ |
| 150 | + STREET_LAMP("streetLamp"), |
| 151 | + WIND_TURBINE("windTurbine"), |
| 152 | +} |
| 153 | + |
| 154 | +enum class RoadObjectRoadMarkSubType(override val identifier: String) : RoadObjectSubType { |
| 155 | + ARROW_LEFT("arrowLeft"), |
| 156 | + ARROW_LEFT_LEFT("arrowLeftLeft"), |
| 157 | + ARROW_LEFT_RIGHT("arrowLeftRight"), |
| 158 | + ARROW_RIGHT("arrowRight"), |
| 159 | + ARROW_RIGHT_RIGHT("arrowRightRight"), |
| 160 | + ARROW_RIGHT_LEFT("arrowRightLeft"), |
| 161 | + ARROW_STRAIGHT("arrowStraight"), |
| 162 | + ARROW_STRAIGHT_LEFT("arrowStraightLeft"), |
| 163 | + ARROW_STRAIGHT_RIGHT("arrowStraightRight"), |
| 164 | + ARROW_STRAIGHT_LEFT_RIGHT("arrowStraightLeftRight"), |
| 165 | + ARROW_MERGE_LEFT("arrowMergeLeft"), |
| 166 | + ARROW_MERGE_RIGHT("arrowMergeRight"), |
| 167 | + |
| 168 | + /** these are referenced by a signal */ |
| 169 | + SIGNAL_LINES("signalLines"), |
| 170 | + |
| 171 | + /** for example, YIELD or 50, might be referenced by a signal */ |
| 172 | + TEXT("text"), |
| 173 | + |
| 174 | + /** for example, Wheelchair or bicycle */ |
| 175 | + SYMBOL("symbol"), |
| 176 | + PAINT("paint"), |
| 177 | + |
| 178 | + /** for example, restricted area, keep clear area */ |
| 179 | + AREA("area"), |
| 180 | +} |
| 181 | + |
| 182 | +enum class RoadObjectRoadSurfaceSubType(override val identifier: String) : RoadObjectSubType { |
| 183 | + /** mostly metal cover to access sewerage tunnels */ |
| 184 | + MANHOLE("manhole"), |
| 185 | + |
| 186 | + /** road damage */ |
| 187 | + POTHOLE("pothole"), |
| 188 | + |
| 189 | + /** road damage that has been fixed */ |
| 190 | + PATCH("patch"), |
| 191 | + |
| 192 | + /** mostly raised surface to prevent higher speeds **/ |
| 193 | + SPEED_BUMP("speedbump"), |
| 194 | + |
| 195 | + /** water drainage */ |
| 196 | + DRAIN_GUTTER("drainGutter"), |
| 197 | +} |
| 198 | + |
| 199 | +enum class RoadObjectTrafficIslandSubType(override val identifier: String) : RoadObjectSubType { |
| 200 | + /** typical traffic island with some curbstone, road mark */ |
| 201 | + ISLAND("island"), |
| 202 | +} |
| 203 | + |
| 204 | +enum class RoadObjectTreeSubType(override val identifier: String) : RoadObjectSubType { |
| 205 | + /** needle tree */ |
| 206 | + NEEDLE("needle"), |
| 207 | + |
| 208 | + /** leaf tree */ |
| 209 | + LEAF("leaf"), |
| 210 | + |
| 211 | + /** palm tree */ |
| 212 | + PALM("palm"), |
| 213 | +} |
| 214 | + |
| 215 | +enum class RoadObjectVegetationSubType(override val identifier: String) : RoadObjectSubType { |
| 216 | + /** a single bush */ |
| 217 | + BUSH("bush"), |
| 218 | + |
| 219 | + /** an area that is a forest */ |
| 220 | + FOREST("forest"), |
| 221 | + |
| 222 | + /** a single hedge */ |
| 223 | + HEDGE("hedge"), |
| 224 | +} |
0 commit comments