Skip to content

Commit

Permalink
Rename: com.dnd.runus.domain.common패키지의 Coordinate 클래스 명을 CoordinateP…
Browse files Browse the repository at this point in the history
…oint로 변경 (#320)
  • Loading branch information
hee9841 authored Dec 19, 2024
1 parent 88f67dd commit 8f73cf8
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.dnd.runus.domain.challenge.achievement.ChallengeAchievementPercentageRepository;
import com.dnd.runus.domain.challenge.achievement.ChallengeAchievementRecord;
import com.dnd.runus.domain.challenge.achievement.ChallengeAchievementRepository;
import com.dnd.runus.domain.common.Coordinate;
import com.dnd.runus.domain.common.CoordinatePoint;
import com.dnd.runus.domain.common.Pace;
import com.dnd.runus.domain.goalAchievement.GoalAchievement;
import com.dnd.runus.domain.goalAchievement.GoalAchievementRepository;
Expand Down Expand Up @@ -172,8 +172,8 @@ public RunningRecordAddResultResponse addRunningRecord(long memberId, RunningRec
Member member =
memberRepository.findById(memberId).orElseThrow(() -> new NotFoundException(Member.class, memberId));

Coordinate emptyCoordinate = new Coordinate(0, 0, 0);
List<Coordinate> route = List.of(emptyCoordinate, emptyCoordinate);
CoordinatePoint emptyCoordinate = new CoordinatePoint(0, 0, 0);
List<CoordinatePoint> route = List.of(emptyCoordinate, emptyCoordinate);

RunningRecord record = runningRecordRepository.save(RunningRecord.builder()
.member(member)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* @param latitude 위도
* @param altitude 고도
*/
public record Coordinate(double longitude, double latitude, double altitude) {
public Coordinate(double longitude, double latitude) {
public record CoordinatePoint(double longitude, double latitude, double altitude) {
public CoordinatePoint(double longitude, double latitude) {
this(longitude, latitude, Double.NaN);
}
}
4 changes: 2 additions & 2 deletions src/main/java/com/dnd/runus/domain/running/RunningRecord.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dnd.runus.domain.running;

import com.dnd.runus.domain.common.Coordinate;
import com.dnd.runus.domain.common.CoordinatePoint;
import com.dnd.runus.domain.common.Pace;
import com.dnd.runus.domain.member.Member;
import com.dnd.runus.global.constant.RunningEmoji;
Expand All @@ -20,7 +20,7 @@ public record RunningRecord(
Pace averagePace,
ZonedDateTime startAt,
ZonedDateTime endAt,
List<Coordinate> route,
List<CoordinatePoint> route,
String startLocation,
String endLocation,
RunningEmoji emoji) {}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.dnd.runus.infrastructure.persistence.domain;

import com.dnd.runus.domain.common.Coordinate;
import com.dnd.runus.domain.common.CoordinatePoint;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.LineString;
import org.locationtech.jts.geom.PrecisionModel;
Expand All @@ -14,21 +15,20 @@
public final class GeometryMapper {
GeometryMapper() {}

public static Coordinate toDomain(org.locationtech.jts.geom.Coordinate coordinate) {
return new Coordinate(coordinate.getX(), coordinate.getY(), coordinate.getZ());
public static CoordinatePoint toDomain(Coordinate coordinate) {
return new CoordinatePoint(coordinate.getX(), coordinate.getY(), coordinate.getZ());
}

public static List<Coordinate> toDomain(LineString lineString) {
public static List<CoordinatePoint> toDomain(LineString lineString) {
return Stream.of(lineString.getCoordinates())
.map(GeometryMapper::toDomain)
.toList();
}

public static LineString toLineString(List<Coordinate> coordinates) {
org.locationtech.jts.geom.Coordinate[] geoCoordinates = coordinates.stream()
.map(coordinate -> new org.locationtech.jts.geom.Coordinate(
coordinate.longitude(), coordinate.latitude(), coordinate.altitude()))
.toArray(org.locationtech.jts.geom.Coordinate[]::new);
public static LineString toLineString(List<CoordinatePoint> coordinates) {
Coordinate[] geoCoordinates = coordinates.stream()
.map(coordinate -> new Coordinate(coordinate.longitude(), coordinate.latitude(), coordinate.altitude()))
.toArray(Coordinate[]::new);
return GeometryFactoryHolder.INSTANCE.createLineString(geoCoordinates);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dnd.runus.application.challenge;

import com.dnd.runus.domain.challenge.*;
import com.dnd.runus.domain.common.Coordinate;
import com.dnd.runus.domain.common.CoordinatePoint;
import com.dnd.runus.domain.common.Pace;
import com.dnd.runus.domain.member.Member;
import com.dnd.runus.domain.running.RunningRecord;
Expand Down Expand Up @@ -108,7 +108,7 @@ void getChallengesWithYesterdayRecords_checkGoalValue() {
new Pace(7, 0),
startDate,
startDate.plusMinutes(21),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO),
Expand All @@ -121,7 +121,7 @@ void getChallengesWithYesterdayRecords_checkGoalValue() {
new Pace(7, 0),
startDate.plusMinutes(5),
startDate.plusMinutes(5).plusMinutes(28),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.dnd.runus.domain.badge.BadgeAchievementRepository;
import com.dnd.runus.domain.challenge.achievement.ChallengeAchievementPercentageRepository;
import com.dnd.runus.domain.challenge.achievement.ChallengeAchievementRepository;
import com.dnd.runus.domain.common.Coordinate;
import com.dnd.runus.domain.common.CoordinatePoint;
import com.dnd.runus.domain.common.Pace;
import com.dnd.runus.domain.goalAchievement.GoalAchievementRepository;
import com.dnd.runus.domain.member.Member;
Expand Down Expand Up @@ -113,7 +113,7 @@ void testDeleteAllDataAboutMember_WithRunningRecords_NoChallengeAchievement() {
new Pace(5, 11),
ZonedDateTime.now(),
ZonedDateTime.now().plusHours(1),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand Down Expand Up @@ -149,7 +149,7 @@ void testDeleteAllDataAboutMember_WithRunningRecords_WithChallengeAchievement()
new Pace(5, 11),
ZonedDateTime.now(),
ZonedDateTime.now().plusHours(1),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.dnd.runus.domain.challenge.achievement.ChallengeAchievementPercentageRepository;
import com.dnd.runus.domain.challenge.achievement.ChallengeAchievementRepository;
import com.dnd.runus.domain.challenge.*;
import com.dnd.runus.domain.common.Coordinate;
import com.dnd.runus.domain.common.CoordinatePoint;
import com.dnd.runus.domain.common.Pace;
import com.dnd.runus.domain.goalAchievement.GoalAchievement;
import com.dnd.runus.domain.goalAchievement.GoalAchievementRepository;
Expand Down Expand Up @@ -103,7 +103,7 @@ void getRunningRecord() {
new Pace(5, 30),
ZonedDateTime.now(),
ZonedDateTime.now(),
List.of(new Coordinate(0, 0, 0), new Coordinate(0, 0, 0)),
List.of(new CoordinatePoint(0, 0, 0), new CoordinatePoint(0, 0, 0)),
"start location",
"end location",
RunningEmoji.VERY_GOOD);
Expand Down Expand Up @@ -160,7 +160,7 @@ void getRunningRecord_challenge() {
new Pace(5, 30),
ZonedDateTime.now(),
ZonedDateTime.now(),
List.of(new Coordinate(0, 0, 0), new Coordinate(0, 0, 0)),
List.of(new CoordinatePoint(0, 0, 0), new CoordinatePoint(0, 0, 0)),
"start location",
"end location",
RunningEmoji.VERY_GOOD);
Expand Down Expand Up @@ -517,7 +517,7 @@ private RunningRecord createRunningRecord(RunningRecordRequest request, Member m
.averagePace(Pace.from(
request.runningData().distanceMeter(),
request.runningData().runningTime()))
.route(List.of(new Coordinate(0, 0, 0), new Coordinate(0, 0, 0)))
.route(List.of(new CoordinatePoint(0, 0, 0), new CoordinatePoint(0, 0, 0)))
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.dnd.runus.domain.challenge.achievement.ChallengeAchievementRecord;
import com.dnd.runus.domain.challenge.achievement.ChallengeAchievementRepository;
import com.dnd.runus.domain.challenge.achievement.PercentageValues;
import com.dnd.runus.domain.common.Coordinate;
import com.dnd.runus.domain.common.CoordinatePoint;
import com.dnd.runus.domain.common.Pace;
import com.dnd.runus.domain.member.Member;
import com.dnd.runus.domain.member.MemberRepository;
Expand Down Expand Up @@ -69,7 +69,7 @@ void setUp() {
new Pace(5, 11),
ZonedDateTime.now(),
ZonedDateTime.now(),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.dnd.runus.domain.challenge.ChallengeType;
import com.dnd.runus.domain.challenge.achievement.ChallengeAchievement;
import com.dnd.runus.domain.challenge.achievement.ChallengeAchievementRepository;
import com.dnd.runus.domain.common.Coordinate;
import com.dnd.runus.domain.common.CoordinatePoint;
import com.dnd.runus.domain.common.Pace;
import com.dnd.runus.domain.member.Member;
import com.dnd.runus.domain.member.MemberRepository;
Expand Down Expand Up @@ -63,7 +63,7 @@ void setUp() {
new Pace(5, 11),
ZonedDateTime.now(),
ZonedDateTime.now(),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dnd.runus.infrastructure.persistence.domain.goalAchievement;

import com.dnd.runus.domain.challenge.GoalMetricType;
import com.dnd.runus.domain.common.Coordinate;
import com.dnd.runus.domain.common.CoordinatePoint;
import com.dnd.runus.domain.common.Pace;
import com.dnd.runus.domain.goalAchievement.GoalAchievement;
import com.dnd.runus.domain.goalAchievement.GoalAchievementRepository;
Expand Down Expand Up @@ -54,7 +54,7 @@ void setUp() {
new Pace(5, 11),
ZonedDateTime.now(),
ZonedDateTime.now(),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand Down Expand Up @@ -128,7 +128,7 @@ void deleteAllByRunningRecordIdsSuccess() {
new Pace(5, 11),
ZonedDateTime.now(),
ZonedDateTime.now(),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand All @@ -141,7 +141,7 @@ void deleteAllByRunningRecordIdsSuccess() {
new Pace(5, 11),
ZonedDateTime.now(),
ZonedDateTime.now(),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dnd.runus.infrastructure.persistence.domain.running;

import com.dnd.runus.domain.common.Coordinate;
import com.dnd.runus.domain.common.CoordinatePoint;
import com.dnd.runus.domain.common.Pace;
import com.dnd.runus.domain.member.Member;
import com.dnd.runus.domain.member.MemberRepository;
Expand Down Expand Up @@ -57,7 +57,7 @@ void deleteByMemberId() {
new Pace(5, 11),
ZonedDateTime.now(),
ZonedDateTime.now(),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.BAD);
Expand Down Expand Up @@ -91,7 +91,7 @@ void getYesterdayRunningRecord() {
new Pace(5, 11),
dayBeforeYesterday.plusHours(i * i).plusMinutes(1),
dayBeforeYesterday.plusHours(i * i).plusMinutes(30),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO);
Expand Down Expand Up @@ -125,7 +125,7 @@ void hasYesterdayRunningRecord() {
new Pace(5, 11),
dayBeforeYesterday.plusHours(i * i).plusMinutes(1),
dayBeforeYesterday.plusHours(i * i).plusMinutes(30),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO);
Expand Down Expand Up @@ -170,7 +170,7 @@ void getTotalDistanceWithRunningRecords() {
new Pace(5, 11),
todayMidnight,
todayMidnight,
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO);
Expand Down Expand Up @@ -202,7 +202,7 @@ void getAllRunningRecordsByMemberId() {
new Pace(5, 11),
ZonedDateTime.now(),
ZonedDateTime.now(),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand Down Expand Up @@ -257,7 +257,7 @@ void getWeeklyDistanceSummary_WithRunningRecords() {
new Pace(5, 11),
ZonedDateTime.now(),
ZonedDateTime.now(),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand Down Expand Up @@ -313,7 +313,7 @@ void getWeeklyDurationSummary_WithRunningRecords() {
new Pace(5, 11),
ZonedDateTime.now(),
ZonedDateTime.now(),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand Down Expand Up @@ -369,7 +369,7 @@ void getAvgDistance_WithRunningRecords() {
new Pace(5, 11),
startDate.minusDays(1),
startDate.minusDays(1).plusHours(1),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand All @@ -383,7 +383,7 @@ void getAvgDistance_WithRunningRecords() {
new Pace(5, 11),
startDate,
startDate.plusHours(1),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand All @@ -397,7 +397,7 @@ void getAvgDistance_WithRunningRecords() {
new Pace(5, 11),
nextOfDndDate.minusDays(1),
nextOfDndDate.minusDays(1).plusHours(1),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand All @@ -411,7 +411,7 @@ void getAvgDistance_WithRunningRecords() {
new Pace(5, 11),
nextOfDndDate,
nextOfDndDate.plusHours(1),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand Down Expand Up @@ -465,7 +465,7 @@ void getAvgDuration_WithRunningRecords() {
new Pace(5, 11),
startDate.minusDays(1),
startDate.minusDays(1).plusHours(1),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand All @@ -479,7 +479,7 @@ void getAvgDuration_WithRunningRecords() {
new Pace(5, 11),
startDate,
startDate.plusHours(1),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand All @@ -493,7 +493,7 @@ void getAvgDuration_WithRunningRecords() {
new Pace(5, 11),
nextOfDndDate.minusDays(1),
nextOfDndDate.minusDays(1).plusHours(1),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand All @@ -507,7 +507,7 @@ void getAvgDuration_WithRunningRecords() {
new Pace(5, 11),
nextOfDndDate,
nextOfDndDate.plusHours(1),
List.of(new Coordinate(1, 2, 3), new Coordinate(4, 5, 6)),
List.of(new CoordinatePoint(1, 2, 3), new CoordinatePoint(4, 5, 6)),
"start location",
"end location",
RunningEmoji.SOSO));
Expand Down
Loading

0 comments on commit 8f73cf8

Please sign in to comment.