-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make IndoorSelection as pure kotlin class to prepare KMP (#128)
- Loading branch information
Showing
10 changed files
with
371 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
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
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
65 changes: 65 additions & 0 deletions
65
naver-map-compose/src/main/java/com/naver/maps/map/compose/indoor/IndoorLevel.kt
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,65 @@ | ||
/* | ||
* Copyright 2024 SOUP | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.naver.maps.map.compose.indoor | ||
|
||
/** | ||
* | ||
* νλμ μ€λ΄μ§λ μΈ΅μ λνλ΄λ λΆλ³ ν΄λμ€. | ||
* νλμ μ€λ΄μ§λ μΈ΅μ λ€λ₯Έ μΈ΅κ³Ό μ°κ²°λ μ μμ΅λλ€. | ||
* μ΄ ν΄λμ€μ μΈμ€ν΄μ€λ μ§μ μμ±ν μ μκ³ [IndoorZone]μ μ΄μ©ν΄μ κ°μ Έμ¬ μ μμ΅λλ€. | ||
* | ||
* @property name μΈ΅ λͺ μΉ. | ||
* @property indoorView μΈ΅μ ν΄λΉνλ μ€λ΄μ§λ λ·°. | ||
* @property connections μ°κ²°λ μ€λ΄μ§λ λ·° λͺ©λ‘. | ||
*/ | ||
public class IndoorLevel( | ||
public val name: String, | ||
public val indoorView: IndoorView, | ||
public val connections: List<IndoorView>, | ||
) { | ||
|
||
/** | ||
* μ°κ²°λ μΈ΅ μ€ κ΅¬μ IDκ° zoneIdμΈ μ€λ΄μ§λ λ·°μ μΈλ±μ€λ₯Ό λ°νν©λλ€. | ||
* | ||
* @param zoneId ꡬμ ID. | ||
* @return μ€λ΄μ§λ λ·°μ μΈλ±μ€. μ°κ²°λ μΈ΅ μ€μ IDκ° zoneIdμΈ μΈ΅μ΄ μμ κ²½μ° -1. | ||
*/ | ||
public fun getConnectionIndex(zoneId: String): Int { | ||
return connections.indexOfFirst { connection -> | ||
connection.zoneId == zoneId | ||
} | ||
} | ||
|
||
/** | ||
* μ°κ²°λ μΈ΅ μ€ κ΅¬μ IDκ° zoneIdμΈ μ€λ΄μ§λ λ·°λ₯Ό λ°νν©λλ€. | ||
* | ||
* @param zoneId ꡬμ ID. | ||
* @return μ€λ΄μ§λ λ·°. μ°κ²°λ μΈ΅ μ€μ IDκ° zoneIdμΈ μΈ΅μ΄ μμ κ²½μ° null. | ||
*/ | ||
public fun getConnection(zoneId: String): IndoorView? { | ||
return connections.getOrNull(getConnectionIndex(zoneId)) | ||
} | ||
|
||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (javaClass != other?.javaClass) return false | ||
return indoorView == (other as IndoorLevel).indoorView | ||
} | ||
|
||
override fun hashCode(): Int { | ||
return indoorView.hashCode() | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
naver-map-compose/src/main/java/com/naver/maps/map/compose/indoor/IndoorRegion.kt
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,50 @@ | ||
/* | ||
* Copyright 2024 SOUP | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.naver.maps.map.compose.indoor | ||
|
||
/** | ||
* μ€λ΄μ§λκ° μ‘΄μ¬νλ μμμ λνλ΄λ λΆλ³ ν΄λμ€. | ||
* νλμ μ€λ΄μ§λ μμμ μλ‘ κ²Ήμ³μ§ ν κ° μ΄μμ ꡬμμΌλ‘ μ΄λ£¨μ΄μ§λλ€. | ||
* μ΄ ν΄λμ€μ μΈμ€ν΄μ€λ μ§μ μμ±ν μ μμ΅λλ€. | ||
* | ||
* @property zones μμμ μν΄ μλ ꡬμ λͺ©λ‘. | ||
*/ | ||
public class IndoorRegion( | ||
public val zones: List<IndoorZone>, | ||
) { | ||
|
||
/** | ||
* μμμ μν΄ μλ ꡬμ μ€ IDκ° zoneIdμΈ κ΅¬μμ μΈλ±μ€λ₯Ό λ°νν©λλ€. | ||
* | ||
* @param zoneId ꡬμ ID. | ||
* @return ꡬμμ μΈλ±μ€. μμ λ΄μ IDκ° zoneIdμΈ κ΅¬μμ΄ μμ κ²½μ° -1. | ||
*/ | ||
public fun getZoneIndex(zoneId: String): Int { | ||
return zones.indexOfFirst { zone -> | ||
zone.zoneId == zoneId | ||
} | ||
} | ||
|
||
/** | ||
* μμμ μν΄ μλ ꡬμ μ€ IDκ° zoneIdμΈ κ΅¬μμ λ°νν©λλ€. | ||
* | ||
* @param zoneId ꡬμ ID. | ||
* @return ꡬμ κ°μ²΄. μμ λ΄μ IDκ° zoneIdμΈ κ΅¬μμ΄ μμ κ²½μ° null. | ||
*/ | ||
public fun getZone(zoneId: String): IndoorZone? { | ||
return zones.getOrNull(getZoneIndex(zoneId)) | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
naver-map-compose/src/main/java/com/naver/maps/map/compose/indoor/IndoorSelection.kt
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,42 @@ | ||
/* | ||
* Copyright 2024 SOUP | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.naver.maps.map.compose.indoor | ||
|
||
/** | ||
* νλμ μ€λ΄μ§λ μμ λ΄μμ μ νλ ꡬμ λ° μΈ΅μ λνλ΄λ λΆλ³ ν΄λμ€. | ||
* | ||
* @property region μμμ λ°νν©λλ€. | ||
* @property zoneIndex μ νλ ꡬμμ μΈλ±μ€λ₯Ό λ°νν©λλ€. | ||
* @property levelIndex μ νλ μΈ΅μ μΈλ±μ€λ₯Ό λ°νν©λλ€. | ||
*/ | ||
public class IndoorSelection( | ||
public val region: IndoorRegion, | ||
public val zoneIndex: Int, | ||
public val levelIndex: Int, | ||
) { | ||
|
||
/** | ||
* μ νλ ꡬμμ λ°νν©λλ€. | ||
*/ | ||
public val zone: IndoorZone | ||
get() = region.zones[zoneIndex] | ||
|
||
/** | ||
* μ νλ μΈ΅μ λ°νν©λλ€. | ||
*/ | ||
public val level: IndoorLevel | ||
get() = zone.levels[levelIndex] | ||
} |
27 changes: 27 additions & 0 deletions
27
naver-map-compose/src/main/java/com/naver/maps/map/compose/indoor/IndoorView.kt
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,27 @@ | ||
/* | ||
* Copyright 2024 SOUP | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.naver.maps.map.compose.indoor | ||
|
||
/** | ||
* νλμ μ€λ΄μ§λλ₯Ό λνλ΄λ λΆλ³ ν΄λμ€. | ||
* | ||
* @property zoneId ꡬμ IDλ₯Ό λ°νν©λλ€. | ||
* @property levelId μΈ΅ IDλ₯Ό λ°νν©λλ€. | ||
*/ | ||
public data class IndoorView( | ||
public val zoneId: String, | ||
public val levelId: String, | ||
) |
Oops, something went wrong.