Skip to content

Commit

Permalink
Revise AssignmentToAssignmentEntityMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Rapter1990 committed Aug 20, 2023
1 parent 6f8ab8d commit 6b68522
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import com.ays.assignment.model.Assignment;
import com.ays.assignment.model.entity.AssignmentEntity;
import com.ays.common.model.mapper.BaseMapper;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.*;
import org.locationtech.jts.geom.impl.CoordinateArraySequence;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
Expand Down Expand Up @@ -48,9 +47,10 @@ static AssignmentToAssignmentEntityMapper initialize() {
*/
default Point mapToPoint(Double latitude, Double longitude) {
if (latitude != null && longitude != null) {
Coordinate coordinate = new Coordinate(latitude, longitude);
GeometryFactory geometryFactory = new GeometryFactory();
return geometryFactory.createPoint(coordinate);
final Coordinate[] coordinates = new Coordinate[]{new Coordinate(latitude, longitude)};
final CoordinateSequence coordinateSequence = new CoordinateArraySequence(coordinates);
final PrecisionModel precisionModel = new PrecisionModel(PrecisionModel.FLOATING);
return new GeometryFactory(precisionModel, 4326).createPoint(coordinateSequence);
}
return null;
}
Expand Down

0 comments on commit 6b68522

Please sign in to comment.